CVE-2026-46634
published 2026-07-14CVE-2026-46634: Twig is a template language for PHP. From 3.9.0 until 3.26.0, template_from_string() compiles an inner template under a synthesized __string_template__ name…
PriorityP348critical9.8CVSS 3.1
AVNACLPRNUINSUCHIHAH
EPSS
0.62%
47.9th percentile
Twig is a template language for PHP. From 3.9.0 until 3.26.0, template_from_string() compiles an inner template under a synthesized __string_template__ name that can fall outside a SourcePolicyInterface sandbox decision, allowing a sandboxed template that can call template_from_string and include to render an inner template without security policy enforcement. This issue is fixed in version 3.26.0.
Affected
3 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| symfony | twig | >= 3.9.0 < 3.26.0 | 3.26.0 |
| twig | twig | >= 3.9.0 < 3.26.0 | 3.26.0 |
| twigphp | twig | — | — |
CVSS provenance
nvdv3.19.8CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
nvdv4.07.7HIGHCVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
VulDB
twigphp Twig up to 3.25.x SourcePolicyInterface template_from_string sandbox
vuldb·2026-07-30·CVSS 9.8
CVE-2026-46634 [CRITICAL] twigphp Twig up to 3.25.x SourcePolicyInterface template_from_string sandbox
A vulnerability was found in twigphp Twig up to 3.25.x and classified as critical. This affects the function template_from_string of the component SourcePolicyInterface Handler. The manipulation results in sandbox issue.
This vulnerability was named CVE-2026-46634. The attack may be performed from remote. There is no available exploit.
It is suggested to upgrade the affected component.
GHSA
Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name
ghsa·2026-05-21
CVE-2026-46634 [MEDIUM] CWE-693 Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name
Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name
### Description
When the sandbox is enabled selectively via `SourcePolicyInterface` (and not globally), a sandboxed template that is allowed to call `template_from_string` and `include` can render an arbitrary inner template with no security policy enforcement.
`Environment::createTemplate()` compiles the inner string under a synthesized name (`__string_template__`), so a name/path-based `SourcePolicy` returns `false` for it, and the inner template's `checkSecurity()` becomes a no-op. From a template the integrator believes is sandboxed, an attacker can use any tag/filter/function (including `constant()` to read secrets, or `|map("system")` to execute shell commands).
### Resolution
This
No detection rules found.
No public exploits indexed.
No writeups or analysis indexed.
2026-07-14
Published