Описание
GetRepositoryByName, DeleteRepositoryByName and GetArtifactByName allow access of arbitrary repositories in Minder by any authenticated user
Summary
A Minder user can use the endpoints listed in the issue title to access any repository in the DB, irrespective of who owns the repo and any permissions that user may have.
Details
https://github.com/stacklok/minder/blob/e88e4b286e4bc04c03b0332a77961f085e1aa77f/database/query/repositories.sql#L22-L23 https://github.com/stacklok/minder/blob/a115c8524fbd582b2b277eaadce024bebbded508/internal/controlplane/handlers_repositories.go#L277-L278
The DB query used here checks by repo owner, repo name and provider name (which is always "github"). These query values are not distinct for the particular user - as long as the user has valid credentials and a provider, they can set the repo owner/name to any value they want and the server will return information on this repo.
DeleteRepositoryByName uses the same query and I have been able to delete another user's repo using this technique.
The GetArtifactByName endpoint also uses this DB query. I have not reproduced the behaviour with this endpoint due to a lack of a suitable test case, but I do not see anything in the implementation of the endpoint to prevent it being exploited.
PoC
Setup:
- Fresh provider/project on the production minder instance which is owned by me.
- A repo registered by another user (in this case, Ozz)
Impact
Any user and project in a multi-tenant Minder instance.
Ссылки
- https://github.com/stacklok/minder/security/advisories/GHSA-v627-69v2-xx37
- https://nvd.nist.gov/vuln/detail/CVE-2024-27916
- https://github.com/stacklok/minder/commit/45750b4e9fb2de33365758366e06c19e999bd2eb
- https://github.com/stacklok/minder/blob/a115c8524fbd582b2b277eaadce024bebbded508/internal/controlplane/handlers_repositories.go#L277-L278
- https://github.com/stacklok/minder/blob/main/internal/controlplane/handlers_repositories.go#L257-L299
Пакеты
github.com/stacklok/minder
< 0.0.33
0.0.33
Связанные уязвимости
Minder is a software supply chain security platform. Prior to version 0.0.33, a Minder user can use the endpoints `GetRepositoryByName`, `DeleteRepositoryByName`, and `GetArtifactByName` to access any repository in the database, irrespective of who owns the repo and any permissions present. The database query checks by repo owner, repo name and provider name (which is always `github`). These query values are not distinct for the particular user - as long as the user has valid credentials and a provider, they can set the repo owner/name to any value they want and the server will return information on this repo. Version 0.0.33 contains a patch for this issue.