Jinja2 < 3.1.6 Sandbox Bypass (CVE-2025-27516)

high Nessus Plugin ID 326272

Synopsis

A Python library installed on the remote host is affected by a sandbox bypass vulnerability.

Description

The version of Jinja2 installed on the remote host is prior to 3.1.6. It is, therefore, affected by a sandbox bypass vulnerability:

- 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. 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. (CVE-2025-27516)

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number.

Solution

Upgrade to Jinja2 version 3.1.6 or later.

See Also

http://www.nessus.org/u?3dd1deb9

Plugin Details

Severity: High

ID: 326272

File Name: jinja2_CVE-2025-27516.nasl

Version: 1.1

Type: Local

Agent: windows, macosx, unix

Family: Misc.

Published: 7/10/2026

Updated: 7/10/2026

Configuration: Enable thorough checks (optional)

Supported Sensors: Nessus Agent, Nessus

Risk Information

VPR

Risk Factor: Medium

Score: 5

Percentile: 94.41

CVSS v2

Risk Factor: Medium

Base Score: 6.8

Vector: CVSS2#AV:L/AC:L/Au:S/C:C/I:C/A:C

CVSS Score Source: CVE-2025-27516

CVSS v3

Risk Factor: High

Base Score: 8.8

Vector: CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Vulnerability Information

CPE: cpe:/a:palletsprojects:jinja2

Patch Publication Date: 3/5/2025

Vulnerability Publication Date: 3/5/2025

Reference Information

CVE: CVE-2025-27516