Skip to content
Misconfiguration Disclosed report Advanced

Attachments may be hijacked via AppCache+CookieBombing trick (bc3_production_blobs bucket)

Attachments in a Google Cloud Storage bucket could be served with an HTML content type, allowing an attacker to upload a malicious HTML file that uses AppCache and cookie bombing to hijack future uploads and downloads from that bucket. An attacker could then steal or manipulate files accessed via direct links.

hudmi Follow

Originally disclosed on HackerOne

  • Triaged in 2 days
  • Fixed in 44 days
  • Paid in 6 days
  • Disclosed after 2.2 years

Basecamp attachments are stored in the bc3_production_blobs bucket in the root directory and can be served with text/html content-type.

https://storage.googleapis.com/bc3_production_blobs/*key*?GoogleAccessId=bc3-production-storage%40bc3-production.iam.gserviceaccount.com&Expires=1535826443&Signature=*sign*&response-content-type=text/html

So with AppCache+CookieBombing trick an attacker can upload html file and if the user visit url of this file then all further uploads to this bucket and downloads from it will be hijacked by an attacker. To know more about this trick refer to https://labs.detectify.com/2018/08/02/bypassing-exploiting-bucket-upload-policies-signed-urls/

##Reproduction steps To upload the files:

  1. Login to 3.basecamp.com
  2. Open campfire of any project
  3. Upload target files
  4. Extract direct links of them to Google Storage and remove response-content-disposition param

I have uploaded 3 files by this way:

<html manifest="[manifest_url]">
This is the test page for a PoC. Now if you send any request in this bucket it will be hijacked.
<script>
setTimeout(function(){
for(var i = 1e3; i>0; i--){document.cookie = i + '=' + Array(4e3).join('0') + '; path=/'};
}, 3000);
</script>
</html>
CACHE MANIFEST 

FALLBACK:
/bc3_production_blobs/ [fallback_url]
<html>
<script>
alert('Your request to the page '+location.href+' is hijacked!');
</script>
</html>

##PoC Go to http://████████/bc3attach and then try to open any direct link of bc3_production_blobs bucket. You will see alert popup with full url of this file. Refer to the video.

Impact

Direct links to any attachments can be hijacked and confedential files can be compromised

Attachments

The original report as published on HackerOne, by hudmi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Basecamp stores attachments in a Google Cloud Storage bucket named bc3_production_blobs. Objects in that bucket live in the root directory and can be served with a text/html content type. The report shows a signed URL of the following shape:

HTTP
https://storage.googleapis.com/bc3_production_blobs/*key*?GoogleAccessId=bc3-production-storage%40bc3-production.iam.gserviceaccount.com&Expires=1535826443&[redacted]&response-content-type=text/html

The URL carries a GoogleAccessId for the [redacted] service account, an Expires value, a Signature, and a response-content-type parameter. That last parameter is what lets a caller ask Google Storage to return the object as text/html rather than as a download.

Setup

The researcher needed a normal Basecamp account on 3.basecamp.com and access to a project with a campfire. No special role or tooling is described. The precondition for the attack is that an attacker can get a file into the bucket and obtain a direct link to it, which the campfire upload flow provides.

Finding it

The observation is that attachments are stored in a bucket whose objects sit in the root directory and can be served as text/html. Because the signed URL accepts a response-content-type parameter, an uploaded file can be made to render as an HTML document in the browser rather than being downloaded. That turns an attachment upload into a way to host attacker-controlled HTML on the storage origin.

From there the researcher applied the AppCache plus CookieBombing technique, described in a Detectify Labs article linked in the report, to hijack the bucket for a victim. The claim is that once the user visits the URL of the uploaded HTML file, all further uploads to the bucket and downloads from it are hijacked by the attacker.

Exploitation

Step 1: Upload the files through campfire

  1. Log in to 3.basecamp.com.
  2. Open the campfire of any project.
  3. Upload the target files.
  4. Extract their direct Google Storage links and remove the response-content-disposition parameter.

The report's step 4 is to remove the response-content-disposition parameter from the extracted link.

Step 2: The HTML page with the AppCache manifest

The first uploaded file is an HTML page that declares a manifest and, after a delay, writes a large number of cookies:

HTML
<html manifest="[manifest_url]">
This is the test page for a PoC. Now if you send any request in this bucket it will be hijacked.
<script>
setTimeout(function(){
for(var i = 1e3; i>0; i--){document.cookie = i + '=' + Array(4e3).join('0') + '; path=/'};
}, 3000);
</script>
</html>

The manifest attribute points at the second file. The script waits three seconds and then sets 1000 cookies, each named with a number from 1000 down to 1 and each holding a value of roughly 4000 characters, all with path=/. This is the cookie bombing part: it fills the browser's per-origin cookie storage for the storage host.

