Skip to content
Access control Write-up Beginner

Sensitive data exposure by requesting a resource with a different content type

A file-sharing endpoint enforced access control only for the normal file URL, but appending an Atom feed extension returned private file metadata and thumbnails without the permission check. An attacker with a file token could read data about files belonging to other users.

Yogendra Jaiswal Follow

Published on medium.com

It had been some time since I received invitations to private programs on HackerOne, so I decided to see if I could find some bugs elsewhere. I used some Google dorks to find some sites, but these didn’t interest me as much.

Yogendra Jaiswal (Vulnholic), on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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. 4 min read.

Context

This write-up is about a file-sharing feature on a website that lets users upload files and view them through a unique token. Each uploaded file gets its own token, and some files are meant to be visible only to certain users. A file is normally reached at a URL of the form:

Text
https://example.com/folder/unique_token

When a user tried to open a file that belonged to someone else's account, the application refused access and returned an error saying the user was not allowed to access the file. The site also exposed Atom feeds, and that is where the problem lay.

Setup

The researcher, Yogendra Jaiswal (also known as Vulnholic), found the target outside HackerOne. After a Twitter search for #bugbounty turned up a tweet offering money for security vulnerabilities, he started testing the site and reported a couple of issues by email. The company replied that it ran a private program on HackerOne and asked him to submit through the platform, which he did.

No special accounts, roles, tools or versions are described. The only precondition that matters is the one the feature itself creates: a file that belongs to another user, reachable by its unique token, which the application is supposed to protect.

Finding it

While working through the program, the researcher noticed that the application used so-called Atom feeds. Atom is an XML-based web content and metadata syndication format, and an application-level protocol for publishing and editing web resources belonging to periodically updated websites. All Atom feeds must be well-formed XML documents and are identified with the application/atom+xml media type.

Some of these Atom feeds were accessible by appending .atom to files. That suggested the same file could be requested through a different content type, and that the access check might not apply to that path.

Exploitation

Step 1: Confirm the normal access control

Requesting a file that belonged to another account through its normal URL produced an error stating that the user was not allowed to access the file. The file URL has the shape:

Text
https://example.com/folder/unique_token

At this point the token alone was not enough to read someone else's file.

Step 2: Request the same file as an Atom feed

The researcher went back to the file and requested the same resource with .atom appended to the token:

Text
https://example.com/folder/unique_token.atom

Instead of the 403 Forbidden error, the response contained private data about the file. It returned a thumbnail, which was especially interesting when the requested file was an image. The same token that was refused under the normal URL was accepted under the .atom variant, and the response disclosed information the user was not entitled to see.

Root cause

The application generated a unique token per uploaded file and enforced per-user access on the normal file route, but the .atom representation of the same resource did not apply the same authorisation check. Because the Atom feed was served under a different content type, the request took a path where the ownership check was missing, and the file's private data, including a thumbnail for images, was returned. The report does not describe the code, so the exact mechanism is likely a separate handler or format branch that skipped the check rather than a flaw in the token itself.

Impact

An attacker who knows or obtains a file's unique token could read private data about that file, including a thumbnail when the file is an image, even though the file belongs to another account and the normal URL refuses access. The exposure depends on possessing the token, and the report does not state how tokens could be obtained or whether the full file contents, as opposed to metadata and a thumbnail, were returned.

Fix

The report says the issue was resolved on 13th September 2017, but does not say what was modified. The measure the finding calls for is to apply the same per-user authorisation check to every representation of a file, including the .atom feed, so that a request for a different content type cannot bypass the ownership check.

Variants to test

  1. Append format extensions to protected resources. Take a URL that returns 403 for another user's object and request it with .atom, and also try other representations the framework supports. A positive result is a response containing data about the object instead of the access error.
  2. Compare content types for the same token. Request the token normally and as a feed, and compare status codes and bodies. A positive result is a 200 with private fields where the normal request returned 403.
  3. Check image and thumbnail endpoints. If the application renders previews, request the preview through the alternate format. A positive result is a thumbnail of a file the account does not own.
  4. Look for other feed or export routes. Enumerate routes that syndicate or export user content and test them against objects belonging to another account. A positive result is any private field, such as a filename, owner detail or preview, returned without an ownership check.

Timeline

Date Event
6th September 2017 Reported
7th September 2017 Got response from team
7th September 2017 Triaged
7th September 2017 Rewarded bounty
13th September 2017 Resolved

Before this finding, the researcher had submitted an IDOR that was closed as informative; he re-explained the impact and the report was then closed. The Atom feed issue was triaged the next day and rewarded with a bounty.

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

