VDB

CVE-2025-27516

CVE-2025-27516 PUBLISHED CVSS 5.4 MEDIUM

Jinja sandbox breakout through attr filter selecting format method

Reported by github_m · Published March 5, 2025

Jinja2 is fixed in 3.1.6 (PyPI)

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.

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
Jinja2PyPI3.1.6
grafana-oncallWolfi1.15.2-r1
jupyter-docker-stacksChainguard999.9.9_git20260925-r0
py3.10-vllm-cuda-11.8Chainguard0.7.3-r1
py3.10-vllm-cuda-12.6Chainguard0.7.3-r1
tensorflow-cpu-jupyterChainguard2.18.0-r1
reflexChainguard0.7.2-r0
python-jinja2Amazon Linux2.7.2-3.amzn2.0.4
py3.9-torchvision-cuda-12.3Chainguard0.18.1-r2
grafana-oncallChainguard1.15.2-r1
py3.10-torchvision-cuda-12.3Chainguard0.18.1-r4
python3-jinja2Amazon Linux2.11.3-1.amzn2023.0.6

17 more packages have a fixed version. See every fix in Lookup.

Risk scores

CVSS 4.0
5.4
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

Affected products

VendorProductVersions
palletsjinja< 3.1.6
wolfigrafana-oncall0
chainguardjupyter-docker-stacks0
PyPIJinja20
chainguardpy3.10-vllm-cuda-11.80
chainguardpy3.10-vllm-cuda-12.60
chainguardtensorflow-cpu-jupyter0
chainguardreflex0
amazon:2python-jinja20
chainguardpy3.9-torchvision-cuda-12.30
chainguardgrafana-oncall0
chainguardpy3.10-torchvision-cuda-12.30
amazon:2023python3-jinja20
wolfitensorflow-cpu-jupyter0
chainguardtext-generation-inference0
chainguardpy3.9-torchvision-cuda-11.80
chainguardpy3.11-torchaudio-cuda-12.30
wolficheckov0
wolfijupyter-docker-stacks0, 0
chainguardcheckov0

…and 17 more

Timeline

  • Mar 5, 2025 CVE Published
  • Mar 6, 2025 EPSS Score (30 in total, the first dated here)
  • Mar 10, 2026 Security Advisory (32 in total, the first dated here)
  • Mar 25, 2026 CVE Updated
  • Jun 15, 2026 Coalition ESS Score
  • Nov 15, 2026 Distribution Patch (29 in total, the first dated here)

Query this with the API

The same record, from the CLI:

vulnetix vdb vuln CVE-2025-27516
vulnetix vdb fixes CVE-2025-27516

Or with curl, using the org id and key from your account page:

curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
  "https://api.vdb.vulnetix.com/v2/vuln/CVE-2025-27516/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›