the_open_door
coffee
ESEN
← Back to index

IKE Aggressive Mode + PSK cracking

IKE (Internet Key Exchange) is the protocol IPsec uses to negotiate encryption parameters, authenticate the parties and exchange keys before bringing up a VPN tunnel. It listens on UDP/500 (sometimes UDP/4500 too with NAT-T). IKEv1 has two negotiation modes:

When a server accepts Aggressive Mode with PSK authentication, an attacker can trigger a handshake, capture the hash derived from the PSK and crack it by dictionary. It's a classic IPsec VPN misconfiguration.

Enumeration with ike-scan. The -A (--aggressive) flag forces Aggressive Mode. The response reveals the auth type (Auth=PSK), the algorithms (e.g. Enc=3DES Hash=SHA1 Group=2) and, crucially, the ID the server sends in cleartext:

ike-scan -A <ip>
# ... Auth=PSK ... ID(Type=ID_USER_FQDN, Value=ike@domain.htb)

That ID (here an FQDN like ike@domain.htb) is the identity to present so the server completes the handshake and hands over the crackable material.

Capture the handshake. We replay the negotiation passing the discovered --id and dump the hash with --pskcrack:

sudo ike-scan -A <ip> --id=ike@domain.htb --pskcrack=ike.txt

Crack the PSK. The ike-scan package ships psk-crack, which runs a dictionary against the captured hash:

psk-crack ike.txt --dictionary /usr/share/wordlists/rockyou.txt
# key "freakingrockstarontheroad" matches SHA1 hash ...

Why the PSK matters. A VPN's pre-shared key is often the same (or a direct hint) that gets reused on other services. The natural next step is to try it via credential reuse against SSH or other services with the user the ID suggests (in Expressway, the ike user over SSH).

How to detect it. The signature is the negotiation itself on UDP/500 in Aggressive Mode: the VPN concentrator logs aggressive-mode PSK attempts, and a burst of handshakes initiated from an IP that never completes the tunnel (only extracts the material) is the ike-scan pattern. An IDS with IKE signatures detects it. At rest, a responder configured to accept Aggressive Mode + PSK is already the exposure to audit; if the cracked PSK is reused, a login (SSH, etc.) appears with the user the ID suggested.

Defence. Disable Aggressive Mode on the VPN concentrator; if unavoidable, use long, random PSKs (not dictionary words) or, better, certificate-based authentication instead of a PSK.

Toolsike-scanpsk-crack

Machines where it's used