CVE-2022-39261
published high CVSS 3.1 · 7.5Twig may load a template outside a configured directory when using the filesystem loader
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| twigphp | — | Twig=> 1.0.0, < 1.44.7 · >= 2.0.0, < 2.15.3 · >= 3.0.0, < 3.4.3 | Affected | Not stated | GitHub_M |
| Debian | bullseye | php-twig | Advisory build | 2.14.3-1+deb11u2 | DSA-5248-1 |
| Ubuntu | bionic | php-twig | Advisory build | 2.4.6-1ubuntu0.1~esm1 | USN-5947-1 |
| Debian | buster | twig | Advisory build | 2.6.2-2+deb10u1 | DLA-3147-1 |
| Ubuntu | bionic | twig | Advisory build | 2.4.6-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | focal | php-twig | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | focal | php-twig-cssinliner-extra | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | focal | php-twig-extra-bundle | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
Show 15 more entries
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Ubuntu | focal | php-twig-html-extra | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | focal | php-twig-inky-extra | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | focal | php-twig-intl-extra | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | focal | php-twig-markdown-extra | Advisory build | 2.12.5-1ubuntu0.1~esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-cache-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-cssinliner-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-extra-bundle | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-html-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-inky-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-intl-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-markdown-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | jammy | php-twig-string-extra | Advisory build | 3.3.8-2ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | xenial | php-twig | Advisory build | 1.23.1-1ubuntu4+esm1 | USN-5947-1 |
| Ubuntu | xenial | twig | Advisory build | 1.23.1-1ubuntu4+esm1 | USN-5947-1 |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.5 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| twigphp | Twig | => 1.0.0, < 1.44.7 (affected)>= 2.0.0, < 2.15.3 (affected)>= 3.0.0, < 3.4.3 (affected) | GitHub_M · cna |
Weaknesses
1- CWE-22 CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
References
11- https://github.com/twigphp/Twig/commit/35f3035c5deb0041da7b84daf02dea074ddc7a0b
- https://github.com/twigphp/Twig/security/advisories/GHSA-52m2-vc4m-jj33
- [debian-lts-announce] 20221011 [SECURITY] [DLA 3147-1] twig security update https://lists.debian.org/debian-lts-announce/2022/10/msg00016.html
- FEDORA-2022-d39b2a755b https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/2OKRUHPVLIQVFPPJ2UWC3WV3WQO763NR/
- FEDORA-2022-4490a4772d https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AUVTXMNPSZAHS3DWZEM56V5W4NPVR6L7/
- FEDORA-2022-9d8ee4a6de https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NWRFPZSR74SYVJKBTKTMYUK36IJ3SQJP/
- FEDORA-2022-c6fe3ebd94 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TW53TFJ6WWNXMUHOFACKATJTS7NIHVQE/
- FEDORA-2022-73b9fb7a77 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WV5TNNJLGG536TJH6DLCIAAZZIPV2GUD/
- FEDORA-2022-1695454935 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YU4ZYX62H2NUAKKGUES4RZIM4KMTKZ7F/
- DSA-5248 https://www.debian.org/security/2022/dsa-5248
- https://www.drupal.org/sa-core-2022-016
Provider assertions
3GitHub_M · cna
Twig may load a template outside a configured directory when using the filesystem loader
CISA-ADP · adp
CISA ADP Vulnrichment
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- 543b13bbabf2a983ca77ffa8f136a9d13a331e783b3a2adf384cf6a1f9990f75
- Ingested
- 23 Sep 2026, 08:02:02 UTC
- Source record
- Official CVE record