ubuntu-cve-2025-27516
Vulnerability from osv_ubuntu
Jinja is an extensible templating engine. Prior to 3.1.6, an oversight in how the Jinja sandboxed environment interacts with the |attr filter allows an attacker that controls the content of a template to execute arbitrary Python code. To exploit the vulnerability, an attacker needs to control the content of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates. Jinja's sandbox does catch calls to str.format and ensures they don't escape the sandbox. However, it's possible to use the |attr filter to get a reference to a string's plain format method, bypassing the sandbox. After the fix, the |attr filter no longer bypasses the environment's attribute lookup. This vulnerability is fixed in 3.1.6.
{
"affected": [
{
"ecosystem_specific": {
"availability": "Available with Ubuntu Pro with Legacy support add-on: https://ubuntu.com/pro",
"binaries": [
{
"binary_name": "python-jinja2",
"binary_version": "2.7.2-2ubuntu0.1~esm6"
},
{
"binary_name": "python3-jinja2",
"binary_version": "2.7.2-2ubuntu0.1~esm6"
}
]
},
"package": {
"ecosystem": "Ubuntu:Pro:14.04:LTS",
"name": "jinja2",
"purl": "pkg:deb/ubuntu/jinja2@2.7.2-2ubuntu0.1~esm6?arch=source\u0026distro=esm-infra-legacy/trusty"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.7.2-2ubuntu0.1~esm6"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.7-3",
"2.7.1-1",
"2.7.2-1",
"2.7.2-2",
"2.7.2-2ubuntu0.1~esm1",
"2.7.2-2ubuntu0.1~esm2",
"2.7.2-2ubuntu0.1~esm3",
"2.7.2-2ubuntu0.1~esm4"
]
},
{
"ecosystem_specific": {
"availability": "Available with Ubuntu Pro (Infra-only): https://ubuntu.com/pro",
"binaries": [
{
"binary_name": "python-jinja2",
"binary_version": "2.8-1ubuntu0.1+esm5"
},
{
"binary_name": "python3-jinja2",
"binary_version": "2.8-1ubuntu0.1+esm5"
}
]
},
"package": {
"ecosystem": "Ubuntu:Pro:16.04:LTS",
"name": "jinja2",
"purl": "pkg:deb/ubuntu/jinja2@2.8-1ubuntu0.1+esm5?arch=source\u0026distro=esm-infra/xenial"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.8-1ubuntu0.1+esm5"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.8-1",
"2.8-1ubuntu0.1",
"2.8-1ubuntu0.1+esm1",
"2.8-1ubuntu0.1+esm2",
"2.8-1ubuntu0.1+esm3"
]
},
{
"ecosystem_specific": {
"availability": "Available with Ubuntu Pro (Infra-only): https://ubuntu.com/pro",
"binaries": [
{
"binary_name": "python-jinja2",
"binary_version": "2.10-1ubuntu0.18.04.1+esm4"
},
{
"binary_name": "python3-jinja2",
"binary_version": "2.10-1ubuntu0.18.04.1+esm4"
}
]
},
"package": {
"ecosystem": "Ubuntu:Pro:18.04:LTS",
"name": "jinja2",
"purl": "pkg:deb/ubuntu/jinja2@2.10-1ubuntu0.18.04.1+esm4?arch=source\u0026distro=esm-infra/bionic"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.10-1ubuntu0.18.04.1+esm4"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.9.6-1",
"2.10-1",
"2.10-1ubuntu0.18.04.1",
"2.10-1ubuntu0.18.04.1+esm1",
"2.10-1ubuntu0.18.04.1+esm2",
"2.10-1ubuntu0.18.04.1+esm3"
]
},
{
"ecosystem_specific": {
"availability": "No subscription required",
"binaries": [
{
"binary_name": "python-jinja2",
"binary_version": "2.10.1-2ubuntu0.5"
},
{
"binary_name": "python3-jinja2",
"binary_version": "2.10.1-2ubuntu0.5"
}
]
},
"package": {
"ecosystem": "Ubuntu:20.04:LTS",
"name": "jinja2",
"purl": "pkg:deb/ubuntu/jinja2@2.10.1-2ubuntu0.5?arch=source\u0026distro=focal"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.10.1-2ubuntu0.5"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.10-2ubuntu1",
"2.10-2ubuntu2",
"2.10.1-1ubuntu1",
"2.10.1-2",
"2.10.1-2ubuntu0.2",
"2.10.1-2ubuntu0.3",
"2.10.1-2ubuntu0.4"
]
},
{
"ecosystem_specific": {
"availability": "No subscription required",
"binaries": [
{
"binary_name": "python3-jinja2",
"binary_version": "3.0.3-1ubuntu0.4"
}
]
},
"package": {
"ecosystem": "Ubuntu:22.04:LTS",
"name": "jinja2",
"purl": "pkg:deb/ubuntu/jinja2@3.0.3-1ubuntu0.4?arch=source\u0026distro=jammy"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.0.3-1ubuntu0.4"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.11.3-1",
"3.0.1-2",
"3.0.3-1",
"3.0.3-1ubuntu0.1",
"3.0.3-1ubuntu0.2",
"3.0.3-1ubuntu0.3"
]
},
{
"ecosystem_specific": {
"availability": "No subscription required",
"binaries": [
{
"binary_name": "python3-jinja2",
"binary_version": "3.1.2-1ubuntu1.3"
}
]
},
"package": {
"ecosystem": "Ubuntu:24.04:LTS",
"name": "jinja2",
"purl": "pkg:deb/ubuntu/jinja2@3.1.2-1ubuntu1.3?arch=source\u0026distro=noble"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.1.2-1ubuntu1.3"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"3.1.2-1",
"3.1.2-1ubuntu1",
"3.1.2-1ubuntu1.1",
"3.1.2-1ubuntu1.2"
]
}
],
"aliases": [],
"details": "Jinja is an extensible templating engine. Prior to 3.1.6, an oversight in how the Jinja sandboxed environment interacts with the |attr filter allows an attacker that controls the content of a template to execute arbitrary Python code. To exploit the vulnerability, an attacker needs to control the content of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates. Jinja\u0027s sandbox does catch calls to str.format and ensures they don\u0027t escape the sandbox. However, it\u0027s possible to use the |attr filter to get a reference to a string\u0027s plain format method, bypassing the sandbox. After the fix, the |attr filter no longer bypasses the environment\u0027s attribute lookup. This vulnerability is fixed in 3.1.6.",
"id": "UBUNTU-CVE-2025-27516",
"modified": "2026-01-20T05:27:23Z",
"published": "2025-03-06T00:00:00Z",
"references": [
{
"type": "REPORT",
"url": "https://ubuntu.com/security/CVE-2025-27516"
},
{
"type": "REPORT",
"url": "https://www.cve.org/CVERecord?id=CVE-2025-27516"
},
{
"type": "REPORT",
"url": "https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403"
},
{
"type": "REPORT",
"url": "https://github.com/pallets/jinja/security/advisories/GHSA-cpwx-vrp4-4pq7"
},
{
"type": "ADVISORY",
"url": "https://ubuntu.com/security/notices/USN-7343-1"
}
],
"related": [
"USN-7343-1"
],
"schema_version": "1.7.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
},
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
},
{
"score": "medium",
"type": "Ubuntu"
}
],
"upstream": [
"CVE-2025-27516"
]
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.