CVE-2023-5764: Ansible core Ansible Template Injection Vulnerability Vulnerability
MODERATECVE-2023-5764 is a MODERATE (CVSS 6.6) ansible template injection vulnerability vulnerability (CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine) affecting Ansible core libraries in the PyPI ecosystem. The issue involves ansible template injection vulnerability. Remediation is available by upgrading affected packages to version 2.16.1, 2.15.8, 2.14.12.
CVE-2023-5764 at a Glance
Security Impact
CVSS: 6.6
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N).
How to Fix CVE-2023-5764
To remediate this vulnerability, upgrade all affected Ansible core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install ansible-core>=2.16.1
pip install ansible-core>=2.15.8
pip install ansible-core>=2.14.12
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show ansible-core
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2023-5764, inspect your installed packages using pip:
pip show ansible-core
Analyze the terminal output to locate any version of Ansible core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.16.1), your application is affected.
Note: The pip show ansible-core command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine, where the product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. In Ansible core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-5764 Affected Ansible core Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ansible-core
|
PyPI |
≥ 2.16.0
< 2.16.1
|
2.16.1
|
|
ansible-core
|
PyPI |
≥ 2.15.0
< 2.15.8
|
2.15.8
|
|
ansible-core
|
PyPI |
< 2.14.12
|
2.14.12
|
References
Frequently Asked Questions
What is CVE-2023-5764?
Which Ansible core versions are affected?
What version fixes CVE-2023-5764?
Is ansible-core affected?
What is the CVSS score of CVE-2023-5764?
What CWE is associated with CVE-2023-5764?
How can I check PyPI dependencies for CVE-2023-5764?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7j69-qfc3-2fq9",
"modified" : "2024-09-16T21:08:57Z",
"published" : "2023-12-13T00:30:37Z",
"aliases" : [ "CVE-2023-5764" ],
"summary" : "Ansible template injection vulnerability",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "ansible-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.16.0"
}, {
"fixed" : "2.16.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "ansible-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.15.0"
}, {
"fixed" : "2.15.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "ansible-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.14.12"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-5764"
}, {
"type" : "WEB",
"url" : "https://github.com/ansible/ansible/commit/270b39f6ff02511a2199505161218cbd1a5ae34f"
}, {
"type" : "WEB",
"url" : "https://github.com/ansible/ansible/commit/7239d2d371bc6e274cbb7314e01431adce6ae25a"
}, {
"type" : "WEB",
"url" : "https://github.com/ansible/ansible/commit/fea130480d261ea5bf6fcd5cf19a348f1686ceb1"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2023:7773"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/security/cve/CVE-2023-5764"
}, {
"type" : "WEB",
"url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2247629"
}, {
"type" : "WEB",
"url" : "https://github.com/ansible/ansible"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/X7Q6CHPVCHMZS5M7V22GOKFSXZAQ24EU"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-12-20T20:30:30Z",
"nvd_published_at" : "2023-12-12T22:15:22Z"
}
}