GitLabApplication

CVE-2021-39872

MEDIUM · 6.5 CVSS v3.1 Published 2021-10-05
Fix available
A fix is available. Upgrade to 14.1.7 / 14.2.5 or later.
See remediation →
71/100
Remediation priority · Elevated
Remotely reachable Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
In all versions of GitLab CE/EE since version 14.1, an improper access control vulnerability allows users with expired password to still access GitLab through git and API through access tokens acquired before password expiration.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

In GitLab CE/EE versions 14.1 and later, an improper access control vulnerability allows users with expired passwords to continue accessing GitLab through git operations and the API using access tokens that were acquired before their password expired. The access tokens remain valid even after the associated password becomes invalid, bypassing password expiration controls.

MitigationImplement token validation that checks password status at authentication time, ensuring access tokens are invalidated when the user's password expires, and establish token expiration policies aligned with password rotation requirements.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
GitLabApplication
Affected:>= 14.1.0, < 14.1.7>= 14.2.0, < 14.2.5= 4.3.0

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check installed GitLab version
    Run `gitlab-rake gitlab:env:info` or check the GitLab UI at /admin/application_settings/overview. Compare the version to the affected ranges: 14.1.0 through 14.1.6, 14.2.0 through 14.2.4, or version 14.3.0.
    Affected if The installed version falls within the affected ranges listed above.
  2. Verify password expiration is enabled
    Go to GitLab admin area, navigate to Settings > Sign-up and sign-in (or run `gitlab-ctl show-config` and search for `password_authentication_enabled` and `password_expires_at` settings). Check if password expiration policies are configured.
    Affected if Password expiration is enabled and enforced in the GitLab instance.
  3. Identify users with expired passwords
    Use the Rails console: `User.where.not(password_expires_at: nil).where('password_expires_at < ?', Time.current)`. This lists users whose passwords have already expired.
    Affected if Any users exist with expired passwords in the system.
  4. Check for active personal access tokens
    In the Rails console, run `PersonalAccessToken.where('expires_at IS NULL OR expires_at > ?', Time.current).pluck(:user_id, :id, :name)`. This lists all non-expired access tokens that could still be used.
    Affected if Active personal access tokens exist in the system.
  5. Identify affected user/token combinations
    Cross-reference users with expired passwords against those with valid tokens. In Rails console: `expired_users = User.where.not(password_expires_at: nil).where('password_expires_at < ?', Time.current); tokens = PersonalAccessToken.where('expires_at IS NULL OR expires_at > ?', Time.current).where(user_id: expired_users.select(:id)); puts tokens.count`
    Affected if Any valid access tokens belong to users with expired passwords.

A user is affected if they run a vulnerable GitLab version, have password expiration enabled, and have active access tokens issued to users whose passwords have since expired.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 14.1.7 / 14.2.5 or later
Fixed in 14.1.714.2.5
Interim mitigation

Implement token validation that checks password status at authentication time, ensuring access tokens are invalidated when the user's password expires, and establish token expiration policies aligned with password rotation requirements.

Recommended fix High confidence

14.1.7 or 14.2.5 (or latest stable 14.x/15.x release)

  1. 1. Backup your GitLab instance database and repositories
  2. 2. Ensure you have a rollback plan in place
  3. 3. For GitLab 14.1.x (>=14.1.0, <14.1.7): Upgrade to version 14.1.7 or later in the 14.1.x series
  4. 4. For GitLab 14.2.x (>=14.2.0, <14.2.5): Upgrade to version 14.2.5 or later in the 14.2.x series
  5. 5. For GitLab 4.3.0: This appears to be an older CE/EE release; upgrade to a supported stable version (14.1.7+, 14.2.5+, or latest 14.x/15.x stable)
  6. 6. After upgrade, verify that users with expired passwords can no longer authenticate via git or API using pre-expiration access tokens
  7. 7. Review and rotate any potentially compromised access tokens
Caveat Major GitLab upgrades (e.g., 14.x to 15.x) may require database migrations and have breaking changes - review GitLab upgrade guides

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in GitLab Scoped from the published advisory
  • Consultation6.0 h
  • Implementation16.0 h
  • Testing10.0 h
  • Review / QA6.0 h
38.0 hours of engineering $6,660
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $10,656.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2021-39872 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2021-39872 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data