# An attacker can run pipeline jobs as arbitrary user

Deleting a group owner account left them as pipeline triggerer of a mirrored project, letting an attacker run CI jobs with the victim's CI_JOB_TOKEN and steal private repos.

- Payout: $12,000
- Severity: critical
- Program: GitLab
- Found by: u3mur4
- Disclosed: 2020-08-26
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/894569
- Library page: https://bugbountylibrary.com/r/h1%3A894569
- Tags: area:web domain:web impact:data-leak impact:privesc kind:bounty platform:hackerone sev:critical tech:ci-cd technique:chained vuln:access-control vuln:auth-bypass vuln:business-logic

**Target:** GitLab.com CI/CD mirroring pipelines and group membership
**Root cause:** When a group owner who triggered mirror-update pipelines deletes their account without being removed from group members, the pipeline triggerer falls back to another owner account, so attacker-controlled mirrored .gitlab-ci.yml runs under the victim's identity.
**Steps:**
1. Victim: create private repo with private files.
2. Attacker1: create public project `poc` with `.gitlab-ci.yml` (ruby image, echo).
3. Attacker2: create public group `test`, project `poc`, set Pull mirroring to Attacker1's repo, enable `Trigger pipelines for mirror updates`.
4. Attacker2: invite Victim to `test` group and set role to Owner.
5. Attacker2: delete own account.
6. Attacker1: update `.gitlab-ci.yml` to `git clone https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/victim/private_repo_name.git` and cat files.
7. Wait for mirror update (~30 min) to trigger pipeline as Victim; job clones victim's private repo using victim's CI_JOB_TOKEN.
**How found:** Researcher noticed that deleting a group owner account left them as the pipeline triggerer for mirror updates, and hypothesized the trigger would fall back to another owner — then built a two-attacker-account mirroring setup to confirm.
**Exploitation:** Attacker controls mirrored repo content; after victim becomes sole owner and attacker2 deletes account, mirror-triggered pipeline executes attacker's CI script under victim identity, exfiltrating CI_JOB_TOKEN to clone private/member-only repos and registry.
**Escalation:** Token grants access to victim's private repos, member-only repos, and container registry, broadening data theft beyond a single project.
**Insight:** Look at identity fallback when a triggering user is deleted: dangling group memberships and mirror-triggered pipelines can reassign job execution to a remaining owner, turning CI_JOB_TOKEN into a cross-tenant credential.

## Proof of concept (copied exactly from the original report)

**Malicious .gitlab-ci.yml cloning victim private repo**

```
image: "ruby:2.6"

rspec:
  script:
    - git clone https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/victim/private_repo_name.git
    - cd private_repo_name
    - ls -lah .
    - cat README.md
```

