vtp

package
v0.783.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package vtp decodes Cisco's VLAN Trunking Protocol — the L2 protocol that synchronises the VLAN database across the switches of a VTP domain. VTP is a notorious switch-security hazard: a VTP server (or a rogue host that can reach a trunk) advertising a **higher configuration-revision number** overwrites the VLAN database of every switch in the domain — injecting a Subset advertisement with a high revision and an empty/forged VLAN list deletes or rewrites all VLANs domain-wide (a classic L2 denial-of-service). Decoding a captured VTP frame surfaces the domain name, the message type, and the all- important configuration revision — the reconnaissance a switch- security audit needs. It joins the project's switch / L2 decoders (internal/cdp, lldp, stp, lacp, vlan, macsec, dtp).

Wrap-vs-native judgement

Native. A VTP PDU is a fixed header (version, code, a per-code
octet, a domain-name length + 32-octet domain name) followed by a
per-code body, carried in an LLC/SNAP frame (OUI 0x00000C, PID
0x2003). Decoding is byte-field extraction + a short record walk —
a dependency is not justified. stdlib only, no new go.mod dep.

Verifiable / no confidently-wrong output

The header and the Summary / Subset bodies — including the VLAN
information records (id, name, status, type, MTU) of a Subset
advertisement — are decoded and were verified field-for-field
against scapy's VTP layer. The MD5 digest is surfaced as hex and
NOT verified (it is computed over the VLAN database + the VTP
password, which is not on the wire). Advertisement-Request and
Join messages carry little beyond the domain, so they are named
with the header decoded and the body left raw.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Version    int    `json:"version"`
	Code       int    `json:"code"`
	CodeName   string `json:"code_name"`
	DomainName string `json:"domain_name"`

	// Summary / Subset advertisement fields.
	Followers       *int   `json:"followers,omitempty"`        // Summary
	SequenceNumber  *int   `json:"sequence_number,omitempty"`  // Subset
	ConfigRevision  *int64 `json:"config_revision,omitempty"`  // the attack-critical field
	UpdaterIdentity string `json:"updater_identity,omitempty"` // Summary (IPv4)
	UpdateTimestamp string `json:"update_timestamp,omitempty"` // Summary (YYMMDDHHMMSS)
	MD5Hex          string `json:"md5_digest_hex,omitempty"`   // Summary (not verified)

	VLANs []VLANInfo `json:"vlans,omitempty"` // Subset advertisement

	PayloadHex string   `json:"payload_hex,omitempty"`
	Notes      []string `json:"notes,omitempty"`
}

Result is the decoded view of a VTP PDU.

func Decode

func Decode(input string) (*Result, error)

Decode parses a VTP PDU. The input is hex (whitespace / ':' / '-' / '_' separators and a '0x' prefix tolerated). It may be the PDU itself, or any frame containing the LLC/SNAP VTP signature (OUI 0x00000C, PID 0x2003).

type VLANInfo

type VLANInfo struct {
	VLANID     int    `json:"vlan_id"`
	Name       string `json:"name"`
	Status     int    `json:"status"`
	StatusName string `json:"status_name"`
	Type       int    `json:"type"`
	TypeName   string `json:"type_name"`
	MTU        int    `json:"mtu"`
}

VLANInfo is one VLAN record from a Subset advertisement.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL