# CVE-2017-7481: Ansible fails to properly mark lookup-plugin results as unsafe

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.3
- **CVSS:** 5.3 (v3.0, CNA) `CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: None; User interaction: Required; Scope: Unchanged; Confidentiality impact: None; Integrity impact: High; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 4.58% (percentile 92, 2026-11-26)
- **CWE:** CWE-20
- **Aliases:** GHSA-w578-j992-554x, PYSEC-2018-41
- **Published:** 2018-07-19T13:00:00.000Z
- **Modified:** 2026-06-17T01:24:26.090Z

## Who should check

- Projects that depend on PyPI package ansible (\>= 2.3.0.0, \< 2.3.1.0)
- Anyone running \[UNKNOWN\] ansible ansible 2.3.1.0; ansible 2.4.0.0

## Description

Ansible before versions 2.3.1.0 and 2.4.0.0 fails to properly mark lookup-plugin results as unsafe. If an attacker could control the results of lookup() calls, they could inject Unicode strings to be parsed by the jinja2 templating system, resulting in code execution. By default, the jinja2 templating language is now marked as 'unsafe' and is not evaluated.

## Affected and fixed versions

- PyPI `ansible`: affected \>= 2.3.0.0, \< 2.3.1.0; fixed 2.3.1.0, 2.1.6.0, 2.2.3.0, 2.4.0.0 (osv)
- \[UNKNOWN\] ansible: ansible 2.3.1.0; ansible 2.4.0.0 (cvelist)

## Mitigation

- Upgrade ansible to one of 2.3.1.0, 2.1.6.0, 2.2.3.0, 2.4.0.0 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2017-7481. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2017-7481.md
Affected: ansible >= 2.3.0.0, < 2.3.1.0
Fixed in: 2.3.1.0, 2.1.6.0, 2.2.3.0, 2.4.0.0

Steps:
1. Search this machine and project for ansible (PyPI), [UNKNOWN] ansible: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2017-7481 being exploited?

There is no confirmed exploitation: CVE-2017-7481 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 4.58% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2017-7481?

Medium: CVSS 5.3 (v3.0, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2017-7481?

ansible \>= 2.3.0.0, \< 2.3.1.0.

### Is there a fix for CVE-2017-7481?

Yes. Fixed in 2.3.1.0, 2.1.6.0, 2.2.3.0, 2.4.0.0. Upgrade ansible to one of 2.3.1.0, 2.1.6.0, 2.2.3.0, 2.4.0.0 (or later in the same release line).

### How do I check if I'm affected by CVE-2017-7481?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://access.redhat.com/errata/RHSA-2017:1599>
- vendor: <https://access.redhat.com/errata/RHSA-2017:1334>
- vendor: <https://access.redhat.com/errata/RHSA-2017:1244>
- vendor: <https://access.redhat.com/errata/RHSA-2017:1499>
- vendor: <https://access.redhat.com/errata/RHSA-2017:2524>
- vendor: <https://access.redhat.com/errata/RHSA-2017:1476>
- vendor: <https://usn.ubuntu.com/4072-1/>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2017-7481>
- vendor: <https://github.com/advisories/GHSA-w578-j992-554x>
- patch: <https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-7481>
- patch: <https://github.com/ansible/ansible/commit/ed56f51f185a1ffd7ea57130d260098686fcc7c2>
- patch: <https://github.com/ansible/ansible/commit/fd30f5328986f9e1da434474481f32bf918a600c>
- patch: <https://github.com/ansible/ansible/commit/f0e348f5eeb70c1fb3127d90891da43b5c0a9d29>
- patch: <https://github.com/ansible/ansible/commit/a1886911fcf4b691130cfc70dfc5daa5e07c46a3>
- other: <http://www.securityfocus.com/bid/98492>
- other: <https://lists.debian.org/debian-lts-announce/2021/01/msg00023.html>
- other: <https://web.archive.org/web/20170801122609/http://www.securityfocus.com/bid/98492>
- other: <https://usn.ubuntu.com/4072-1>
- other: <https://github.com/pypa/advisory-database/tree/main/vulns/ansible/PYSEC-2018-41.yaml>
- other: <https://github.com/ansible/ansible>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2017-7481>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-w578-j992-554x> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2018-41> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2017-7481> · JSON: <https://flawdb.com/api/v1/entries/CVE-2017-7481>
