Internet Protocol Security | |
Year started | 1996 |
---|---|
Organization | Internet Engineering Task Force |
Base standards | Various, see IETF documentation chapter |
Internet protocol suite |
---|
Application layer |
Transport layer |
Internet layer |
Link layer |
Incomputing,Internet Protocol Security (IPsec) is a secure networkprotocol suite thatauthenticates andencryptspackets of data to provide secure encrypted communication between two computers over anInternet Protocol network. It is used invirtual private networks (VPNs).
IPsec includes protocols for establishingmutual authentication between agents at the beginning of asession and negotiation ofcryptographic keys to use during the session. IPsec can protect data flows between a pair of hosts (host-to-host), between a pair of security gateways (network-to-network), or between a security gateway and a host (network-to-host).[1]IPsec uses cryptographic security services to protect communications overInternet Protocol (IP) networks. It supports network-level peer authentication,data origin authentication,data integrity, data confidentiality (encryption), and protection fromreplay attacks.
The protocol was designed by a committee instead of being designed via a competition. Some experts criticized it, stating that it is complex and with a lot of options, which has a devastating effect on a security standard.[2] There is alleged interference ofNSA to weaken its security features.
Starting in the early 1970s, theAdvanced Research Projects Agency sponsored a series of experimentalARPANET encryption devices, at first for nativeARPANET packet encryption and subsequently forTCP/IP packet encryption; some of these were certified and fielded. From 1986 to 1991, theNSA sponsored the development of security protocols for the Internet under its Secure Data Network Systems (SDNS) program.[3] This brought together various vendors includingMotorola who produced a network encryption device in 1988. The work was openly published from about 1988 byNIST and, of these,Security Protocol at Layer 3 (SP3) would eventually morph into the ISO standard Network Layer Security Protocol (NLSP).[4]
In 1992, the USNaval Research Laboratory (NRL) was funded by DARPA CSTO to implement IPv6 and to research and implement IP encryption in 4.4BSD, supporting both SPARC and x86 CPU architectures. DARPA made its implementation freely available via MIT. Under NRL'sDARPA-funded research effort, NRL developed theIETF standards-track specifications (RFC 1825 through RFC 1827) for IPsec.[5] NRL's IPsec implementation was described in their paper in the 1996USENIX Conference Proceedings.[6] NRL's open-source IPsec implementation was made available online byMIT and became the basis for most initial commercial implementations.[5]
TheInternet Engineering Task Force (IETF) formed the IP Security Working Group in 1992[7] to standardize openly specified security extensions to IP, calledIPsec.[8] The NRL developed standards were published by the IETF as RFC 1825 through RFC 1827.[9]
The initialIPv4 suite was developed with few security provisions. As a part of the IPv4 enhancement, IPsec is alayer 3OSI model orinternet layer end-to-end security scheme. In contrast, while some other Internet security systems in widespread use operate above thenetwork layer, such asTransport Layer Security (TLS) that operates above thetransport layer andSecure Shell (SSH) that operates at theapplication layer, IPsec can automatically secure applications at theinternet layer.
IPsec is anopen standard as a part of the IPv4 suite and uses the followingprotocols to perform various functions:[10][11]
The Security Authentication Header (AH) was developed at theUS Naval Research Laboratory in the early 1990s and is derived in part from previous IETF standards' work for authentication of theSimple Network Management Protocol (SNMP) version 2. Authentication Header (AH) is a member of the IPsec protocol suite. AH ensures connectionlessintegrity by using ahash function and a secret shared key in the AH algorithm. AH also guarantees the data origin byauthenticating IPpackets. Optionally a sequence number can protect the IPsec packet's contents againstreplay attacks,[18][19] using thesliding window technique and discarding old packets.
AH operates directly on top of IP, usingIP protocol number51.[21]
The following AH packet diagram shows how an AH packet is constructed and interpreted:[12]
Offset | Octet | 0 | 1 | 2 | 3 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Octet | Bit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
0 | 0 | Next Header | Payload Len | Reserved | |||||||||||||||||||||||||||||
4 | 32 | Security Parameters Index | |||||||||||||||||||||||||||||||
8 | 64 | Sequence Number | |||||||||||||||||||||||||||||||
12 | 96 | Integrity Check Value | |||||||||||||||||||||||||||||||
⋮ | ⋮ |
The IP Encapsulating Security Payload (ESP)[22] was developed at theNaval Research Laboratory starting in 1992 as part of aDARPA-sponsored research project, and was openly published byIETF SIPP[23] Working Group drafted in December 1993 as a security extension for SIPP. ThisESP was originally derived from the US Department of DefenseSP3D protocol, rather than being derived from the ISO Network-Layer Security Protocol (NLSP). The SP3D protocol specification was published byNIST in the late 1980s, but designed by the Secure Data Network System project of theUS Department of Defense. Encapsulating Security Payload (ESP) is a member of the IPsec protocol suite. It provides originauthenticity through sourceauthentication,data integrity through hash functions andconfidentiality throughencryption protection for IPpackets. ESP also supportsencryption-only andauthentication-only configurations, but using encryption without authentication is strongly discouraged because it is insecure.[24][25][26]
UnlikeAuthentication Header (AH), ESP in transport mode does not provide integrity and authentication for the entireIP packet. However, intunnel mode, where the entire original IP packet isencapsulated with a new packet header added, ESP protection is afforded to the whole inner IP packet (including the inner header) while the outer header (including any outer IPv4 options or IPv6 extension headers) remains unprotected.
ESP operates directly on top of IP, using IP protocol number 50.[21]
The following ESP packet diagram shows how an ESP packet is constructed and interpreted:[27]
Offset | Octet | 0 | 1 | 2 | 3 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Octet | Bit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
0 | 0 | Security Parameters Index | |||||||||||||||||||||||||||||||
4 | 32 | Sequence Number | |||||||||||||||||||||||||||||||
8 | 64 | Payload Data | |||||||||||||||||||||||||||||||
⋮ | ⋮ | ||||||||||||||||||||||||||||||||
⋮ | ⋮ | ||||||||||||||||||||||||||||||||
⋮ | ⋮ | (Padding) | |||||||||||||||||||||||||||||||
⋮ | ⋮ | Pad Length | Next Header | ||||||||||||||||||||||||||||||
⋮ | ⋮ | Integrity Check Value ⋮ | |||||||||||||||||||||||||||||||
⋮ | ⋮ |
The IPsec protocols use asecurity association, where the communicating parties establish shared security attributes such asalgorithms and keys. As such, IPsec provides a range of options once it has been determined whether AH or ESP is used. Before exchanging data, the two hosts agree on whichsymmetric encryption algorithm is used to encrypt the IP packet, for exampleAES orChaCha20, and which hash function is used to ensure the integrity of the data, such asBLAKE2 orSHA256. These parameters are agreed for the particular session, for which a lifetime must be agreed and asession key.[28]
The algorithm for authentication is also agreed before the data transfer takes place and IPsec supports a range of methods. Authentication is possible throughpre-shared key, where asymmetric key is already in the possession of both hosts, and the hosts send each other hashes of the shared key to prove that they are in possession of the same key. IPsec also supportspublic key encryption, where each host has a public and a private key, they exchange their public keys and each host sends the other anonce encrypted with the other host's public key. Alternatively if both hosts hold apublic key certificate from acertificate authority, this can be used for IPsec authentication.[29]
The security associations of IPsec are established using theInternet Security Association and Key Management Protocol (ISAKMP). ISAKMP is implemented by manual configuration with pre-shared secrets,Internet Key Exchange (IKE and IKEv2),Kerberized Internet Negotiation of Keys (KINK), and the use of IPSECKEYDNS records.[17][1]: §1 [30] RFC 5386 defines Better-Than-Nothing Security (BTNS) as an unauthenticated mode of IPsec using an extended IKE protocol. C. Meadows, C. Cremers, and others have usedformal methods to identify various anomalies which exist in IKEv1 and also in IKEv2.[31]
In order to decide what protection is to be provided for an outgoing packet, IPsec uses theSecurity Parameter Index (SPI), an index to the security association database (SADB), along with the destination address in a packet header, which together uniquely identifies a security association for that packet. A similar procedure is performed for an incoming packet, where IPsec gathers decryption and verification keys from the security association database.
ForIP multicast a security association is provided for the group, and is duplicated across all authorized receivers of the group. There may be more than one security association for a group, using different SPIs, thereby allowing multiple levels and sets of security within a group. Indeed, each sender can have multiple security associations, allowing authentication, since a receiver can only know that someone knowing the keys sent the data. Note that the relevant standard does not describe how the association is chosen and duplicated across the group; it is assumed that a responsible party will have made the choice.
To ensure that the connection between two endpoints has not been interrupted, endpoints exchangekeepalive messages at regular intervals, which can also be used to automatically reestablish a tunnel lost due to connection interruption.
Dead Peer Detection (DPD) is a method of detecting a deadInternet Key Exchange (IKE) peer. The method uses IPsec traffic patterns to minimize the number of messages required to confirm the availability of a peer. DPD is used to reclaim the lost resources in case a peer is found dead and it is also used to perform IKE peer failover.
UDP keepalive is an alternative to DPD.
The IPsec protocols AH and ESP can be implemented in a host-to-host transport mode, as well as in a network tunneling mode.
In transport mode, only the payload of the IP packet is usuallyencrypted or authenticated. The routing is intact, since the IP header is neither modified nor encrypted; however, when theauthentication header is used, the IP addresses cannot be modified bynetwork address translation, as this always invalidates thehash value. Thetransport andapplication layers are always secured by a hash, so they cannot be modified in any way, for example bytranslating theport numbers.
A means to encapsulate IPsec messages forNAT traversal (NAT-T) has been defined byRFC documents describing the NAT-T mechanism.
In tunnel mode, the entire IP packet is encrypted and authenticated. It is then encapsulated into a new IP packet with a new IP header. Tunnel mode is used to createvirtual private networks for network-to-network communications (e.g. between routers to link sites), host-to-network communications (e.g. remote user access) and host-to-host communications (e.g. private chat).[32]
Tunnel mode supports NAT traversal.
Cryptographic algorithms defined for use with IPsec include:
Refer to RFC 8221 for details.
The IPsec can be implemented in the IP stack of anoperating system. This method of implementation is done for hosts and security gateways. Various IPsec capable IP stacks are available from companies, such as HP or IBM.[33] An alternative is so calledbump-in-the-stack (BITS) implementation, where the operating system source code does not have to be modified. Here IPsec is installed between the IP stack and the networkdrivers. This way operating systems can be retrofitted with IPsec. This method of implementation is also used for both hosts and gateways. However, when retrofitting IPsec the encapsulation of IP packets may cause problems for the automaticpath MTU discovery, where themaximum transmission unit (MTU) size on the network path between two IP hosts is established. If a host or gateway has a separatecryptoprocessor, which is common in the military and can also be found in commercial systems, a so-calledbump-in-the-wire (BITW) implementation of IPsec is possible.[34]
When IPsec is implemented in thekernel, the key management andISAKMP/IKE negotiation is carried out from user space. The NRL-developed and openly specified "PF_KEY Key Management API, Version 2" is often used to enable the application-space key management application to update the IPsec security associations stored within the kernel-space IPsec implementation.[35] Existing IPsec implementations usually include ESP, AH, and IKE version 2. Existing IPsec implementations onUnix-like operating systems, for example,Solaris orLinux, usually include PF_KEY version 2.
Embedded IPsec can be used to ensure the secure communication among applications running over constrained resource systems with a small overhead.[36]
IPsec was developed in conjunction withIPv6 and was originally required to be supported by all standards-compliant implementations ofIPv6 before RFC 6434 made it only a recommendation.[37] IPsec is also optional forIPv4 implementations. IPsec is most commonly used to secure IPv4 traffic.[citation needed]
IPsec protocols were originally defined in RFC 1825 through RFC 1829, which were published in 1995. In 1998, these documents were superseded by RFC 2401 and RFC 2412 with a few incompatible engineering details, although they were conceptually identical. In addition, a mutual authentication and key exchange protocolInternet Key Exchange (IKE) was defined to create and manage security associations. In December 2005, new standards were defined in RFC 4301 and RFC 4309 which are largely a superset of the previous editions with a second version of the Internet Key Exchange standardIKEv2. These third-generation documents standardized the abbreviation of IPsec to uppercase "IP" and lowercase "sec". "ESP" generally refers to RFC 4303, which is the most recent version of the specification.
Since mid-2008, an IPsec Maintenance and Extensions (ipsecme) working group is active at the IETF.[38][39]
In 2013, as part ofSnowden leaks, it was revealed that the USNational Security Agency had been actively working to "Insert vulnerabilities into commercial encryption systems, IT systems, networks, and endpoint communications devices used by targets" as part of theBullrun program.[40] There are allegations that IPsec was a targeted encryption system.[41]
The OpenBSD IPsec stack came later on and also was widely copied. In a letter whichOpenBSD lead developerTheo de Raadt received on 11 Dec 2010 from Gregory Perry, it is alleged that Jason Wright and others, working for the FBI, inserted "a number ofbackdoors andside channel key leaking mechanisms" into the OpenBSD crypto code. In the forwarded email from 2010, Theo de Raadt did not at first express an official position on the validity of the claims, apart from the implicit endorsement from forwarding the email.[42] Jason Wright's response to the allegations: "Every urban legend is made more real by the inclusion of real names, dates, and times. Gregory Perry's email falls into this category. ... I will state clearly that I did not add backdoors to the OpenBSD operating system or theOpenBSD Cryptographic Framework (OCF)."[43] Some days later, de Raadt commented that "I believe that NETSEC was probably contracted to write backdoors as alleged. ... If those were written, I don't believe they made it into our tree."[44] This was published before the Snowden leaks.
An alternative explanation put forward by the authors of theLogjam attack suggests that the NSA compromised IPsec VPNs by undermining theDiffie-Hellman algorithm used in the key exchange. In their paper,[45] they allege the NSA specially built a computing cluster to precompute multiplicative subgroups for specific primes and generators, such as for the second Oakley group defined in RFC 2409. As of May 2015, 90% of addressable IPsec VPNs supported the second Oakley group as part of IKE. If an organization were to precompute this group, they could derive the keys being exchanged and decrypt traffic without inserting any software backdoors.
A second alternative explanation that was put forward was that theEquation Group usedzero-day exploits against several manufacturers' VPN equipment which were validated byKaspersky Lab as being tied to the Equation Group[46] and validated by those manufacturers as being real exploits, some of which were zero-day exploits at the time of their exposure.[47][48][49] TheCisco PIX and ASA firewalls had vulnerabilities that were used for wiretapping by the NSA[citation needed].
Furthermore, IPsec VPNs using "Aggressive Mode" settings send a hash of the PSK in the clear. This can be and apparently is targeted by the NSA using offlinedictionary attacks.[45][50][51]
The spelling "IPsec" is preferred and used throughout this and all related IPsec standards. All other capitalizations of IPsec [...] are deprecated.