Cyber Posture

CVE-2025-27516

High

Published: 05 March 2025

Published
05 March 2025
Modified
03 November 2025
KEV Added
Patch
CVSS Score 8.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
EPSS Score 0.0012 30.7th percentile
Risk Priority 18 60% EPSS · 20% KEV · 20% CVSS

Description

Adversaries may abuse Python commands and scripts for execution.

Security Summary

CVE-2025-27516 is a sandbox escape vulnerability in Jinja, an extensible templating engine for Python, affecting versions prior to 3.1.6. The issue stems from an oversight in how the Jinja sandboxed environment handles the |attr filter, which allows an attacker controlling the content of a template to execute arbitrary Python code. Specifically, while the sandbox blocks calls to str.format to prevent escapes, the |attr filter can be used to obtain a reference to a string's underlying format method, bypassing these restrictions. This impacts applications that use Jinja to execute untrusted templates.

An attacker must control the content of a template rendered by a vulnerable Jinja instance to exploit this flaw, with feasibility depending on the application's design—such as web apps allowing user-supplied templates. Exploitation enables arbitrary Python code execution within the sandboxed context. The CVSS v3.1 base score of 8.8 (AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H) reflects a local attacker with low privileges requiring low complexity and no user interaction, achieving high impacts on confidentiality, integrity, and availability due to the changed scope.

The vulnerability is fixed in Jinja 3.1.6, where the |attr filter no longer bypasses the environment's attribute lookup restrictions. Official advisories, including the GitHub security advisory (GHSA-cpwx-vrp4-4pq7) and the associated commit, detail the patch. Debian LTS announcements confirm backported fixes for affected distributions. Security practitioners should upgrade to Jinja 3.1.6 or later and audit applications for untrusted template execution.

Details

CWE(s)
CWE-1336

Affected Products

palletsprojects
jinja
≤ 3.1.6
debian
debian linux
11.0

MITRE ATT&CK Enterprise Techniques

T1059.006 Python Execution
Adversaries may abuse Python commands and scripts for execution.
Why these techniques?

The vulnerability directly enables arbitrary Python code execution by bypassing Jinja sandbox restrictions via the |attr filter, mapping to Python scripting interpreter usage.

Confidence: HIGH · MITRE ATT&CK Enterprise v19.0

References