IKE Aggressive Mode With a Pre-Shared Key
A VPN gateway accepts IKE aggressive mode with pre-shared key authentication, which discloses a hash from which the key can be recovered by offline guessing.
| Severity | Medium |
| CVSS 3.1 | 5.9 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N Open in the calculator |
| CVSS 4.0 | 8.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-522: Insufficiently Protected Credentials |
| OWASP Top 10 | A06:2025 Insecure Design |
| MITRE ATT&CK | T1110.002 Password Cracking, T1133 External Remote Services |
| Category | Cryptographic Failures |
Description
Internet Key Exchange version 1 (IKEv1), used to set up IPsec VPNs, can establish its first phase in main mode or aggressive mode. Aggressive mode completes in three messages instead of six, but it sends the peers' identities unprotected and, when the peers authenticate with a pre-shared key (PSK), the responder's reply includes a hash computed from the key and from values that are all sent in the clear.
Anyone who obtains that reply, either by starting an exchange with the gateway or by observing an exchange between legitimate peers, can test candidate keys against the hash offline, with no further contact with the gateway and no lockout. The likelihood of recovery depends mostly on the key's strength: a long, randomly generated key cannot practically be recovered, while a short, guessable or dictionary-based key, such as a word-based phrase, can be recovered quickly with ordinary hardware. The gateway generally needs a recognised identity, such as a remote access group name, before it replies with a hash, but on some implementations identities can be guessed or enumerated from differences in its responses.
An attacker who recovers the key may be able to establish a tunnel as a legitimate peer where the gateway relies on the key alone, or impersonate the gateway to remote access clients and capture the user credentials they send through extended authentication (XAUTH). Any other gateway or client that shares the key is exposed too. Where users must also authenticate individually with strong credentials and multi-factor authentication, the key alone does not give network access.
The weakness is identified with tools such as ike-scan, which sends an aggressive mode proposal (its --aggressive option, with --id for the identity) and, with --pskcrack, saves the returned values in a form that psk-crack or hashcat can attack. Vulnerability scanners report it as IKE aggressive mode with pre-shared key supported, usually on UDP port 500.
Remediation
- Disable aggressive mode, so that IKEv1 peers must use main mode, which protects identities and does not disclose a hash to an initiator that has not proved knowledge of the key. On Cisco ASA the command is
crypto ikev1 am-disable, and on Cisco IOS and IOS XE it iscrypto isakmp aggressive-mode disable; other gateways have an equivalent setting in their IKE or phase 1 configuration. - Prefer IKEv2, which has no aggressive mode and in which the responder proves knowledge of the key only after the initiator has done so.
- Replace pre-shared keys with certificate-based authentication for site-to-site tunnels, and for remote access use a solution that authenticates each user individually with multi-factor authentication rather than relying on a shared group key.
- Where a pre-shared key must remain, generate it randomly with high entropy, for example 32 or more random characters, use a different key for each peer, and replace any key that has been used with aggressive mode, as it may already have been captured.
Remote access clients that depend on group keys with aggressive mode will stop connecting once it is disabled, so migrate them first. As an interim measure, replace a weak key with a long random one, which makes offline recovery impractical. Confirm the fix by repeating the ike-scan aggressive mode test and checking that no hash is returned.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.