a breach in the same-origin policy induced by … · a breach in the same-origin policy induced by...

32
A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY MIRRORING EXTERNAL CONTENT Jacob Thompson October 16, 2016

Upload: others

Post on 18-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY MIRRORING EXTERNAL CONTENT

Jacob Thompson

October 16, 2016

Page 2: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

About ISE● We are:

– Computer Scientists

– Academics

– Ethical Hackers

● Our customers are:– Fortune 500 enterprises

– Entertainment, software security, healthcare

● Our perspective is:– White box

Page 3: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Cross-Site Scripting

Page 4: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Same-Origin Policy

● spy.example.org cannot read cookies for secret.example.com

● spy.example.org JavaScript code cannot interact with DOM for secret.example.com

● Cross-server interaction strictly controlled● And so on...

Page 5: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Example

Page 6: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Seen This Before?

● http://www.example.net/fetch?url=http:%2f%2fsecret.example.com%2f

● http://www.example.net/fetch?url=http:%2f%2fspy.example.org%2f

Page 7: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Mirror Site

● Serve a copy of HTML and JavaScript content from an origin other than where it originated

Page 8: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

“Pure” Mirrors

● Search engine page caches● Translation services● Internet Archive

Page 9: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Proxy Sites

● Bad approximation of Tor?● Hide.me● Whoer.net● CGIProxy software● PHProxy software

Page 10: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

The Problem

● Mirroring security-relevant content causes a breakdown in the same-origin policy

● Privacy compromise– History leak

● Security compromise– Session leak

– Full same-origin bypass

● Let's see examples of different behavior

Page 11: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Normal vs. Mirrored Behavior

Page 12: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

History Leak – Normal (safe)

Page 13: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

History Leak – Translator (unsafe)

Page 14: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Session Leak – Normal (safe)

Page 15: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Session Leak – Proxy (unsafe)

Page 16: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Same Origin – Normal (safe)

Page 17: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Same Origin – Proxy (unsafe)

Page 18: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Mitigations by Mirror Sites

Page 19: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Cookie Blocking

● HTTP headers● JavaScript document.cookie● Breaking legitimate sites● Verdict: no good

Page 20: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Script/Object Stripping

● Breaks legitimate sites● Verdict: no good

Page 21: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Clearing/Resetting Cookies

● Interesting?● Verdict: maybe

Page 22: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

One-to-One Unique Hostnames

● e.g., www.example.com => fBdnswUStgA08LmGKhlIg.proxy.example.net, www.example.org => STDMnt7vcf7ii72NzUA.proxy.example.net

● Verdict: probably

Page 23: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Mirroring still seems risky regardless of these strategies...

Page 24: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Mitigations by Websites?

Page 25: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

HttpOnly Flag

● Protects against cookie leakage via JavaScript● Can't protect against same origin policy bypass

attack● Verdict: no

Page 26: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Authorization Header

● E.g., as in RESTful APIs● Can't be used in all situations● Verdict: maybe

Page 27: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Hardening Headers

● Strict Transport Security● Public Key Pinning● Any workable proxy would have to strip these...● Verdict: no

Page 28: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Blocking Proxy Sites

● Bad for usability?● Where would blacklist be found?

Page 29: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

No great solution to protect applications from broken mirror sites

Page 30: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

End users

● Use real proxies for anonymization (e.g., Tor)?● Caution with static mirrors

Page 31: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Future Work

● Only about one week thinking about this issue● Worse exploits?● More examples?● Better mitigation techniques?● Blog to follow

Page 32: A BREACH IN THE SAME-ORIGIN POLICY INDUCED BY … · a breach in the same-origin policy induced by mirroring external content jacob thompson october 16, 2016

Questions?