OFF-PATH ATTACKS AGAINST PKI Markus Brandt, Tianxiang Dai, Amit - - PowerPoint PPT Presentation

off path attacks against pki
SMART_READER_LITE
LIVE PREVIEW

OFF-PATH ATTACKS AGAINST PKI Markus Brandt, Tianxiang Dai, Amit - - PowerPoint PPT Presentation

OFF-PATH ATTACKS AGAINST PKI Markus Brandt, Tianxiang Dai, Amit Klein, Haya Shulman, Michael Waidner 1 WHO AM I? n Security Researcher n Technische Universitt Darmstadt n Fraunhofer-Institut fr Sichere Informationstechnologie n Freelancer n


slide-1
SLIDE 1

OFF-PATH ATTACKS AGAINST PKI

Markus Brandt, Tianxiang Dai, Amit Klein, Haya Shulman, Michael Waidner

1
slide-2
SLIDE 2 2

WHO AM I?

n Security Researcher

n Technische Universität Darmstadt n Fraunhofer-Institut für Sichere Informationstechnologie

n Freelancer n Teaching IT Security at TU Darmstadt n Special interest:

n Network Security n Crypto n Reverse engineering n …

slide-3
SLIDE 3

nPublic-Key Infrastructures nDomain Validation nOff-Path attack against Domain Validation nDefences nConclusion

3

OUTLINE

slide-4
SLIDE 4

PUBLIC-KEY INFRASTRUCTURES

4
slide-5
SLIDE 5 5

LET'S START WITH A SIMPLE EXAMPLE

client

slide-6
SLIDE 6 6

INSECURE WITHOUT ENCRYPTION

client

slide-7
SLIDE 7 7

ENCRYPTION PROTECTS THE DATA

client

?

slide-8
SLIDE 8 8

CERTIFICATES BIND CRYPTOGRAPHIC KEYS TO SUBJECTS

client

Certificate is signed by trusted root

slide-9
SLIDE 9 9

CERTIFICATES BIND CRYPTOGRAPHIC KEYS TO SUBJECTS

client

Certificate is signed by untrusted root

  • r self signed

ebay

slide-10
SLIDE 10

DOMAIN VALIDATION

10
slide-11
SLIDE 11 11

MORE THAN 100 ROOT CA IN BROWSERS

Automated Free / cheap Immediate Domain Validation (DV) Organisation Validation (OV) Extended Validation (EV) Expensive Manual Time-consuming

n We tested 17 CAs that perform DV n They control over 95% of the certificates market n Five were vulnerable n Only one vulnerable CA is sufficient n Usually it doesn’t matter which CA signed it

slide-12
SLIDE 12 12

CERTIFICATE ISSUANCE WITH DOMAIN VALIDATION

1 2 3 5 4

slide-13
SLIDE 13 13

RESOLVING A DOMAIN NAME

www.ebay.com? www.ebay.com?

Client DNS resolver Nameserver ns.ebay.com

1.2.3.4 1.2.3.4 1.2.3.4

slide-14
SLIDE 14 14

REPLYING FROM CACHE

www.ebay.com?

Client DNS resolver

1.2.3.4 1.2.3.4

slide-15
SLIDE 15

OFF-PATH ATTACK AGAINST DOMAIN VALIDATION

15
slide-16
SLIDE 16 16

WE ASSUME THE WEAKEST ATTACKER

Off-Path (Spoofing) Attackers can: n only inject packets n not eavesdrop n not modify or delay packets in any way

slide-17
SLIDE 17 17

DNS CACHE POISONING

www.ebay.com? www.ebay.com?

Client DNS resolver Nameserver ns.ebay.com

1.2.3.4 6.6.6.6 6.6.6.6 DNS Cache Poisoning

6.6.6.6

slide-18
SLIDE 18 18

AGAINST OFF-PATH POISONING: CHALLENGE-RESPONSE

n Send request from random port (16 Bit) n Select random DNS transaction ID (also 16 Bit) n 232 values àimpractical to guess!

slide-19
SLIDE 19 19

DNS PACKET: IP HEADER

Bit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

v4 IHL TOS Total Length

IP Header 32

IP Identifier Flags Fragment Offset

64

Time To Live Protocol IP Header Checksum

96

Source IP Address

128

Destination IP Address

slide-20
SLIDE 20 20

DNS PACKET: UDP HEADER

Bit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

v4 IHL TOS Total Length

IP Header 32

IP Identifier Flags Fragment Offset

64

Time To Live Protocol IP Header Checksum

96

Source IP Address

128

Destination IP Address

160

Source Port Destination Port

UDP Header 192

Length UDP Checksum

slide-21
SLIDE 21 21

DNS PACKET: DNS HEADER

Bit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

v4 IHL TOS Total Length

IP Header 32

IP Identifier Flags Fragment Offset

64

Time To Live Protocol IP Header Checksum

96

Source IP Address

128

Destination IP Address

160

Source Port Destination Port

UDP Header 192

Length UDP Checksum

224

Transaction Identifier (TXID) DNS Flags

DNS Header 256

