Skip to content
Access control Disclosed report Intermediate

Mozilla Phabricator emails allow any user to secretly access secure revision title, comments and private files

Mozilla's Phabricator email system parses remarkup as an omnipotent user, bypassing permission checks. An attacker can embed query panels or private file references in comments to extract confidential data they should not access.

Dylan Farrar Follow

Originally disclosed on Mozilla

  • Fixed in 25 days
  • Paid in 38 days
  • Disclosed after 25 days
Text
Mozilla Phabricator emails parses remarkup in the context of an omnipotent user: https://github.com/mozilla-conduit/phabricator/blob/master/moz-extensions/src/email/resolve/ResolveComments.php#L183, this is very dangerous because it bypasses all permission checks.

An attacker can embed query panels in remarkup to extract confidential data while bypassing all permission checks.

Steps to reproduce:
1. Install Mozilla's Phabricator deployment: https://github.com/mozilla-conduit/phabricator
2. Install Phabricator Emails python script: https://github.com/mozilla-conduit/phabricator-emails
3. Confirm that the python script is working properly outputing email HTML to the debug directory
4. With an unprivileged user, a secret differential revision can be created that is only visible to the attacker using the view policy. The view policy option is hidden on the production Phabricator, but this is only cosmetic, and can still be modified by inserting the data in the POST request. Phab-bot will not try to enforce any rules around secure revisions because it will not be able to access the revision. The revision will be invisible without manually looking at the database or access logs.
5. Create some privileged objects
6. Create a dashboard query panel (path: /dashboard/panel/edit/?panelType=query), set type to feed (to see recent activity) or transactions to view raw transactions, or Differential Revisions to query revisions
7. Reference the panel in a comment like "{W<id>}"
8. View the HTML output of the email in the python script
9. The HTML will include the unfiltered results from the queries, and will include objects you do not have permission to see

The attacker can also modify the queries themselves by adding the panel to a dashboard, clicking the manage panel button, and then Customize Query, allowing them to, for example, filter only to revisions that include the tag 'sec-approval'.

An attacker can also use this bug to access any private file, an attacker can find a private file simply by iterating the file IDs until the find a file they cannot access. Then they can access the file simply by pasting into a comment on their secret differential revision like "{F<id>}", this will embed the image/include a download link, at which point the attacker can access the download link. The download link has no authentication because it uses a secret token in the URL.

Fix:
Ideally the markup should be parsed as the recipient, but it doesn't look like this feature is architectured in a way that would make this easy to do.

A quick fix is simply to replace "PhabricatorUser::getOmnipotentUser()" with "new PhabricatorUser()".
This will ensure that the remarkup will be parsed as a normal user with no additional permissions.

The original report as published on Mozilla's Bugzilla, by Dylan Farrar. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

The email rendering code parses remarkup using an omnipotent user context, so all permission checks are bypassed.

Impact

An attacker could access confidential revision titles, comments, and private files, and could filter queries to target specific tags like 'sec-approval'.

What the attacker needed

Mozilla's Phabricator deployment; Phabricator Emails python script; an unprivileged user account

The fix

The markup should ideally be parsed as the recipient, but a quick fix is to replace the omnipotent user with a normal user so remarkup is parsed with no additional permissions.

How it was found

  1. Install Mozilla's Phabricator deployment and the Phabricator Emails python script.
  2. Confirm the python script outputs email HTML to the debug directory.
  3. As an unprivileged user, create a secret differential revision visible only to the attacker by modifying the view policy in the POST request.
  4. Create privileged objects and a dashboard query panel (type feed, transactions, or Differential Revisions).
  5. Reference the panel in a comment using the panel syntax.
  6. View the HTML output of the email in the python script to see unfiltered query results including objects the attacker cannot access.

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 software projects. When it sends emails, it processes special formatting (remarkup) as a super-user who can see everything. This means an attacker can put special codes in a comment to make the email show private information, like secret code changes or files, that they normally couldn't see.

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 by Dylan Farrar

View all

1 more disclosed report, best first.

More from Mozilla

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.