Responsible disclosure: improper access control in Gitlab private project.
Published on rpadovani.com
As I said back in September regarding a responsible disclosure about Facebook, data access control isn’t easy. While it can sound elementary, it is very difficult, both on a theoretical side and on a practical side.
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.
Context
GitLab organises work around groups and projects. A private group can contain many projects, and membership of the group is what normally grants a user access to those projects. Within each project a member holds a role, such as reporter, developer or master, and that role determines what they can see and do in that specific project.
The feature at the centre of this report is the removal of a user from a private group by an administrator. The expectation is simple: once a user is removed from the parent group, they lose access to the projects inside it. The report shows that this expectation did not hold when the user's role had been changed in individual projects.
As the author notes, data access control is not easy, neither theoretically nor practically. This write-up is a responsible disclosure about GitLab, first reported on HackerOne and tracked on the GitLab issue tracker; both links are now public.
Setup
The scenario needs a private group containing dozens of projects, an administrator who manages group membership, and a user who is a member of the group. The user's role in some of the projects is changed away from whatever role they hold at group level. No specific GitLab version, tooling or request capture is described in the report; the issue is about the behaviour of group and project membership, not about a particular payload.
Finding it
The researcher describes the issue in three steps:
- A rogue user is added to a private group with dozens of projects.
- The user's role in some projects changes.
- The rogue is fired and removed from the group, but still has access to the projects where their role was changed.
The second step is the interesting one, because it can happen for several different reasons:
- The rogue is added as
masterand, knowing this vulnerability, decreases their privileges to stay in some projects. This is the only malicious case. - The rogue is added as
developer, becomes responsible for some projects, and is promoted to themasterrole. - The rogue is added as
reporter, and is then promoted for a project, and so on.
What makes this look wrong is the state of the administrative interface at removal time: when an admin removes a user from a private group, there is no indication that the user still has access to private projects if their role was changed. The administrator performs what looks like a complete removal and has no signal that anything remains.
Exploitation
Step 1: join the private group
The rogue user is added to a private group that contains dozens of projects. At this point they are an ordinary member, and their access derives from the group membership.
Step 2: change the role in selected projects
The user's role is changed in some of the projects. This can be a promotion by an administrator (for example from developer to master because the user became responsible for a project), a promotion from reporter, or, in the malicious case, a deliberate reduction of privileges by a user who was added as master and wants to keep access to particular projects after removal.
Step 3: get removed from the group
The user is removed from the parent group, for example because they leave the organisation. The administrator sees no warning that the user retains access to projects where the role was changed.
Step 4: keep reading the projects
After removal, the user can still see all resources of a project of a secret group. After removal, the user can still see all resources of a project of a secret group where their role was changed.
Root cause
The report frames this as a broken authorisation problem: after removal from the group, the user can still see all resources of a project of a secret group if their role was changed. The administrative interface compounds the problem by giving no indication that the user still has access to private projects when their role was changed.
Why the existing defences did not stop it is not described in the report; . The report does not include code or a patch analysis.
Impact
A user can still see all resources of a project of a secret group after they have been removed from the parent group. The condition is that their role was changed in that project before removal. The report describes only that the user can still see all resources of such a project.
Fix
GitLab deployed a fix in production on 31 January 2019 and publicly disclosed it in the GitLab 11.7.3 security release. The report does not describe what the fix changed. The researcher notes that if GitLab had communicated with him, he would have double checked their work. since the team believed the issue was fixed around December 2018 and closed the internal issue, only to find on 25 January 2019 that it was still present.
Variants to test
- Remove a user from a private group after promoting them in a single project, then check whether they can still read that project's resources. A positive result is any resource still visible to the removed user.
- Remove a user from a private group after demoting them in a project (the malicious case where a
masterlowers their own role). A positive result is retained access to the projects where the role was lowered. - Repeat with different role transitions, for example
reporterto a higher role in one project, and check whether the removal from the group revokes access in every project or only in those where the role was never changed. - Check the administrative interface at removal time for any warning about remaining project access. A positive result is a silent removal while the user still has access.
Timeline
- 29 January 2018: first disclosure to GitLab.
- 9 February 2018: GitLab confirmed the issue and triaged it, assigning a medium priority.
- 25 February 2018: the researcher asks for a timeline.
- 27 February 2018: GitLab says it will update with a timeline.
- 16 March 2018: almost two months later, the researcher asks again for a timeline or suggests going public, since administrators of groups can easily check and avoid the vulnerability.
- 17 March 2018: GitLab says it will update with a timeline and asks not to go public.
- Somewhere around December 2018: the team thinks the issue has been fixed and closes the internal issue, without communicating with the researcher.
- 17 January 2019: the researcher asks for an update; the message is never answered.
- 25 January 2019: the security team sees the issue is still present.
- 31 January 2019: the fix is deployed in production and publicly disclosed, without informing the researcher.
- 5 March 2019: the researcher asks again for an update.
- 12 March 2019: GitLab says the issue has been fixed and awards the bounty.
GitLab awarded a $2000 bounty for the disclosure. The researcher notes a total lack of communication, and that if GitLab had communicated, the fix could have been double checked before deployment and public disclosure.
What happened, in plain words
GitLab is a website where teams keep their code and plan their work. Inside GitLab, work is organised into groups and projects. A group is like a folder that can hold many projects, and a project is like a single repository of code plus its issues, merge requests and other resources. A private group is one that only invited people can see. When someone is a member of a private group, they normally get access to all the projects inside it.
Within each project, a member has a role. The role decides what the person can do in that project. The report mentions three roles: reporter, developer and master. A reporter can mostly view things, a developer can push code, and a master has broad control over the project. The exact permissions are not described in the report; what matters is that a higher role means more access.
The feature in question is removing a user from a private group. An administrator clicks remove, and the expectation is simple: the user loses access to every project inside that group. The report shows that this expectation did not hold when the user's role had been changed in individual projects. The user could still see the resources of those projects after being removed from the parent group.
The author also makes a general point: controlling who can access data is not easy, neither in theory nor in practice. This was a responsible disclosure: the researcher told GitLab about the problem privately, first on HackerOne (a platform for reporting security bugs) and then on GitLab's own issue tracker, so that it could be fixed before being made public. Both links are now public.
Setup
To reproduce the situation you need three things:
- A private group that contains dozens of projects.
- An administrator who manages who belongs to the group.
- A user who is a member of the group.
The user's role in some of those projects is changed so that it differs from the role they have at group level. The report does not mention a specific GitLab version, a particular tool, or any captured network request. The issue is about how group and project membership behave, not about a special payload or a malformed request.
Finding it
The researcher describes the issue in three steps:
- A rogue user is added to a private group with dozens of projects.
- The user's role in some projects changes.
- The rogue is fired and removed from the group, but still has access to the projects where their role was changed.
The second step is the interesting one, because it can happen for several different reasons:
- The rogue is added as
masterand, knowing this vulnerability, decreases their privileges to stay in some projects. This is the only malicious case. - The rogue is added as
developer, becomes responsible for some projects, and is promoted to themasterrole. - The rogue is added as
reporter, and is then promoted for a project, and so on.
What makes this look wrong is what the administrator sees at removal time. When an admin removes a user from a private group, there is no indication that the user still has access to private projects if their role was changed. The administrator performs what looks like a complete removal and gets no signal that anything remains.
Exploitation
Step 1: join the private group
The rogue user is added to a private group that contains dozens of projects. At this point they are an ordinary member, and their access comes from being in the group.
Step 2: change the role in selected projects
The user's role is changed in some of the projects. This can be a promotion by an administrator, for example from developer to master because the user became responsible for a project, or a promotion from reporter. In the malicious case, it is a deliberate reduction of privileges by a user who was added as master and wants to keep access to particular projects after removal.
Step 3: get removed from the group
The user is removed from the parent group, for example because they leave the organisation. The administrator sees no warning that the user keeps access to projects where the role was changed.
Step 4: keep reading the projects
After removal, the user can still see all resources of a project of a secret group. After removal, the user can still see all resources of a project of a secret group where their role was changed.
Root cause
The report describes this as an access control problem. Authorisation is the part of a system that decides what a logged-in user is allowed to do. Here, a user removed from a private group can still see all resources of a project of that group if their role was changed. The administrative interface makes it worse by giving no indication that the user still has access to private projects when their role was changed.
The report does not explain why the existing defences did not stop it. The report contains no code and no analysis of the patch.
Impact
A user can still see all resources of a project of a secret group after they have been removed from the parent group. The condition is that their role was changed in that project before removal. The report describes only that the user can still see all resources of such a project.
Fix
GitLab deployed a fix in production on 31 January 2019 and publicly disclosed it in the GitLab 11.7.3 security release. The researcher notes that if GitLab had communicated with him, he would have double checked their work. The team believed the issue was fixed around December 2018 and closed the internal issue, only to find on 25 January 2019 that it was still present.
Variants to test
- Remove a user from a private group after promoting them in a single project, then check whether they can still read that project's resources. A positive result is any resource still visible to the removed user.
- Remove a user from a private group after demoting them in a project (the malicious case where a
masterlowers their own role). A positive result is retained access to the projects where the role was lowered. - Repeat with different role transitions, for example
reporterto a higher role in one project, and check whether the removal from the group revokes access in every project or only in those where the role was never changed. - Check the administrative interface at removal time for any warning about remaining project access. A positive result is a silent removal while the user still has access.
Timeline
- 29 January 2018: first disclosure to GitLab.
- 9 February 2018: GitLab confirmed the issue and triaged it, assigning a medium priority.
- 25 February 2018: the researcher asks for a timeline.
- 27 February 2018: GitLab says it will update with a timeline.
- 16 March 2018: almost two months later, the researcher asks again for a timeline or suggests going public, since administrators of groups can easily check and avoid the vulnerability.
- 17 March 2018: GitLab says it will update with a timeline and asks not to go public.
- Somewhere around December 2018: the team thinks the issue has been fixed and closes the internal issue, without communicating with the researcher.
- 17 January 2019: the researcher asks for an update; the message is never answered.
- 25 January 2019: the security team sees the issue is still present.
- 31 January 2019: the fix is deployed in production and publicly disclosed, without informing the researcher.
- 5 March 2019: the researcher asks again for an update.
- 12 March 2019: GitLab says the issue has been fixed and awards the bounty.
GitLab awarded a $2000 bounty for the disclosure. The researcher notes a total lack of communication, and that if GitLab had communicated, the fix could have been double checked before deployment and public disclosure.
Glossary
- API: a way for one program to talk to another over the internet, usually by sending requests to specific addresses and getting structured answers back.
- Authorisation: the part of a system that decides what a logged-in user is allowed to do, as opposed to authentication, which decides who the user is.
- Broken authorisation: a flaw where the system lets a user do or see something they should not be allowed to, because the permission check is missing or wrong.
- Bounty: a payment made by a company to someone who reports a security problem to them.
- Cookie: a small piece of data a website stores in your browser so it can recognise you on later requests.
- Developer: a GitLab role that can, among other things, push code to a project. The exact permissions are not described in the report.
- GitLab: a website for hosting code and managing software projects, organised into groups and projects.
- Group: a container in GitLab that can hold many projects and many members. Membership of a group normally gives access to the projects inside it.
- HackerOne: a platform where security researchers report bugs to companies and companies manage those reports.
- Master: a GitLab role with broad control over a project.
- Medium priority: a severity label GitLab assigned to the issue when it triaged it.
- Private group: a group that only its members can see.
- Project: a single repository of code in GitLab, together with its issues, merge requests and other resources.
- Reporter: a GitLab role that can mostly view a project.
- Responsible disclosure: reporting a security problem privately to the company that runs the software, so it can be fixed before the details become public.
- Role: the label attached to a user inside a group or project that determines what they can do there, such as
reporter,developerormaster. - Token: a piece of data used to prove identity or permission in a request.
- Triaged: reviewed and classified by the company's security team, for example by assigning a priority.