Step 3: The cache manifest with a fallback

The second file is the AppCache manifest:

Text
CACHE MANIFEST

FALLBACK:
/bc3_production_blobs/ [fallback_url]

The FALLBACK section tells the browser that any request under /bc3_production_blobs/ that cannot be served from the cache should be served from [fallback_url] instead. Combined with the manifest being attached to the storage origin, this is what redirects later bucket requests to the attacker's page.

Step 4: The fallback page

The third file is the page served as the fallback:

HTML
<html>
<script>
alert('Your request to the page '+location.href+' is hijacked!');
</script>
</html>

It pops an alert containing the full URL of whatever page the victim tried to reach, which demonstrates that the request was intercepted.

Step 5: The proof of concept

The researcher directs the reader to http://████████/bc3attach and then to open any direct link of the bc3_production_blobs bucket. The result is the alert popup showing the full URL of the file. A video accompanies the report to show this.

Root cause

The bucket serves user-uploaded objects from the root directory and honours a response-content-type parameter on signed URLs, so an attachment can be returned as text/html on the storage origin. Because the AppCache manifest is scoped to that origin, an attacker who can upload HTML there can register a manifest for the whole bucket path and define a FALLBACK entry for /bc3_production_blobs/. The page writes 1000 cookies with path=/ after a three second delay.

Impact

In the researcher's words, direct links to any attachments can be hijacked and confidential files can be compromised. The hijack applies to a victim who visits the attacker's uploaded file URL; from that point, further uploads to the bucket and downloads from it are redirected through the attacker's fallback. The report does not quantify how many users or attachments are affected, nor does it describe what happens to a victim who never opens the malicious attachment link.

Fix

The report does not state what fix was applied.

Variants to test

  1. On other products that store uploads in cloud buckets, request a signed URL with response-content-type=text/html and check whether the object renders as HTML. A positive result is an uploaded file being interpreted as a page rather than downloaded.
  2. Check whether the bucket serves objects from the root directory, since the manifest FALLBACK path in this report is tied to /bc3_production_blobs/. A positive result is a predictable path prefix covering all objects.
  3. Upload an HTML file with a manifest attribute pointing at a second uploaded file and confirm the browser fetches and applies the manifest. A positive result is the manifest being accepted for the storage origin.
  4. Add a FALLBACK entry for the bucket path and request another object in the bucket. A positive result is the fallback page being served instead of the object.
  5. Combine the manifest with cookie bombing and observe whether requests still fall through to the fallback. A positive result is the fallback page appearing after the cookies are written.

Hunting notes

This kind of bug hides where user-uploaded content is served from a shared storage origin that also controls response headers through URL parameters. During recon, look for attachment and upload links pointing at cloud storage hosts, and inspect the query string for parameters such as response-content-type and response-content-disposition. The signal that matters is an object that can be returned as text/html from a path that covers other users' files. The researcher uploaded three files through campfire, extracted their direct links, and showed that opening any direct link of the bucket produced the hijack alert with the requested URL.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

Basecamp is a project management website. One of its features lets people upload files (documents, images, and so on) and share them with others in a project. Those uploaded files are not kept on Basecamp's own servers: they are stored in a Google Cloud Storage bucket, which is a large online locker run by Google. The bucket in this report is called bc3_production_blobs.

The researcher found that a file uploaded through Basecamp could be made to open in a browser as a web page instead of being downloaded. That matters because a web page can contain instructions that the browser follows. Using a technique called AppCache plus CookieBombing, the researcher showed that once a victim opened the malicious file, later requests to that same storage bucket could be redirected to a page the attacker controls. In the researcher's words, direct links to any attachments could be hijacked and confidential files could be compromised.

This article walks through the report step by step, explaining each idea from scratch.

The pieces involved

Before the steps, here is what each part of the setup is:

  • Google Cloud Storage bucket: think of it as a shared online cupboard. Each file inside it is called an object. A bucket has a name, and every object has a key (its path inside the cupboard).
  • Signed URL: a web link that carries a proof of permission inside it. Instead of logging in, the link itself contains a signature that tells Google "this request is allowed". It is like a visitor pass with an expiry date printed on it.
  • Content type: a label a server attaches to a file saying what kind of thing it is. text/html means "this is a web page, render it in the browser". A different label would make the browser download the file instead.
  • Service account: a robot user account used by software rather than a person. The one named here is [redacted].
  • AppCache: an older browser feature where a web page can point at a list of files (a manifest) and the browser stores them for offline use. The manifest can also say "if something is not in the list, show this other page instead".
  • Cookie: a small piece of text a website asks the browser to store and send back on later requests. Cookies are how sites remember who you are.
  • Cookie bombing: deliberately creating a huge number of cookies so that the browser's storage for that site fills up and older entries get pushed out.

