Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2026-46634— Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name

Quick assessment

Affected
twigphp Twig
Exploitation
Public or AI PoC available; prioritize validation
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

twigphp Twig是twigphp的PHP模板引擎。 twigphp Twig 3.9.0版本至3.26.0之前版本存在处理逻辑错误漏洞,该漏洞源于模板编译时使用了合成的__string_template__\<hash\>名称,可能绕过SourcePolicyInterface沙箱决策,允许沙箱化模板调用template_from_string和include渲染内部模板且无需安全策略执行。

CVSS 7.7 · High EPSS 0.62% · P48

Possible ATT&CK Techniques 1 AI

T1068 · Exploitation for Privilege Escalation

Affected Version Matrix 1

VendorProduct Version RangeStatus
twigphp Twig >= 3.9.0, < 3.26.0 affected
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2026-46634

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name
Source: CVE Program / CVE List V5
Vulnerability Description
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__<hash> 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.
Source: CVE Program / CVE List V5
CVSS Information
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Source: CVE Program / CVE List V5
Vulnerability Type
保护机制失效
Source: CVE Program / CVE List V5
Vulnerability Title
twigphp Twig 处理逻辑错误漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
twigphp Twig是twigphp的PHP模板引擎。 twigphp Twig 3.9.0版本至3.26.0之前版本存在处理逻辑错误漏洞,该漏洞源于模板编译时使用了合成的__string_template__\<hash\>名称,可能绕过SourcePolicyInterface沙箱决策,允许沙箱化模板调用template_from_string和include渲染内部模板且无需安全策略执行。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
twigphp Twig >= 3.9.0, < 3.26.0 -

II. Public POCs for CVE-2026-46634

# POC Description Source Link Shenlong Link
AI-Generated POC Verified env Premium
Reproduced successfully in a real sandbox · Below is the actual recording of building the environment and exploiting the vulnerability.
Reproduction recording is a Pro+ exclusive
Watch the full sandbox build + live exploit recording for this CVE. Limited-time ¥499/mo.
Upgrade to Pro+
claude_code · 10745 chars
Pro+ exclusive includes:
Vulnerability reproduction recording (real sandbox build + trigger, exclusive)
In-depth vulnerability mechanism
Trigger conditions & impact
Full executable POC code
Exploit chain & mitigation
POC zip download
100+ AI POC generations per month

III. Intelligence Information for CVE-2026-46634

请登录查看更多情报信息。

Patches & Fixes for CVE-2026-46634 (1)

Vendor Advisories for CVE-2026-46634 (1)

Vendor Pages for CVE-2026-46634 (1)

Same Patch Batch · twigphp · 2026-07-14 · 17 CVEs total

CVE-2026-47730 Twig: XSS in profiler HtmlDumper via unescaped template and profile names
CVE-2026-47732 Twig Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points
CVE-2026-48806 Twig: Sandbox `__toString()` policy bypass via dynamic mapping keys
CVE-2026-48805 Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php`
CVE-2026-48808 Twig: Sandbox property allowlist bypass via the `column` filter under `SourcePolicyInterfa
CVE-2026-48807 Twig: Sandbox `__toString()` policy bypass via `Traversable` in `join` and `replace` filte
CVE-2026-49981 Twig: Sandbox filter, tag and function allow-list bypass when sandbox state changes betwee
CVE-2026-46635 Twig: Sandbox property allowlist bypass via the `column` filter (array_column on objects)
CVE-2026-46638 Twig: `{% sandbox %}{% include %}` skips checkSecurity() on cached templates (incomplete f
CVE-2026-46628 Twig: The `spaceless` filter implicitly marks its output as safe
CVE-2026-46640 Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation
CVE-2026-46637 Twig: HTML-output filters in twig/* extras incorrectly declared `is_safe => ['all']`
CVE-2026-46639 Twig: Sandbox property and method bypass via object-destructuring assignment
CVE-2026-46627 Twig: Sandbox resource exhaustion via unbounded `for` / `range()`
CVE-2026-46633 Twig: PHP code injection via `{% use %}` template name
CVE-2026-46629 Twig: Unbounded formatter memoisation in twig/intl-extra keyed on template-controlled argu

IV. Related Vulnerabilities

V. Comments for CVE-2026-46634

No comments yet


Leave a comment