安全速报自动同步 · 保留上游原文

【中危】twig 安全更新(GHSA-h8vq-8gpg-mhcg)

S
KHack 安全情报
2026/7/1 发布 · 2 阅读

安全情报快照 · 风险级别:中危 · CVE-2026-48808 · GHSA-h8vq-8gpg-mhcg

先看结论

twig存在安全风险,<= 3.26.0 受影响,建议升级至 3.27.0。

影响范围

生态 组件 受影响版本 首个修复版本
composer twig/twig <= 3.26.0 3.27.0

处置建议

优先将 twig/twig 升级至 3.27.0 或更高版本;升级前请结合业务依赖完成兼容性验证。

上游技术详情(原文)

Description

This is a residual bypass of CVE-2026-46635 / GHSA-vcc8-phrv-43wj that only affects sandboxing enabled through SourcePolicyInterface (and not the regular global sandbox mode).

CoreExtension::column() receives the active sandbox state via the needs_is_sandboxed channel as a boolean $isSandboxed, but then routes the per-element property reads through SandboxExtension::checkPropertyAllowed() without forwarding the current Source. SandboxExtension::checkPropertyAllowed() re-evaluates isSandboxed($source) internally; with $source = null the SourcePolicyInterface-driven decision is lost, the method short-circuits to "not sandboxed", and the property allowlist is never consulted.

A template author whose sandbox is gated by a SourcePolicyInterface and who has column on their allowedFilters list can therefore read any public or magic property of any object reachable in the render context, regardless of SecurityPolicy::$allowedProperties. Direct attribute access to the same property is blocked, and the same payload is also blocked under global sandbox mode, which makes this a clear policy enforcement gap rather than a configuration issue.

Resolution

CoreExtension::column() no longer goes through the SandboxExtension wrapper for the property check. It calls the security policy directly: the per-source decision is already captured by the $isSandboxed boolean computed at the call site, so the property allowlist is enforced consistently for both global and source-policy sandboxing.

Credits

Twig would like to thank Vincent55 Yang for reporting the issue and Fabien Potencier for providing the fix.

来源与许可

本页自动同步 GitHub Advisory Database 的公开数据,并保留上游原文供核验;不宣称原创分析。数据许可:CC-BY-4.0。

评论

还没有评论,来说两句。