Unauthorized read for conan repository
A guest member of a private GitLab group could list Conan package recipes in that group's private registry using the Conan client, even though the web interface and REST API returned 403 for the same user. This let a low-privilege user learn which packages and versions were stored in a private registry.
GitLab
Originally disclosed on GitLab
- Fixed in 2.0 years
- Disclosed after 2.0 years
HackerOne report #901473 by fushbey on 2020-06-18, assigned to @jeremymatos:
Summary
Hi, I want to report an unauthorized read related to conan packages, I was not quite familiar with Conan so I had doubts but after several trying, I am confident the bug is there, please confirm to me if I am right.
The bug is, a user that is Guest in a private group, can list Conan packages available in the registry despite not having enough access level, indeed the web restricts access:
- When accessing the Web page for the group > Packages & Registries . Surprisingly this menu item is shown, however on clicking on it the page shows an error message:
Something went wrong while fetching the packages list., Inspecting the network calls we see indeed we got a 403 response. to/api/v4/groups/6/packages?page=1&per_page=20&sort=desc&order_by=created_at&package_name=. I come back to this API call later.
-When accessing the Web page for our project The menu item "Packages & repositories" is not even shown, accessing it directly with the URL returns a 404.
However, using conan search does return results.
Steps to reproduce
I am gonna assume you installed conan successfully (which by the way did not install very easily on my Gitlab EE container)
1 - userA creates a private group: cpp-group
1 - userA creates a private project in that group: cpp-hello
1 - userA invites userB as guest
1 - userA: Create a Conan package as explained here
* conan new Hello/1.0 -t
* conan create . cpp-group+cpp-hello/beta
2 - userA: Add our Conan registry to remote:
conan remote add gitlab https://gitlab.example.com/api/v4/packages/conan
3 - Upload the package with the owner of the private group
CONAN_LOGIN_USERNAME=userA CONAN_PASSWORD=<userA PAT> conan upload Hello/0.1@cpp-group+cpp-hello/beta --all
4 - Search for Hello package using userA
CONAN_LOGIN_USERNAME=userA CONAN_PASSWORD=<userA PAT> conan search Hello* -r gitlab
Existing package recipes:
Hello/1.0@cpp-group+cpp-hello/beta
5 - Delete userA from cache, make sure it worked:
conan user && conan user --clean && conan user
6 - search for packages using userB
CONAN_LOGIN_USERNAME=userB CONAN_PASSWORD=<userB PAT> conan search Hello* -r gitlab
Existing package recipes:
Hello/1.0@cpp-group+cpp-hello/beta
7 - Compare that with the API call:
curl -s -H 'Authorization: Bearer <userB'sPAT>' 'http://gitlab.example.com/api/v4/groups/<PROJECT_ID>/packages?page=1&per_page=20&sort=desc&order_by=created_at&package_name=' | jq
{
"message": "403 Forbidden"
}
To prove myself there is a bug and not some caching problem I tested outside the container with userB and still worked.
Impact
The user can list recipes from a private Conan registry although the Web does not show them.
What is the current bug behavior?
Allowing unauthorized users to know the packages used in a repository with a private Conan registry.
What is the expected correct behavior?
Same as the Web UI (and API), return a forbidden response instead of showing the package name.
Impact
Read above.
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 Conan registry API endpoint did not enforce the same group permission check as the web packages API, so a guest could search packages.
Impact
A guest could read the names of packages in a private Conan registry, although the web UI and REST API blocked the same access.
What the attacker needed
A GitLab account; guest membership in a private group; a Conan package in the group registry
How it was found
- Create a private group and a private project inside it, then invite a second user as guest.
- Create and upload a Conan package to the group's registry as the group owner.
- Search for the package with the owner's credentials to confirm it exists.
- Clear the local Conan credentials and search again as the guest user.
- Observe that the guest still receives the package recipe list, while the equivalent REST API call returns 403.
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.
GitLab has a package registry where teams store software packages, and a private group should only let members with enough permission see them. A guest is the lowest member role. The reporter found that the Conan command-line tool still returned package names for a guest, while the website correctly refused.
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.