The IP Security Protocol, Part 1
The authentication header (AH) format is specified in RFC 2402. Usage of this IPSec feature guarantees data integrity and uniquely authenticates the sending peer. AH operation depends on algorithms called hash functions. These are basically one-way functions that, given an arbitrary-length data sequence, produce a fixed-length hash ( group of bytes) guaranteed to be different for input sequences differing even by one bit.
When the AH packet is built, a hash function is applied to the whole IP packet. The resulting value is stored inside an additional header attached to the packet itself. This new packet is then sent on the network. Upon reception of the packet, the destination host applies the same hash function to the received packet and compares the obtained value to the one stored in the AH header. If the two values differ, it means the packet integrity is compromised, and the packet is rejected.
Actually, some fields of the original IP header are not considered while computing the hash, because their value is subject to change along the path. Examples of such fields are the time to live (TTL) and the IP checksum.
Some readers may wonder what would prevent an attacker from modifying both packet bytes and the hash value in order to make the latter coherent with the former. Hash functions used for AH are called keyed hashes. In the computation of the basic hash, they also consider a secret key (which has been negotiated between the IPSec peers, as we will see in a while), thus making it impossible for someone who does not know the key to recalculate the new hash.
This is also the reason why AH can authenticate the sending host. Since the secret key is needed to calculate the hash, verifying the latter's correctness simultaneously proves that the packet is untouched and that the sender knew the secret key. Thus, he is the legitimate sender.
The keyed hash algorithm mandated by RFC 2402 is HMAC, which must be used in conjunction with either MD5 or SHA. For more details on these obscure acronyms, see the sidebar. The two working modes are commonly referred to by HMAC-MD5-96 or HMAC-SHA-1-96, respectively. Other hash algorithms may be added in the future without changing the overall AH architecture; only the hash computation modules would need to be modified.
An optional feature of AH is protection against replay attacks. This is possible thanks to a monotonically increasing counter that also is included in the AH header. Generation of the counter is mandatory for the sending peer, whereas its verification by the receiving peer is optional.
The most important fields contained in the AH header are:
a 32-bit integer called SPI (security parameter index) that is used to associate the packet with a specific security relationship between the communicating peers (more on this in Part 2);
a 32-bit sequence number that is used to protect against replay attacks. The number must be monotonically increasing and can wrap only when a new connection procedure is established; and
the authentication data proper (ICV, integrity check value), computed by the sending peer as described above.
What AH does not provide is data confidentiality. An AH packet carries some information related to its integrity, but the original packet payload is still in clear text. An eavesdropper, therefore, will be able to read packet content and grab any sensitive information that may be present. Anyway, he will not be able to modify the packet and substitute it for the real one. Neither will he be allowed to forge fake data and send it to the receiver by pretending to be the legitimate sender. If data confidentiality is required, IPSec's ESP format must be used.
In Part 2 of this article, we will discuss encapsulating security payloads, IPSec modes, security associations and key exchange mechanisms.
Applied Cryptography, by Bruce Schneier, is an excellent and deep introduction to cryptography issues and algorithms.
Cryptonomicom, by Neal Stephenson, is a good novel romance deeply related to cryptography.
IETF RFCs 2401-2411, RFC 2451, and others (available from www.ietf.org), specify the IPSec architecture and its components.
"OpenSSL Programming", Linux Journal, September 2001. Eric Rescorla gives an introduction on how to use SSL in your own programs.
"Problem Areas for the IP Security Protocols", Proc. 6th Usenix Unix Security Symposium, July 1996. Steve Bellovin explains, among other things, why using confidentiality without authentication is dangerous.
"The 101 Uses of OpenSSH: Part II", Linux Journal, February 2001. Mick Bauer introduces the basic concepts of public key cryptography.
Gianluca Insolvibile has been a Linux enthusiast since kernel 0.99pl4. He currently deals with networking and digital video research and development.
|Privacy Is Personal||Jul 02, 2015|
|July 2015 Issue of Linux Journal: Mobile||Jul 01, 2015|
|July 2015 Video Preview||Jul 01, 2015|
|PHP for Non-Developers||Jun 30, 2015|
|A Code Boot Camp for Underprivileged Kids||Jun 30, 2015|
|Comprehensive Identity Management and Audit for Red Hat Enterprise Linux||Jun 29, 2015|
- Privacy Is Personal
- PHP for Non-Developers
- Secure Server Deployments in Hostile Territory
- Linux Kernel 4.1 Released
- July 2015 Issue of Linux Journal: Mobile
- Django Templates
- Comprehensive Identity Management and Audit for Red Hat Enterprise Linux
- A Code Boot Camp for Underprivileged Kids
- Attack of the Drones
- Practical Books for the Most Technical People on the Planet