Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface
Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-24425
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 4 Nov 2026, 09:04 UTC · Revision 1
Source evidence
Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface
core-osv · Original sourcePublished 20 May 2026, 13:45 UTC
Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.
osv:CVE-2026-24425
Complete source record
{
"id": "a30ad85c2b9a3a2511b51194e15c4e71decdd0078283c4168dbce7b104f71243",
"url": "https://osv.dev/vulnerability/CVE-2026-24425",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface",
"summary": "Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.",
"evidence": "osv:CVE-2026-24425",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2026-24425",
"aliases": [
"CVE-2026-24425",
"GHSA-2q52-x2ff-qgfr"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/twigphp/twig",
"type": "GIT",
"events": [
{
"introduced": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623"
},
{
"last_affected": "19185947ec75d433a3ac650af32fc05649b95ee1"
},
{
"introduced": "47857eebb197745f66369b76c044a2359e3cc5b9"
},
{
"fixed": "1fcae487b180d78e6351f4e0afa91f9eab96a2bc"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.16.0"
},
{
"last_affected": "2.16.1"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "3.9.0"
},
{
"fixed": "3.26.0"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "1fcae487b180d78e6351f4e0afa91f9eab96a2bc"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v3.26.0"
}
]
}
}
],
"versions": [
"2.16.*",
"v3.25.0",
"v3.24.0",
"v3.23.0",
"v3.22.2",
"v3.22.1",
"v3.22.0",
"v3.21.1",
"v3.21.0",
"v3.20.0",
"v3.19.0",
"v3.18.0",
"v3.17.1",
"v3.17.0",
"v3.16.0",
"v3.15.0",
"v3.14.0",
"v3.11.0",
"v2.16.1",
"v3.13.0",
"v3.12.0",
"v3.10.3",
"v3.10.2",
"v3.10.1",
"v3.10.0",
"v3.9.3",
"v3.9.2",
"v3.9.1",
"v3.9.0",
"v2.16.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-24425.json"
}
}
],
"modified": "2026-10-28T02:30:34.109963221Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/24xxx/CVE-2026-24425.json",
"https://github.com/twigphp/Twig/releases/tag/v3.26.0",
"https://github.com/twigphp/Twig/security/advisories/GHSA-2q52-x2ff-qgfr",
"https://nvd.nist.gov/vuln/detail/CVE-2026-24425",
"https://www.vulncheck.com/advisories/twig-x-x-sandbox-bypass-via-sourcepolicyinterface",
"https://github.com/twigphp/Twig"
],
"provider_metadata": {
"cwe_ids": [
"CWE-693"
],
"cna_assigner": "VulnCheck",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/24xxx/CVE-2026-24425.json"
}
},
"related_cves": [
{
"value": "CVE-2026-24425",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 501317,
"published_at": "2026-05-20T13:45:02.413+00:00"
}