CVE-2026-46640 — Vulnerability in twig/twig — CVE Details
Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation
Summary
Advisory Timeline
- First published May 21, 2026 (144 days ago).
- Last revised September 10, 2026 — 111 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
composer require "twig/twig:^3.26.0"
After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: packagist (1).
| Package | Ecosystem | Affected | Fixed In |
|---|---|---|---|
| twig/twig | packagist | v3.15.0, v3.16.0, v3.17.0, v3.17.1 (+11 more) | 3.26.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-94Code InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.
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
References
- https://github.com/twigphp/Twig/security/advisories/GHSA-45vw-wh46-2vx8WEB
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-46640.yamlWEB
- https://github.com/twigphp/TwigPACKAGE
- https://github.com/vladko312/extras/blob/main/CVE-2026-46640.pyWEB
- https://symfony.com/cve-2026-46640WEB
Frequently Asked Questions
- What is CVE-2026-46640?
- Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.8/10).
- How do I check if my project is affected by CVE-2026-46640?
- CVE-2026-46640 affects twig/twig. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-46640 and 200,000+ other known vulnerabilities.
Severity & Exploitability
High exploitability or significant impact. Prioritize remediation within days.
Also Known As
Related CVEs
- CVE-2026-46633CRITICAL
Twig: PHP code injection via `{% use %}` template name
- CVE-2026-24425HIGH
Twig: Possible sandbox bypass when using a source policy
- CVE-2026-46639HIGH
Twig: Sandbox property and method bypass via object-destructuring assignment
- CVE-2026-65954HIGH
PHPCSUtils: Remote code execution via eval() in AbstractArrayDeclarationSniff::getActualArrayKey()
- CVE-2026-61825HIGH
code16/sharp has a stored XSS via data-html-content Sanitizer Bypass
- CVE-2024-45411MEDIUM
Twig has a possible sandbox bypass
- CVE-2026-46638MEDIUM
Twig: `{% sandbox %}{% include %}` skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411)
Check if you're affected
Scan your dependencies to see if this vulnerability affects your projects.
Scan Your Dependencies