Autoclose can close any task regardless of policies/spaces
A user who can push to a repository with autoclose enabled can close any Maniphest task, even those they cannot view or edit, by including autoclose syntax in a commit message. This bypasses task policies and space restrictions.
- Fixed in 33 hours
- Disclosed after 10 days
Description
If a user can push to a repository that has autoclose enabled, they can close //any// Maniphest task on the install, including tasks whose policies otherwise restrict the user from viewing or editing, and tasks inside Spaces that the user can't view.
I don't think this rises to the level of "security vulnerability." In particular, I don't think this is an issue on installs that operate like the upstream, where the repositories and projects are all related, and the developers who can push to the repositories are trusted throughout the install. On my install, though, the users are multiple, disparate teams who want to restrict access from each other, and they shouldn't be able to close each other's tickets. The only reason I'm filing here instead of as a normal bug report is so that in case there are other installs like mine, the issue doesn't become public before Phacility has a chance to review it.
Steps to Reproduce
These steps involve an administrator and two users, Alice and Eve.
- As an administrator:
- Create a repository R and configure it so that it's Visible To, Editable By, and Pushable By Eve, and Autoclose is On. OR Configure Diffusion's policies, setting the Default Edit Policy and Can Create Repositories to All Users.
- (Optional) Create a Space S, and make it visible to only Alice.
- As Alice:
- Create a Maniphest task T. Set policies so it's Visible To and Editable By only Alice. If the administrator created Space S, then also make the task visible to Space S instead of the default space.
- As Eve:
- Confirm that task T is not visible.
- If the administrator created repository R, then clone it. If instead the administrator configured Diffusion to allow anyone to create repositories, then create a new repository R with Autoclose turned On, and clone it.
- Commit something. The author can be anyone and doesn't need to be a Phabricator user. In the commit message, write something about a mongoose, and use autoclose syntax to close task T.
- Push the commit.
- As Alice again:
- Confirm that task T has been closed despite policies and restricted spaces.
- Hunt down and destroy Eve. (Being hunted down and destroyed is probably a security vulnerability?)
Versions
I reproduced this on a test instance on Phacility with the following versions:
- phabricator: 699ab153e3751e5389c69db4387d261e358de290 (Fri, Apr 7) (branched from 7707685733d26bf1c7278a2f338416a038c2709b on origin)
- arcanist: 3512c4ab86d66a103a6733a0589177f93b6d6811 (Fri, Apr 7) (branched from a59cfca5f190c44403dfc7449c678a2aa1626bb4 on origin)
- phutil: f568eb7b9542259cd3c0dcb3405cc9a83c90a2f5 (Mon, Apr 3) (branched from c581e769f10c6d2b427900897edba74e01a572bd on origin)
- libcore: 3eebdfca5b325792fdd2003a261e1ab94b919322 (Fri, Mar 24)
- services: 198eb67bd82296b6938d038836c7269c84bad98f (Feb 13 2017) (branched from 772620edd80ce593b104dba7721db42b9eb020a2 on origin)
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 autoclose mechanism does not verify that the user pushing the commit has permission to edit the task being closed.
What the attacker needed
Push access to a repository with autoclose enabled
How it was found
- As an administrator, create a repository R and configure it so that it's Visible To, Editable By, and Pushable By Eve, and Autoclose is On.
- As Alice, create a Maniphest task T. Set policies so it's Visible To and Editable By only Alice.
- As Eve, confirm that task T is not visible.
- As Eve, clone repository R.
- As Eve, commit something with a message that uses autoclose syntax to close task T.
- As Eve, push the commit.
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.
Autoclose is a feature that automatically closes tasks when a commit message mentions them. The problem is that it doesn't check if the person pushing the commit is allowed to close that task. So anyone who can push to a repository can close any task, even private ones.
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.