Skip to main content
Menu
Advisories

Sandbox property allow-list bypass via the join filter on non-iterable objects

GHSA-P2X6-PPF3-32R3Published Updated GitHub

Description

The join filter converted a value that isn't iterable with (array) $value. For an object, that gives every property, including the private and protected ones. A sandboxed template allowed to use join could therefore print properties that the policy denies, and that templates can't read otherwise:

{{ user|join(',') }}

Resolution

A value that isn't iterable is now joined as a single item. A Stringable object prints its checked string, and other objects throw, as with the first and last filters.

The patch for this issue is available here for branch 3.x.

Credits

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

Affected versions

References

GitHub · twigphp/Twig