Twig has unguarded calls to `__isset()` and to array-accesses when the sandbox is enabled
Published 6 Nov 2024 · Updated 12 Nov 2024
Affected packages
- Affected
- <3.11.2
- Fixed in
- 3.11.2
composer require twig/twig:^3.11.2- Affected
- >=3.12 <3.14.1
- Fixed in
- 3.14.1
composer require twig/twig:^3.14.1Details
Description
In a sandbox, and 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.
Resolution
The sandbox mode now ensures access to array-like's properties is allowed.
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 Nicolas Grekas for providing the fix.
Is GHSA-jjxq-ff2g-95vh in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected twig/twig, and gives you the command that fixes it.
References
- Linkgithub.com/twigphp/Twig/security/advisories/GHSA-jjxq-ff2g-95vh
- Advisorynvd.nist.gov/vuln/detail/CVE-2024-51755
- Linkgithub.com/twigphp/Twig/commit/831c148e786178e5f2fde9db67266be3bf241c21
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2024-51755.yaml
- Packagegithub.com/twigphp/Twig
- Linksymfony.com/blog/unguarded-calls-to-__isset-and-to-array-accesses-when-the-sandbox-is-enabled
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.