Ansible Automation PlatformApplication · Redhat

CVE-2021-3681

MEDIUM · 5.5 CVSS v3.1 Published 2022-04-18
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
57/100
Remediation priority · Elevated
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
A flaw was found in Ansible Galaxy Collections. When collections are built manually, any files in the repository directory that are not explicitly excluded via the ``build_ignore`` list in "galaxy.yml" include files in the ``.tar.gz`` file. This contains sensitive info, such as the user's Ansible Galaxy API key and any secrets in ``ansible`` or ``ansible-playbook`` verbose output without the``no_log`` redaction. Currently, there is no way to deprecate a Collection Or delete a Collection Version. Once published, anyone who downloads or installs the collection can view the secrets.

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

When building Ansible Galaxy collections manually, any files in the repository directory not explicitly excluded via the `build_ignore` list in galaxy.yml are included in the generated .tar.gz archive. This inadvertently packages sensitive files such as API keys, credentials, or secrets from verbose output, which become publicly accessible to anyone downloading the collection.

MitigationEnsure all sensitive files are explicitly listed in the `build_ignore` directive in galaxy.yml before building collections, and avoid including secrets in files within the repository directory. Review existing published collections for inadvertent secret exposure.

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
Ansible Automation PlatformApplication
Affected:= 1.2
Ansible GalaxyApplication
Affected:= 3.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
Local
Complexity
Low
Privileges
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS:3.1/AV:L/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. Verify Ansible Galaxy or Automation Platform version
    Run `ansible-galaxy --version` or check the installed version of the ansible-galaxy package
    Affected if The installed version is 3.3.0 for Galaxy or 1.2 for Ansible Automation Platform
  2. Locate galaxy.yml files in collection repositories
    Search for any galaxy.yml files in the repository or collection directories that have been used to build collections
    Affected if A galaxy.yml file exists and was used to build a collection package
  3. Inspect build_ignore configuration
    Open each galaxy.yml file and check if the `build_ignore` directive is defined and lists all sensitive file patterns
    Affected if The build_ignore directive is missing, incomplete, or does not cover sensitive files like *.key, *.pem, credentials, or secrets
  4. Examine built collection archives for sensitive content
    If any .tar.gz archives exist from `ansible-galaxy collection build`, extract them (tar -xzf) and search for files containing keywords like 'password', 'secret', 'key', 'token', 'credential'
    Affected if The archive contains files with sensitive names or content that were not intentionally included for public distribution
  5. Review repository for unignored sensitive files
    Check the repository directory for files that may contain secrets (such as .env files, *-secret.yml, id_rsa, api_keys.txt) and verify they are listed in build_ignore
    Affected if Sensitive files exist in the repository directory but are not explicitly listed in build_ignore in galaxy.yml

A user is affected if they are running the specific affected versions AND have built collections without properly configuring build_ignore in galaxy.yml, resulting in sensitive files being packaged in their published collections.

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
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

Ensure all sensitive files are explicitly listed in the `build_ignore` directive in galaxy.yml before building collections, and avoid including secrets in files within the repository directory. Review existing published collections for inadvertent secret exposure.

Recommended fix Moderate confidence

ansible-core >= 2.12 (or latest stable)

  1. 1. Identify the current version of ansible-core or ansible-galaxy CLI in use by running: ansible-galaxy --version
  2. 2. Upgrade ansible-core to the latest stable release that includes the fix for this vulnerability
  3. 3. If using ansible-builder, ensure it is also updated to the latest version
  4. 4. When building collections in the future, explicitly define a comprehensive build_ignore list in galaxy.yml to exclude sensitive files such as: .git, *.log, *secrets*, *password*, *.key, and any files containing API keys or credentials
  5. 5. Review all existing published collections and regenerate them without any sensitive files included
Caveat Upgrading ansible-core may introduce breaking changes in playbooks; review the changelog for your version

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

Fix this in Ansible Automation Platform Scoped from the published advisory
  • Consultation2.0 h
  • Implementation1.0 h
  • Testing1.0 h
  • Review / QA1.0 h
5.0 hours of engineering $910
Get help mitigating

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

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

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