Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…
EPSS 0.6%top 52%

CVE-2026-46640: CWE-94: Improper Control of Generation of Code ('Code Injection') in twigphp Twig

0
High
VulnerabilityCVE-2026-46640cvecve-2026-46640cwe-94
Published: 07/14/2026 (07/14/2026, 21:22:57 UTC)
Source: CVE Database V5
Vendor/Project: twigphp
Product: Twig

Description

Twig, a PHP template language, has a code injection vulnerability (CWE-94) in versions from 3.15.0 up to but not including 3.26.0. The issue arises from improper validation of dynamic attribute syntax that allows attacker-controlled strings to be concatenated into MacroReferenceExpression names, resulting in raw PHP code execution at template load time. This vulnerability is rated high severity with a CVSS score of 8.7. The vulnerability is fixed in version 3.26.0.

CVSS v4.0

Score 8.7high

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
Low
User Interaction
None
Vuln. Confidentiality
High
Vuln. Integrity
High
Vuln. Availability
High
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
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 software

Affected versions
>=3.15.0 <3.26.0

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 07/22/2026, 23:08:59 UTC

Technical Analysis

CVE-2026-46640 describes a code injection vulnerability in Twig versions >=3.15.0 and <3.26.0. The flaw occurs because the _self.(<string>) and import-alias dynamic attribute syntax can incorporate attacker-controlled strings into MacroReferenceExpression names without proper identifier validation. This leads to raw PHP code being emitted into the generated template source and executed when the template loads. The vulnerability allows remote code execution with no user interaction required and low attack complexity, but requires some privileges (PR:L). The issue is resolved in Twig 3.26.0.

Potential Impact

An attacker able to supply crafted input to the vulnerable Twig template syntax can cause arbitrary PHP code execution at template load time. This can lead to full compromise of the application environment running Twig templates. The vulnerability has a high CVSS score (8.7) indicating significant impact, including high confidentiality, integrity, and availability impacts.

Mitigation Recommendations

This vulnerability is fixed in Twig version 3.26.0. Users should upgrade to version 3.26.0 or later to remediate this issue. No other official remediation or temporary fix is indicated. Patch status is confirmed by the vendor advisory stating the issue is fixed in 3.26.0.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-05-15T20:11:54.584Z
Cvss Version
4.0
State
PUBLISHED
Remediation Level
null

Threat ID: 6a56aea268715ace4342b10b

Added to database: 07/14/2026, 21:48:18 UTC

Last enriched: 07/22/2026, 23:08:59 UTC

Last updated: 08/26/2026, 22:52:11 UTC

Views: 58

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses