CVE-2024-51755
Low · 2.2CVSS
2.2
EPSS
0.4%
Published
Nov 6, 2024
CISA due date
—
Cloudanix analysis
A template system used by many PHP applications had a gap in its safety controls that could let certain data slip through when handling lists of items.
- Exploitation
- Remote Authenticated
- Attacker needs
- High Privilege
- Complexity
- High
- Impact
- Data Exposure
- Component
- Library
- Class
- Authorization Bypass
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- High
What it actually does
The sandbox security policy in Twig fails to enforce checks on attributes of Array-like objects, allowing direct attribute access that bypasses the property policy; the __isset() method is invoked only after the missing security check.
Why it matters to the business
Applications relying on Twig sandboxing for untrusted templates may expose limited sensitive data from array-like structures, increasing risk of information leakage in multi-tenant or user-generated content environments; low exploitability and no known active campaigns reduce immediate urgency but still require prompt patching.
How an attack unfolds
An attacker with the ability to supply or influence Twig templates executed inside a sandbox crafts input that references attributes on Array-like objects; because the security policy is not applied to these attributes, the attacker retrieves protected data that the policy was intended to block.
How to fix it
Upgrade twigphp/twig to version 3.11.2, 3.14.1, or the commit 5b580ec1882b54c98cbd8c0f8a3ca5d1904db6b1; no workarounds exist.
How to confirm the fix worked
After upgrade, confirm that attempts to access attributes of Array-like objects inside sandboxed templates now correctly invoke the property policy and are denied when the policy forbids them; review template rendering logs for policy enforcement messages.
Typical attack path
- Identify a Twig-based application that renders user-controlled or untrusted templates inside sandbox mode
- Craft template syntax that accesses attributes on an Array-like object
- Submit the template for rendering
- Observe successful retrieval of attribute values that the security policy should have denied
How to detect it
Review application logs for template rendering activity involving sandbox mode and unexpected attribute access on array objects; examine any custom Twig extensions or policies for references to ArrayAccess or similar interfaces.
What your security team should do
- Prioritize upgrade of all Twig installations to the fixed versions within standard change windows
- Audit any custom security policies to ensure they cover Array-like objects after the update
- Monitor vendor announcements for additional BC-break impacts from the __isset() ordering change
The record
Twig is a template language for PHP. In a sandbox, an attacker can access attributes of Array-like objects as they were not checked by the security policy. They are now checked via the property policy and the `__isset()` method is now called after the security check. This is a BC break. This issue has been patched in versions 3.11.2 and 3.14.1. All users are advised to upgrade. There are no known workarounds for this issue.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | twig/twig | 0 | 3.11.2 |
| Packagist | twig/twig | 3.12 | 3.14.1 |
| Debian:11 | php-twig | 0 | No fix |
| Debian:12 | php-twig | 0 | No fix |
| Debian:13 | php-twig | 0 | 3.14.2-1 |
| Ubuntu:20.04:LTS | php-twig | 0 | No fix |
| Ubuntu:22.04:LTS | php-twig | 0 | No fix |
| Ubuntu:24.04:LTS | php-twig | 0 | No fix |
| Ubuntu:24.10 | php-twig | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | twig | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | twig | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | php-twig | 0 | No fix |
| Ubuntu:Pro:22.04:LTS | php-twig | 0 | No fix |
| Ubuntu:Pro:24.04:LTS | php-twig | 0 | No fix |
| packagist | twig/twig | 1.0.0 | 3.11.2 |
| packagist | twig/twig | 3.12 | 3.14.1 |
| packagist | twig/twig | 3.12.0 | 3.14.1 |
Related vulnerabilities
- CVE-2024-51754 Twig is a template language for PHP. Also affects twig/twig
- CVE-2024-45411 Twig is a template language for PHP. Also affects twig/twig
- CVE-2026-105754 vLLM is an inference and serving engine for large language models. CWE-668
- CVE-2026-92940 vm2 versions 3.11.3 through 3.11.6 expose the host process's real https.globalAgent to… CWE-668
- CVE-2026-85053 Improper resource exposure in CacheStorage in Google Chrome prior to 152.0.7977.82… CWE-668
- CVE-2026-82652 SiYuan before v3.8.1 fails to filter invisible-tier content from SQL embed blocks… CWE-668
- CVE-2026-82650 SiYuan 3.8.0 contains a path traversal / sensitive file exposure vulnerability in the… CWE-668
- CVE-2026-79068 Improper resource exposure in StreamsAPI in Google Chrome prior to 152.0.7977.65 allowed… CWE-668