CVE-2021-39872
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 · uneditedIn 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 confidenceIn 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.
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>= 14.1.0, < 14.1.7>= 14.2.0, < 14.2.5= 4.3.0CVSS 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 checksWork through these to decide whether this CVE applies to you.
-
Check installed GitLab versionRun `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.
-
Verify password expiration is enabledGo 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.
-
Identify users with expired passwordsUse 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.
-
Check for active personal access tokensIn 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.
-
Identify affected user/token combinationsCross-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.
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 · scoped14.1.714.2.5
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.
14.1.7 or 14.2.5 (or latest stable 14.x/15.x release)
- 1. Backup your GitLab instance database and repositories
- 2. Ensure you have a rollback plan in place
- 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. 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. 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. After upgrade, verify that users with expired passwords can no longer authenticate via git or API using pre-expiration access tokens
- 7. Review and rotate any potentially compromised access tokens
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation6.0 h
- Implementation16.0 h
- Testing10.0 h
- Review / QA6.0 h
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 locallyCheck 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 sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2021-39872 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
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.
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.
- 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