1 Securing IP 1 Securing Networks Guy Leduc Chapter 5: Network Data Plane Security: IPsec For a summary, see: Computer Networking: A Top Down Approach, 7 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2016. (section 8.7) Mainly based on Network Security - PRIVATE Communication in a PUBLIC World C. Kaufman, R. Pearlman, M. Speciner Pearson Education, 2002. (chapters 17 and 18) and RFC 7296 Securing IP 2 Chapter 5: Network Data Plane Security Chapter goals: ❒ security in practice: ❍ Security in the network layer (versus other layers) ❍ Focus on the data plane ❍ IPsec and its use in VPNs
29
Embed
Securing Networks Guy Leduc Chapter 5: Network …leduc/cours/ISIR/SecNet-ch5.pdf1 Securing IP 1 Securing Networks Guy Leduc Chapter 5: Network Data Plane Security: IPsec For a summary,
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Securing IP 1
Securing Networks
Guy Leduc
Chapter 5:Network Data Plane Security: IPsec
For a summary, see:
Computer Networking: A Top Down Approach, 7th edition. Jim Kurose, Keith RossAddison-Wesley, April 2016.(section 8.7)
Mainly based on
Network Security - PRIVATE Communication in a PUBLIC World C. Kaufman, R. Pearlman, M. SpecinerPearson Education, 2002.(chapters 17 and 18)
and RFC 7296
Securing IP 2
Chapter 5: Network Data Plane Security
Chapter goals: ❒ security in practice:
❍ Security in the network layer (versus other layers)
❍ Focus on the data plane❍ IPsec and its use in VPNs
2
Securing IP 3
Chapter Roadmap
❒ Security in the network layer❒ IPsec - The big picture❒ IPsec protocols: AH and ESP❒ IPsec Key Exchange protocol: IKE
Securing IP 4
Relative Location of Security Facilities in the TCP/IP Stack
❒ Both are general-purpose (i.e. application independent) solutions, but❒ IPsec is NOT specific to TCP
❍ Does work with UDP, and any other protocol above IP (e.g., ICMP, OSPF)❒ IPsec protects the whole IP payload, including transport headers (e.g. port #)
❍ Traffic analysis is thus more difficult (could be web, email, …)❒ IPsec is from network entity to network entity, not from application process to
❒ Institutions often want private networks for security❍ Costly! Separate routers, links, DNS infrastructure
❒ VPN: institution’s inter-office traffic is sent over public Internet instead ❍ Encrypted before entering public Internet❍ Logically separate from other traffic
❒ IP-level security encompasses the following 3 functional areas:❍ confidentiality
• enables communicating nodes to encrypt messages to prevent eavesdropping by third parties
❍ data integrity, including origin authentication• assures that a received packet was, in fact, transmitted
by the party identified as the source in the packet header• assures that the packet has not been altered• also includes replay attack prevention
❍ key management• secure exchange of keys
Securing IP 8
IP Security Overview❒ In 1994, the Internet Architecture Board (IAB) issued a report
entitled "Security in the Internet Architecture"❍ General consensus that the Internet needs more and better security❍ In 1997, 2500 reported security incidents affecting nearly 150,000 sites❍ Most serious attacks: IP spoofing and packet sniffing❍ This justified the 2 main functions of IPsec
❒ The security capabilities were designed for IPv6 but fortunately they were also designed to be usable with the current IPv4
❒ IPsec can encrypt and/or authenticate all traffic at the IP level. Thus IPsec provides the capability to secure communications across a LAN, across private and public WANs, and across the Internet❍ VPN (Virtual Private Networks)❍ Secure remote access over the Internet❍ Enhancing Extranet and Intranet connectivity with partners❍ Enhancing Electronic Commerce
5
Securing IP 9
Benefits of IPsec❒ When IPsec is implemented in a firewall or router, it
provides strong security that can be applied to all traffic crossing the perimeter
❒ IPsec is below the transport layer and so is transparent to applications❍ No need to change software on a user or server system when IPsec
is implemented in a firewall or router❍ No need to train users, issue keying material on a per-user basis, or
revoke keying material when users leave the organization❒ IPsec can provide security to individual users if needed❒ IPsec can play a vital role in the routing architecture. It can
ensure that:❍ router and neighbour advertisements come from authorized routers❍ a redirect message comes from the router to which the initial packet
was sent❍ a routing update is not forged
Securing IP 10
Chapter Roadmap
❒ Security in the network layer❒ IPsec - The big picture❒ IPsec protocols: AH and ESP❒ IPsec Key Exchange protocol: IKE
❍ select security protocols, ❍ determine the algorithm(s) to use, and ❍ put in place any cryptographic keys required
❒ IPsec services and their support by AH and ESP
AH ESP ESP encryption only encryption+authentication
Access Control x x x Connectionless integrity x x Data origin authentication x x Rejection of replayed packets x x x Confidentiality x x Limited traffic flow confidentiality x x
9
Securing IP 17
Security associations (SAs) ❒ Before sending data, a virtual connection is
established from sending entity to receiving entity❒ Called “security association (SA)”
❍ SAs are simplex: for only one direction❒ Both sending and receiving entities maintain state
information about the SA❍ Recall that TCP endpoints also maintain state
information❍ IP is connectionless; IPsec is connection-oriented!❍ It does not mean that IPsec establishes a Virtual Circuit
though• Only SA endpoints maintain state, not intermediate nodes
Security Association (2)❒ An SA is uniquely identified by 3 parameters:
❍ Security Parameters Index (SPI): a bitstring assigned to this SA by the receiver end, and having local significance only. Used to select the SA under which a received packet will be processed. If unknown SPI, drop packet
❍ IP Destination Address: can be a router or host address, can be unicast or multicast
❍ Security Protocol Identifier: indicates whether the association is an AH or ESP SA
❒ The SPI alone seems to suffice to uniquely identify the SA, but❍ The same SPI can be assigned to both an ESP SA and an AH SA, so this
security protocol identifier is needed to remove ambiguity❍ For multicast, the SPI is chosen by the source, so the destination address
field is also needed to remove ambiguity❒ Hence, in any IP packet, the SA is uniquely identified by these 3 fields
R1 stores for SA:o 32-bit identifier for SA: Security Parameter Index (SPI)o origin SA interface (200.168.1.100)o destination SA interface (193.68.2.23)o type of encryption used (e.g., AES with CBC)o encryption keyo type of integrity check used (e.g., HMAC with SHA1)o authentication key
R1 converts original datagraminto IPsec datagram❒ Appends to back of original datagram (which includes
original header fields!) an “ESP trailer” field❒ Encrypts result using algorithm & key specified by SA❒ Appends to front of this encrypted quantity the “ESP
header”, creating “enchilada”❒ Creates authentication MAC over the whole enchilada,
using algorithm and key specified in SA❒ Appends MAC to back of enchilada, forming payload❒ Creates brand new IP header, with all the classic IPv4
initialization values, key lifetimes, …❒ Sequence number counter: used to generate the sequence
number field in AH and ESP headers❒ Anti-replay window: used to determine whether an inbound AH or
ESP packet is a replay❒ Lifetime of the SA❒ Sequence counter overflow flag: indicates what to do when a
counter overflow occurs (usually close the SA)❒ IPsec protocol mode: tunnel or transport mode❒ Path MTU: any observed path maximum transmission unit (to
avoid fragmentation)
Securing IP 30
Security Policy Database (SPD)❒ Policy: For a given datagram, sending entity needs to know if it should
use IPsec❍ Needs also to know which SA to use
❒ A nominal Security Policy Database (SPD) defines the means by which IP traffic is related to specific SAs (or possibly to no SA)❍ Info in SPD indicates “what” to do with arriving datagram❍ Then info in the SAD indicates “how” to do it
❒ An SPD contains entries, each of which defines a subset of IP traffic (via some IP and upper-layer protocol field values, called selectors) and points to an SA for that traffic (or requires to establish one)
❒ Outbound processing obeys the following general sequence for each packet:❍ Compare the values of the appropriate fields in the packet (selector fields)
against the SPD to find a matching SPD entry❍ Determine the SA associated with that entry (if any) and its associated SPI❍ Do the required IPsec processing (i.e. AH or ESP processing)
Note: ESP header is authenticated, so SPI is authenticated!Therefore source and destination IP addresses, which are linked to the SPI in the SAD, cannot be changed without being detected!
Combining authentication and confidentiality❒ First method: ESP with authentication
❍ does not authenticate the non mutable parts of the IP header (in transport mode) or new IP header (in tunnel mode)
• but IP addresses are nevertheless integrity protected through the authenticated SPI!❍ applies encryption before authentication
• so authentication applies to the cyphertext, rather than the plaintext❒ Second method: ESP (without authentication), then AH
❍ ESP SA within AH SA: double encapsulation❍ does authenticate the non mutable parts of the IP header❍ has the disadvantage of using two SAs
❒ Third method: first AH, then ESP (without authentication)❍ authentication applies to the plaintext
• allows to store the authentication information together with the message (without having to reencrypt the message to verify the authentication)
❍ the authentication header is protected by encryption❍ still two SAs: double encapsulation
❒ Usage of AH and ESP can be in transport or tunnel modes
22
Securing IP 43
Do we need AH?
❒ We clearly need ESP for encryption, but do we need AH?❒ AH protects the IP header itself. But does IP header
protection matter?❍ If it were necessary, ESP in tunnel mode could provide it. Why?
❒ Intermediate routers cannot check header integrity; integrity can only be checked at the receiving end of the SA. Why?❍ So impossible to drop spoofed packet in network
Securing IP 44
IPsec and NAT❒ NAT translates the source IP address and the source port
of the IP packet!❍ A NAT box actually does IP spoofing
❒ An IPsec SA cannot go through a NAT box❍ With AH, the integrity check would fail❍ With ESP, the port number is encrypted❍ And the NAT box doesn’t have the keys
❒ Need to encapsulate IPsec packets in UDP packets:
IP TCP User Data
HASH ESP 50 IP Encrypted Data
IP Payload UDP
23
Securing IP 45
IPSec Tunnels & QoS
new IP header ESP header
IP header IP payload
Original IP datagram
IP datagram with ESP tunnel
IP header IP payload
TOS / DSCP
Securing IP 46
Chapter Roadmap
❒ Security in the network layer❒ IPsec - The big picture❒ IPsec protocols: AH and ESP❒ IPsec Key Exchange protocol: IKE
❒ Manual keying is impractical for large VPN with 100s of endpoints
❒ Instead use IPsec IKE (Internet Key Exchange)
Securing IP 48
IKE – Introduction❒ IKEv1 was defined in 1998 (RFC 2409)
❍ still in use (e.g. in Android)❒ IKEv2 was defined in 2014 (RFC 7296)
❍ recommended
❒ IKE runs over UDP on port 500 (possibly port 4500)❍ But should be source port agile, in case a NAT box is present
between the 2 peers❍ IKE must accept requests from other ports and reply to these ports
❒ Since UDP is unreliable, ❍ IKE must use timeouts and sequence numbers,❍ to detect packet loss, packet replay, packet forgery, etc.
25
Securing IP 49
IKE – 2 phases – overview❒ IKE has two phases
❍ (phases were used explicitly in IKEv1, they are still implicit in IKEv2)
❒ Phase 1: establish one bi-directional IKE SA❍ The two peers establish a secure, authenticated channel with which to
communicate❍ Initialization step:
• Neither encrypted, nor integrity checked• Negotiation of security parameters• Exchange of nonces• Exchange of (anonymous) Diffie-Hellman (DH) values• Derivation of keys to be used in next step and in phase 2
❍ Authentication step:• Encrypted and integrity checked• Exchange of the identities (initialization step was anonymous)• Exchange of proofs of knowledge of secrets corresponding to the 2 identities
– Based on a pre-shared secret key (PSK) or a PKI (certificates)
❒ Phase 2: IKE SA is used to securely negotiate pairs of IPsec child SAs
Securing IP 50
IKE phase 1 – initialization
2: Crypto_suite_chosenB, YB, NB, SPIB
1: Crypto_suiteA, YA, NA, SPIA
KAB : the calculated DH shared keyNote: both computations in //
❒ Crypto_suite: Proposed security parameters❍ proposed methods for encryption
and integrity protection❍ proposed DH group
(i.e., size of DH keys)❍ proposed Pseudo-Random
Functions (PRF)❒ YA, YB: DH parameters❒ NA, NB: Nonces❒ SPIA, SPIB: IKE SPIs chosen
❒ Anonymous DH is usedo No identity revealed, only the IP addresseso Vulnerable to MIM! But authentication will follow!o Note: YA and YB can be specific to this session (for forward secrecy)
! KAB, NA, NB and the PRF are then used to derive other keys, such as:o a pair for IKE encryption (one per direction), o a pair for IKE integrity protection (one per direction), o one key for phase 2
26
Securing IP 51
IKE phase 1 – authentication
3: KAB(A, proof I’m A)
4: KAB(B, proof I’m B)
A and B reveal their identities.But identities still hidden topassive attackers.A MIM could discover A’s id, though.
❒ Convenient notation: in messages 3 and 4, it is not KAB that is actually used, but the derived keys for encryption and integrity protection
❒ Proof of identity can be based on:❍ The pre-shared key, or❍ The private signature key (certificates can be added to messages 2 and 3)
❒ Proof I’m A:❍ A builds a message containing her identity A and (most fields of) message 1❍ With a PKI, Alice signs it with her private key and only sends the signature❍ With a PSK, Alice sends a MAC of it with the PSK❍ Why is it necessary to use message 1 in signature or MAC?
• 1. Bars downgrade attack on cryto_suite proposed by Alice• 2. Bars MIM attack (see next slide)
MIM attack on IKE
❒ In IKE, NB is also used in the « proof I’m A » to further bind this proof to the current run
Trudy must use YT associated with its secret value XT
Discovers A’s id
27
Securing IP 53
IKE init step – Thwarting Clogging Attacks (1)
❒ DH is computationally expensive❒ IKE employs a mechanism, known as
cookies, to thwart clogging attacks❒ When it detects a large number of half-
open IKE SAs, the responding IKE will not start DH, but send a cookie to the initiator❍ The only overhead is to send an
acknowledgement, not to perform a DH calculation
❍ If the source address was spoofed, the opponent may not get any answer
❒ The cookie must be returned in the retransmitted message 1 of the IKE initialization step
1: Init_req
cookie
1 again + cookie
Check cookie, if OK starts DH
Gets it only if initial IP addresswas not spoofed
Securing IP 54
Thwarting Clogging Attacks(2)
❒ So, cookie must depend on the specific run of the protocol❒ For example the cookie can be a keyed hash of (NA, IPA, SPIA),
where the key is a generated secret that B is the only one to know
1: Init_req
cookie
1 again + cookie
Improvement: To save space in case of DoS attack,B does not want to store copies of its cookies
Makes sense only if B can recognise that a cookie is one of his own cookies!
But then the scheme is vulnerable to the following attack:
Spoofed IP address
Don’t get cookie, but can return anothercookie’ recorded in arun with my address OK, cookie’ is one of my cookies
I start DH
1: Init_req
cookie
1 again + cookie’
28
Securing IP 55
IKE – phase 2 – overview
❒ IKE SA is used to securely negotiate pairs of IPsec child SAs❍ e.g. AH or ESP, or any other service which needs key material
and/or parameter negotiation❒ Uses one of the keys derived in phase 1 and the nonces to
create IPsec shared secret keys for AH or ESP child SAs❒ Those IPsec SAs are unidirectional❒ Quick procedure and keys can be changed often
❍ Little computational cost, only symmetric key crypto
6: KAB (Crypto_suite_chosenB, NB)
5: KAB(Crypto_suiteA, NA)Again, in messages 5 and 6, it is not KAB that is actually used, but the derived keys for encryption and integrity protection
SPIs are also communicatedTraffic selectors as well.
Securing IP 56
IPsec only authenticates the host!
❒ IPsec authenticates the remote peer (router or host), not the final user using the host!
❒ If the host is stolen (e.g. a laptop), it can still establish IPsec SAs and connect to a VPN!
❒ Needs an extra authentication level in some cases (e.g., travelling salesman with laptop): user authentication after IKE phase 1❍ E.g., extra authentication with username and
password❍ Or IPsec client with Smart card
29
Securing IP 57
IPsec: summary❒ IKE used to establish shared
secret keys, algorithms, SPI numbers
❒ Two principal protocols:❍ authentication header (AH)