UBUNTU-CVE-2025-27516

Source
https://ubuntu.com/security/CVE-2025-27516
Import Source
https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2025/UBUNTU-CVE-2025-27516.json
JSON Data
https://api.test.osv.dev/v1/vulns/UBUNTU-CVE-2025-27516
Related
Published
2025-03-06T00:00:00Z
Modified
2025-03-12T16:40:12Z
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

Ubuntu:Pro:14.04:LTS / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@2.7.2-2ubuntu0.1~esm6?arch=source&distro=esm-infra-legacy/trusty

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.7.2-2ubuntu0.1~esm6

Affected versions

2.*

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 with Legacy support add-on: https://ubuntu.com/pro",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "2.7.2-2ubuntu0.1~esm6",
            "binary_name": "python-jinja2"
        },
        {
            "binary_version": "2.7.2-2ubuntu0.1~esm6",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "2.7.2-2ubuntu0.1~esm6",
            "binary_name": "python3-jinja2"
        }
    ]
}

Ubuntu:Pro:16.04:LTS / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@2.8-1ubuntu0.1+esm5?arch=source&distro=esm-infra/xenial

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.8-1ubuntu0.1+esm5

Affected versions

2.*

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",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "2.8-1ubuntu0.1+esm5",
            "binary_name": "python-jinja2"
        },
        {
            "binary_version": "2.8-1ubuntu0.1+esm5",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "2.8-1ubuntu0.1+esm5",
            "binary_name": "python3-jinja2"
        }
    ]
}

Ubuntu:Pro:18.04:LTS / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@2.10-1ubuntu0.18.04.1+esm4?arch=source&distro=esm-infra/bionic

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.10-1ubuntu0.18.04.1+esm4

Affected versions

2.*

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": "Available with Ubuntu Pro (Infra-only): https://ubuntu.com/pro",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "2.10-1ubuntu0.18.04.1+esm4",
            "binary_name": "python-jinja2"
        },
        {
            "binary_version": "2.10-1ubuntu0.18.04.1+esm4",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "2.10-1ubuntu0.18.04.1+esm4",
            "binary_name": "python3-jinja2"
        }
    ]
}

Ubuntu:20.04:LTS / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@2.10.1-2ubuntu0.5?arch=source&distro=focal

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.10.1-2ubuntu0.5

Affected versions

2.*

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",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "2.10.1-2ubuntu0.5",
            "binary_name": "python-jinja2"
        },
        {
            "binary_version": "2.10.1-2ubuntu0.5",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "2.10.1-2ubuntu0.5",
            "binary_name": "python3-jinja2"
        }
    ]
}

Ubuntu:22.04:LTS / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@3.0.3-1ubuntu0.4?arch=source&distro=jammy

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.0.3-1ubuntu0.4

Affected versions

2.*

2.11.3-1

3.*

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",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "3.0.3-1ubuntu0.4",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "3.0.3-1ubuntu0.4",
            "binary_name": "python3-jinja2"
        }
    ]
}

Ubuntu:24.10 / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@3.1.3-1ubuntu1.24.10.2?arch=source&distro=oracular

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.3-1ubuntu1.24.10.2

Affected versions

3.*

3.1.2-1ubuntu1
3.1.3-1
3.1.3-1ubuntu1
3.1.3-1ubuntu1.24.10.1

Ecosystem specific

{
    "availability": "No subscription required",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "3.1.3-1ubuntu1.24.10.2",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "3.1.3-1ubuntu1.24.10.2",
            "binary_name": "python3-jinja2"
        }
    ]
}

Ubuntu:24.04:LTS / jinja2

Package

Name
jinja2
Purl
pkg:deb/ubuntu/jinja2@3.1.2-1ubuntu1.3?arch=source&distro=noble

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.2-1ubuntu1.3

Affected versions

3.*

3.1.2-1
3.1.2-1ubuntu1
3.1.2-1ubuntu1.1
3.1.2-1ubuntu1.2

Ecosystem specific

{
    "availability": "No subscription required",
    "ubuntu_priority": "medium",
    "binaries": [
        {
            "binary_version": "3.1.2-1ubuntu1.3",
            "binary_name": "python-jinja2-doc"
        },
        {
            "binary_version": "3.1.2-1ubuntu1.3",
            "binary_name": "python3-jinja2"
        }
    ]
}