Configuring Ipsec Virtual Private Networks
Configuring Ipsec Virtual Private Networks
Maintaining a secure VPN tunnel can be complex and requires regular maintenance. To maintain a secure VPN, network
administrators should perform the following tasks on a regular basis:
Reduce the VPN gateway attack surface
Verify that cryptographic algorithms are Committee on National Security Systems Policy (CNSSP) 15-compliant
Avoid using default VPN settings
Remove unused or non-compliant cryptography suites
Apply vendor-provided updates (i.e. patches) for VPN gateways and clients
Examples of recommended ACLs and IPS signatures for obsolete or anomalous VPN traffic are in Appendices A and D.
When configuring ISAKMP/IKE, many vendors support having several possible ISAKMP/IKE policies. The device is then
trusted to choose the strongest matching policy between the remote and local ends of the VPN. Some vendors do this
through priority numbers and others through explicit selection. NSA recommends only configuring policies that meet the
minimum level of security and removing any legacy policies. Also, if priority numbers are used, the strongest ISAKMP/IKE
policy should be the highest priority (for many vendors a priority of “1” is the highest priority). Each ISAKMP/IKE policy
includes at least three key components. These components are the Diffie-Hellman algorithm/group, encryption algorithm,
and hashing algorithm.
The following is an example of the minimum recommended ISAKMP/IKE settings per CNSSP 15 as of June 2020 [2]:
Diffie-Hellman Group: 16
Encryption: AES-256
Hash: SHA-384
1 For proprietary application layer VPN best practices, refer to NSA’s Cybersecurity Advisory “Mitigating Recent VPN Vulnerabilities.”
Many vendors also support configuring multiple IPsec policies; however, these policies are normally explicitly configured
for a specific VPN. NSA recommends utilizing the strongest cryptography suites supported by the network device. Similar
to ISAKMP/IKE, the IPsec policy contains three key components: (1) the encryption algorithm; (2) hashing algorithm; and
(3) the block cipher mode. The following is an example of the minimum recommended IPsec settings per CNSSP 15 as of
June 2020 [2]:
Encryption: AES-256
Hash: SHA-384
Block Cipher Mode: CBC
Configuration examples for recommended ISAKMP/IKE and IPsec policies on several common vendor devices are
included in Appendix B.
The best way to verify that existing VPN configurations are utilizing approved cryptographic algorithms is to review the
current ISAKMP/IKE and IPsec security associations (SAs). Appendix C provides a set of common vendor commands to
show the current SAs and which cryptographic algorithms were negotiated.
NSA recommends using this approach when reviewing ISAKMP/IKE and IPsec configurations because it will display the
exact cryptography settings that were negotiated. On the other hand, if this approach is not followed, reviewing a device’s
configuration file may miss where a device is selecting a non-compliant algorithm that was a device default or left over
from a previous VPN configuration.
If SAs are identified with non-compliant algorithms, administrators should immediately investigate why the VPN negotiated
a lower cryptography standard and make appropriate configuration changes. Also, if pre-shared keys are being used for
VPN authentication, NSA recommends that all keys be replaced as they may have been compromised due to the use of
weak cryptography.
Many organizations can detect or even block the use of certain common outdated cryptographic algorithms in IPsec, such
as the Data Encryption Standard (DES), Triple DES (3DES), and Diffie-Hellman groups 1, 2, and 5, within their networks
using an IPS. NSA has also observed related scanning activity that includes anomalous ISAKMP packets, which most
networks should be able to block without affecting normal VPN traffic. IPS signatures for some common obsolete
cryptographic algorithms and the anomalous packets are provided in Appendix D.
Cryptography standards continue to change over time as the computing environment evolves and new weaknesses in
algorithms are identified. Administrators should prepare for cryptographic agility and periodically check CNSSP and NIST
guidance for the latest cryptography requirements, standards, and recommendations.
NSA recommends that administrators avoid using these tools as they may allow more than the desired cryptography
suites. If these tools are used, then be sure to evaluate all configuration settings that the tool deployed. Administrators
should then remove any non-compliant ISAKMP/IKE and IPsec policies. As a best practice, administrators should not
utilize any default settings and ensure that all ISAKMP/IKE and IPsec policies are explicitly configured for the CNSSP 15-
compliant algorithms.
algorithms. Leaving extra ISAKMP/IKE and IPsec policies as acceptable ISAKMP/IKE and IPsec policies creates a
vulnerability known as a downgrade attack. This type of attack is where a malicious user or Man-in-the-Middle only offers
weak cryptography suites and forces the VPN endpoints to negotiate non-compliant cryptography suites.
Negotiating non-compliant cryptography leaves the encrypted VPN vulnerable to exploitation, including potential
decryption, data modification, and adversarial system access. To mitigate this vulnerability, administrators should validate
that only compliant ISAKMP/IKE and IPsec policies are configured and all unused or non-compliant policies are explicitly
removed from the configuration. NSA also recommends periodically validating that only compliant policies are configured
as the use of automated tools, graphical interfaces, or user error could reintroduce non-compliant policies.
Conclusion
VPNs are essential for enabling remote access and connecting remote sites securely. However, without the proper
configuration, patch management, and hardening, VPNs are vulnerable to many different types of attacks. To ensure that
the confidentiality and integrity of a VPN is protected, reduce the VPN gateway attack surface, always use CNSSP 15-
compliant cryptography suites, avoid using vendor defaults, disable all other cryptography suites, and apply patches in a
timely manner. Following the steps identified in this paper will ensure the most secure VPN configurations.
Works Cited
[1] “Securing IPsec Virtual Private Networks.” National Security Agency, July 2020. [Online] Available at: www.nsa.gov/cybersecurity-guidance
[2] “Use of Public Standards for Secure Information Sharing.” Committee on National Security Systems, 20 October 2016. [Online] Available at:
https://www.cnss.gov/CNSS/issuances/Policies.cfm
Related Guidance
“Mitigating Recent VPN Vulnerabilities.” National Security Agency, 2019. [Online] Available at:
https://media.defense.gov/2019/Oct/07/2002191601/-1/-1/0/CSA-MITIGATING-RECENT-VPN-VULNERABILITIES.PDF
Disclaimer of Endorsement
The information and opinions contained in this document are provided "as is" and without any warranties or guarantees. Reference herein to any specific
commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not constitute or imply its endorsement,
recommendation, or favoring by the United States Government, and this guidance shall not be used for advertising or product endorsement purposes.
Contact
Client Requirements / General Cybersecurity Inquiries: Cybersecurity Requirements Center, 410-854-4200, Cybersecurity_Requests@nsa.gov
Media inquiries / Press Desk: 443-634-0721, MediaRelations@nsa.gov
Cisco ASA®2:
Access-list deny-ike extended permit udp <source_peer_ip> <destination_peer_ip> eq isakmp
Access-list deny-ike extended permit udp <source_peer_ip> <destination_peer_ip> eq 4500
Access-list deny-ike extended permit esp <source_peer_ip> <destination_peer_ip>
Access-list deny-ike extended deny udp any <destination_peer_ip> eq isakmp
Access-list deny-ike extended deny udp any <destination_peer_ip> eq 4500
Access-list deny-ike extended deny esp any <destination_peer_ip>
Juniper SRX®3:
[edit security policies from-zone untrust to-zone trust]
Policy <permit-policy-name> {
Match {
source-address <source-peer-ip>;
destination-address <destination-peer-ip>;
Application [junos-ike junos-ike-nat];
}
Then {
Permit;
}
}
Policy <deny-policy-name> {
Match {
source-address any
destination-address <destination-peer-ip>;
Application [junos-ike junos-ike-nat];
}
Then {
deny;
}
}
}
}
Block all IKEv1 traffic (only use for devices that do not use any IKEv1)
alert udp any any -> any [500,4500] (msg:"All IKEv1"; content:"|00 00 00 00 00 00 00 00 01 10 02 00
00 00 00 00 |"; offset: 8; sid:1; rev:1;)
Block all IKEv2 traffic (only use for devices that do not use any IKEv2)
alert udp any any -> any [500,4500] (msg:"All IKEv2"; content:"|00 00 00 00 00 00 00 00 21 20 22 08
00 00 00 00 |"; offset: 8; sid:2; rev:1;)
ISAKMP:
IKEv1:
crypto isakmp policy 1
encryption aes 256
group [16|20]
hash [sha384|sha512]
IKEv2:
crypto ikev2 proposal <proposal name>
encryption aes-cbc-256
integrity [sha384|sha512]
group [16|20]
IPsec:
crypto ipsec transform-set <transform name> esp-256-aes [esp-sha-hmac|esp-sha384-hmac|esp-sha512-
hmac]
CISCO ASA
ISAKMP:
For Cisco ASA devices, NSA recommends IKEv2, since the IKEv1 implementation only supports SHA1.
IKEv2:
crypto ikev2 policy 1
encryption [aes-256|aes-gcm-256]
integrity [sha384|sha512]
group [16|20]
IPsec:
crypto ipsec ikev2 ipsec-proposal <proposal name>
protocol esp encryption [aes-256|aes-gcm-256]
protocol esp integrity [sha-384|sha512]
Juniper SRX
4 IOS® is a registered trademark of Cisco Systems, Inc. in the United States and other countries and is used under license to Apple, Inc.
encryption-algorithm [aes-256-cbc|aes-256-gcm]
}
policy ike-policy {
mode main;
proposals ike-proposal;
}
gateway <gw name> {
ike-policy ike-policy;
version v2-only; #For IKEv2 otherwise SRX defaults to IKEv1
}
IPsec:
[edit security ipsec]
proposal <proposal name> {
protocol esp;
authentication-algorithm [hmac-sha-384|hmac-sha-512]
encryption-algorithm [aes256-cbc|aes256-gcm]
}
IPsec:
[edit network ike crypto-profiles]
ipsec-crypto-proiles <profile name> {
dh-group group 20;
esp;
authentication [sha384|sha512];
encryption [aes-256-cbc|aes-256-gcm];
}
Aruba®6
IPsec:
crypto ipsec mtu <max-mtu> transform-set <transform-set-name> [esp-aes256|esp-aes256-gcm]
Apriva®7
Apriva does not provide extensive documentation for configuring their devices online. The following configuration snippet
was created using NIAP configuration guidance. Based on the documentation provided, the ISAKMP/IKE and IPsec
configuration is co-located.
ISAKMP/IKE:
show crypto isakmp sa detail
IPSEC:
show crypto ipsec sa
Juniper SRX:
ISAKMP/IKE:
show ike security-associations details
IPSEC:
show security ipsec security-associations detail
ISAKMP/IKE:
show vpn ike-sa
IPSEC:
show vpn ipsec-sa
Aruba:
ISAKMP/IKE:
Aruba provides the following command to show ISAKMP SAs however it does not provide cryptography details
IPSEC:
show crypto ipsec sa
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE group detected"; content:!"|00 00
00 00 00 00 00 00|"; offset: 36; depth: 8; content:"|80 02 00 01 80 04 00 01|"; within: 80; sid: 1;
rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE group detected"; content:!"|00 00
00 00 00 00 00 00|"; offset: 36; depth: 8; content:"|80 02 00 01 80 04 00 02|"; within: 80; sid: 2;
rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE group detected"; content:!"|00 00
00 00 00 00 00 00|"; offset: 36; depth: 8; content:"|80 02 00 01 80 04 00 05|"; within: 80; sid: 3;
rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE group detected"; content:!"|00 00
00 00 00 00 00 00|"; offset: 36; depth: 8; content:"|80 02 00 02 80 04 00 01|"; within: 80; sid: 4;
rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE group detected"; content:!"|00 00
00 00 00 00 00 00|"; offset: 36; depth: 8; content:"|80 02 00 02 80 04 00 02|"; within: 80; sid: 5;
rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE group detected"; content:!"|00 00
00 00 00 00 00 00|"; offset: 36; depth: 8; content:"|80 02 00 02 80 04 00 05|"; within: 80; sid: 6;
rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE DES Encryption Used"; content:"|00
00 08 01 00 00 02|"; offset:41; depth: 7; sid: 7; rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE DES Encryption Used"; content:"|00
00 08 01 00 00 03|"; offset:41; depth: 7; sid: 8; rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE DES Encryption Used"; content:"|00
00 08 01 00 00 09|"; offset:41; depth: 7; sid: 9; rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE DES Encryption Used"; content:"|00
00 08 01 00 00 11|"; offset:41; depth: 7; sid: 10; rev: 1;)
alert udp $HOME_NET 500 -> $EXTERNAL_NET any (msg:"Obsolete IKE DES Encryption Used"; content:"|00
00 08 01 00 00 21|"; offset:41; depth: 7; sid: 11; rev: 1;)
alert udp any any -> any 500 (msg:"Anomalous ISAKMP"; content:"|00 00 00 00 00 00 00 00 21 20 22 08
00 00 00 00 |"; offset: 8; content:"|03 00 00 0e 01 00 00 00 00 00|"; distance:16; sid: 12;
rev:1;)