CVE-2022-39261
Twig may load a template outside a configured directory when using the filesystem loader
- Published
- Updated
- Reserved
- Assigned by
- GitHub_M
Description
Twig is a template language for PHP. Versions 1.x prior to 1.44.7, 2.x prior to 2.15.3, and 3.x prior to 3.4.3 encounter an issue when the filesystem loader loads templates for which the name is a user input. It is possible to use the `source` or `include` statement to read arbitrary files from outside the templates' directory when using a namespace like `@somewhere/../some.file`. In such a case, validation is bypassed. Versions 1.44.7, 2.15.3, and 3.4.3 contain a fix for validation of such template names. There are no known workarounds aside from upgrading.
Scores
| Scored by | CVSS | Score | Vector |
|---|---|---|---|
| GitHub_MCNA (assigner) | 3.1 | High7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVDNVD · Modified | 3.1 | High7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
- EPSS (exploitation in 30 days)
- 3.2% · top 12% of all CVEs (5 Nov 2026)
- CISA SSVC
- Exploitation: none · Automatable: yes · Technical impact: partial
The list uses the assigner's score when there is one, then CISA's, then NVD's: High 7.5.
Weakness
Affected products
Affected packages
From reviewed advisories of the GitHub Advisory Database.
- Packagisttwig/twigGHSA-52m2-vc4m-jj33 (opens in a new tab)
References (11)
- https://github.com/twigphp/Twig/security/advisories/GHSA-52m2-vc4m-jj33 (opens in a new tab)x_transferred
- https://github.com/twigphp/Twig/commit/35f3035c5deb0041da7b84daf02dea074ddc7a0b (opens in a new tab)x_transferred
- https://www.drupal.org/sa-core-2022-016 (opens in a new tab)x_transferred
- DSA-5248 (opens in a new tab)vendor-advisoryx_transferred
- FEDORA-2022-4490a4772d (opens in a new tab)vendor-advisoryx_transferred
- FEDORA-2022-d39b2a755b (opens in a new tab)vendor-advisoryx_transferred
- FEDORA-2022-1695454935 (opens in a new tab)vendor-advisoryx_transferred
- FEDORA-2022-9d8ee4a6de (opens in a new tab)vendor-advisoryx_transferred
- [debian-lts-announce] 20221011 [SECURITY] [DLA 3147-1] twig security update (opens in a new tab)mailing-listx_transferred
- FEDORA-2022-c6fe3ebd94 (opens in a new tab)vendor-advisoryx_transferred
- FEDORA-2022-73b9fb7a77 (opens in a new tab)vendor-advisoryx_transferred
Sources
The same CVE in the primary databases and aggregators, to check against.
- CVE.org record (opens in a new tab)
- CVE List JSON (GitHub) (opens in a new tab)
- NVD (opens in a new tab)
- FIRST EPSS (opens in a new tab)
- OSV.dev (opens in a new tab)
- GitHub Advisory GHSA-52m2-vc4m-jj33 (opens in a new tab)
- CIRCL Vulnerability-Lookup (opens in a new tab)
Badge for a README or a ticket
[](https://trackcve.app/cve/CVE-2022-39261)Record last updated .