Question Count Answer Record Count

288

Authority Record Count Additional Record Count

slide-22
SLIDE 22 22

DNS PACKET: DNS PAYLOAD

Bit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

v4 IHL TOS Total Length

IP Header 32

IP Identifier Flags Fragment Offset

64

Time To Live Protocol IP Header Checksum

96

Source IP Address

128

Destination IP Address

160

Source Port Destination Port

UDP Header 192

Length UDP Checksum

224

Transaction Identifier (TXID) DNS Flags

DNS Header 256

Question Count Answer Record Count

288

Authority Record Count Additional Record Count

Question Section

DNS Payload

Answer Section Authority Section Additional Section

slide-23
SLIDE 23 23

CHALLENGES

n Modify communication without seeing it and without access to it n Overwrite cached record with incorrect value n Exploit DNS cache poisoning to circumvent PKI authentication (and issue certificate)

slide-24
SLIDE 24 24

GOALS

Create correct response (Port, TXID) Inject into DNS cache Issue spoofed certificate

1 2 3

slide-25
SLIDE 25 25

LET’S START WITH STEP 1

Create correct response (Port, TXID) Inject into DNS cache Issue spoofed certificate

1 3

slide-26
SLIDE 26 26

LARGE PACKETS CAN GET FRAGMENTED ON PATH

Net 2.2.2.0 Net 3.3.3.0 Net 5.5.5.0

From: 2.2.2.5 To : 3.3.3.7 Bob, how much I love you

From: 2.2.2.5 To : 3.3.3.7 Bob, how much I . . . From: 2.2.2.5 To : 3.3.3.7 . . . love you!

Bob, how much I love you Bob, how much I love you IPs, Ports and IP IDs have to match!

slide-27
SLIDE 27 27

FRAGMENTATION CAN ALSO BE REQUESTED

Net 2.2.2.0 Net 3.3.3.0 Net 5.5.5.0 ¸

From: 2.2.2.5 To : 3.3.3.7 Bob, how much I love you

ICMP Packet too big

Bob, how much I love you

slide-28
SLIDE 28 28

ICMP

FRAGMENTATION NEEDED AND DON'T FRAGMENT WAS SET

Bit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

v4 IHL TOS Total Length

IP Header 32

IP Identifier Flags Fragment Offset

64

Time To Live Protocol IP Header Checksum

96

Source IP Address

128

Destination IP Address

160

Type = 3 Code = 4 ICMP Checksum

ICMP Header 192

Unused MTU = 100

224

v4 IHL TOS Total Length

IP Header 256

IP Identifier Flags Fragment Offset

288

Time To Live Protocol IP Header Checksum

320

Source IP Address

352

Destination IP Address …

IP Payload
slide-29
SLIDE 29 29

FORCING FRAGMENTATION

n Among 5K-top Alexa that reduce the MTU n 33,4% allow >= 296 bytes n 11% allow < 296 bytes n ICMP Messages can be sent by anyone n OSes typically do not apply any checks for UDP n UDP is stateless.

slide-30
SLIDE 30 30

EXPLOITING FRAGMENTATION AGAINST DNS

Bit

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

v4 IHL TOS Total Length

32

IP Identifier Flags Fragment Offset

64

Time To Live Protocol IP Header Checksum

96

Source IP Address

128

Destination IP Address

160

Source Port Destination Port

192

Length UDP Checksum

224

Transaction Identifier (TXID) DNS Flags

256

Question Count Answer Record Count

Modify only this! 288

Authority Record Count Additional Record Count

Question Section Answer Section Authority Section Additional Section

But what about the IP ID?

slide-31
SLIDE 31 31

RFC 791

September 1981 Internet Protocol Overview Fragmentation [...] The identification field is used to distinguish the fragments of

  • ne datagram from those of another. The originating protocol module
  • f an internet datagram sets the identification field to a value

that must be unique for that source-destination pair and protocol for the time the datagram will be active in the internet system. The originating protocol module of a complete datagram sets the more-fragments flag to zero and the fragment offset to zero. [...]

slide-32
SLIDE 32 32

HOW DO MAKE IP IDENTIFIERS UNIQUE?

RANDOM IP IDENTIFIERS

n Very few servers use random IP ID values (<1%) n Quite complicated n Needs enough entropy n Has to check for collisions

slide-33
SLIDE 33 33

HOW DO MAKE IP IDENTIFIERS UNIQUE?

Per-Destination IP ID

n <40% of the nameservers use a per-destination incrementing IP ID n Default in Linux n Attacks exist [KC14]

[KC14] Jeffrey Knockel and Jedidiah R Crandall. 2014. Counting Packets Sent Between Arbitrary Internet Hosts.. In FOCI.
slide-34
SLIDE 34 34

HOW DO MAKE IP IDENTIFIERS UNIQUE?

Sequentially Incrementing IP ID

n >60% of 10K-top Alexa domains use sequentially incrementing IP ID values n Easiest to attack n Simply estimate incremention

slide-35
SLIDE 35 35

