IPsec (Internet Protocol Security) is a set of protocols and standards used to
secure and protect network communication at the IP (Internet Protocol)
layer.
It provides a framework for authenticating and encrypting data exchanged
between devices on an IP network, ensuring data confidentiality, integrity,
and authentication. IPsec is widely used in VPNs (Virtual Private
Networks) and in securing communication over the internet.
In Computer Emergency Response Team (CERT)’s 2001 annual report it
listed 52,000 security incidents in which most serious types of attacks
included IP spoofing, in which intruders create packets with false IP
addresses and exploit applications that use authentication based on IP and
various forms of eavesdropping and packet sniffing, in which attackers
read transmitted information, including logon information and database
contents.
In response to these issues, the IAB included authentication and encryption
as necessary security features in the next-generation IP i.e. IPv6.
In 1995, the Internet Engineering Task Force (IETF) published five
security based standards related to IPSec.
The overall idea of IPSec is to encrypt and seal the transport and
application-layer data during transmission.
It also offers integrity protection for the Internet layer. However, the
Internet header itself is not encrypted, because of which the intermediate
routers can deliver encrypted IPSec messages to the intended recipient.
IPSec Protocols
IP packet consists of two portions: IP header and the actual data.
IPSec features are implemented in the form of additional IP headers (called
extension headers) to the standard, default IP headers.
These extension IP headers follow the standard IP headers.
IPSec offers two main services: authentication and confidentiality.
Each of these requires its own extension header.
Therefore, to support these two main services, IPSec defines two IP
extension headers: one for authentication and another for confidentiality.
The Authentication Header (AH) protocol :Provides authentication, integrity,
and an optional anti-replay service. The IPSec AH is a header in an IP packet,
which contains a cryptographic checksum (similar to a message digest or hash) for
the contents of the packet. The AH is simply inserted between the IP header and
any subsequent packet contents. No changes are required to the data contents of the
packet. Thus, security resides completely in the contents of the AH.
The Encapsulating Security Payload (ESP) protocol provides data
confidentiality. The ESP protocol also defines a new header to be inserted into the
IP packet. ESP processing also includes the transformation of the protected data
into an unreadable, encrypted format. Under normal circumstances, the ESP will be
inside the AH. That is, encryption happens first and then authentication
On receipt of an IP packet that was processed by IPSec, the receiver processes the
AH first, if present. The outcome of this tells the receiver if the contents of the
packet are all right or whether they have been tampered with, while in transit.
If the receiver finds the contents acceptable, it extracts the key and algorithms
associated with the ESP and decrypt the contents.
An encrypted tunnel is established between two hosts.
Two sets of IP headers: internal and external.
The internal IP header (which is encrypted) contains the source and destination addresses
as X and Y, whereas the external IP header contains the source and destination addresses as
P1 and P2.
That way, X and Y are protected from potential attackers.
In the tunnel mode, IPSec protects the entire IP datagram. It takes an IP
datagram (including the IP header), adds the IPSec header and trailer and
encrypts the whole thing. It then adds new IP header to this encrypted
datagram.
In contrast, the transport mode does not hide the actual source and destination
addresses. They are visible in plain text, while in transit.
In the transport mode, IPSec takes the transport-layer payload, adds IPSec header
and trailer, encrypts the whole thing and then adds the IP header.
Thus, the IP header is not encrypted.
How to decide which mode should be used?
In the tunnel mode, the new IP header has information
different from that is there in the original IP header. The
tunnel mode is normally used between two routers, a host
and a router or a router and a host. In other words, it is
generally not used between two hosts, since the idea is to
protect the original packet, including its IP header. It is as if
the whole packet goes through an imaginary tunnel.
The transport mode is useful when we are interested in a
host-to-host (i.e. end-to-end) encryption.
The sending host uses IPSec to authenticate and/or encrypt
the transport layer payload and only the receiver verifies it.
This protocol is used for the key management procedures and is called Internet Key
Exchange (IKE) protocol.
IKE is used to negotiate the cryptographic algorithms to be later used by AH and
ESP in the actual cryptographic operations.
The IPSec protocols are designed to be independent of the actual lower-level
cryptographic algorithms. Thus, IKE is the initial phase of IPSec, where the
algorithms and keys are decided. After the IKE phase, the AH and ESP protocols
take over.
IPSEC is designed to be able to use various security protocols, it uses
Security Associations (SA) to specify the protocols to be used.
The output of the IKE phase is a Security Association (SA).
IPsec establishes a security association between two devices, defining the
parameters for secure communication, including the encryption and
authentication methods to be used.
SA is an agreement between the communicating parties about factors such
as the IPSec protocol version in use, mode of operation (transport mode or
tunnel mode), cryptographic algorithms, cryptographic keys, lifetime of
keys, etc.
Once this is done, both major protocols of IPSec (i.e. AH and ESP) make
use of SA for their actual operation.
If both AH and ESP are used, each communicating party requires two sets
of SA: one for AH and one for ESP. Moreover, an SA is simplex, i.e.
unidirectional. Therefore, at a second level, we need two sets of SA per
communicating party: one for incoming transmission and another for
outgoing transmission. Thus, if the two communicating parties use both
AH and ESP, each of them would require four sets of SA.
SA is a database record which specifies security parameters controlling security
operations. They are referenced by the sending host and established by the
receiving host. An index parameter called the Security Parameters Index (SPI) is
used. SAs are in one direction only and a second SA must be established for the
transmission to be bi-directional.
A security association is uniquely identified by three parameters:
Security Parameters Index (SPI): A bit string assigned to this SA and having local
significance only. The SPI is carried in AH and ESP headers to enable the receiving
system to select the SA under which a received packet will be processed.
IP Destination Address: Currently, only unicast addresses are allowed; this is the
address of the destination endpoint of the SA, which may be an end user system or
a network system such as a firewall or router.
Security Protocol Identifier: This indicates whether the association is an AH or ESP
security association.
A Security Association (SA) is a fundamental concept in IPsec (Internet Protocol
Security) that represents the relationship and parameters necessary to secure
communication between two network entities, such as hosts or gateways. SAs
define how data is protected and are used to manage the cryptographic keys,
algorithms, and various parameters needed for secure communication. An SA is
unidirectional, meaning that separate SAs are needed for outbound and inbound
traffic.
Here are the key fields and attributes associated with an SA:
Security Parameters Index (SPI): A unique value used to identify the SA. The
SPI is used by the recipient to select the appropriate SA for processing incoming
packets.
Security Protocol: Specifies whether the SA is associated with the Authentication
Header (AH) or the Encapsulating Security Payload (ESP). AH provides data
authentication and integrity, while ESP offers data encryption and authentication.
Authentication Algorithm: For AH, this specifies the algorithm used for
authentication and integrity checking, such as HMAC-SHA256. For ESP, it
specifies the algorithm used for data authentication, which is typically the same as
that used in AH.
Encryption Algorithm (ESP only): If the SA is associated with ESP, this field
specifies the encryption algorithm used to encrypt the data. Common encryption
algorithms include AES and 3DES.
Key: The cryptographic key used for data encryption and/or authentication. In
IPsec, keys must be securely distributed and refreshed periodically.
Lifetime: Specifies the duration or amount of data that an SA is valid for. This
ensures that keys are refreshed regularly for added security.
Mode: Identifies the mode of operation, which can be either "transport mode" or
"tunnel mode." In transport mode, the original IP header is preserved, while in
tunnel mode, a new IP header is added, typically for VPN purposes.
Source IP Address and Subnet Mask: In tunnel mode, these fields identify the
source address and subnet mask of the protected network or host.
Destination IP Address and Subnet Mask: In tunnel mode, these fields identify the
destination address and subnet mask of the protected network or host.
Direction (Inbound or Outbound): Indicates whether the SA is for processing
inbound or outbound traffic.
Anti-Replay Window: Prevents replay attacks by specifying a window of
acceptable sequence numbers for incoming packets.
Next-Hop Gateway (Tunnel Mode): In tunnel mode, this field specifies the IP
address of the next-hop gateway that will forward the encrypted packets to their
destination.
Security Associations are created and maintained by IPsec devices to establish
secure connections, and they play a critical role in ensuring the confidentiality,
integrity, and authenticity of data transferred over IP networks. SAs need to be
carefully configured and managed to meet specific security requirements and to
protect network communication effectively.
Without a proper key management set up, IPSec cannot exist.
This key management in IPSec consists of two aspects: key agreement and
distribution.
As we know, we require four keys if we want to make use of both AH and
ESP: two keys for AH (one for message transmissions, one for message
receiving) and two keys for ESP (one for message transmissions, one for
message receiving).
The protocol used in IPSec for key management is called as ISAKMP/Oakley.
The Internet Security Association and Key Management Protocol (ISAKMP)
protocol a platform for key management. It defines the procedures and packet
formats for negotiating, establishing, modifying, and deleting SAs.
ISAKMP messages can be transmitted via the TCP or UDP transport protocol.
TCP and UDP port number 500 is reserved for ISAKMP.
The initial version of ISAKMP mandated the use of the Oakley protocol.
Oakley is based on the Diffie Hellman key exchange protocol, with a few
variations..
(a) Secure Remote Internet Access
(b)Secure Branch Office Connectivity
(c)Set Up Communication with Other Organizations
Benefits of IPSec
The benefits of IPSec are listed below:
• IPSec in a firewall/router provides strong security to all traffic crossing the
perimeter
• IPSec in a firewall is resistant to bypass
• IPSec is below transport layer(TCP,UDP), hence transparent to applications
• IPSec can be transparent to end users
• IPSec can provide security for individual users if needed (useful for offsite
workers and setting up a secure virtual subnetwork for sensitive applications)
Routing Applications
IPSec also plays a vital role in the routing architecture required for
internetworking.
It assures that:
• router advertisements come from authorized routers
• neighbor advertisements come from authorized routers
• redirect messages come from the router to which initial packet was sent
• A routing update is not forged
SSL stands for Secure Sockets Layer. It is a standard security technology that
establishes an encrypted link between a web server and a browser, ensuring that all
data transmitted between the server and the browser remains private and integral.
It provides two basic security services: authentication and confidentiality.
Netscape Corporation developed SSL in 1994. Since then, SSL has become the
world’s most popular Web-security mechanism.
SSL is used to secure sensitive data such as login credentials, credit card
information, and other personal information.
SSL provides for secure communication between client and server by allowing
mutual authentication, the use of digital signatures for integrity and encryption for
privacy.
SSL protocol has different versions such as SSLv2.0, SSLv3.0, where SSLv3.0 has
an advantage with the addition of support for certificate chain loading.
SSL 3.0 is the basis for the Transport Layer Security [TLS] protocol standard. SSL
is designed to make use of TCP to provide a reliable end-to-end secure service.