Download IPsec Key Management - Lecture Notes - Network Security | ISA 656 and more Study notes Cryptography and System Security in PDF only on Docsity!
Network Security - ISA 656
IPsec
IPsec Key Management (IKE)
Angelos Stavrou September 28, 2008
What is IPsec, and Why?
IPSec What is IPsec, andWhy? HistoryIPsec StructurePacket LayoutAuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
Network-layer security protocol for theInternet.
n
Completely transparent to applications.
n
TCP- or application-level retransmissionshandle deleted or damaged packets.
-^
Generally must modify protocol stack or kernel;out of reach of application writers or users.
History
IPSecWhat is IPsec, andWhy? History IPsec StructurePacket LayoutAuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
SP
Layer 3 security protocol for SDNS.
NLSP
OSIfied version of SP3, with an
incomprehensible spec.
swIPe
UNIX implementation by Ioannidis and
Blaze.
IPsec Structure
IPSecWhat is IPsec, andWhy?History IPsec Structure Packet LayoutAuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
Nested headers: IP, ESP, AH, maybe anotherIP, TCP or UDP, then data.
n
Cryptographic protection can be host to host,host to firewall, or firewall to firewall.
n
Option for user-granularity keying.
n
Works with IPv4 and IPv6.
Packet Layout
IPSecWhat is IPsec, andWhy?HistoryIPsec Structure Packet Layout AuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
Transport Mode
IP ESP
TCP^ userdata
Tunnel Mode
IP
ESP
IP
TCP
user data
Authentication Header (AH)
IPSecWhat is IPsec, andWhy?HistoryIPsec StructurePacket Layout AuthenticationHeader (AH) AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
Based on keyed cryptographic hash function.
n
Covers payload and portion of preceeding IPheader.
n
Uses
Security Parameter Index
(SPI) to
identify security association, and hence key,algorithm, etc.
AH Layout
IPSecWhat is IPsec, andWhy?HistoryIPsec StructurePacket LayoutAuthenticationHeader (AH) AH Layout EncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
Encapsulating Security Payload(ESP)
IPSecWhat is IPsec, andWhy?HistoryIPsec StructurePacket LayoutAuthenticationHeader (AH)AH Layout EncapsulatingSecurity Payload(ESP) ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
Carries encrypted packet.
n
An SPI is used, as with AH.
n
Standard use of ESP is for DES in CBC mode.
IPsec and Firewalls
IPSecWhat is IPsec, andWhy?HistoryIPsec StructurePacket LayoutAuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsec IPsec and Firewalls IPsec and the DNSImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
Encryption is not authentication.
n
Access controls may need to be applied toencrypted traffic, depending on the source.
n
The source IP address is only authenticated ifit is somehow bound to the certificate.
n
Encrypted traffic can use a different firewall;however, co-ordination of policies may beneeded.
IPsec and the DNS
IPSecWhat is IPsec, andWhy?HistoryIPsec StructurePacket LayoutAuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and Firewalls IPsec and the DNS ImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
IPsec often relies on the DNS. u
Users specify hostnames.
u
IPsec operates at the IP layer, where IPaddresses are used.
u
An attacker could try to subvert themapping.
n
DNSSEC may not meet some organizationalsecurity standards.
n
DNSSEC — which isn’t deployed yet, either —uses its own certificates, not X.509.
Implementation Issues
IPSecWhat is IPsec, andWhy?HistoryIPsec StructurePacket LayoutAuthenticationHeader (AH)AH LayoutEncapsulatingSecurity Payload(ESP)ESP LayoutTopologiesPathsUses for IPsecIPsec and FirewallsIPsec and the DNS ImplementationIssues Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks
n
How do applications request cryptographicprotection? How do they verify its existence?
n
How do adminstrators mandate cryptographybetween host or network pairs?
n
We need to resolve authorization issues.
Key Management
Requirements
IPSec Key ManagementRequirements Why KeyManagement?Static KeysReplay ProtectionSA ManagementOther Issues Internet KeyExchange (IKE) Some Attacks
Why Key Management?
IPSec Key ManagementRequirements Why KeyManagement? Static KeysReplay ProtectionSA ManagementOther Issues Internet KeyExchange (IKE) Some Attacks
n
Where do IPsec keys come from?
n
Could we use static keys?
n
What are the other requirements for keymanagement?
Static Keys
IPSec Key ManagementRequirementsWhy KeyManagement? Static Keys Replay ProtectionSA ManagementOther Issues Internet KeyExchange (IKE) Some Attacks
n
In theory, static keys can be used; in practice,they have several disadvantages
n
Primary disadvantage: they almost certainlywill not be random enough
n
(If they’re passwords, attackers can launch apassword guessing attack)
n
History (and theory) suggest that it’s a badidea to encrypt too much plaintext with asingle key
n
You can’t use replay protection with static keys
Replay Protection
IPSec Key ManagementRequirementsWhy KeyManagement?Static Keys Replay Protection SA ManagementOther Issues Internet KeyExchange (IKE) Some Attacks
n
The first packet transmitted on an SA
must
be
numbered 1
n
Any time a machine reboots and losesknowledge of its sequence number status, itwill restart from 1
n
Besides,
packets isn’t that many; it
will
wrap around at some point
n
Replays can be used to attack confidentiality
SA Management
IPSec Key ManagementRequirementsWhy KeyManagement?Static KeysReplay Protection SA Management Other Issues Internet KeyExchange (IKE) Some Attacks
n
We spoke of the SADB
n
How does it get populated?
n
We must negotiate it!
Initial Exchange
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic Philosophy Initial Exchange What Do We Have?AuthenticationWhat Do We Have?Traffic SelectorsChild SAsRekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
(Each message includes a random SPI, todistinguish between different IKE sessions.)
n
Negotiate cryptographic algorithms
n
Do a Diffie-Hellman exchange
I
R
SA
1 i
,^
KE
, Ni
i
R
I
SA
r
,^
KE
, Nr
,r
[
Certreq
]
SA
Crypto algorithm proposals and answer
KE
Diffie-Hellman exponential
N
Nonce (random number)
Certreq
List of trust anchors (CAs)
What Do We Have?
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial Exchange What Do We Have? AuthenticationWhat Do We Have?Traffic SelectorsChild SAsRekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
I has proposed several algorithms; R hasaccepted one of each category
n
The two sides have a Diffie-Hellman sharedsecret. The Diffie-Hellman shared secret iscombined with the two nonces to produce
seed
keying material
. Any message
M
protected by
keying material derived from this will bewritten
M
n
Different keys are used in each direction
n
I knows what CAs R trusts
n
Neither side knows the other’s identity yet
Authentication
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have? Authentication What Do We Have?Traffic SelectorsChild SAsRekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
I^
R
ID
,i
SA
2 i
,^
TS
,i
TS
,r
[
Cert
]^
,^
Auth
R
I
ID
,r
SA
2 r
,^
TS
,i
TS
r^
,^
Auth
Both sides send their own identities, the SA datafor subsequent exchanges,
traffic selectors
, and an
authenticator
The authenticator is either an HMAC or a digitalsignature of the message (including the SPI)concatenated with the current sender’s identityand the other party’s nonce.There are various other optional payloads forcertificates, CAs, etc.
What Do We Have?
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have?Authentication What Do We Have? Traffic SelectorsChild SAsRekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
Both sides know the other’s identity
n
Both sides have authenticated the other
n
Both sides have shared seed key material
n
I has proposed a traffic selector; R hasaccepted a possibly-narrower one
Traffic Selectors
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have?AuthenticationWhat Do We Have? Traffic Selectors Child SAsRekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
A
traffic selector
is a list of IP addresses and
port numbers that are to be protected by theSA
n
TS
i^
specifies source addresses and ports; TS
r
specifies destination addresses and ports
n
I proposes a certain range of traffic it wishes toprotect
n
R may agree to a narrower range
n
This lets I — possibly a laptop — have asimple, “protect everything” configuration; thecentral gateway can narrow the scope ofprotection if desired
Child SAs
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have?AuthenticationWhat Do We Have?Traffic Selectors Child SAs RekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
The control SA can now be used to createchild SAs for actual user traffic
I
R
SA
, N
,i
[
KE
]i
,^
[TS
,i
TS
]r
R
I
SA
, N
,r
[
KE
]r
,^
[TS
,i
TS
]r
n
Send new nonces for use in calculating keyingmaterial. For greater forward secrecy, send anoptional new Diffie-Hellman exponential.
n
Optionally negotiate new traffic selectors
Rekeying
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have?AuthenticationWhat Do We Have?Traffic SelectorsChild SAs Rekeying SA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
Any SA can be rekeyed
n
To rekey an SA, send a Rekey message with anSA identifier, new nonces, and perhaps newDiffie-Hellman exponentials
n
Omit traffic selectors
SA Lifetime
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have?AuthenticationWhat Do We Have?Traffic SelectorsChild SAsRekeying SA Lifetime Other ControlMessagesTimeoutsDenial of ServiceDefensesUsing IKE Some Attacks
n
SAs do not have negotiated lifetimes
n
When either side thinks an SA has beenaround for long enough, it negotiates a new SA
n
Net effect: SA lifetime is the shorter of thetwo sides’ preferences
n
After
the new one is set up, delete the old SA
Using IKE
IPSec Key ManagementRequirements Internet KeyExchange (IKE)IKEBasic PhilosophyInitial ExchangeWhat Do We Have?AuthenticationWhat Do We Have?Traffic SelectorsChild SAsRekeyingSA LifetimeOther ControlMessagesTimeoutsDenial of ServiceDefenses Using IKE Some Attacks
n
A host is configured with an initial protectionSPD
n
When a packet is to be sent that matches theSPD, IPsec searches for an existing SA
n
If there is none, a request is sent to the localIKE daemon
n
The IKE daemon attempts to create an SA,and updates the SAD
n
(On some systems, this may result in updatingthe SPD)
n
The packet is then transmitted
Some Attacks
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks Attacks!Splicing AttackDefensesUsing a SeparateSA?Probable PlaintextAttacksDefenses
Attacks!
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some Attacks Attacks! Splicing AttackDefensesUsing a SeparateSA?Probable PlaintextAttacksDefenses
n
I keep talking about subtle attacks
n
Let’s look at some old ones...
Splicing Attack
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some AttacksAttacks! Splicing Attack DefensesUsing a SeparateSA?Probable PlaintextAttacksDefenses
n
Suppose that (a) ESP is being used with noauthentication, (b) no sequence numbers, and(c) the good guy and the bad guy can sendtraffic on the same SA
n
The bad guy intercepts a good guy’s packet,sends a UDP packet with checksums turnedoff, and intercepts it, too
n
The attacker then uses CBC splicing to replacethe end of the UDP packet with the goodguy’s packet, and reinjects it
n
The receiving IPsec sees this packet, decryptsit, and passes it to the bad guy’s UDP listener
Defenses
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some AttacksAttacks!Splicing Attack Defenses Using a SeparateSA?Probable PlaintextAttacksDefenses
n
Use ESP authentication
n
Use ESP sequence numbers, to preventreinjection of the UDP packet (though thereare other variants that make that less useful)
n
Use a separate SA for each connection
Using a Separate SA?
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some AttacksAttacks!Splicing AttackDefenses Using a SeparateSA? Probable PlaintextAttacksDefenses
n
If you use separate SAs for each connection, itmakes life easier for traffic analysts
n
It can also aid cryptanalysts
Probable Plaintext Attacks
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some AttacksAttacks!Splicing AttackDefensesUsing a SeparateSA? Probable PlaintextAttacks Defenses
n
How does a cryptanalyst know if a guess atthe key was correct?
n
What should the packet look like?
n
Compare certain fields from two packets forthe same connection — they should match
n
Source and destination IP address must matchexactly
n
Probabilistically, most bits of counters (such asTCP sequence numbers) will match: if youadd 512 to a 32-bit number, probability is .97that the high-order 18 bits remain unchanged,and the low-order 9 bits are always unchanged
n
Other fields can be matched as well
Defenses
IPSec Key ManagementRequirements Internet KeyExchange (IKE) Some AttacksAttacks!Splicing AttackDefensesUsing a SeparateSA?Probable PlaintextAttacks Defenses
n
Not easy!
n
Try avoiding per-connection SAs
n
Don’t use ciphers that are weak enough thatthis is a useful attack...