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…

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 versions from 3.15.0 up to but not including 3.26.0 contain a code injection vulnerability. This occurs because dynamic attribute syntax can concatenate attacker-controlled strings into macro references without proper validation, leading to execution of raw PHP code at template load time. The issue 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/14/2026, 22:19:24 UTC

Technical Analysis

CVE-2026-46640 is a code injection vulnerability in the Twig PHP template engine affecting versions 3.15.0 through 3.25.x. The vulnerability arises from improper control of code generation where dynamic attribute syntax (_self.(<string>) and import-alias) allows attacker-controlled strings to be concatenated into MacroReferenceExpression names without identifier validation. This results in raw PHP code being emitted and executed during template loading. The vulnerability is resolved in Twig version 3.26.0.

Potential Impact

An attacker can inject and execute arbitrary PHP code during template load time, potentially leading to full system compromise or unauthorized actions within the application context. The vulnerability has a high CVSS 4.0 score of 8.7, indicating significant impact with network attack vector, low attack complexity, no privileges required, and no user interaction needed.

Mitigation Recommendations

Upgrade Twig to version 3.26.0 or later, where this vulnerability is fixed. No official patch or temporary fix is indicated other than upgrading. Since this is not a cloud service, remediation depends on user-side upgrade.

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/14/2026, 22:19:24 UTC

Last updated: 07/14/2026, 22:27:30 UTC

Views: 2

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