Force maintainer to take ownership of a scheduled CI pipeline before editing it
A maintainer could edit a scheduled CI pipeline created by another maintainer without that owner's knowledge, so pipelines would keep running under the editor's identity. The report also exposed a worse issue where a maintainer could run scheduled pipelines using another maintainer's CI job token, which is tracked separately.
GitLab
Originally disclosed on GitLab
- Fixed in 2.4 years
- Disclosed after 2.4 years
Context
This issue was first created via a HackerOne report. The full details of the report have been moved to a comment to keep the description uncluttered.
The worst vulnerability exposed by the report is that a maintainer can execute scheduled pipelines using another maintainer's CI_JOB_TOKEN. Fixing this vulnerability is addressed in https://gitlab.com/gitlab-org/gitlab/-/issues/328553 and will not be addressed by this issue. See https://gitlab.com/gitlab-org/gitlab/-/issues/118782#note_575544233 for more details.
A lesser vulnerability is that Maintainer B can edit a pipeline schedule created by Maintainer A without Maintainer A's knowledge. This vulnerability will be addressed by this issue.
Proposed solution
Force maintainer or above user B to take ownership of the pipeline schedule in order to edit it. If Maintainer A then wants to edit the schedule, they must take ownership again or pipelines will keep running as maintainer B.
Technical details
Disallow updating schedules owned by other users, by making owner_of_schedule mandatory in Ci::PipelineSchedulePolicy => :update_pipeline_schedule. Move update_pipeline_schedule into a new policy block so that other policies are not effected by this change
Note: this is a breaking change for the pipeline schedule edit action in the REST API. Because it is a ~security fix, the breaking change should be communicated in a security blog post with the release of the fix and not before
Related Security Issue: https://gitlab.com/gitlab-org/security/gitlab/-/issues/658
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 pipeline schedule update policy did not require the acting user to be the owner of the schedule, so any maintainer could update another user's schedule.
Impact
A maintainer could silently take over another maintainer's scheduled pipeline and have it run under their own identity; the more serious token misuse is out of scope here and handled elsewhere.
What the attacker needed
Maintainer role on the project; another maintainer's schedule exists
The fix
The update policy should require the acting user to own the schedule, forcing them to take ownership before editing; the text says this is a breaking change for the REST API edit action.
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.
In GitLab, a scheduled pipeline runs a project's CI jobs automatically at set times. A maintainer is a trusted user who can change project settings. The problem was that one maintainer could quietly change a schedule another maintainer had set up, so the jobs would then run as the person who edited it rather than the original owner.
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.