Skip to content
Access control Disclosed report Intermediate

Differential "Show Raw File" feature exposes generated files to unauthorised users

When a user clicks "Show Raw File" on a diff, Phabricator generates a file that does not inherit the diff's view policy. Another user who guesses the file's numeric identifier can then download it and read a private diff they were not permitted to see.

calvium Follow

Originally disclosed on HackerOne

Medium 4.8 View original
  • Fixed in 1 hour
  • Paid in 2 hours
  • Disclosed after 2 hours

Summary: In certain circumstances, a user or mongoose can see a file from a diff they should not be able to see due to a policy.

Preface: We are an app agency using a private Phabricator instance to manage projects. This issue prevents us from allowing clients to access our instance as they would have the ability to see some confidential content for other clients. Spaces and policies seem to work fine other than this issue.

Video: Attached is a <8 min video where I show the issue on a fresh Phabricator installation. The first 6 mins is preparation. The issue is visible in the last 30 seconds.

You will see I look up ID of the generated file in the database to speed up the demonstration. We could scan through pages automatically with a script to make this bug more viable.

Reproduction steps:

  • Open two different browsers (to simulate two different users)
  • BROWSER 1: Log in as a user
  • BROWSER B: Log in as another user
  • BROWSER 1: Go to differential and create a new diff. Make it visible to just yourself
  • BROWSER 1: Update the diff a few times (I've seen the bug more reproducible when the diff is long and the update weaves in changes throughout the file, though this may not actually be a factor)
  • BROWSER B: Visit the diff page, see it is restricted and you cannot see it.
  • BROWSER 1: On the diff page, click "View Options" > "Show Raw File (Right)". This generates a File.
  • BROWSER B: Start guessing file number pages (this could be done automatically).
  • BROWSER B: Eventually you will hit the file number of the new file and can see the private diff from BROWSER 1.

Expected result:

  • The file generated by Phabricator while comparing diffs should not be accessible. It is not inheriting any policy.

Actual result:

  • BROWSER B can download the content of the file, seeing a private diff.

Conclusion: We have over 80,000 files in our Phabricator instance from 10s of projects from various clients. If we share our instance with a client that is either malicious or naive in keeping their credentials secure, we would expose some of our other clients code as a consequence of using the "Show Raw File" feature.

Thanks Matt Votsikas Calvium Ltd

Attachments

show-raw-file.mp4 From the original on HackerOne

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

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 generated raw-file object is created without copying the source diff's view policy, so it defaults to a more permissive visibility.

Impact

A user could read private diffs belonging to other users or clients, exposing confidential source code, though the attacker must guess or enumerate file identifiers.

What the attacker needed

Two accounts on the same instance; attacker can guess or enumerate file IDs

How it was found

  1. Open two browsers and log in as two different users.
  2. In the first browser, create a new diff visible only to yourself and update it a few times.
  3. In the second browser, confirm the diff page is restricted.
  4. In the first browser, use "View Options" then "Show Raw File (Right)" to generate a file.
  5. In the second browser, guess file number pages until the new file is found and its private content is shown.

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.

Phabricator is a tool for managing code changes, and each change (a "diff") can be restricted so only certain people see it. The "Show Raw File" button creates a separate downloadable file, but that file was not given the same restriction, so anyone who guessed its number could open it. This is like locking a document in a drawer but leaving a copy on the desk.

What is Access control?

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.

More from Phabricator

View all

The newest disclosed reports for this program.

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.