The signed URL

The report shows a signed URL of this shape:

HTTP
https://storage.googleapis.com/bc3_production_blobs/*key*?GoogleAccessId=bc3-production-storage%40bc3-production.iam.gserviceaccount.com&Expires=1535826443&[redacted]&response-content-type=text/html

Line by line, in plain words:

  • https://storage.googleapis.com/bc3_production_blobs/*key* is the address of one object inside the bucket. *key* stands for the object's name or path.
  • GoogleAccessId=... names the service account whose permission the link is using. The %40 is just an encoded @ sign.
  • Expires=1535826443 is a timestamp: after that moment the link stops working.
  • `[redacted] is the proof that the link was genuinely issued by someone allowed to do so. Without it, Google would refuse the request.
  • response-content-type=text/html is the interesting part. It asks Google to hand the file back labelled as a web page. The report's point is that this last parameter lets a caller decide how the file is presented, and text/html means the browser will render it rather than download it.

Setting up

The researcher needed an ordinary Basecamp account on 3.basecamp.com and access to a project that has a campfire. A campfire is Basecamp's chat area for a project; it also lets people drop files into the conversation. No special role or extra tooling is described. The only precondition for the attack is that an attacker can get a file into the bucket and obtain a direct link to it, and the campfire upload flow provides exactly that.

Finding it

The observation behind the bug is simple: attachments are stored in a bucket whose objects sit in the root directory, and those objects can be served as text/html. Because the signed URL accepts a response-content-type parameter, an uploaded file can be made to render as an HTML document in the browser instead of being downloaded. That turns an ordinary attachment upload into a way to host attacker-controlled HTML on the storage site's own address.

From there the researcher applied the AppCache plus CookieBombing technique, described in a Detectify Labs article linked in the report, to hijack the bucket for a victim. The claim is that once the user visits the URL of the uploaded HTML file, all further uploads to the bucket and downloads from it are hijacked by the attacker.

Exploitation

Step 1: Upload the files through campfire

  1. Log in to 3.basecamp.com.
  2. Open the campfire of any project.
  3. Upload the target files.
  4. Extract their direct Google Storage links and remove the response-content-disposition parameter.

Why each step: steps 1 to 3 are just the normal way a user puts a file into the bucket, so the attacker uses the product as intended. Step 4 is the trick. The report's step 4 is to remove the response-content-disposition parameter from the extracted link. In other words, the file can now be shown as a page.

Step 2: The HTML page with the AppCache manifest

The first uploaded file is an HTML page that declares a manifest and, after a delay, writes a large number of cookies:

HTML
<html manifest="[manifest_url]">
This is the test page for a PoC. Now if you send any request in this bucket it will be hijacked.
<script>
setTimeout(function(){
for(var i = 1e3; i>0; i--){document.cookie = i + '=' + Array(4e3).join('0') + '; path=/'};
}, 3000);
</script>
</html>

Line by line:

  • <html manifest="[manifest_url]"> opens the page and tells the browser to fetch a manifest from [manifest_url], which is the second uploaded file. This is the AppCache part: the browser reads that list and stores the files it names.
  • The plain sentence in the middle is just text shown on the page, describing what the proof of concept does.
  • <script> starts a block of JavaScript, the language browsers run inside pages.
  • setTimeout(function(){ ... }, 3000); means "wait 3000 milliseconds (three seconds), then run the code inside". The code waits three seconds before writing the cookies.
  • for(var i = 1e3; i>0; i--) is a loop that counts down from 1000 (1e3 is shorthand for 1000) to 1.
  • document.cookie = i + '=' + Array(4e3).join('0') + '; path=/' creates one cookie per loop turn. The cookie's name is the current number, its value is about 4000 zero characters (Array(4e3).join('0') builds a string of 4000 zeros), and path=/ means the cookie applies to the whole site.
  • The closing tags end the script and the page.

So the page waits three seconds and then sets 1000 cookies, each named with a number from 1000 down to 1 and each holding a value of roughly 4000 characters. This is the cookie bombing part: it fills the browser's cookie storage for the storage host. The everyday comparison is stuffing so many papers into a small filing cabinet that older papers have to be thrown out to make room.

Step 3: The cache manifest with a fallback

The second file is the AppCache manifest:

Text
CACHE MANIFEST

FALLBACK:
/bc3_production_blobs/ [fallback_url]

Line by line:

  • CACHE MANIFEST is the required first line that tells the browser "this file is an AppCache manifest".
  • FALLBACK: starts a section that defines a substitute.
  • /bc3_production_blobs/ [fallback_url] says: for any request under the path /bc3_production_blobs/ that cannot be served from the cache, serve [fallback_url] instead.

Combined with the manifest being attached to the storage site's address, this is what redirects later bucket requests to the attacker's page. Think of it as leaving a note at the front desk: "if you cannot find what the visitor asked for, hand them this other document instead".

Step 4: The fallback page

The third file is the page served as the fallback:

HTML
<html>
<script>
alert('Your request to the page '+location.href+' is hijacked!');
</script>
</html>

Line by line:

  • <html> and </html> wrap the page.
  • <script> starts JavaScript.
  • alert(...) opens a small popup box in the browser with a message.
  • 'Your request to the page '+location.href+' is hijacked!' builds that message: the fixed text, then location.href (the full address of the page the victim was trying to reach), then the rest of the sentence.

So it pops an alert containing the full URL of whatever page the victim tried to reach, which demonstrates that the request was intercepted rather than served normally.

Step 5: The proof of concept

The researcher directs the reader to http://████████/bc3attach and then to open any direct link of the bc3_production_blobs bucket. The result is the alert popup showing the full URL of the file. A video accompanies the report to show this.

Root cause

The bucket serves user-uploaded objects from the root directory and honours a response-content-type parameter on signed URLs, so an attachment can be returned as text/html on the storage site's address. Because the AppCache manifest is scoped to that address, an attacker who can upload HTML there can register a manifest for the whole bucket path and define a FALLBACK entry for /bc3_production_blobs/. The page writes 1000 cookies with path=/ after a three second delay.

Impact

In the researcher's words, direct links to any attachments can be hijacked and confidential files can be compromised. The hijack applies to a victim who visits the attacker's uploaded file URL; from that point, further uploads to the bucket and downloads from it are redirected through the attacker's fallback. The report does not quantify how many users or attachments are affected, nor does it describe what happens to a victim who never opens the malicious attachment link.

Fix

The report does not state what fix was applied.

Variants to test

  1. On other products that store uploads in cloud buckets, request a signed URL with response-content-type=text/html and check whether the object renders as HTML. A positive result is an uploaded file being interpreted as a page rather than downloaded.
  2. Check whether the bucket serves objects from the root directory, since the manifest FALLBACK path in this report is tied to /bc3_production_blobs/. A positive result is a predictable path prefix covering all objects.
  3. Upload an HTML file with a manifest attribute pointing at a second uploaded file and confirm the browser fetches and applies the manifest. A positive result is the manifest being accepted for the storage address.
  4. Add a FALLBACK entry for the bucket path and request another object in the bucket. A positive result is the fallback page being served instead of the object.
  5. Combine the manifest with cookie bombing and observe whether requests still fall through to the fallback. A positive result is the fallback page appearing after the cookies are written.

Hunting notes

This kind of bug hides where user-uploaded content is served from a shared storage address that also controls response headers through URL parameters. During recon, look for attachment and upload links pointing at cloud storage hosts, and inspect the query string for parameters such as response-content-type and response-content-disposition. The signal that matters is an object that can be returned as text/html from a path that covers other users' files. The researcher uploaded three files through campfire, extracted their direct links, and showed that opening any direct link of the bucket produced the hijack alert with the requested URL.

Glossary

  • AppCache: an older browser feature that lets a web page store files for offline use, guided by a list called a manifest.
  • Attachment: a file uploaded to and shared through a product such as Basecamp.
  • Bucket: a named container in cloud storage that holds files (objects).
  • Campfire: Basecamp's chat area for a project, which also accepts file uploads.
  • Content type: a label on a response saying what kind of file it is, such as text/html for a web page.
  • Cookie: a small piece of text a site asks the browser to store and send back on later requests.
  • Cookie bombing: creating a very large number of cookies to fill the browser's storage for a site and push out older entries.
  • FALLBACK: the section of an AppCache manifest that names a substitute page for requests that cannot be served from the cache.
  • Google Cloud Storage: Google's online file storage service.
  • HTML: the language web pages are written in.
  • JavaScript: the programming language browsers run inside web pages.
  • Manifest: in AppCache, a file listing what the browser should cache and what to do when something is missing.
  • Object: a single file stored inside a bucket.
  • Proof of concept (PoC): a working demonstration that a vulnerability is real.
  • Query string: the part of a URL after the ?, made of parameters and their values.
  • Root directory: the top level of a storage path, with no folder in front of the object name.
  • Service account: a robot account used by software rather than a person.
  • Signed URL: a web link containing a signature that proves the request is authorised, often with an expiry time.
  • response-content-disposition: a URL parameter that tells the browser whether to show a file inline or download it.
  • response-content-type: a URL parameter that tells the storage service which content type to label the response with.
  • Vulnerability: a weakness in a system that lets someone use it in a way its designers did not intend.

More from Basecamp

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.