Advisory

GHSA-6377-hfv9-hqf6

Also known as: CVE-2024-51754

Summary

Twig has unguarded calls to __toString() when nesting an object into an array

Details

Description

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).

Resolution

The sandbox mode now checks the __toString() method call on all objects.

The patch for this issue is available here for the 3.11.x branch, and here for the 3.x branch.

Credits

We would like to thank Jamie Schouten for reporting the issue and Fabien Potencier for providing the fix.

Severity

Low Basis: The source's own band: LOW

Dates

Published
2024-11-06 19:52 UTC
Modified
2025-05-29 21:34 UTC

Affected packages and fixes

twig/twig

Packagist · All systems

Affected

  • introduced 0, fixed 3.11.2 (ecosystem)

Fixed versions

3.11.2

Fix

The export has no generic command for this ecosystem.

twig/twig

Packagist · All systems

Affected

  • introduced 3.12, fixed 3.14.1 (ecosystem)

Fixed versions

3.14.1

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences