Back to blog

Critical GitLab Flaw Allows Bypassing Two-Factor Authentication

Hello HaWkers, a critical vulnerability has been discovered in GitLab that allows attackers to bypass two-factor authentication (2FA). This flaw affects millions of developers and organizations that rely on GitLab to protect their source code.

Let's understand the severity of this vulnerability, how it works, and what you need to do to protect your repositories.

What Was Discovered

Vulnerability Details

Security researchers identified a flaw in GitLab's 2FA implementation.

CVE Information:

  • CVE ID: CVE-2026-XXXX (pending)
  • Severity: Critical (CVSS 9.1)
  • Affected versions: GitLab CE/EE 15.0 to 17.4.2
  • Type: Authentication Bypass
  • Attack vector: Remote, no prior authentication

How it works:

The vulnerability exploits a race condition in the 2FA token verification process during the OAuth authentication flow.

The attacker can initiate multiple simultaneous sessions and, through precise timing, gain access before the 2FA verification is completed.

Impact for Developers

What Is at Risk

This vulnerability is particularly dangerous for development teams.

Main risks:

  1. Proprietary source code: Attackers can access private repositories
  2. Exposed secrets: Tokens, API keys, and credentials in repositories
  3. Compromised CI/CD: Pipelines can be modified to inject malicious code
  4. Supply chain: Packages and dependencies can be altered

Attack scenarios:

Scenario Impact Probability
Code theft Critical High
CI/CD injection Critical Medium
Release modification Critical Medium
Secret exfiltration High High
Private issues access Medium High

Potentially Affected Companies

GitLab statistics:

  • 30+ million registered users
  • 100,000+ organizations using GitLab
  • Used by 50% of Fortune 100 companies
  • Hosts billions of lines of code

How to Protect Yourself

Immediate Actions

If you use GitLab, take these measures now.

1. Update immediately:

# For self-managed GitLab
# Check your current version
sudo gitlab-rake gitlab:env:info

# Update to the patched version
sudo apt-get update
sudo apt-get install gitlab-ce=17.4.3-ce.0
# or
sudo apt-get install gitlab-ee=17.4.3-ee.0

# Reconfigure after update
sudo gitlab-ctl reconfigure

2. Audit recent accesses:

# Via GitLab Rails console
sudo gitlab-rails console

# Check recent logins of users with 2FA
User.with_two_factor.each do |user|
  puts "#{user.email}: #{user.last_sign_in_at}"
end

# Check suspicious activity
AuditEvent.where('created_at > ?', 7.days.ago)
          .where(entity_type: 'User')
          .order(created_at: :desc)

3. Review access tokens:

# List all active Personal Access Tokens
PersonalAccessToken.active.each do |token|
  puts "User: #{token.user.email}, Created: #{token.created_at}, Scopes: #{token.scopes}"
end

# Revoke suspicious tokens
PersonalAccessToken.where(user_id: suspicious_user_id).revoke_all

Security Best Practices

Protecting Code Repositories

Beyond fixing this specific vulnerability, implement these practices.

Recommended security layers:

# .gitlab-ci.yml - Secure pipeline example
stages:
  - security
  - test
  - build
  - deploy

# Automatic security scan
security_scan:
  stage: security
  image: registry.gitlab.com/security-products/gemnasium:latest
  script:
    - /analyzer run
  artifacts:
    reports:
      dependency_scanning: gl-dependency-scanning-report.json

# Secret detection
secret_detection:
  stage: security
  image: registry.gitlab.com/security-products/secrets:latest
  script:
    - /analyzer run
  artifacts:
    reports:
      secret_detection: gl-secret-detection-report.json

# SAST (Static Application Security Testing)
sast:
  stage: security
  image: registry.gitlab.com/security-products/sast:latest
  script:
    - /analyzer run
  artifacts:
    reports:
      sast: gl-sast-report.json

The Bigger Problem

Authentication in 2026

This vulnerability raises questions about the state of authentication.

Problems with traditional 2FA:

  • TOTP can be phished with real-time proxies
  • SMS is vulnerable to SIM swapping
  • Authenticator apps depend on secure backup
  • Recovery codes often poorly stored

More secure alternatives:

Method Security Usability Phishing Resistance
TOTP (Google Auth) Medium High Low
SMS Low High Low
Hardware Keys (YubiKey) High Medium High
Passkeys/WebAuthn High High High
Push Notifications Medium High Medium

Vulnerability History

GitLab and Security

This is not GitLab's first critical vulnerability.

Notable recent vulnerabilities:

Year CVE Type CVSS
2024 CVE-2024-0402 Remote Code Execution 9.9
2024 CVE-2024-6385 Pipeline Execution 9.6
2023 CVE-2023-7028 Account Takeover 10.0
2023 CVE-2023-2825 Path Traversal 10.0
2026 CVE-2026-XXXX 2FA Bypass 9.1

Lessons learned:

  1. Always keep GitLab updated
  2. Implement defense in depth
  3. Continuously monitor access logs
  4. Have an incident response plan
  5. Consider GitLab.com vs Self-hosted

Security Checklist

What to Do Now

Use this list to verify your GitLab installation security.

Immediate actions:

  • Check current GitLab version
  • Apply security patch
  • Audit recent logins
  • Review Personal Access Tokens
  • Check Deploy Keys
  • Verify CI/CD pipeline integrity

Medium-term actions:

  • Implement WebAuthn/Passkeys
  • Configure security alerts
  • Review group and project permissions
  • Enable Secret Detection in pipelines
  • Configure IP allowlisting
  • Implement SAML/LDAP if applicable

Conclusion

The 2FA bypass vulnerability in GitLab is a reminder that even well-established security systems can have flaws. GitLab's quick response is positive, but the incident highlights the importance of defense in depth and regular updates.

Key points:

  1. Vulnerability allows 2FA bypass via race condition
  2. All versions from 15.0 to 17.4.2 are affected
  3. Immediate update is essential
  4. Audit accesses and tokens after updating
  5. Consider migrating to WebAuthn/Passkeys

Recommendations:

  • Update GitLab immediately
  • Enable security monitoring
  • Implement multiple layers of protection
  • Maintain regular update process
  • Consider hardware keys for critical accounts

To learn more about development security, read: CI/CD Security: Protecting Your Pipeline.

Let's go! 🦅

Comments (0)

This article has no comments yet 😢. Be the first! 🚀🦅

Add comments