# CVE-2021-4041: ansible-runner vulnerable to shell command injection

Source: https://junglewise.ai/threats/cve-2021-4041-ansible-runner-vulnerable-to-shell-command-injection  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-08-24  
License: CC BY 4.0 with a link back

CVE-2021-4041 · Severity: low · CVSS 3.1 · Published 2022-08-24

A flaw was found in ansible-runner. An improper escaping of the shell command, while calling the ansible_runner.interface.run_command, can lead to parameters getting executed as host's shell command. A developer could unintentionally write code that gets executed in the host rather than the virtual environment.

Technologies: [ansible-runner (PyPI)](https://junglewise.ai/threats/technologies/ansible-runner). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2021-4041 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2021-4041 being exploited in the wild.

**How severe is CVE-2021-4041?** Low severity, with a CVSS score of 3.1, published 24 August 2022.

**Which products and versions are affected?** ansible-runner (PyPI) ECOSYSTEM:introduced=0,fixed=2.1.0, GIT:introduced=0,fixed=3533f265f4349a3f2a0283158cd01b59a6bbc7bd|ECOSYSTEM:introduced=0,fixed=2.1.0.

**Is there a fix for CVE-2021-4041?** Yes. ansible-runner (PyPI): upgrade to 2.1.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected by CVE-2021-4041?** Check whether you run ansible-runner (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- ansible-runner (PyPI): upgrade to 2.1.0 or later

  ```sh
  pip install "ansible-runner>=2.1.0"
  ```


## Affected products

- ansible-runner (PyPI) ECOSYSTEM:introduced=0,fixed=2.1.0, GIT:introduced=0,fixed=3533f265f4349a3f2a0283158cd01b59a6bbc7bd|ECOSYSTEM:introduced=0,fixed=2.1.0

## Identifiers

- CVE-2021-4041
- GHSA-6j58-grhv-2769
- PYSEC-2022-253

## Related threats

- [ansible-runner has default temporary files written to world R/W locations](https://junglewise.ai/threats/cve-2021-3701-ansible-runner-has-default-temporary-files-written-to-world-r-w)
- [ansible-runner vulnerable to Race Condition](https://junglewise.ai/threats/cve-2021-3702-ansible-runner-vulnerable-to-race-condition)