WHAT HAPPENS IF THE 2ND FRAGMENT ARRIVES FIRST?

n Operating systems keep 2nd fragment and wait for 1st fragment n Windows keeps 100 fragments n Linux keeps 64 fragments n Older Linux kernels allow for thousands of fragments n Can be set via ip_frag_max_dist

slide-36
SLIDE 36 36

NOW WE WANT TO INSERT OUR ENTRY INTO THE CACHE

Create correct response (Port, TXID) Inject into DNS cache Issue spoofed certificate

2

slide-37
SLIDE 37 37

ADVANCED CACHE POISONING

sub.doma.in? sub.doma.in?

DNS resolver

Cache:

Domain IP doma.in 1.1.1.1 ns.doma.in 2.2.2.2 … …

ns.doma.in 2.2.2.2

Answer: (none) Authoritative Server: sub.doma.in NS ns.doma.in Additional Section: ns.doma.in A 9.9.9.9

slide-38
SLIDE 38 38

ADVANCED CACHE POISONING

sub.doma.in? sub.doma.in?

DNS resolver

Cache:

Domain IP doma.in 1.1.1.1 ns.doma.in 9.9.9.9 … …

ns.doma.in 2.2.2.2

Answer: (none) Authoritative Server: sub.doma.in NS ns.doma.in Additional Section: ns.doma.in A 9.9.9.9

ns.doma.in has a new IP. I should update this.

slide-39
SLIDE 39 39

THIS WAS JUST ONE (VERY SIMPLE) EXAMPLE “Internet-wide study of DNS cache injections” [KSW17] examines 18 different techniques There may be many others yet to be discovered

[KSW17] A. Klein, H. Shulman and M. Waidner, "Internet-wide study of DNS cache injections," IEEE INFOCOM 2017 - IEEE Conference on Computer Communications, Atlanta, GA, 2017
slide-40
SLIDE 40 40

DNS RESOLVERS APPLY DIFFERENT POLICIES

Deciding which records to cache and which to overwrite

slide-41
SLIDE 41 41

DIFFERENT DNS SERVER ARE VULNERABLE TO DIFFERENT PAYLOADS

slide-42
SLIDE 42 42

SO WE CAN TRY TO ATTACK OUR VICTIMS BY

n Fingerprinting DNS server n Selecting payload n Poisoning DNS cache with payload n e.g. using Fragmentation

slide-43
SLIDE 43 43

AND THE FINAL STEP

Create correct response (Port, TXID) Inject into DNS cache Issue spoofed certificate

3

slide-44
SLIDE 44

PUTTING IT ALL TOGETHER

3

mail.vict.im A 6.6.6.6

2 4 5 1 1 2 6

Headers + part of Payload

mail.vict.im A 2.2.2.2

7 8

2nd fragment 1st fragment

2

slide-45
SLIDE 45 45

IMPERSONATION SUCCESSFUL!

client

ebay

Our certificate is signed by a trusted CA.

slide-46
SLIDE 46

DEFENCES

46
slide-47
SLIDE 47 47

SHORT TERM DEFENCES

n Disable caching n Makes the attack hard but not impossible n Disable IP fragmentation n Will disconnect some networks n Force DNS over TCP n Off-path TCP injections attacks do exist n Offers no security against MITM attackers

slide-48
SLIDE 48 48

LONG TERM DEFENCES

n DNS over HTTPS/TLS n Securing PKI with PKI? n DNSSec n If fully deployed (proposed in mid-90s) n Domain Validation++

slide-49
SLIDE 49 49

DOMAIN VALIDATION++

n Drop-in replacement for conventional Domain Validation n Validation performed from multiple vantage points n Secures DV even against global MITM attackers n even they cannot be everywhere n Each vantage point has a local resolver n Hardened config / Caching disabled n Uses orchestrator that evaluates voting of DV agents each performing the DNS part n Communicate via HTTPS (fixed certificates) n Validation succeeds if majority returns the same response Ø For more details, visit pki.cad.sit.fraunhofer.de

slide-50
SLIDE 50 50

SIMULATION OF ATTACKER'S SUCCESS

slide-51
SLIDE 51 51

ADVICES

n Disable caching for DV resolvers n Adopt DV++ n Harden DNS resolvers n Limit fragmentation to reasonable values (e.g. MTU >= 1280) n Deploy DNSSec

slide-52
SLIDE 52 52

DNSSEC DEPLOYMENT IS CHALLENGING…

n 1/3 signed-domains cannot be validated n 35% domains signed with shared keys n 90% domains signed with weak keys (≤1024 bits) n 70% signed domains do not refresh keys

slide-53
SLIDE 53

CONCLUSION

53
slide-54
SLIDE 54 54

CONCLUSION

n Deployment of security in the Internet is challenging n Similar problems in many systems n How to make local enhancement of security work n Understand the landscape n See beyond the horizon n Security at partial adoption n Give incentives to adapt new technologies

slide-55
SLIDE 55

THANK YOU FOR YOUR ATTENTION QUESTIONS?

HTTPS://PKI.CAD.SIT.FRAUNHOFER.DE

55