CVE-2025-27516

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-27516
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-27516.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-27516
Aliases
Related
Published
2025-03-05T21:15:20Z
Modified
2025-03-31T05:59:38.065868Z
Downstream
Summary
[none]
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'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.

References

Affected packages

Alpine:v3.18 / py3-jinja2

Package

Name
py3-jinja2
Purl
pkg:apk/alpine/py3-jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.6-r0

Affected versions

2.*

2.5.5-r0
2.5.5-r1
2.5.5-r2
2.5.5-r3
2.6-r0
2.7-r0
2.7-r1
2.7.1-r0
2.7.2-r0
2.7.3-r0
2.8-r0
2.8-r1
2.9.4-r0
2.9.4-r1
2.9.6-r0
2.10-r0
2.10-r1
2.10-r2
2.10-r3
2.10.1-r0
2.10.3-r0
2.11.0-r0
2.11.1-r0
2.11.2-r0
2.11.3-r0
2.11.3-r1

3.*

3.0.0-r0
3.0.1-r0
3.0.1-r1
3.0.3-r0
3.0.3-r1
3.1.1-r0
3.1.2-r0
3.1.2-r1
3.1.2-r2
3.1.4-r0
3.1.5-r0

Alpine:v3.19 / py3-jinja2

Package

Name
py3-jinja2
Purl
pkg:apk/alpine/py3-jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.6-r0

Affected versions

2.*

2.5.5-r0
2.5.5-r1
2.5.5-r2
2.5.5-r3
2.6-r0
2.7-r0
2.7-r1
2.7.1-r0
2.7.2-r0
2.7.3-r0
2.8-r0
2.8-r1
2.9.4-r0
2.9.4-r1
2.9.6-r0
2.10-r0
2.10-r1
2.10-r2
2.10-r3
2.10.1-r0
2.10.3-r0
2.11.0-r0
2.11.1-r0
2.11.2-r0
2.11.3-r0
2.11.3-r1

3.*

3.0.0-r0
3.0.1-r0
3.0.1-r1
3.0.3-r0
3.0.3-r1
3.1.1-r0
3.1.2-r0
3.1.2-r1
3.1.2-r2
3.1.2-r3
3.1.4-r0
3.1.5-r0

Alpine:v3.20 / py3-jinja2

Package

Name
py3-jinja2
Purl
pkg:apk/alpine/py3-jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.6-r0

Affected versions

2.*

2.5.5-r0
2.5.5-r1
2.5.5-r2
2.5.5-r3
2.6-r0
2.7-r0
2.7-r1
2.7.1-r0
2.7.2-r0
2.7.3-r0
2.8-r0
2.8-r1
2.9.4-r0
2.9.4-r1
2.9.6-r0
2.10-r0
2.10-r1
2.10-r2
2.10-r3
2.10.1-r0
2.10.3-r0
2.11.0-r0
2.11.1-r0
2.11.2-r0
2.11.3-r0
2.11.3-r1

3.*

3.0.0-r0
3.0.1-r0
3.0.1-r1
3.0.3-r0
3.0.3-r1
3.1.1-r0
3.1.2-r0
3.1.2-r1
3.1.2-r2
3.1.2-r3
3.1.3-r0
3.1.3-r1
3.1.4-r0
3.1.5-r0

Alpine:v3.21 / py3-jinja2

Package

Name
py3-jinja2
Purl
pkg:apk/alpine/py3-jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.6-r0

Affected versions

2.*

2.5.5-r0
2.5.5-r1
2.5.5-r2
2.5.5-r3
2.6-r0
2.7-r0
2.7-r1
2.7.1-r0
2.7.2-r0
2.7.3-r0
2.8-r0
2.8-r1
2.9.4-r0
2.9.4-r1
2.9.6-r0
2.10-r0
2.10-r1
2.10-r2
2.10-r3
2.10.1-r0
2.10.3-r0
2.11.0-r0
2.11.1-r0
2.11.2-r0
2.11.3-r0
2.11.3-r1

3.*

3.0.0-r0
3.0.1-r0
3.0.1-r1
3.0.3-r0
3.0.3-r1
3.1.1-r0
3.1.2-r0
3.1.2-r1
3.1.2-r2
3.1.2-r3
3.1.3-r0
3.1.3-r1
3.1.4-r0
3.1.5-r0

Debian:11 / jinja2

Package

Name
jinja2
Purl
pkg:deb/debian/jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

2.*

2.11.3-1
2.11.3-1+deb11u1
2.11.3-1+deb11u2

3.*

3.0.1-1
3.0.1-2
3.0.3-1~bpo11+1
3.0.3-1
3.0.3-2
3.1.2-1
3.1.3-1
3.1.3-1.1
3.1.3-2
3.1.5-1
3.1.5-2
3.1.6-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:12 / jinja2

Package

Name
jinja2
Purl
pkg:deb/debian/jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

3.*

3.1.2-1
3.1.2-1+deb12u1
3.1.2-1+deb12u2
3.1.3-1
3.1.3-1.1
3.1.3-2
3.1.5-1
3.1.5-2
3.1.6-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / jinja2

Package

Name
jinja2
Purl
pkg:deb/debian/jinja2?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.6-1

Affected versions

3.*

3.1.2-1
3.1.3-1
3.1.3-1.1
3.1.3-2
3.1.5-1
3.1.5-2

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Git / github.com/pallets/jinja

Affected ranges

Type
GIT
Repo
https://github.com/pallets/jinja
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Fixed

Affected versions

2.*

2.0
2.0rc1
2.1
2.1.1
2.10
2.10.1
2.10.2
2.10.3
2.10.x
2.11.0
2.11.1
2.11.2
2.11.3
2.11.x
2.2
2.2.1
2.3
2.3.1
2.4
2.4.1
2.5
2.5.1
2.5.3
2.5.4
2.5.5
2.6
2.7
2.7.1
2.7.2
2.7.3
2.8
2.8.1
2.9
2.9.1
2.9.2
2.9.3
2.9.4
2.9.5
2.9.6
2.9.x

3.*

3.0.0
3.0.0a1
3.0.0rc1
3.0.0rc2
3.0.1
3.0.2
3.0.3
3.0.x
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5