Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

40
Timing Info-leak Made Easy Presenter: Quan Minh Tam

Transcript of Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Page 1: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Timing Info-leak

Made EasyPresenter: Quan Minh Tam

Page 2: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Đơn vị tổ chức:

Đơn vị tài trợ:

Page 3: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Outline

• Review SSL/TLS weaks

• BEAST is not beast

• CRIME is not crime

– Compression

– CRIME

• TIME is time

– CRIME+

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 4: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Cryptanalysis

• Chosen plaintext | ciphertext

• Adaptive chosen plaintext | ciphertext

• Side channel attack

• Bruteforce attack

• Meet-in-the middle

• Linear | differential attack

• Birthday

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 5: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Timeline

10/22/2013 11:32 PM www.securitybootcamp.vn

• BEAST - 2011

• CRIME - 2012

• BREACH - 2013

• LUCKY 13 - 2013

• TIME - 2013

• RC4 biases in TLS

Page 6: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

CRIME

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 7: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

CRIME

• Compression Ratio Info-leak Made Easy

• Chosen plaintext attack

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 8: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

CRIME

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 9: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

COMPRESSION

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 10: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

COMPRESSION

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 11: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

COMPRESSION

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 12: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

COMPRESSION

10/22/2013 11:32 PM www.securitybootcamp.vn

http://www.c-sharpcorner.com/uploadfile/shivprasadk/best-practice-no-4-improve-bandwidth-performance-of-asp-net-sites-using-iis-compression/

Page 13: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

COMPRESSION

10/22/2013 11:32 PM www.securitybootcamp.vn

• Gzip/Deflate

• HTTP Respone body

• HTTP Request body

• Header compression

– SSL/TLS Compression

• Servers: Open SSL, others

• Clients: Chrome

– SPDY

• Server: Apache mod_spdy

• Client: -IE

Page 14: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

CRIME demo

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 15: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

How can you become a victim of CRIME?

• 1st requirement: the

attacker can sniff your

network traffic.

– You share a (W)LAN.

– He's hacked your home

router.

– He's your network

admin, ISP or

government.

10/22/2013 11:32 PM www.securitybootcamp.vn

https://docs.google.com/presentation/d/11eBmGiHbYcHR9gL5nDyZChu_-lCa2GizeuOfaLU2HOU/edit#slide=id.g1d134dff_0_165

Page 16: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

How can you become a victim of CRIME?

• 2nd requirement:

you visit evil.com.

– You click on a link.

– Or you surf a non-

HTTPS site.

10/22/2013 11:32 PM www.securitybootcamp.vn

https://docs.google.com/presentation/d/11eBmGiHbYcHR9gL5nDyZChu_-lCa2GizeuOfaLU2HOU/edit#slide=id.g1e3070b2_1_21

Page 17: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

TIME

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 18: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Review

• Round-Trip Time (RTT)

• Maximum Transmission Unit (MTU)

• Maximum Segment Size (MSS)

MSS = MTU - sizeof(TCPHDR) - sizeof(IPHDR)

• TCP Sliding Window System

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 19: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

10/22/2013 11:32 PM www.securitybootcamp.vn

http://ulam2.cs.luc.edu/ebook/html/slidingwindows.html

Page 20: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

TIME

• Timing Info-leak Made Easy

• Chosen Plaintext Attack

• Targets compression and timing

information leakage

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 21: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

• HTTP request

– CRIME for request to extract cookie data

• HTTP response

– Extended CRIME to extract response data

– Access a behind authentication resource

for user login status detection

– Application specific: e.g. number of digits in

bank account balance

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 22: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

HTTP payload

• HTTP Payload size may carry sensitive

information

– HTTP payload size differences detection is

sufficient to extract the sensitive information

• Using timing measurements attacker can

distinguish HTTP payload size differences

• These timing measurements can be done with

javascript on attacker site

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 23: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

XHR POC

• Create HTTP request with XHR– XHR adheres to SOP

• Allows GET requests to flow

– If headers allow show response

– If not, abort

• We don’t care for the response

– Timing leaks the request size

• Use getTime() on XHR events– onreadystatechange

• Noise elimination– Repeat the process (say 10 times) and obtain Minimal time

10/23/2013 2:41 AM www.securitybootcamp.vn

Page 24: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

• HTML with Javascript, sending method is XHR

• Sends one byte diff requests alternately 10 times

– The longer request crosses the send window boundary

– The shorter is exactly within

• Measures requests time

• Outputs length and time

• Outputs the minimal timing values for both requests’

length

10/23/2013 2:51 AM www.securitybootcamp.vn

Page 25: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

XHR

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 26: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

10/23/2013 2:33 AM www.securitybootcamp.vn

Page 27: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

10/23/2013 2:35 AM www.securitybootcamp.vn

Page 28: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 29: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

10/23/2013 2:50 AM www.securitybootcamp.vn

Page 30: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Real world

10/23/2013 2:53 AM www.securitybootcamp.vn

1

SCB

Page 31: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

• Iframe

• Use getTime() on iframe events

– onLoad

– Onreadystatechange(IE)

10/23/2013 3:02 AM www.securitybootcamp.vn

1

Page 32: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

Real world

10/23/2013 2:57 AM www.securitybootcamp.vn

2

SCB

Page 33: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

• HTTP request with IMG src

– It is not a image? Don’t worry

– X-Frame-Options? Don’t worry

• Use getTime() on img events

– onLoad

– Onreadystatechange(IE)

10/23/2013 3:07 AM www.securitybootcamp.vn

2

Page 34: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

New Risk?

10/23/2013 3:09 AM www.securitybootcamp.vn

Page 35: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

New Risk?

10/23/2013 3:12 AM www.securitybootcamp.vn

• Automation attack

– via URL

– via loadtine

• SOP?

– data leaked out

Page 36: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

MITIGATIONS

• Adding random timing delays

• X-Frame-Options

• Unknown-parameter

• CAPTCHA, CSRF token

10/22/2013 11:32 PM www.securitybootcamp.vn

Page 37: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

MITIGATIONS

• Adding random timing delays

10/23/2013 3:15 AM www.securitybootcamp.vn

ineffective

Page 38: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

MITIGATIONS

• X-Frame-Options

– Browser should support and respect “X-

Frame-Options'' header for all content

inclusion (not just IFRAME);

10/23/2013 3:23 AM www.securitybootcamp.vn

Page 39: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

MITIGATIONS

• CSRF protection

• Unknow parameter

• Captcha

10/23/2013 3:23 AM www.securitybootcamp.vn

Page 40: Security Bootcamp 2013 - Timing info-leak made easy - Quan Minh Tâm

That’s all

10/23/2013 3:24 AM www.securitybootcamp.vn