Phabricator Diffusion application allows unauthorized users to delete mirrors
A guest user without access to a repository could still delete its mirror because the mirror deletion endpoint lacked permission checks. An attacker could remove repository mirrors without authorisation.
- Fixed in 8 hours
- Paid in 8 hours
- Disclosed after 30 days
I have succesfully reproduced this issue following these steps:
-
Creating a repository with an administrator user
-
Checking that my "guest" user hasn't access to the newly created repository:
-
However, the guest user does have access to delete the mirror:
You can review the lack of permission-checks in the file: applications/diffusion/controller/DiffusionMirrorDeleteController.php
What the report shows
The target is Phabricator's Diffusion application, the part of the platform that hosts and manages code repositories. The researcher found that a user without access to a repository could still reach the endpoint that deletes a repository mirror.
The reproduction is short and uses two accounts: an administrator and a low-privileged user described as a "guest". The steps are:
- Create a repository with an administrator user.
- Confirm that the guest user has no access to the newly created repository by visiting its edit page:
http://phabricator/diffusion/TEST/edit/
- As the guest user, request the mirror deletion endpoint for the same repository:
http://phabricator/diffusion/TEST/mirror/delete/1/
The guest user is able to delete the mirror even though the guest has no access to the repository's edit page. The researcher points to the controller that handles this action as the place where the permission check is missing:
applications/diffusion/controller/DiffusionMirrorDeleteController.php
The report records a bounty of 300.00 USD and was disclosed on 9 January 2015. It does not give a severity rating, a CVSS score or details of the fix.
Root cause
The report attributes the bug to a lack of permission checks in DiffusionMirrorDeleteController.php. In other words, the delete action does not verify that the caller has the rights needed to modify the repository identified in the path. The access control that protects the edit page is not applied to the mirror deletion route, so authorisation is enforced inconsistently across actions on the same object. The report states the missing check directly; the exact mechanism by which the route is exposed is not described.
Impact
A user who should not be able to modify a repository can delete its mirror configuration. The report demonstrates the deletion only; it does not describe further consequences such as data loss on the remote side, and it does not show what happens to the underlying repository itself. The practical impact is unauthorised modification of repository configuration by a low-privileged user.
How this kind of bug works
This is a broken access control or missing function-level authorisation issue. Web frameworks usually route each action to its own controller or handler. Authorisation is often implemented per controller, either through a shared base class, a policy object, middleware or an explicit check at the top of the action. When a new action is added, or when an existing action is refactored, the check can be omitted, and the action becomes reachable by anyone who can construct the URL.
The bug class is dangerous because it is invisible to the UI: the interface hides the link from users who lack permission, but the endpoint behind the link does not care. Attackers do not need the UI; they only need the route, the object identifier and a valid session. Object identifiers in the path, such as the repository name TEST and the mirror id 1 in this report, make the target easy to enumerate.
Defences are straightforward in principle: enforce authorisation on the server for every action, centralise it so that new controllers inherit the check by default, and deny by default rather than allow by default. Tests should assert that unauthorised users receive a denial for each state-changing route, not just for the pages that link to them.
How to test for it
A general method for this bug class:
- Map the application's state-changing actions. Look for routes that create, edit, delete, enable, disable or reconfigure objects. These often appear in the UI as buttons or links, but the route itself is what matters.
- Create two accounts at different privilege levels, for example an administrator and a low-privileged user, and, where the application supports it, an unauthenticated session.
- As the privileged user, perform the action and capture the request: method, path, query string, body parameters and any CSRF token.
- As the low-privileged user, replay the same request with your own session and, if applicable, your own CSRF token. Do not change the object identifier first; the point is to test whether the same object can be modified by a user who cannot see it.
- Compare the response with the privileged response. A positive result is a success status or a state change (the object is actually modified or deleted) rather than a redirect to a login page or an error page.
- Confirm the state change out of band, for example by reloading the object as the administrator.
Common false positives: the server returns a generic error page with a 200 status but performs no action; the request is rejected by a CSRF check rather than an authorisation check; the low-privileged account actually has the permission through a group or role you did not notice; or the action is idempotent and the object was already in the target state. Always verify the effect, not just the status code.
How it is fixed
More broadly, the check should be moved into a shared base controller or policy layer so that every action on the object enforces it consistently, and the application should deny by default when no policy is defined. Regression tests should cover each state-changing route with an unauthorised user and assert a denial.
Hunting notes
Missing authorisation tends to hide in actions that are rarely exercised: delete, archive, disable, rotate, reset and mirror or sync operations. It also appears in newer endpoints added after the main authorisation layer was written, in API routes that mirror UI actions, and in bulk or administrative actions. Recon signals include route names that contain verbs such as delete or edit, object identifiers in the path, and UI elements that are hidden for your account while the underlying request is still accepted. To make a report land, demonstrate the state change with two accounts, show the denial on the corresponding read or edit page, and state clearly what the low-privileged user was able to modify. Keep the proof minimal and reproducible.
What happened, in plain words
Phabricator is a web platform for software teams. One of its applications, called Diffusion, hosts and manages code repositories. A repository is a shared folder of source code that a team works on together.
The researcher found that a user who was not allowed to touch a repository could still reach the address that deletes its mirror. The user had no access to the repository's edit page, but the delete action worked anyway.
To show this, the researcher used two accounts: an administrator (a user with full rights) and a low-privileged user described as a "guest". The steps were:
- Create a repository with the administrator account.
- Check that the guest user has no access to the new repository by visiting its edit page:
http://phabricator/diffusion/TEST/edit/
- As the guest user, request the mirror deletion address for the same repository:
http://phabricator/diffusion/TEST/mirror/delete/1/
Step 2 matters because it proves the guest really is locked out of the repository. If the guest could open the edit page, there would be nothing to complain about. Step 3 matters because it shows the lock is not applied everywhere: the same guest who is refused the edit page is allowed to delete the mirror.
Reading the two addresses: phabricator is the server, diffusion is the application, TEST is the name of the repository, and edit or mirror/delete/1 is the action being asked for. The 1 at the end is the identifier of the mirror to delete. A request is simply the message your browser sends to a server when you open a page or click a button; here the researcher sent the delete request directly instead of clicking a hidden button.
The researcher pointed at the file that handles this action as the place where the permission check is missing:
applications/diffusion/controller/DiffusionMirrorDeleteController.php
A controller is the piece of code on the server that runs when a particular address is requested. The report records a bounty of 300.00 USD and was disclosed on 9 January 2015. It gives no severity rating, no CVSS score and no details of the fix.
Why it happens
The report blames a lack of permission checks in DiffusionMirrorDeleteController.php. In plain terms, the delete action never asks "is this user allowed to change this repository?" before doing the work. The check that protects the edit page is simply not applied to the mirror deletion address, so the same object is guarded in one place and open in another.
The report states the missing check directly. It does not describe exactly how the address ends up reachable.
What the impact is
A user who should not be able to change a repository can delete its mirror configuration. The report demonstrates the deletion only; it does not describe further consequences such as data loss on the remote side, and it does not show what happens to the repository itself. The practical effect is that a low-privileged user can change repository settings without permission.
In general, how this kind of bug works
This is a broken access control bug, also called missing function-level authorisation. Authorisation means deciding whether a user is allowed to do a particular thing, as opposed to authentication, which is only about proving who the user is. A useful comparison: a building can check your identity badge at the door (authentication) but still forget to lock the storage room (authorisation).
Web frameworks send each address to its own controller. The permission check is often written once in a shared base class or policy so that every controller inherits it. When someone adds a new action, or rewrites an old one, the check can be left out, and the action becomes reachable by anyone who can type the address.
This bug class is dangerous because the screen hides it. The interface does not show the delete link to users without permission, but the address behind the link does not care. An attacker does not need the button; they only need the address, the object identifier and a valid session. A session is the server's memory of you being logged in, usually carried in a cookie, a small piece of data your browser stores and sends back with each request. Object identifiers in the address, such as the repository name TEST and the mirror id 1, make targets easy to guess and try one after another.
The defences are simple in principle: check permission on the server for every action, put the check in one shared place so new controllers get it by default, and refuse by default rather than allow by default. Tests should confirm that an unauthorised user is refused on every action that changes something, not only on the pages that link to it.
In general, how to test for it
- List the actions that change something: create, edit, delete, enable, disable, reconfigure. They often appear as buttons, but the address behind the button is what matters.
- Create two accounts at different privilege levels, for example an administrator and a low-privileged user, and, where the application allows it, also try without logging in.
- As the privileged user, perform the action and capture the request: the method, the path, any parameters and any CSRF token. A CSRF token is a random value the site puts in forms to prove the request came from its own pages and not from another site.
- As the low-privileged user, send the same request with your own session and, if applicable, your own CSRF token. Keep the object identifier the same at first; the question is whether a user who cannot see the object can still change it.
- Compare the response with the privileged one. A positive result is a success status or an actual change, not a redirect to the login page or an error page.
- Confirm the change separately, for example by reloading the object as the administrator.
Common false positives: the server returns a generic error page with a 200 status but does nothing; the request is stopped by a CSRF check rather than a permission check; the low-privileged account actually has the right through a group or role you did not notice; or the action changes nothing because the object was already in the target state. Always verify the effect, not just the status code.
In general, how it is fixed
More broadly, the check should live in a shared base controller or policy layer so every action on the object enforces it the same way, and the application should refuse by default when no policy is defined. Regression tests should cover each action that changes something, using an unauthorised user, and assert a refusal.
In general, where to look
Missing authorisation tends to hide in actions that are rarely used: delete, archive, disable, rotate, reset, and mirror or sync operations. It also appears in newer addresses added after the main permission layer was written, in API routes that copy what the interface does, and in bulk or administrative actions. Useful signals are address names containing verbs such as delete or edit, object identifiers in the path, and interface elements hidden from your account while the request behind them is still accepted. To make a report land, show the change with two accounts, show the refusal on the matching read or edit page, and state clearly what the low-privileged user was able to change. Keep the proof minimal and repeatable.
Glossary
- Phabricator: a web platform for software teams; Diffusion is its application for hosting and managing code repositories.
- Repository: a shared store of source code that a team works on together.
- Mirror: a second copy of a repository kept elsewhere and kept in sync with the original.
- Request: the message a browser sends to a server when you open a page or trigger an action.
- Endpoint: a specific address on a server that performs a particular action.
- Controller: the server-side code that runs when a particular address is requested.
- Authentication: proving who you are, for example by logging in.
- Authorisation: deciding whether an identified user is allowed to perform a particular action.
- Broken access control: a bug where the server does not properly check whether a user is allowed to do something.
- Missing function-level authorisation: a form of broken access control where a specific action lacks its permission check.
- Session: the server's record of you being logged in, usually referenced by a cookie.
- Cookie: a small piece of data stored by your browser and sent back to the site with each request.
- CSRF token: a random value placed in forms to prove a request came from the site's own pages.
- Bounty: a payment made to a researcher for reporting a valid security bug.
- CVSS: a standard scoring system for rating the severity of a vulnerability.
- False positive: a finding that looks like a bug but is not, for example because the action had no real effect.