# CVE-2023-5764: Ansible: template injection

> An attacker can execute arbitrary code via template injection in Ansible by crafting malicious template data, affecting automation platform users.

- **Severity:** High 7.1 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/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:** 12 Dec 2023
- **Updated:** 20 Nov 2025
- **Also known as:** AZL-32158, AZL-34538, CLSA-2024-1716272658, CLSA-2024-1716287930, CLSA-2024-1716485825, CLSA-2025-1761901881, DEBIAN-CVE-2023-5764, GHSA-7j69-qfc3-2fq9, OESA-2025-1391, OESA-2025-1392, OESA-2025-1393, OESA-2025-1394, PYSEC-2026-1122, UBUNTU-CVE-2023-5764, openSUSE-SU-2024:13485-1, openSUSE-SU-2024:13486-1

## What is CVE-2023-5764?

CVE-2023-5764 is a high-severity code injection vulnerability in Fedoraproject Extra Packages for Enterprise Linux, published on 12 Dec 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

A template injection flaw was found in Ansible where a user's controller internal templating operations may remove the unsafe designation from template data. This issue could allow an attacker to use a specially crafted file to introduce templating injection when supplying templating data.

Weakness: CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine)

## Which versions are affected by CVE-2023-5764?

7 open source packages ship an affected version, including ansible-core. It affects 6 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ansible-core` | PyPI | All versions | 2.14.12, 2.15.8, 2.16.1 |
| `ansible-core` | PyPI | All versions | 2.14.12 |
| `ansible-core` | PyPI | All versions | 2.14.12 |
| `ansible-core` | PyPI | From 2.15.0 | 2.15.8 |
| `ansible-core` | PyPI | From 2.15.0 | 2.15.8 |
| `ansible-core` | PyPI | From 2.16.0 | 2.16.1 |
| `ansible-core` | PyPI | From 2.16.0 | 2.16.1 |
| `ansible-documentation` | openSUSE:Tumbleweed | All versions | 2.15.7-1.1 |

Products: Fedoraproject Extra Packages for Enterprise Linux, Fedoraproject Fedora, Redhat Ansible, Redhat Ansible Automation Platform, Redhat Ansible Developer, Redhat Ansible Inside.

## How do I fix CVE-2023-5764?

Upgrade ansible-core to a fixed version for your release line: 2.14.12, 2.15.8 or 2.16.1.

## Is CVE-2023-5764 being exploited?

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

## Other vulnerabilities in Fedoraproject Extra Packages for Enterprise Linux

- [CVE-2023-34152](https://insights.sbomify.com/CVE-2023-34152/): Command injection in ImageMagick (critical 9.8)
- [CVE-2022-4170](https://insights.sbomify.com/CVE-2022-4170/): Code injection in rxvt-unicode (critical 9.8)
- [CVE-2022-40315](https://insights.sbomify.com/CVE-2022-40315/): Moodle Minor SQL injection risk in admin user browsing (critical 9.8)
- [CVE-2022-45152](https://insights.sbomify.com/CVE-2022-45152/): Moodle blind Server-Side Request Forgery (SSRF) vulnerability in LTI provider library (critical 9.1)
- [CVE-2022-24882](https://insights.sbomify.com/CVE-2022-24882/): Server side NTLM does not properly check parameters in FreeRDP (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-5764 and fix it if it is affected.

What it is: CVE-2023-5764 is a high-severity code injection vulnerability in Fedoraproject Extra Packages for Enterprise Linux, published on 12 Dec 2023. 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-2023-5764 in the wild and no public exploit code.

Affected packages and fixed versions:
- ansible-core (PyPI): affected all versions; fixed in 2.14.12, 2.15.8, 2.16.1
- ansible-core (PyPI): affected all versions; fixed in 2.14.12
- ansible-core (PyPI): affected all versions; fixed in 2.14.12
- ansible-core (PyPI): affected from 2.15.0; fixed in 2.15.8
- ansible-core (PyPI): affected from 2.15.0; fixed in 2.15.8
- ansible-core (PyPI): affected from 2.16.0; fixed in 2.16.1
- ansible-core (PyPI): affected from 2.16.0; fixed in 2.16.1

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-2023-5764/ (Markdown: https://insights.sbomify.com/CVE-2023-5764/index.md)
```

## Sources

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

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