A website let people upload files and then look at them again through a special web address. Each uploaded file got its own long, hard-to-guess code in that address, so in theory only people who were meant to see the file would know the address. The site also checked, when you opened a file, whether the file belonged to you. If it did not, you got an error saying you were not allowed to see it.

The researcher found that the same file could be asked for in a second way, by adding .atom to the end of the address. That second way was meant to hand the file out as an "Atom feed", a format used to publish lists of updates. The site forgot to run the ownership check on that second way. So a file that was refused at its normal address was handed over, together with private details about it, when the same address was requested with .atom on the end.

This kind of mistake is called information disclosure: the site reveals information to someone who should not have it. The researcher reported it, the company confirmed it the next day, paid a bounty, and resolved it within a week.

Background: how the researcher got there

The researcher is Yogendra Jaiswal, who also goes by the name Vulnholic. He had been waiting for invitations to private bug bounty programs on HackerOne, a platform where companies list security programs and researchers report bugs to them. When no invitations came, he looked elsewhere.

He tried Google dorks, which are specially crafted search queries used to surface pages that ordinary searches do not show, but the sites he found did not interest him. A search on Twitter for #bugbounty gave him more leads. One tweet stood out: someone was offering money for security vulnerabilities. He started testing that site straight away.

After a while he found a couple of vulnerabilities and contacted the company by email. The next day they replied that they ran a private program on HackerOne and asked him to report through the platform instead. He was pleased, because reports on the platform earn reputation points there.

Once inside the program he saw that many of the top 100 hackers on HackerOne were taking part. That was discouraging: if those people were already looking, what was left for him? He remembered the platform's slogan, "#TogetherWeHitHarder", and decided to keep digging to prove he could find something too.

He went back to the site and kept looking. He was very excited when he found an IDOR (Insecure Direct Object Reference). An IDOR is when a site lets you reach someone else's record simply by changing an identifier in a request, because it never checks that the record belongs to you. He submitted it, and the next day the company closed it as informative, a status meaning the report did not demonstrate a security impact. The impact of the IDOR was not immediately clear to them. He went back and explained the impact as well as he could. They must have understood, because they figured out what he meant and closed the report.

That earlier lesson matters here: a bug is only as good as the impact you can explain. The finding below is the one that was triaged and paid.

The feature that was tested

The site had a way to view files that users had uploaded. When a file is uploaded, the site generates a unique token for it. A token is a long random-looking string that is hard to guess; think of it as a claim ticket for a coat at a cloakroom. The ticket number is not your name, but if you hold the ticket you can ask for the coat. Files were reached at an address of this shape:

Text
https://example.com/folder/unique_token

Reading that address from left to right: https:// means the connection is encrypted; example.com is the site; /folder/ is the section of the site where files live; and unique_token is the claim ticket for one particular file. Some of these files were meant to be visible only to certain users.

When the researcher tried to open a file that belonged to someone else's account, the site showed an error saying he was not allowed to access the file. That is the correct behaviour: the site knew who was asking and refused because the file was not theirs. At that point the token alone was not enough to read another person's file.

The discovery: Atom feeds

While exploring, the researcher noticed that the application had so-called Atom feeds.

Atom is the name of an XML-based format for web content and metadata syndication, and an application-level protocol for publishing and editing web resources belonging to periodically updated websites. In everyday terms, it is a standard way for a site to publish a list of items, such as recent posts, in a machine-readable form, so that feed readers and other software can pick them up. All Atom feeds must be well-formed XML documents, and they are identified with the application/atom+xml media type. XML is a text format that marks up data with tags, and a media type (also called a content type) is the label a server puts on a response to say what kind of data it is, such as a web page, an image, or in this case a feed.

Some of these Atom feeds could be reached by appending .atom to files. That was the clue. If the same file can be served in a different format, the site may handle that format with separate code, and separate code can forget a check that the main path performs.

Exploitation

Step 1: Confirm the normal access control

First the researcher confirmed the normal behaviour. Requesting a file that belonged to another account through its usual address produced an error stating that the user was not allowed to access the file. The address has this shape:

Text
https://example.com/folder/unique_token

Line by line: https:// is the encrypted web protocol; example.com is the site being tested; /folder/ is the directory-like path where uploaded files are served; unique_token is the per-file claim ticket. The purpose of this step was to establish the baseline: with this address, the site refuses. Any later request that succeeds where this one fails is the bug.

Step 2: Request the same file as an Atom feed

The researcher went back to the same file and requested the same resource, but this time with .atom appended to the token:

