# CVE-2021-20191: Insertion of Sensitive Information into Log File in ansible

> Ansible leaks sensitive credentials in console logs by default, allowing attackers to steal secrets and compromise data confidentiality.

- **Severity:** Medium 5.5 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 26 May 2021
- **Updated:** 3 Aug 2024
- **Also known as:** ALPINE-CVE-2021-20191, CLEANSTART-2026-XW66953, DEBIAN-CVE-2021-20191, GHSA-8f4m-hccc-8qph, PYSEC-2021-124, UBUNTU-CVE-2021-20191

## What is CVE-2021-20191?

CVE-2021-20191 is a medium-severity vulnerability in Redhat Ansible Tower, published on 26 May 2021. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

A flaw was found in ansible. Credentials, such as secrets, are being disclosed in console log by default and not protected by no_log feature when using those modules. An attacker can take advantage of this information to steal those credentials. The highest threat from this vulnerability is to data confidentiality. Versions before ansible 2.9.18 are affected.

Weakness: CWE-532 (Insertion of Sensitive Information into Log File)

## Which versions are affected by CVE-2021-20191?

7 open source packages ship an affected version, including ansible. It affects 8 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ansible` | PyPI | All versions | 2.8.19, 2.9.18, 2.10.7 |
| `ansible` | PyPI | All versions | 2.8.19rc1 |
| `ansible` | PyPI | All versions | 2.8.19rc1 |
| `ansible` | PyPI | From 2.10.0a1 | 2.10.7 |
| `ansible` | PyPI | From 2.10.0a1 | 2.10.7 |
| `ansible` | PyPI | From 2.9.0a1 | 2.9.18rc1 |
| `ansible` | PyPI | From 2.9.0a1 | 2.9.18rc1 |

Products: Oracle Virtualization, Redhat Ansible, Redhat Ansible Tower, Redhat Cisco Nx-Os Collection, Redhat Community General Collection, Redhat Community Network Collection, Redhat Docker Community Collection, Redhat Google Cloud Platform Ansible Collection.

## How do I fix CVE-2021-20191?

Upgrade ansible to a fixed version for your release line: 2.8.19, 2.9.18, 2.10.7 or 2.8.19rc1.

## Is CVE-2021-20191 being exploited?

There is no known exploitation of CVE-2021-20191 in the wild and no public exploit code.

## Other vulnerabilities in Redhat Ansible Tower

- [CVE-2013-3779](https://insights.sbomify.com/CVE-2013-3779/): Other in n/a (high 7.5)
- [CVE-2011-3538](https://insights.sbomify.com/CVE-2011-3538/): Auth bypass in n/a (medium 6.8)
- [CVE-2015-2581](https://insights.sbomify.com/CVE-2015-2581/): Other in n/a (medium 6.4)
- [CVE-2014-2439](https://insights.sbomify.com/CVE-2014-2439/): Other in n/a (medium 6.4)
- [CVE-2020-10775](https://insights.sbomify.com/CVE-2020-10775/): Open redirect in ovirt-engine (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-20191 and fix it if it is affected.

What it is: CVE-2021-20191 is a medium-severity vulnerability in Redhat Ansible Tower, published on 26 May 2021. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-20191 in the wild and no public exploit code.

Affected packages and fixed versions:
- ansible (PyPI): affected all versions; fixed in 2.8.19, 2.9.18, 2.10.7
- ansible (PyPI): affected all versions; fixed in 2.8.19rc1
- ansible (PyPI): affected all versions; fixed in 2.8.19rc1
- ansible (PyPI): affected from 2.10.0a1; fixed in 2.10.7
- ansible (PyPI): affected from 2.10.0a1; fixed in 2.10.7
- ansible (PyPI): affected from 2.9.0a1; fixed in 2.9.18rc1
- ansible (PyPI): affected from 2.9.0a1; fixed in 2.9.18rc1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-20191/ (Markdown: https://insights.sbomify.com/CVE-2021-20191/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-20191
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-20191
- OSV: https://osv.dev/vulnerability/CVE-2021-20191

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-20191/
Summaries are generated and may contain mistakes; the official description above is the record.
