CVE-2024-45411: Twig/twig Twig Has A Possible Sandbox Vulnerability
MODERATECVE-2024-45411 is a MODERATE (CVSS 8.5) twig has a possible sandbox vulnerability (CWE-693: Protection Mechanism Failure) affecting Twig/twig libraries in the Packagist ecosystem. The issue involves twig has a possible sandbox bypass. Remediation is available by upgrading affected packages to version 1.44.8, 2.16.1, 3.14.0, 3.11.1.
CVE-2024-45411 at a Glance
Security Impact
CVSS: 8.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2024-45411
To remediate this vulnerability, upgrade all affected Twig/twig dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade twig/twig to 1.44.8
Upgrade twig/twig to 2.16.1
Upgrade twig/twig to 3.14.0
Upgrade twig/twig to 3.11.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for twig/twig
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-45411, inspect your project dependencies for Twig/twig:
inspect dependencies for twig/twig
Analyze the terminal output to locate any version of Twig/twig in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.44.8), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-693: Protection Mechanism Failure, where the product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. In Twig/twig, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-45411 Affected Twig/twig Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
twig/twig
|
Packagist |
≥ 1.0.0
< 1.44.8
|
1.44.8
|
|
twig/twig
|
Packagist |
≥ 2.0.0
< 2.16.1
|
2.16.1
|
|
twig/twig
|
Packagist |
≥ 3.12.0
< 3.14.0
|
3.14.0
|
|
twig/twig
|
Packagist |
≥ 3.0.0
< 3.11.1
|
3.11.1
|
References
Frequently Asked Questions
What is CVE-2024-45411?
Which Twig/twig versions are affected?
What version fixes CVE-2024-45411?
Is twig/twig affected?
What is the CVSS score of CVE-2024-45411?
What CWE is associated with CVE-2024-45411?
How can I check Packagist dependencies for CVE-2024-45411?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6j75-5wfj-gh66",
"modified" : "2024-10-10T14:50:22Z",
"published" : "2024-09-09T20:19:26Z",
"aliases" : [ "CVE-2024-45411" ],
"summary" : "Twig has a possible sandbox bypass",
"details" : "### Description\n\nUnder some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions.\n\nThe security issue happens when all these conditions are met:\n\n * The sandbox is disabled globally;\n * The sandbox is enabled via a sandboxed `include()` function which references a template name (like `included.twig`) and not a `Template` or `TemplateWrapper` instance;\n * The included template has been loaded before the `include()` call but in a non-sandbox context (possible as the sandbox has been globally disabled).\n\n### Resolution\n\nThe patch ensures that the sandbox security checks are always run at runtime.\n\n### Credits\n\nWe would like to thank Fabien Potencier for reporting and fixing the issue.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "twig/twig"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0"
}, {
"fixed" : "1.44.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "twig/twig"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.16.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "twig/twig"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.12.0"
}, {
"fixed" : "3.14.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "twig/twig"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.11.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/twigphp/Twig/security/advisories/GHSA-6j75-5wfj-gh66"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45411"
}, {
"type" : "WEB",
"url" : "https://github.com/twigphp/Twig/commit/11f68e2aeb526bfaf638e30d4420d8a710f3f7c6"
}, {
"type" : "WEB",
"url" : "https://github.com/twigphp/Twig/commit/2102dd135986db79192d26fb5f5817a566e0a7de"
}, {
"type" : "WEB",
"url" : "https://github.com/twigphp/Twig/commit/41103dcdc2daab4c83cdd05b5b4fde5b7e41e635"
}, {
"type" : "WEB",
"url" : "https://github.com/twigphp/Twig/commit/7afa198603de49d147e90d18062e7b9addcf5233"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2024-45411.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/twigphp/Twig"
}, {
"type" : "WEB",
"url" : "https://symfony.com/blog/twig-security-release-possible-sandbox-bypass"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-693" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-09T20:19:26Z",
"nvd_published_at" : "2024-09-09T19:15:13Z"
}
}