CVE-2026-48805: Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php`

Published Jun 30, 2026
·
Updated

Description

The 3.26.0 source-policy hardening changed the signature of CoreExtension::checkArrow() to take a boolean $isSandboxed instead of an Environment, and added the same $isSandboxed argument to CoreExtension::arraySome() and CoreExtension::arrayEvery(). Compiled templates were updated to pass the per-source sandbox state computed at the call site.

The deprecated internal wrappers exposed in src/Resources/core.php for legacy third-party code (twigcheckarrowinsandbox(), twigarraysome(), twigarrayevery()) were not updated:

- twigarraysome() and twigarrayevery() call CoreExtension::arraySome() / arrayEvery() without forwarding the sandbox state. The underlying methods default $isSandboxed to false, so the callable-must-be-a-Closure restriction is silently bypassed in sandbox mode and a string callable such as 'strcmp' is accepted. - twigcheckarrowinsandbox() passes the Environment object where CoreExtension::checkArrow() now expects a bool, which throws a TypeError on PHP 8+.

Compiled Twig templates are not affected: they call CoreExtension:: directly with the correct arguments. Applications are only impacted if they still call the deprecated twig helpers on top of a sandboxed Environment.

Resolution

The three wrappers now resolve the current sandbox state via twigresolveissandboxed() (the same helper compiled templates use), and forward it to the corresponding CoreExtension:: method. twigcheckarrowinsandbox() no longer triggers a TypeError, and twigarraysome() / twigarrayevery() now enforce the same sandbox restriction as compiled templates.

Credits

We would like to thank El Kharoubi Iosif for reporting the issue and Fabien Potencier for providing the fix.

Other sources

Twig is a template language for PHP. Prior to 3.27.0, deprecated internal wrappers in src/Resources/core.php do not forward the current sandbox state to CoreExtension::checkArrow(), arraySome(), and arrayEvery(), allowing legacy calls such as twigarraysome(), twigarrayevery(), and twigcheckarrowinsandbox() to bypass sandbox callable restrictions. This issue is fixed in version 3.27.0.

MITRE

Affected Software

2 affected componentsFixes available
composer/twig/twig<=3.26.0
3.27.0
Symfony Twig<3.27.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/twig/twig to a version that resolves this vulnerability.

    Fixed in 3.27.0
  2. Upgrade

    Upgrade twig to a version that resolves this vulnerability.

    Fixed in 3.27.0Patch 3.27.0
  3. Compensating control

    If applications still call the deprecated Twig `twig_*` helpers on top of a sandboxed `Environment`, update them to avoid relying on legacy wrappers until Twig is upgraded to 3.27.0 (affected helpers: `twig_check_arrow_in_sandbox()`, `twig_array_some()`, `twig_array_every()`).

Event History

Jun 30, 2026
Advisory Published
via GitHub·06:41 PM
Data Sourced
via GitHub·06:41 PM
DescriptionWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·09:26 PM
Data Sourced
via MITRE·09:26 PM
DescriptionWeakness
Data Sourced
via NVD·10:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-48805?

CVE-2026-48805 has been assessed with a risk rating of 34.

2

How do I fix CVE-2026-48805?

To fix CVE-2026-48805, upgrade to Twig version 3.27.0 or later.

3

What components are affected by CVE-2026-48805?

CVE-2026-48805 affects the composer/twig/twig package in version 3.26.0.

4

What changes were made in Twig related to CVE-2026-48805?

CVE-2026-48805 changed the signature of CoreExtension::checkArrow(), adding a boolean argument to it.

5

Is CVE-2026-48805 a significant vulnerability?

Yes, CVE-2026-48805 involves alterations to core functions which may pose security risks if not addressed.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203