Side-Channels on the Web:
Attacks and Defenses
Tom Van Goethem
@tomvangoethem
cute-kittens.com cute-puppies.com
cute-kittens.com cute-puppies.com
evil-bunnies.com
BUNNIES ATTACK!
cute-kittens.com cute-puppies.com
evil-bunnies.com
BUNNIES ATTACK!
What can the bunnies (attackers) do?
Same-origin Policy
evil-bunnies.com
cute-kittens.com
<img src="//cute-kittens.com/img">
Same-origin Policy
evil-bunnies.com
cute-kittens.com
fetch("//cute-kittens.com/fetch", {
"method": "POST",
"credentials": "include",
"body": "bunnies=best"
});
Access to fetch at 'http://cute-kittens.com/'
from origin 'http://evil-bunnies.com' has been
blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is
present on the requested resource. If an
opaque response serves your needs, set the
request's mode to 'no-cors' to fetch the
resource with CORS disabled.
Same-origin Policy
evil-bunnies.com
cute-kittens.com
fetch("//cute-kittens.com/fetch", {
"mode": "no-cors",
"method": "POST",
"credentials": "include",
"body": "bunnies=best"
});
Same-origin Policy
evil-bunnies.com
cute-kittens.com
<iframe src="//cute-kittens.com/iframe">
</iframe>
frames[0].document
Uncaught DOMException: Blocked a frame with
origin "http://evil-bunnies.com" from accessing
a cross-origin frame.
Same-origin Policy
evil-bunnies.com
cute-kittens.com
<iframe src="//cute-kittens.com/iframe">
</iframe>
frames[0].length => 5
• Try to leak information about cross-origin responses
• Indirectly: certain browser/web features leak meta-information
• Does the server return an image?
• <img> onerror vs. <img> onload
• Is resource cached by the browser?
• E.g. use timing information
• How many iframes does a resource contain?
• E.g. use frames.length
• Many more, see https://github.com/xsleaks/xsleaks
Side-channel attacks on the web (XSLeaks)
12
Cross-site size-exposing attacks
Size may leak information about user state
~19kB
~183kB
Gelernter, Nethanel, and Amir Herzberg. "Cross-site search attacks." Proceedings of the 22nd ACM SIGSAC Conference on Computer and
Communications Security (CCS). ACM, 2015.
Cross-site timing attacks
• State-dependent content
15
victim
<img src="https://cute-kittens.com/index.hmtl">
cute-kittens.com
Start timer
Stop timer
error event
 Logged in or not?
 #items in online basket
