Skip to content

Twig

Unguarded calls to __toString() when nesting an object into an array in Twig

CVE-2024-51754Published 6 Nov 2024, 19:28 UTC

Real-world risk

0.2/ 10Low

Routine

PreliminaryFrom the CVSS vector only · confidence low

CVSS

2.2

scored by the vendor (CNA), CVSS 3.1

In plain words

No plain-language summary yet. The original description is below.

Original description (from GitHub_M)

Twig is a template language for PHP. In a sandbox, an attacker can call `__toString()` on an object even if the `__toString()` method is not allowed by the security policy when the object is part of an array or an argument list (arguments to a function or a filter for instance). 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.

Am I affected?

ProductAffected versions (from the sources)Fixed in
TwigNiche< 3.11.2; >= 3.12.0, < 3.14.13.11.2, 3.14.1

What to do

Update to a fixed version: 3.11.2, 3.14.1.

Why this score

FactorValueEvidence×
ImpactMinorReflected XSS, CSRF with low effect, open redirect, minor leakFrom the CVSS vector0.30
Attacker positionInternetAnyone on the Internet can reach a typical deploymentFrom the CVSS vector1.00
Privileges neededHighAdmin or equivalentFrom the CVSS vector0.20
Victim interactionNoneNothingFrom the CVSS vector1.00
ConfigurationDefaultOut-of-the-box installs are vulnerableFrom the CVSS vector1.00
ReliabilityHardNarrow race, needs an extra info leak, needs a man-in-the-middle position, or must be chained with another bugFrom the CVSS vector0.45

Threat level T1: Nothing known (× 0.85)

The default for a new disclosure

EPSS 0.4% chance of exploitation in 30 days (percentile 40), as of 2026-12-03.

The arithmetic
  1. Prerequisites multiplied together0.090
  2. Threat T1: Nothing known0.850
  3. 10 × impact 0.3 × prerequisites 0.09 × threat 0.850.230
  4. Rounded to one decimal between 0.1 and 100.2

How the score works

Exploitation and evidence timeline

  1. 6 Nov 2024 Published
  2. 3 Dec 2026 Risk 0.2 (cvss fallback)

Weakness

CWE-668

References

Get alerts for Twig

Free email or text alerts when a vulnerability in Twig reaches risk 8 or higher. Nothing else.

CVE-2024-51754: Unguarded calls to __toString() when nesting an object into an array in Twig · CVE Feed