Twig Sandbox Information Disclosure
The advisory, in context
A sandbox information disclosure exists in Twig before 1.38.0 and 2.x before 2.7.0 because, under some circumstances, it is possible to call the __toString() method on an object even if not allowed by the security policy in place.
Affected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
Earlier releases before 1.38.0
Fixed in 1.38.0
88 explicitly affected versions
1.3.0, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, v1.10.0, v1.10.1, v1.10.2, v1.10.3, v1.11.0, v1.11.1, v1.12.0, v1.12.0-RC1, v1.12.1, v1.12.2, v1.12.3, v1.13.0, v1.13.1, v1.13.2, v1.14.0, v1.14.1, v1.14.2, v1.15.0, v1.15.1, v1.16.0, v1.16.1, v1.16.2, v1.16.3, v1.17.0, v1.18.0, v1.18.1, v1.18.2, v1.19.0, v1.20.0, v1.21.0, v1.21.1, v1.21.2, v1.22.0, v1.22.1, v1.22.2, v1.22.3, v1.23.0, v1.23.1, v1.23.2, v1.23.3, v1.24.0, v1.24.1, v1.24.2, v1.25.0, v1.26.0, v1.26.1, v1.27.0, v1.28.0, v1.28.1, v1.28.2, v1.29.0, v1.30.0, v1.31.0, v1.32.0, v1.33.0, v1.33.1, v1.33.2, v1.34.0, v1.34.1, v1.34.2, v1.34.3, v1.34.4, v1.35.0, v1.35.1, v1.35.2, v1.35.3, v1.35.4, v1.36.0, v1.37.0, v1.37.1, v1.7.0, v1.8.0, v1.8.1, v1.8.2, v1.8.3, v1.9.0, v1.9.1, v1.9.2
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.38.0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"1.3.0",
"1.4.0",
"1.5.0",
"1.5.1",
"1.6.0",
"1.6.1",
"1.6.2",
"1.6.3",
"1.6.4",
"1.6.5",
"v1.10.0",
"v1.10.1",
"v1.10.2",
"v1.10.3",
"v1.11.0",
"v1.11.1",
"v1.12.0",
"v1.12.0-RC1",
"v1.12.1",
"v1.12.2",
"v1.12.3",
"v1.13.0",
"v1.13.1",
"v1.13.2",
"v1.14.0",
"v1.14.1",
"v1.14.2",
"v1.15.0",
"v1.15.1",
"v1.16.0",
"v1.16.1",
"v1.16.2",
"v1.16.3",
"v1.17.0",
"v1.18.0",
"v1.18.1",
"v1.18.2",
"v1.19.0",
"v1.20.0",
"v1.21.0",
"v1.21.1",
"v1.21.2",
"v1.22.0",
"v1.22.1",
"v1.22.2",
"v1.22.3",
"v1.23.0",
"v1.23.1",
"v1.23.2",
"v1.23.3",
"v1.24.0",
"v1.24.1",
"v1.24.2",
"v1.25.0",
"v1.26.0",
"v1.26.1",
"v1.27.0",
"v1.28.0",
"v1.28.1",
"v1.28.2",
"v1.29.0",
"v1.30.0",
"v1.31.0",
"v1.32.0",
"v1.33.0",
"v1.33.1",
"v1.33.2",
"v1.34.0",
"v1.34.1",
"v1.34.2",
"v1.34.3",
"v1.34.4",
"v1.35.0",
"v1.35.1",
"v1.35.2",
"v1.35.3",
"v1.35.4",
"v1.36.0",
"v1.37.0",
"v1.37.1",
"v1.7.0",
"v1.8.0",
"v1.8.1",
"v1.8.2",
"v1.8.3",
"v1.9.0",
"v1.9.1",
"v1.9.2"
]
}From 2.0.0 before 2.7.0
Fixed in 2.7.0
19 explicitly affected versions
v2.0.0, v2.1.0, v2.2.0, v2.3.0, v2.3.1, v2.3.2, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.5.0, v2.6.0, v2.6.1, v2.6.2
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.7.0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"v2.0.0",
"v2.1.0",
"v2.2.0",
"v2.3.0",
"v2.3.1",
"v2.3.2",
"v2.4.0",
"v2.4.1",
"v2.4.2",
"v2.4.3",
"v2.4.4",
"v2.4.5",
"v2.4.6",
"v2.4.7",
"v2.4.8",
"v2.5.0",
"v2.6.0",
"v2.6.1",
"v2.6.2"
]
}References
- https://nvd.nist.gov/vuln/detail/CVE-2019-9942
- https://github.com/twigphp/Twig/commit/eac5422956e1dcca89a3669a03a3ff32f0502077
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2019-9942.yaml
- https://github.com/twigphp/Twig
- https://seclists.org/bugtraq/2019/Mar/60
- https://symfony.com/blog/twig-sandbox-information-disclosure
- https://www.debian.org/security/2019/dsa-4419