[IT-Security-1] IPSec
IPSec
Notes from RWTH Aachen University course
“IT security 1” Wintersemester 2019/20
professor: Meyer, Ulrike Michaela
IPSec: IP security
網路架構
- Application (e.g. SNMP, HTTP, FTP)
- Presentation (e.g. encryption, ASCII, PNG, MIDI)
- Session (e.g. Syn/Ack)
- Transport (e.g. TCP, UDP, port numbers)
- Network (e.g. IP, routers)
- Data Link (e.g. MAC, switches)
- Physical (e.g. cable, RJ45)
可以用additional headers的方式被加到IPv4, IPv6的能力
包含authentication, confidentiality(保密) 和 key management
IPsec在transport layer以上是對應用程式透明
應用:
- 公司內部LANs的連線 over 公開的WAN
- 各host
- 各router
| IP Header | Payload |
| IP Header | IPsec Header | Protected Payload |IPsec支援兩種mode
- transport mode | | | | |
- tunnel mode \(|\ \ \ \ |\)
- security protocols AH and ESP 兩者mode皆可用
transport mode:
- 一個新header或一個header+trailer會加在IP header跟payload中間
- Protected IP Packet包含original IP header
Tunnel Mode:
- 在Original IP packet前(後)加header(trailer)
- 新的outer IP header在Protected IP packet前
AH(Authentication Header protocol)
- 用來授權從source host到destination host的封包
- 用IP header保障integrity
- 防止replay
- 用MAC
- 加在transport mode/ tunnel mode的新header
AH 的位置
ESP Protocol(Encapsulated Security Payload)
- 提供 packet-level source 授權、integrity、replay保護、保密
- 加上header, trailer, MAC
- 加密payload
NULL Encryption
- do nothing
- test_case = 1
data = 0x123456789abcdef
data_len = 8
NULL_data = 0x123456789abcdef
ESP in two modes
ESP v.s. AH
AH | ESP |
payload confidentiality | |
outer IP header 的integrity | |
Inner IP header 的integrity | |
Payload integrity | |
Replay protection (用sequence number) | |
Data source authentication |
- Security Associations (SAs)
- IPsec保障的單方面通訊
- 每個SA都有
- Security Parameter Index (SPI) 在AH or ESP header中,用來保護package
- Security Protocol Identifier 說明是AH或 ESP protocol
- 參數:
- Sequence Number Counter
- Sequence Counter Overflow
- Anti-Replay Window
- AH Information
- ESP Information
- Lifetime of this SA
- IPsec Protocol Mode
- Path MTU(maximum transmission unit)
- SA selectors
- 在SAD(SA-database)中定義各selector
- 包含
- 來源IP
- 目的IP
- 來源目的port
- 通訊協定
- 一個Data來
- 若在SAD中找不到selector,則跳過IPsec的步驟
- 若有selector則找對應的SA,選擇對應的AH/ESP
- 若沒有對應的SA,則用 Internet Key Exchange Protocol(IKE) 跟某個SA協調
- ISAKMP (Internet Security Association and Key Management Protocol)
- 定義 key exchange 授權的 message format
- 支援peers之間的SA協調
- 兩個phase:
- Phase 1 協調一對SA以保護phase 2的ISAKMP
- Phase 2 保護協調SA以用在其他協定(AH/ESP)
- 為何兩個phase
- 相同的phase 1可以用在不同的phase 2
- 相同的安全通道可以有不同的SA
- Key refreshment可以只在phase 2執行
- Phase 1
Aggressive mode | Main mode |
支援 authentication 和 session key establishment | |
3 messages | 6 messages |
額外保護endpoint identifiers | |
強制執行 | |
跟DoS protection有問題 |
- Pre-shared Key, main mode
- Signatures, main mode
- Dos (Denial of Service) protection with cookies
- header有cookies用來提供Dos protection
- Dos(Denial of Service)是因為資源耗盡
- header中的cookie確保responder是無狀態的,直到initiator傳送兩個訊息
- responder的狀態會被存在無法忘記的cookie中,並傳給initiator
- initiator回答後,cookie會被再次生成,跟上個initiator回傳的cookie做比較
- 成本是兩個增加的messages
- Signatures, aggressive mode
- Main mode都是先用key exchange的方式建立公鑰私鑰,再傳遞加密後的ID,signature等
- Signatures, Aggressive Mode是把key exchange所需的資料與ID一起傳遞,再生成公鑰私鑰,傳遞signature
- Signature必須在responder’s cookie前生成,可能有DoS攻擊
Typical Anti-DoS Cookie
- Typical protocol:
- Client 送 request Message #1
- Server建立連線,回傳 Message #2
- Client 結束或建立DoS攻擊
- Cookie version:
- Client 送 request
- Server 送 Hash 後的 connection data ,只有server有 key
- Client 確認後回傳 Hash 資料
- 傳送延後的 Message #2
- Typical protocol:
IKEv2和IKEv1比較
IKEv1 | IKEv2 |
---|---|
較少RFCs | |
較少phase 1 exchanges的選擇 | |
在IKE exchange (phase1)時IPsec的一對SA已建立 | |
chile SA建立 | |
不強制用cookies |
General reading on IPsec and IKEv1
Kaufmann Chapter 18
For IKE v2:
RFC 2410: The NULL Encryption Algorithm and Its Use With IPsec
Additional reading on attacks published sofar
Degabriele et al.: Attacking the IPsec standards in encryption-only configurations. 2007 Degabriele et al.: On the (In)Security of IPsec in MAC-then-encrypt configurations, 2010 Cremers, C.: Key Exchange in IPsec revisited: Formal Analysis of IKEv1 and IKEv2, 2010
Felsch et al: The Dangers of Key Reuse: Practical Attacks on IPsec IKE , 2018
留言
張貼留言