Description
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 twig_array_some(), twig_array_every(), and twig_check_arrow_in_sandbox() to bypass sandbox callable restrictions. This issue is fixed in version 3.27.0.
Published: 2026-07-14
Score: 5.3 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Twig is a template language for PHP. Its deprecated internal wrappers in src/Resources/core.php do not forward the current sandbox state to CoreExtension::checkArrow(), arraySome(), and arrayEvery(). This oversight allows legacy calls such as twig_array_some(), twig_array_every(), and twig_check_arrow_in_sandbox() to bypass sandbox callable restrictions. An attacker who can influence template rendering could exploit these wrappers to escape the sandbox, potentially executing arbitrary code and compromising the integrity of sandbox‑enforced limits. The vulnerability corresponds to CWE‑693, exposing a breakdown in system integrity expectations. The fix is incorporated in Twig version 3.27.0.

Affected Systems

The vulnerability applies to all Twig PHP releases older than 3.27.0. The affected vendor is twigphp, product Twig. Users running any version before the 3.27.0 release are susceptible.

Risk and Exploitability

The CVSS score of 5.3 indicates moderate severity, while an EPSS score of less than 1% suggests a low likelihood of exploitation. The issue is not listed in CISA’s KEV catalog. Exploitation would require the attacker to embed legacy wrapper calls within a template that is processed with sandbox mode enabled. The likely attack vector is inferred from the description: an attacker could inject calls such as twig_array_some() into a template rendered with sandbox mode. This inference follows the provided details, which do not explicitly state the attack path but logically extend from the vulnerability’s nature, indicating that legacy code usage is a prerequisite for exploitation.

Generated by OpenCVE AI on July 31, 2026 at 04:33 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Twig to version 3.27.0 or later.
  • Refactor the codebase to remove any usage of deprecated internal wrappers twig_array_some(), twig_array_every(), and twig_check_arrow_in_sandbox().
  • Ensure that sandbox mode is enabled and properly configured when rendering templates to enforce callable restrictions.

Generated by OpenCVE AI on July 31, 2026 at 04:33 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DSA Debian DSA DSA-6311-1 php-twig security update
Github GHSA Github GHSA GHSA-p42q-9prx-q5wq Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php`
History

Thu, 16 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Wed, 15 Jul 2026 21:00:00 +0000

Type Values Removed Values Added
First Time appeared Twigphp
Twigphp twig
Vendors & Products Twigphp
Twigphp twig

Tue, 14 Jul 2026 21:45:00 +0000

Type Values Removed Values Added
Description 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 twig_array_some(), twig_array_every(), and twig_check_arrow_in_sandbox() to bypass sandbox callable restrictions. This issue is fixed in version 3.27.0.
Title Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php`
Weaknesses CWE-693
References
Metrics cvssV4_0

{'score': 5.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-16T15:09:20.665Z

Reserved: 2026-05-22T20:57:10.975Z

Link: CVE-2026-48805

cve-icon Vulnrichment

Updated: 2026-07-16T15:09:17.294Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-31T04:45:17Z

Weaknesses
  • CWE-693

    Protection Mechanism Failure