Description
Twig is a template language for PHP. Prior to 3.26.0, the Twig sandbox does not prevent a template from consuming CPU, memory, or wall-clock time, even under the strictest allow-list, allowing untrusted templates to cause resource exhaustion. This issue is addressed in version 3.26.0 by documenting that the sandbox does not protect against resource exhaustion.
Published: 2026-07-14
Score: 7.1 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Twig is a template language for PHP. Before version 3.26.0, the Twig sandbox fails to throttle CPU, memory, or wall‑clock consumption even when the strictest allow‑list is enforced. This flaw enables an attacker who can supply or control an untrusted template to execute unbounded `for` loops or `range()` constructs that exhaust server resources, resulting in a denial‑of‑service. The vulnerability is listed as CWE‑400.

Affected Systems

The vulnerability affects the Twig template engine from the TwigPHP project. All installations using Twig earlier than version 3.26.0 are susceptible. Users who render untrusted templates with the strictest sandbox settings must be aware of this limitation.

Risk and Exploitability

The CVSS score of 7.1 represents the severity of the vulnerability, while the EPSS score of less than 1% indicates a very low likelihood of exploitation. The vulnerability is not listed in CISA’s KEV catalog. Exploitation would require an attacker who can supply or control a Twig template rendered by the application, typically through user input or file uploads. The attack path relies on the sandbox’s inability to throttle resource usage, so the affected system must be able to process the template.

Generated by OpenCVE AI on August 1, 2026 at 09:09 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Twig to version 3.26.0 or later to benefit from clarified resource limits documentation.
  • Implement application‑level safeguards, such as enforcing CPU, memory, or wall‑clock time limits on template rendering processes.
  • Avoid rendering untrusted templates in the application’s main process; instead, delegate sandboxed rendering to a separate container or process with strict resource quotas.

Generated by OpenCVE AI on August 1, 2026 at 09:09 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DSA Debian DSA DSA-6311-1 php-twig security update
History

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

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 15 Jul 2026 15: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.26.0, the Twig sandbox does not prevent a template from consuming CPU, memory, or wall-clock time, even under the strictest allow-list, allowing untrusted templates to cause resource exhaustion. This issue is addressed in version 3.26.0 by documenting that the sandbox does not protect against resource exhaustion.
Title Twig: Sandbox resource exhaustion via unbounded `for` / `range()`
Weaknesses CWE-400
References
Metrics cvssV4_0

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


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-16T15:03:37.558Z

Reserved: 2026-05-15T19:34:14.013Z

Link: CVE-2026-46627

cve-icon Vulnrichment

Updated: 2026-07-16T15:03:32.071Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-01T09:15:03Z

Weaknesses
  • CWE-400

    Uncontrolled Resource Consumption