Text
https://example.com/folder/unique_token.atom

Line by line: everything is identical to the previous address except the end. unique_token.atom is the same claim ticket with .atom stuck on, which tells the site "give me this file as an Atom feed". The purpose of this step was to see whether the feed version of the file went through the same ownership check as the normal version.

It did not. Instead of the 403 Forbidden error, the response contained private data about the file. A 403 is the standard web status code for "I know who you are, and you are not allowed". This time the site answered with information instead of a refusal. It returned a thumbnail, which was especially interesting when the requested file was an image: a small preview picture of a file belonging to another account. The same token that was refused under the normal address was accepted under the .atom variant, and the response disclosed information the user was not entitled to see.

Why it worked

The site gave every uploaded file a unique token and enforced per-user access on the normal file route. But the .atom representation of the same resource did not apply the same authorisation check. Authorisation is the part of a site that decides whether the person asking is allowed to do what they are asking for; authentication is only about who they are. Because the Atom feed was served under a different content type, the request took a path where the ownership check was missing, and the file's private data, including a thumbnail for images, came back.

The report does not describe the code, so the exact mechanism is likely a separate handler or format branch that skipped the check, rather than a flaw in the token itself. The token was still doing its job of being hard to guess; the problem was that one door into the file had no lock.

Impact

An attacker who knows or obtains a file's unique token could read private data about that file, including a thumbnail when the file is an image, even though the file belongs to another account and the normal address refuses access. The exposure depends on possessing the token. The report does not state how tokens could be obtained, or whether the full file contents, as opposed to metadata and a thumbnail, were returned.

Fix

The measure the finding calls for is to apply the same per-user authorisation check to every representation of a file, including the .atom feed, so that asking for a different content type cannot bypass the ownership check.

Variants to test

These are the same ideas generalised, so a beginner can try them on other sites:

  1. Append format extensions to protected resources. Take an address that returns 403 for another user's object and request it with .atom, and also try other representations the framework supports. A positive result is a response containing data about the object instead of the access error.
  2. Compare content types for the same token. Request the token normally and as a feed, and compare status codes and bodies. A positive result is a 200 with private fields where the normal request returned 403.
  3. Check image and thumbnail endpoints. If the application renders previews, request the preview through the alternate format. A positive result is a thumbnail of a file the account does not own.
  4. Look for other feed or export routes. Enumerate routes that syndicate or export user content and test them against objects belonging to another account. A positive result is any private field, such as a filename, owner detail or preview, returned without an ownership check.

Timeline

Date Event
6th September 2017 Reported
7th September 2017 Got response from team
7th September 2017 Triaged
7th September 2017 Rewarded bounty
13th September 2017 Resolved

Before this finding, the researcher had submitted an IDOR that was closed as informative; he re-explained the impact and the report was then closed. The Atom feed issue was triaged the next day and rewarded with a bounty.

Glossary

  • Atom: an XML-based format and protocol for publishing lists of web content and metadata, so that feed readers and other software can consume updates.
  • Authentication: the process of proving who you are, for example by logging in.
  • Authorisation: the process of deciding whether the person asking is allowed to do or see something.
  • Bounty: money paid by a company to a researcher for reporting a valid security vulnerability.
  • Bug bounty program: a scheme where a company invites researchers to find and report vulnerabilities, usually with rewards.
  • Content type (media type): the label on a web response saying what kind of data it is, such as a web page, an image, or a feed.
  • 403 Forbidden: the standard web status code meaning the server understood the request but refuses to allow it.
  • Google dork: a specially crafted search query used to surface pages that ordinary searches do not show.
  • HackerOne: a platform where companies run security programs and researchers submit vulnerability reports.
  • IDOR (Insecure Direct Object Reference): a flaw where a site lets you reach someone else's record by changing an identifier in a request, because it never checks that the record belongs to you.
  • Informative: a report status meaning the submission did not demonstrate a security impact.
  • Information disclosure: a flaw where a site reveals information to someone who should not have it.
  • Metadata: data about data, such as a file's name, owner or preview, rather than its full contents.
  • Private program: a bug bounty program that only invited researchers can see and take part in.
  • Reputation: a score on a bug bounty platform that grows as your reports are accepted.
  • Thumbnail: a small preview image of a larger picture or file.
  • Token: a long random-looking string that is hard to guess, used to identify or grant access to something.
  • Triaged: the stage where a company has reviewed a report and confirmed it is a valid issue worth acting on.
  • XML: a text format that marks up data with tags, used by formats such as Atom.

More by Yogendra Jaiswal

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.