Network latency and
instability
evil-bunnies.com
victim
Start timer
Stop timer
[1] Van Goethem et al. The Clock is Still Ticking: Timing Attacks in the Modern Web. In Proceedings of the 22nd ACM SIGSAC Conference
on Computer and Communications Security (CCS '15). ACM, New York, NY, USA, 1382-1393.
 Abuse of firing events during parsing process
- suspend when fetched
- error on fail
<video src="https://doggo-bank.com/index.hmtl">
suspend
error
cute-kittens.comevil-bunnies.com
Browser-based timing attacks
Video Parsing Attack
17
Video Parsing Attack
let video = document.createElement('video');
// suspend => download complete
video.addEventListener('suspend',function(){
start = window.performance.now();
});
// error => parsing complete
video.addEventListener('error',function(){
end = window.performance.now();
});
video.src = 'https://example.org/resource';
CACHE MANIFEST
CACHE:
https://example.org/resource
NETWORK:
*
appcache.manifest
Defense: Cross-Origin Read Blocking (CORB)
• Prevents potentially sensitive filetypes to be loaded in same renderer
• Defense against speculative execution attacks
Sensitive document not in same process => can not be leaked
• Enabled by default
• Only available in Chrome & Edge
Cache Storage Attack
19
Cache Storing Attack
let url = 'https://example.org/resource';
let opts = {credentials: "include", mode: "no-cors"};
let request = new Request(url, opts);
let bogusReq = new Request('/bogus');
fetch(request).then(function(resp) {
// Resource download complete
start = window.performance.now();
return cache.put(bogusReq, resp.clone())
}).then(function() {
// Resource stored in cache
end = window.performance.now();
});
20
Browser-based response size leakage
• Can differentiate resources that differ only few kB
• Video parsing mechanisms already patched
New features may cause new side-channels (e.g. SRI, image parsing, …)?
• Real-world attacks can be improved by using response inflation
One result is repeated many times → difference in response size is artificially enlarged
• Attacks discovered in 2015; bug hunters starting to leverage techniques
21
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
HEIST
HTTP
Encrypted
Information can be
Stolen through
TCP Windows
HEIST
• Determine exact response size (compressed)
• 1 TCP window = 10 TCP packets = 14480 bytes of data
• 2nd TCP window can only start after ACK (--> additional round-trip needed)
• Response fits in 1 TCP window --> 1 RTT, otherwise 2+ RTTs
• Use side-channel to detect when headers are received
fetch() promise resolves
• Use side-channel to detect when full response is received
Cache API store + read
• Timing difference < 5ms --> 1 TCP window, otherwise 2 TCP windows
24
Response (14480 bytes)
1st TCP window
1st TCP window
fetch() resolves cache store + read finishes
Timing difference
Response (14481 bytes)
1st TCP window
ACK
…
2nd TCP window
1st TCP window
ACK
…
2nd TCP window
fetch() resolves
Timing difference (much bigger)
cache store + read finishe
• Important prerequisite: reflection of request in response
Needed to align on TCP window size
• Exact size is known after compression
Allows for BREACH-like attack
31
HEIST
32
Hello $_GET['name'], your secret value is VOLGA_CTF
gzip(Hello Tom, your secret value is VOLGA_CTF)
?name=Tom
==> Hello Tom, your secret value is VOLGA_CTF
gzip(Hello VOLG, your secret value is VOLGA_CTF)
?name=VOLG
==> Hello VOLG, your secret value is {@-27,4}A_CTF
33
gzip(Hello SWAGB, your secret value is VOLGA_CTF)
?name=VOLGB
==> Hello VOLGB, you secret value is {@-27,4}A_CTF
gzip(Hello VOLGA, your secret value is VOLGA_CTF)
?name=VOLGA
==> Hello VOLGA, you secret value is {@-28,5}_CTF
→ 42 bytes
→ 41 bytes
• Can be used to extract cross-origin secrets (CSRF tokens)
• Defense: disable compression for sensitive content
https://blog.cloudflare.com/a-solution-to-compression-oracles-on-the-web/
Not widely deployed, requires regex to know what is sensitive
• Defense: refresh tokens after N requests
Can be tricky + what about other sensitive content?
• Large-scale impact: to be explored
34
HEIST
Storage API &
Quota Management
Attack
Abusing Storage Quota
• Each site (eTLD+1) has a specific quota
IndexedDB, localStorage, …
Cross origin resources (!!!)
• When quota is reached, any attempt to store more is blocked
• Can be used to determine exact size of cross-origin resource
• Exact size --> defenses against response inflation do not work
36
37
Quota
38
Quota
Step 1: fill
39
Quota
Step 1: fill
Step 2: remove x x
40
Quota
Step 1: fill
Step 2: remove x
Step 3: store resource
x
41
Quota
Step 1: fill
Step 2: remove x
Step 3: store resource
Step 4: fill
x
y
42
Quota
Step 1: fill
Step 2: remove x
Step 3: store resource
Step 4: fill
Step 5: x - y = PROFIT
x
y
Quota Management API
• Developers may want to know how many bytes are available/used
• Quota API returns “estimate”
In reality, the estimate provided exact number of bytes
• Attack becomes super easy
x = getEstimate(); store(crossOriginResource); y = getEstimate(); size = y - x;
43
Storage/Quota API status
• Fixes have been deployed
For every stored cross-origin resource, a random number of bytes (approx. 7MB in
Chrome) count towards the quota
• Low-impact solution, highly effective
No performance impact; small usability impact (for sites that store many cross-orgin
resources)
Very few attack scenarios left
Maybe abuse global quota & trigger website to store resource same-origin (highly unlikely)
44
Defenses
Same-site cookie
• Cookie with extra attribute SameSite
SameSite=strict  NO CROSS-SITE REQUESTS!
SameSite=lax  exceptions: top-level GET, prerender
• Soon Lax will be the default in Chrome (& other browsers?)
• In-depth defense against cross-site attacks
46
[1] West, M., Goodwin, M. Same-site cookies. Internet- Draft draft-ietf-httpbis-cookie-same-site-00, IETF
Secretariat, June 2016.
• Cross-origin Read Blocking (CORB)
Blocks rendering sensitive content
• Cross-origin Resource Policy (CORP)
Allows web developers to determine how their resources are included
In development
• Sec-Fetch Metadata
Request headers that give information to web application how request was triggered
• Cache partitioning
Browser cache is keyed to top-document origin & cookie origin
Prevents cache-based attacks
• Cross-Origin Opener Policy (COOP)
Removes reference to opened window (and thereby attacks that rely on it)
Other defenses
Questions?
@tomvangoethem

More Related Content

PDF
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
PDF
[Wroclaw #9] The purge - dealing with secrets in Opera Software
PPT
BlueHat v17 || Out of the Truman Show: VM Escape in VMware Gracefully
PDF
Hack any website
PPTX
DevOOPS: Attacks and Defenses for DevOps Toolchains
PDF
Art of Web Backdoor - Pichaya Morimoto
PPTX
AWS Survival Guide
PDF
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
[Wroclaw #9] The purge - dealing with secrets in Opera Software
BlueHat v17 || Out of the Truman Show: VM Escape in VMware Gracefully
Hack any website
DevOOPS: Attacks and Defenses for DevOps Toolchains
Art of Web Backdoor - Pichaya Morimoto
AWS Survival Guide
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...

What's hot (20)

PPTX
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
PDF
Attacking Oracle with the Metasploit Framework
PDF
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
PDF
Hacking intranet websites
PDF
DevOops & How I hacked you DevopsDays DC June 2015
PDF
Testing Android Security Codemotion Amsterdam edition
PDF
Open Canary - novahackers
PDF
HashiCorp Vault Workshop:幫 Credentials 找個窩
PDF
Testing NodeJS Security
PPT
На страже ваших денег и данных
PPTX
BlueHat v17 || Securing Windows Defender Application Guard
PDF
Veil-PowerView - NovaHackers
PDF
Understanding Windows Access Token Manipulation
PDF
Chris Rutter: Avoiding The Security Brick
PDF
Внедрение безопасности в веб-приложениях в среде выполнения
PDF
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
PPTX
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
PDF
Codetainer: a Docker-based browser code 'sandbox'
PPTX
Security in NodeJS applications
PDF
Big Bang Theory: The Evolution of Pentesting High Security Enviroments IT Def...
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
Attacking Oracle with the Metasploit Framework
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
Hacking intranet websites
DevOops & How I hacked you DevopsDays DC June 2015
Testing Android Security Codemotion Amsterdam edition
Open Canary - novahackers
HashiCorp Vault Workshop:幫 Credentials 找個窩
Testing NodeJS Security
На страже ваших денег и данных
BlueHat v17 || Securing Windows Defender Application Guard
Veil-PowerView - NovaHackers
Understanding Windows Access Token Manipulation
Chris Rutter: Avoiding The Security Brick
Внедрение безопасности в веб-приложениях в среде выполнения
Daniel Kachakil - Android's Download Provider: Discovering and exploiting thr...
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Codetainer: a Docker-based browser code 'sandbox'
Security in NodeJS applications
Big Bang Theory: The Evolution of Pentesting High Security Enviroments IT Def...
Ad

Similar to [OPD 2019] Side-Channels on the Web:
Attacks and Defenses (20)

PDF
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
PDF
Side-Channels on the Web: Attacks and Defenses
KEY
DVWA BruCON Workshop
PDF
VUG5: Varnish at Opera Software
PDF
Attack Chaining: Advanced Maneuvers for Hack Fu
PDF
Krzysztof Kotowicz - Hacking HTML5
PDF
DrupalCamp London 2017 - Web site insecurity
PDF
Krzysztof kotowicz. something wicked this way comes
PDF
Hacking HTML5 offensive course (Zeronights edition)
PDF
White Lightning Sept 2014
PDF
Something wicked this way comes - CONFidence
PPTX
Lessons from running potentially malicious code inside containers
PPTX
Bsides final
PDF
How abusing the Docker API led to remote code execution same origin bypass an...
PDF
Html5 hacking
PPTX
Scale Your Data Tier With Windows Server App Fabric
PPTX
Microsoft Windows Server AppFabric
PDF
HTTP Caching and PHP
PDF
Evolution Of Web Security
PDF
Waf.js: How to Protect Web Applications using JavaScript
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Side-Channels on the Web: Attacks and Defenses
DVWA BruCON Workshop
VUG5: Varnish at Opera Software
Attack Chaining: Advanced Maneuvers for Hack Fu
Krzysztof Kotowicz - Hacking HTML5
DrupalCamp London 2017 - Web site insecurity
Krzysztof kotowicz. something wicked this way comes
Hacking HTML5 offensive course (Zeronights edition)
White Lightning Sept 2014
Something wicked this way comes - CONFidence
Lessons from running potentially malicious code inside containers
Bsides final
How abusing the Docker API led to remote code execution same origin bypass an...
Html5 hacking
Scale Your Data Tier With Windows Server App Fabric
Microsoft Windows Server AppFabric
HTTP Caching and PHP
Evolution Of Web Security
Waf.js: How to Protect Web Applications using JavaScript
Ad

More from OWASP (20)

PDF
[OPD 2019] Web Apps vs Blockchain dApps
PDF
[OPD 2019] Threat modeling at scale
PDF
[OPD 2019] Life after pentest
PDF
[OPD 2019] .NET Core Security
PDF
[OPD 2019] Top 10 Security Facts of 2020
PDF
[OPD 2019] Governance as a missing part of IT security architecture
PDF
[OPD 2019] Storm Busters: Auditing & Securing AWS Infrastructure
PPTX
[OPD 2019] AST Platform and the importance of multi-layered application secu...
PPTX
[OPD 2019] Inter-application vulnerabilities
PDF
[OPD 2019] Automated Defense with Serverless computing
PDF
[OPD 2019] Advanced Data Analysis in RegSOC
PDF
[OPD 2019] Attacking JWT tokens
PDF
[OPD 2019] Rumpkernels meet fuzzing
PDF
[OPD 2019] Trusted types and the end of DOM XSS
PDF
[Wroclaw #9] To be or Not To Be - Threat Modeling in Security World
PDF
OWASP Poland 13 November 2018 - Martin Knobloch - Building Secure Software
PDF
OWASP Poland Day 2018 - Damian Rusinek - Outsmarting smart contracts
PDF
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
PDF
OWASP Poland Day 2018 - Dani Ramirez - IPMI hacking
PPTX
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
[OPD 2019] Web Apps vs Blockchain dApps
[OPD 2019] Threat modeling at scale
[OPD 2019] Life after pentest
[OPD 2019] .NET Core Security
[OPD 2019] Top 10 Security Facts of 2020
[OPD 2019] Governance as a missing part of IT security architecture
[OPD 2019] Storm Busters: Auditing & Securing AWS Infrastructure
[OPD 2019] AST Platform and the importance of multi-layered application secu...
[OPD 2019] Inter-application vulnerabilities
[OPD 2019] Automated Defense with Serverless computing
[OPD 2019] Advanced Data Analysis in RegSOC
[OPD 2019] Attacking JWT tokens
[OPD 2019] Rumpkernels meet fuzzing
[OPD 2019] Trusted types and the end of DOM XSS
[Wroclaw #9] To be or Not To Be - Threat Modeling in Security World
OWASP Poland 13 November 2018 - Martin Knobloch - Building Secure Software
OWASP Poland Day 2018 - Damian Rusinek - Outsmarting smart contracts
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
OWASP Poland Day 2018 - Dani Ramirez - IPMI hacking
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...

Recently uploaded (20)

PPTX
COPD_Management_Exacerbation_Detailed_Placeholders.pptx
PPTX
Partner to Customer - Sales Presentation_V23.01.pptx
PPT
12 Things That Make People Trust a Website Instantly
PDF
healthwealthtech4all-blogspot-com-2025-08-top-5-tech-innovations-that-will-ht...
PPTX
Artificial_Intelligence_Basics use in our daily life
PPTX
curriculumandpedagogyinearlychildhoodcurriculum-171021103104 - Copy.pptx
PPTX
10.2981-wlb.2004.021Figurewlb3bf00068fig0001.pptx
DOCX
Memecoinist Update: Best Meme Coins 2025, Trump Meme Coin Predictions, and th...
PPTX
Basic understanding of cloud computing one need
PDF
The_Decisive_Battle_of_Yarmuk,battle of yarmuk
PDF
Top 8 Trusted Sources to Buy Verified Cash App Accounts.pdf
PDF
Virtual Guard Technology Provider_ Remote Security Service Solutions.pdf
PPSX
AI AppSec Threats and Defenses 20250822.ppsx
PPTX
ECO SAFE AI - SUSTAINABLE SAFE AND HOME HUB
PPTX
module 1-Part 1.pptxdddddddddddddddddddddddddddddddddddd
PDF
Computer Networking, Internet, Casting in Network
PPTX
KSS ON CYBERSECURITY INCIDENT RESPONSE AND PLANNING MANAGEMENT.pptx
PPTX
最新版美国埃默里大学毕业证(Emory毕业证书)原版定制文凭学历认证
DOCX
Powerful Ways AIRCONNECT INFOSYSTEMS Pvt Ltd Enhances IT Infrastructure in In...
PDF
Containerization lab dddddddddddddddmanual.pdf
COPD_Management_Exacerbation_Detailed_Placeholders.pptx
Partner to Customer - Sales Presentation_V23.01.pptx
12 Things That Make People Trust a Website Instantly
healthwealthtech4all-blogspot-com-2025-08-top-5-tech-innovations-that-will-ht...
Artificial_Intelligence_Basics use in our daily life
curriculumandpedagogyinearlychildhoodcurriculum-171021103104 - Copy.pptx
10.2981-wlb.2004.021Figurewlb3bf00068fig0001.pptx
Memecoinist Update: Best Meme Coins 2025, Trump Meme Coin Predictions, and th...
Basic understanding of cloud computing one need
The_Decisive_Battle_of_Yarmuk,battle of yarmuk
Top 8 Trusted Sources to Buy Verified Cash App Accounts.pdf
Virtual Guard Technology Provider_ Remote Security Service Solutions.pdf
AI AppSec Threats and Defenses 20250822.ppsx
ECO SAFE AI - SUSTAINABLE SAFE AND HOME HUB
module 1-Part 1.pptxdddddddddddddddddddddddddddddddddddd
Computer Networking, Internet, Casting in Network
KSS ON CYBERSECURITY INCIDENT RESPONSE AND PLANNING MANAGEMENT.pptx
最新版美国埃默里大学毕业证(Emory毕业证书)原版定制文凭学历认证
Powerful Ways AIRCONNECT INFOSYSTEMS Pvt Ltd Enhances IT Infrastructure in In...
Containerization lab dddddddddddddddmanual.pdf

[OPD 2019] Side-Channels on the Web:
Attacks and Defenses

  • 1. Side-Channels on the Web: Attacks and Defenses Tom Van Goethem @tomvangoethem
  • 5. What can the bunnies (attackers) do?
  • 7. Same-origin Policy evil-bunnies.com cute-kittens.com fetch("//cute-kittens.com/fetch", { "method": "POST", "credentials": "include", "body": "bunnies=best" }); Access to fetch at 'http://cute-kittens.com/' from origin 'http://evil-bunnies.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
  • 8. Same-origin Policy evil-bunnies.com cute-kittens.com fetch("//cute-kittens.com/fetch", { "mode": "no-cors", "method": "POST", "credentials": "include", "body": "bunnies=best" });
  • 9. Same-origin Policy evil-bunnies.com cute-kittens.com <iframe src="//cute-kittens.com/iframe"> </iframe> frames[0].document Uncaught DOMException: Blocked a frame with origin "http://evil-bunnies.com" from accessing a cross-origin frame.
  • 11. • Try to leak information about cross-origin responses • Indirectly: certain browser/web features leak meta-information • Does the server return an image? • <img> onerror vs. <img> onload • Is resource cached by the browser? • E.g. use timing information • How many iframes does a resource contain? • E.g. use frames.length • Many more, see https://github.com/xsleaks/xsleaks Side-channel attacks on the web (XSLeaks)
  • 13. Size may leak information about user state ~19kB ~183kB
  • 14. Gelernter, Nethanel, and Amir Herzberg. "Cross-site search attacks." Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security (CCS). ACM, 2015.
  • 15. Cross-site timing attacks • State-dependent content 15 victim <img src="https://cute-kittens.com/index.hmtl"> cute-kittens.com Start timer Stop timer error event  Logged in or not?  #items in online basket Network latency and instability evil-bunnies.com
  • 16. victim Start timer Stop timer [1] Van Goethem et al. The Clock is Still Ticking: Timing Attacks in the Modern Web. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security (CCS '15). ACM, New York, NY, USA, 1382-1393.  Abuse of firing events during parsing process - suspend when fetched - error on fail <video src="https://doggo-bank.com/index.hmtl"> suspend error cute-kittens.comevil-bunnies.com Browser-based timing attacks
  • 17. Video Parsing Attack 17 Video Parsing Attack let video = document.createElement('video'); // suspend => download complete video.addEventListener('suspend',function(){ start = window.performance.now(); }); // error => parsing complete video.addEventListener('error',function(){ end = window.performance.now(); }); video.src = 'https://example.org/resource'; CACHE MANIFEST CACHE: https://example.org/resource NETWORK: * appcache.manifest
  • 18. Defense: Cross-Origin Read Blocking (CORB) • Prevents potentially sensitive filetypes to be loaded in same renderer • Defense against speculative execution attacks Sensitive document not in same process => can not be leaked • Enabled by default • Only available in Chrome & Edge
  • 19. Cache Storage Attack 19 Cache Storing Attack let url = 'https://example.org/resource'; let opts = {credentials: "include", mode: "no-cors"}; let request = new Request(url, opts); let bogusReq = new Request('/bogus'); fetch(request).then(function(resp) { // Resource download complete start = window.performance.now(); return cache.put(bogusReq, resp.clone()) }).then(function() { // Resource stored in cache end = window.performance.now(); });
  • 20. 20
  • 21. Browser-based response size leakage • Can differentiate resources that differ only few kB • Video parsing mechanisms already patched New features may cause new side-channels (e.g. SRI, image parsing, …)? • Real-world attacks can be improved by using response inflation One result is repeated many times → difference in response size is artificially enlarged • Attacks discovered in 2015; bug hunters starting to leverage techniques 21
  • 24. HEIST • Determine exact response size (compressed) • 1 TCP window = 10 TCP packets = 14480 bytes of data • 2nd TCP window can only start after ACK (--> additional round-trip needed) • Response fits in 1 TCP window --> 1 RTT, otherwise 2+ RTTs • Use side-channel to detect when headers are received fetch() promise resolves • Use side-channel to detect when full response is received Cache API store + read • Timing difference < 5ms --> 1 TCP window, otherwise 2 TCP windows 24
  • 27. 1st TCP window fetch() resolves cache store + read finishes Timing difference
  • 30. 1st TCP window ACK … 2nd TCP window fetch() resolves Timing difference (much bigger) cache store + read finishe
  • 31. • Important prerequisite: reflection of request in response Needed to align on TCP window size • Exact size is known after compression Allows for BREACH-like attack 31 HEIST
  • 32. 32 Hello $_GET['name'], your secret value is VOLGA_CTF gzip(Hello Tom, your secret value is VOLGA_CTF) ?name=Tom ==> Hello Tom, your secret value is VOLGA_CTF gzip(Hello VOLG, your secret value is VOLGA_CTF) ?name=VOLG ==> Hello VOLG, your secret value is {@-27,4}A_CTF
  • 33. 33 gzip(Hello SWAGB, your secret value is VOLGA_CTF) ?name=VOLGB ==> Hello VOLGB, you secret value is {@-27,4}A_CTF gzip(Hello VOLGA, your secret value is VOLGA_CTF) ?name=VOLGA ==> Hello VOLGA, you secret value is {@-28,5}_CTF → 42 bytes → 41 bytes
  • 34. • Can be used to extract cross-origin secrets (CSRF tokens) • Defense: disable compression for sensitive content https://blog.cloudflare.com/a-solution-to-compression-oracles-on-the-web/ Not widely deployed, requires regex to know what is sensitive • Defense: refresh tokens after N requests Can be tricky + what about other sensitive content? • Large-scale impact: to be explored 34 HEIST
  • 35. Storage API & Quota Management Attack
  • 36. Abusing Storage Quota • Each site (eTLD+1) has a specific quota IndexedDB, localStorage, … Cross origin resources (!!!) • When quota is reached, any attempt to store more is blocked • Can be used to determine exact size of cross-origin resource • Exact size --> defenses against response inflation do not work 36
  • 39. 39 Quota Step 1: fill Step 2: remove x x
  • 40. 40 Quota Step 1: fill Step 2: remove x Step 3: store resource x
  • 41. 41 Quota Step 1: fill Step 2: remove x Step 3: store resource Step 4: fill x y
  • 42. 42 Quota Step 1: fill Step 2: remove x Step 3: store resource Step 4: fill Step 5: x - y = PROFIT x y
  • 43. Quota Management API • Developers may want to know how many bytes are available/used • Quota API returns “estimate” In reality, the estimate provided exact number of bytes • Attack becomes super easy x = getEstimate(); store(crossOriginResource); y = getEstimate(); size = y - x; 43
  • 44. Storage/Quota API status • Fixes have been deployed For every stored cross-origin resource, a random number of bytes (approx. 7MB in Chrome) count towards the quota • Low-impact solution, highly effective No performance impact; small usability impact (for sites that store many cross-orgin resources) Very few attack scenarios left Maybe abuse global quota & trigger website to store resource same-origin (highly unlikely) 44
  • 46. Same-site cookie • Cookie with extra attribute SameSite SameSite=strict  NO CROSS-SITE REQUESTS! SameSite=lax  exceptions: top-level GET, prerender • Soon Lax will be the default in Chrome (& other browsers?) • In-depth defense against cross-site attacks 46 [1] West, M., Goodwin, M. Same-site cookies. Internet- Draft draft-ietf-httpbis-cookie-same-site-00, IETF Secretariat, June 2016.
  • 47. • Cross-origin Read Blocking (CORB) Blocks rendering sensitive content • Cross-origin Resource Policy (CORP) Allows web developers to determine how their resources are included In development • Sec-Fetch Metadata Request headers that give information to web application how request was triggered • Cache partitioning Browser cache is keyed to top-document origin & cookie origin Prevents cache-based attacks • Cross-Origin Opener Policy (COOP) Removes reference to opened window (and thereby attacks that rely on it) Other defenses

Editor's Notes

  • #16: User has an account on this website?  enables targeted phishing attacks
  • #17: TODO: code example like previous Instead of timing download, time parsing of browser
  • #39: Fill is needed because Quota is user-dependent
  • #40: Fill is needed because Quota is user-dependent
  • #41: Fill is needed because Quota is user-dependent
  • #42: Fill is needed because Quota is user-dependent
  • #43: Fill is needed because Quota is user-dependent
  • #44: Developed by someone at Google, for W3C, no longer supported