Skip to content
Access control Disclosed report Advanced

Using gitlab-security-policy-bot to bypass cross project access restriction and execute CI/CD pipeline on that project.

GitLab

Originally disclosed on GitLab

  • Fixed in 50 days
  • Disclosed after 50 days

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #2583923 by yvvdwf on 2024-07-01, assigned to GitLab Team:

Report | How To Reproduce

Report

Hi team,

This report is created as being required by Gitlab security team. It is to represent an issue to be separated with the one being reported in 2578672. Thus please refer to 2578672 for any further information.

Gitlab limits strictly scope of CI_JOB_TOKEN to prevent it from accessing to other projects unless users explicitly configures their projects to allow it to access to.

Ruby
  # If the project is private  
  rule { ~public_project & ~internal_access & ~project_allowed_for_job_token }.prevent_all

  # If this project is public or internal we want to prevent all aside from a few public policies  
  rule { public_or_internal & ~project_allowed_for_job_token }.policy do  
    prevent :guest_access  
    prevent :public_access  
    prevent :reporter_access  
    prevent :developer_access  
    prevent :maintainer_access  
    prevent :owner_access  
  end

  rule { public_project & ~project_allowed_for_job_token }.policy do  
    prevent :public_user_access  
  end  

Unfortunately, Gitlab does not explicitly prevents from creating a new pipeline, thus this policy is still valid when this token is generated in a CI job which was triggered by a gitlab-security-policy-bot:

Ruby
      rule { security_policy_bot }.policy do  
        enable :create_pipeline  
        enable :create_bot_pipeline  
        enable :build_download_code  
      end  

Furthermore, Gitlab prevent multiple project membership for security policy bot users, , but it does not prevent this bot from being a member of a group. Thus attackers can add this bot as a group member via bulk import, then abuse this bot to bypass cross project access restriction as explained in 2578672.

Reproduce

Please refer to 2578672 for reproduction steps and a video demo

Best regards,
yvvdwf

Impact

Attacker can abuse gitlab-security-policy-bot to bypass cross project access restriction and execute CI/CD pipeline on that project.

How To Reproduce

Please add reproducibility information to this section:

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity access control bug in gitlab.com. GitLab made it public on 22 August 2024. Fixed in version 17.3.

About 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.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.