GitLabApplication

CVE-2021-22257

MEDIUM · 5.3 CVSS v3.1 Published 2021-10-05
Fix available
A fix is available. Upgrade to 14.0.9 / 14.1.4 or later.
See remediation →
62/100
Remediation priority · Elevated
Remotely reachable No privileges 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
An issue has been discovered in GitLab affecting all versions starting from 14.0 before 14.0.9, all versions starting from 14.1 before 14.1.4, all versions starting from 14.2 before 14.2.2. The route for /user.keys is not restricted on instances with public visibility disabled. This allows user enumeration on such instances.

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

GitLab versions 14.0.x before 14.0.9, 14.1.x before 14.1.4, and 14.2.x before 14.2.2 have an improper access control vulnerability where the /user.keys endpoint remains accessible even when public visibility is disabled on the instance. This allows unauthenticated attackers to enumerate valid usernames by querying this endpoint and receiving different responses for existing versus non-existing users.

MitigationUpgrade GitLab to version 14.0.9, 14.1.4, or 14.2.2 or later. Alternatively, configure web application firewall rules to restrict unauthenticated access to the /user.keys endpoint until upgrade can be performed.

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.0.0, < 14.0.9>= 14.1.0, < 14.1.4>= 14.2.0, < 14.2.2

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
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/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. Determine installed GitLab version
    Run 'gitlab-rake gitlab:env:info' or check /opt/gitlab/version to find the exact GitLab version installed
    Affected if Version is 14.0.0-14.0.8, 14.1.0-14.1.3, or 14.2.0-14.2.1
  2. Check public visibility settings
    Navigate to Admin Area > Settings > Visibility and Controls > General > Visibility and access controls, or inspect gitlab.yml configuration for 'default_projects_limit' or 'restricted_visibility_levels' settings
    Affected if Public visibility is disabled but /user.keys remains accessible
  3. Test unauthenticated access to /user.keys
    Send a GET request to https://YOUR_GITLAB_URL/user.keys without authentication (no login token)
    Affected if Endpoint returns HTTP 200 with key data or different response for existing vs non-existing usernames (valid usernames return specific response, non-existing return 404 or empty)
  4. Verify username enumeration is possible
    Compare responses from /user.keys?username=VALID_USER vs /user.keys?username=NONEXISTENT_USER - look for differences in HTTP status code or response body
    Affected if Different responses are returned allowing attacker to confirm valid usernames without authentication

You are affected if GitLab version is 14.0.x < 14.0.9, 14.1.x < 14.1.4, or 14.2.x < 14.2.2 AND the /user.keys endpoint responds to unauthenticated requests with username-dependent responses.

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.0.9 / 14.1.4 / 14.2.2 or later
Fixed in 14.0.914.1.414.2.2
Interim mitigation

Upgrade GitLab to version 14.0.9, 14.1.4, or 14.2.2 or later. Alternatively, configure web application firewall rules to restrict unauthenticated access to the /user.keys endpoint until upgrade can be performed.

Recommended fix High confidence

Upgrade to GitLab 14.0.9, 14.1.4, or 14.2.2 (or later stable release)

  1. Identify your current GitLab version by checking the GitLab administration panel or running `gitlab-rake gitlab:env:info`
  2. Determine which version branch you are on (14.0.x, 14.1.x, or 14.2.x)
  3. Upgrade GitLab to the appropriate fixed version: 14.0.9, 14.1.4, or 14.2.2
  4. For Omnibus installations: Run `sudo gitlab-ctl restart` after upgrade
  5. For source installations: Restart the GitLab service after upgrade
  6. Verify the upgrade was successful and the /user.keys route is now restricted
Caveat Standard upgrade precautions apply - review release notes for your version branch for any known issues

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

Fix this in GitLab Scoped from the published advisory
  • Consultation2.0 h
  • Implementation1.0 h
  • Testing2.0 h
  • Review / QA1.0 h
6.0 hours of engineering $1,060
Get the upgrade done

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

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2021-22257 — 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-22257 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