Twig: PHP code injection via `{% use %}` template name
Key facts
- Attack vector
- Network
- Privileges required
- Low
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-94.
Summary
Twig is a template language for PHP. Starting in 1.15.1 and prior to 3.26.0, Compiler::string() does not escape single quotes when a template name from a {% use %} tag is placed inside a PHP single-quoted string literal, allowing a crafted template name to terminate the string and inject arbitrary PHP expressions into the compiled cache file. This issue is fixed in version 3.26.0.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| symfony | Twig | 1.15.1 to before 3.26.0 | 3.26.0 | Patch available | CNA |
| — | twig/twig (Packagist) | 1.15.1 to before 3.26.0 | 3.26.0 | Patch available | GHSA-7p85-w9px-jpjp |
- Twig Vendorsymfony Affected 1.15.1 to before 3.26.0 Fixed in 3.26.0 Patch available CNA
- twig/twig (Packagist) Vendor— Affected 1.15.1 to before 3.26.0 Fixed in 3.26.0 Patch available GHSA-7p85-w9px-jpjp
Remediation
- Fix · CNA Twig (twigphp) Fixed in 3.26.0
- Fix · GHSA-7p85-w9px-jpjp twig/twig (Packagist) Fixed in 3.26.0 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2026-46633
- 2026-10-03 Alias added: GHSA-7p85-w9px-jpjp
- 2026-11-04 Affected versions changed · CNA
- 2026-11-04 4 new references · CNA
- 2026-11-04 Affected versions changed · GHSA-7p85-w9px-jpjp
- 2026-11-04 CVSS score changed · GHSA-7p85-w9px-jpjp
- 2026-11-04 6 new references · GHSA-7p85-w9px-jpjp
References
Patch 2
Advisory 2
Other 6
- https://github.com/twigphp/Twig/commit/a2c6db7ea7d2c90923e6708019ec1442526d1c30
- https://gist.github.com/vladko312/d61b950f168c791db4786b83dc7a81e6
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-46633.yaml
- https://github.com/twigphp/Twig/releases/tag/v3.26.0
- https://symfony.com/cve-2026-46633
- https://github.com/twigphp/Twig
More symfony Twig vulnerabilities
- TI-2026-34283 Twig: The `spaceless` filter implicitly marks its output as safe CVSS 4.0MEDIUM 5.1
- TI-2022-07667 Code injection in Twig CVSS 3.1CRITICAL 9.8
- TI-2018-10028 Twig before 2.4.4 allows Server-Side Template Injection (SSTI) via the search search_key… CVSS 3.0CRITICAL 9.8
- TI-2022-18637 Twig may load a template outside a configured directory when using the filesystem loader CVSS 3.1HIGH 7.5
- TI-2026-34292 Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation CVSS 4.0HIGH 8.7
- TI-2026-19691 Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface CVSS 4.0HIGH 8.7
Sources
- CVE-2026-46633 · CVE Program
- CVE-2026-46633 · NVD
- FIRST EPSS
- GHSA-7p85-w9px-jpjp · GitHub Advisory Database · CC BY 4.0
- CVE-2026-46633 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences