agenda
play

Agenda Technical background ! Same-Origin Policy ! - PowerPoint PPT Presentation

H TTP ! E ncrypted ! I nformation can be ! S tolen through ! T CP-windows by ! Mathy Vanhoef & Tom Van Goethem Agenda Technical background ! Same-Origin Policy ! Compression-based attacks ! SSL/TLS & TCP ! Nitty gritty


  1. H TTP ! E ncrypted ! I nformation can be ! S tolen through ! T CP-windows by ! Mathy Vanhoef & Tom Van Goethem

  2. Agenda • Technical background ! • Same-Origin Policy ! • Compression-based attacks ! • SSL/TLS & TCP ! • Nitty gritty HEIST details ! • Demo ! • Countermeasures H E I S T 2

  3. Same-Origin Policy GET /vault Mr. Sniffles https://bunnehbank.com H E I S T 3

  4. Same-Origin Policy GET /vault Mr. Sniffles https://bunnehbank.com H E I S T 3

  5. the World Wide Web https://bunnehbank.com Mr. Sniffles H E I S T 4

  6. the World Wide Web https://bunnehbank.com Mr. Sniffles H E I S T 4

  7. the World Wide Web GET /vault https://bunnehbank.com Mr. Sniffles H E I S T 4

  8. the World Wide Web GET /vault https://bunnehbank.com Mr. Sniffles H E I S T 4

  9. the World Wide Web GET /vault https://bunnehbank.com Mr. Sniffles H E I S T 4

  10. the World Wide Web GET /vault https://bunnehbank.com Mr. Sniffles H E I S T 4

  11. the World Wide Web GET /vault https://bunnehbank.com Mr. Sniffles H E I S T 5

  12. the World Wide Web GET /vault https://bunnehbank.com Mr. Sniffles H E I S T 6

  13. Agenda • Technical background ! • Same-Origin Policy ! • Compression-based attacks ! • SSL/TLS & TCP ! • Nitty gritty HEIST details ! • Demo ! • Countermeasures H E I S T 7

  14. /vault Uncompressed Compressed You requested: 
 You requested: 
 /vault 
 /vault 
 vault_secret=carrots4life _secret=carrots4life → 51 bytes → 47 bytes H E I S T 8

  15. /vault?secret=a /vault?secret=c You requested: 
 You requested: 
 /vault?secret=a 
 /vault?secret=c 
 _ carrots4life _ arrots4life → 50 bytes → 49 bytes H E I S T 9

  16. /vault?secret=a /vault?secret=c You requested: 
 You requested: 
 /vault?secret=a 
 /vault?secret=c 
 49 bytes < 50 bytes → 'c' is a correct guess _ carrots4life _ arrots4life → 50 bytes → 49 bytes H E I S T 10

  17. /vault?secret=ca /vault?secret=cb You requested: 
 You requested: 
 /vault?secret=ca 
 /vault?secret=cb 
 _ rrots4life _ arrots4life → 49 bytes → 50 bytes H E I S T 11

  18. /vault?secret=ca /vault?secret=cb You requested: 
 You requested: 
 /vault?secret=ca 
 /vault?secret=cb 
 49 bytes < 50 bytes → 'ca' is a correct guess _ rrots4life _ arrots4life → 49 bytes → 50 bytes H E I S T 12

  19. Compression-based Attacks • Compression and Information Leakage of Plaintext [FSE'02] ! • Chosen plaintext + compression = plaintext leakage ! • CRIME [ekoparty'12] ! • Exploits SSL compression ! • BREACH [Black Hat USA'13] ! • Exploits HTTP compression H E I S T 13

  20. Agenda • Technical background ! • Same-Origin Policy ! • Compression-based attacks ! • SSL/TLS & TCP ! • Nitty gritty HEIST details ! • Demo ! • Countermeasures H E I S T 14

  21. GET /vault TCP handshake S Y N SYN, ACK ACK SSL handshake Client Hello Server Hello P r e - M a s t e r S e c r e t H E I S T 15

  22. GET /vault encrypt( 
 GET /vault HTTP/1.1 
 Cookie: user=mr.sniffles ! Host: bunnehbank.com ! .... 
 ) 1 TCP data packet H E I S T 16

  23. encrypt( ) = 29 TCP data packets H E I S T 17

  24. encrypt( ) = 29 TCP data packets TCP packet 1 initcwnd TCP packet 2 = ... 10 TCP packet 10 H E I S T 18

  25. encrypt( ) = 29 TCP data packets TCP packet 1 initcwnd TCP packet 2 = ... 10 TCP packet 10 10 ACKs H E I S T 18

  26. encrypt( ) = 29 TCP data packets TCP packet 1 initcwnd TCP packet 2 = ... 10 TCP packet 10 10 ACKs cwnd = 20 H E I S T 18

  27. encrypt( ) = 29 TCP data packets TCP packet 1 initcwnd TCP packet 2 = ... 10 TCP packet 10 10 ACKs cwnd = 20 TCP packet 11 ... TCP packet 29 H E I S T 18

  28. HEIST • A set of techniques that allow attacker to determine the exact size of a network response ! • ... purely in the browser ! • Can be used to perform compression-based attacks, such as CRIME and BREACH, in the browser H E I S T 19

  29. Browser Side-channels • Send authenticated request to /vault resource ! fetch('https://bunnehbank.com/vault', {mode: "no-cors", credentials:"include"}) • Returns a Promise , which resolves as soon as browser receives the first byte of the response performance.getEntries()[-1].responseEnd • Returns time when response was completely downloaded H E I S T 20

  30. HEIST • Step 1: find out if response fits in a single TCP window H E I S T 21

  31. Fetching small resource: T2 - T1 is very small TCP handshake 
 first byte 
 complete received initial TCP 
 GET /vault window received time T1 T2 responseEnd initial TCP 
 fetch('...') window sent Promise 
 SSL handshake 
 complete resolves H E I S T 22

  32. Fetching large resource: T2 - T1 is round-trip time TCP handshake 
 first byte 
 second TCP 
 complete received window received initial TCP 
 GET /vault window received time T1 T2 ACK sent responseEnd initial TCP 
 fetch('...') window sent second TCP 
 Promise 
 SSL handshake 
 window sent complete resolves H E I S T 23

  33. HEIST • Step 1: find out if response fits in a single TCP window ! • Step 2: discover exact response size H E I S T 24

  34. Discover Exact Response Size initcwnd second TCP window Reflected content: x bytes Resource size: ?? bytes H E I S T 25

  35. Discover Exact Response Size initcwnd second TCP window Reflected content: x/2 bytes Resource size: ?? bytes H E I S T 26

  36. Discover Exact Response Size initcwnd second TCP window Reflected content: x/2+x/4 bytes Resource size: ?? bytes H E I S T 27

  37. After log(n) checks, we find: 
 ! y bytes of reflected content = 1 TCP window ! ! y+1 bytes of reflected content = 2 TCP windows 
 → resource size = initcwnd - y bytes initcwnd second TCP window Reflected content: y bytes Resource size: ?? bytes H E I S T 28

  38. HEIST • Step 1: find out if response fits in a single TCP window ! • Step 2: discover exact response size ! • Step 3: do the same for large responses ( > initcwnd ) H E I S T 29

  39. Determine size of large responses • Large response = bigger than initial TCP window • initcwnd is typically set to 10 TCP packets ! • ~14kB ! • TCP windows grow as packets are acknowledged ! • We can arbitrarily increase window size H E I S T 30

  40. = 19 TCP data packets GET /foo CWND = 10 10 TCP packets 10 ACKs CWND = 20 GET /vault 19 TCP packets 19 ACKs sent in single 
 TCP window H E I S T 31

  41. HEIST • Step 1: find out if response fits in a single TCP window ! • Step 2: discover exact response size ! • Step 3: do the same for large responses ( > initcwnd ) ! • Step 4: if available, leverage HTTP/2 H E I S T 32

  42. Leveraging HTTP/2 • HTTP/2 is the new HTTP version ! • Preserves the semantics of HTTP ! • Main changes are on the network level ! • Only a single TCP connection is used for parallel requests H E I S T 33

  43. Leveraging HTTP/2 • Determine exact response size without reflected content in the same response ! • Use (reflected) content in other responses on the same server ! • Note that BREACH still requires (a few bytes of) reflective content in the same resource H E I S T 34

  44. = 6 TCP packets /reflect?x=... = 3 TCP packets GET /reflect?x=... CWND = 10 GET /vault Promise 
 9 TCP packets resolves 9 ACKs responseEnd contains both 
 /reflect 
 and /vault H E I S T 35

  45. = 6 TCP packets /reflect?x=... = 5 TCP packets GET /reflect?x=... CWND = 10 GET /vault Promise 
 10 TCP packets resolves 10 ACKs CWND = 20 1 TCP packet contains both 
 1 ACK responseEnd /reflect and 
 part of /vault H E I S T 36

  46. DEMO H E I S T 38

  47. Other targets • Compression-based attacks ! • gzip compression is used by virtually every website ! • Size-exposing attacks ! • Uncover victim's demographics from popular social networks ! • Reveal victim's health conditions from online health websites ! • .... ! • Hard to find sites that are not vulnerable H E I S T 39

  48. Countermeasures • Browser layer ! • Prevent side-channel leak (infeasible) ! • Disable third-party cookies (complete) ! • HTTP layer ! • Block illicit requests (inadequate) ! • Disable compression (incomplete) ! • Network layer ! • Randomize TCP congestion window (inadequate) ! • Apply random padding (inadequate) H E I S T 40

  49. Conclusion • Collection of techniques to discover network response size in the browser , for all authenticated cross-origin resources ! • Side-channel originates from subtle interplay between multiple layers ! • Allows for compression-based and size-exposing attacks ! • HTTP/2 makes exploitation easier ! • Many countermeasures, few that actually work H E I S T 41

  50. H E I S T Questions? Mathy Vanhoef ! Tom Van Goethem ! @vanhoefm ! @tomvangoethem ! mathy.vanhoef@cs.kuleuven.be tom.vangoethem@cs.kuleuven.be

Recommend


More recommend