Skip to content
Fencer Intel
high 7.5

CVE-2022-39261 json

Twig may load a template outside a configured directory when using the filesystem loader

published 4y ago modified last mo. also BIT-drupal-2022-39261 , DRUPAL-CORE-2022-016 , EUVD-2022-6700 , GHSA-52m2-vc4m-jj33

cvss
7.5
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
3.2%
EPSS 3.2% chance of exploitation in 30 days, percentile 88%
public exploits
0
none known

Summary

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.

Patch / fix

  • packagist twig/twig 1.44.7, 2.15.3, 3.4.3
  • bitnami drupal 9.3.22, 9.4.7
  • packagist drupal/core 9.3.22, 9.4.7
  • symfony twig 1.44.7, 2.15.3, 3.4.3
  • drupal drupal 9.3.22, 9.4.7
  • php-twig Debian 14, Debian 13, Debian 12 3.4.3-1

debian advisories DEBIAN-CVE-2022-39261

  • twig Ubuntu Pro 16.04 LTS 1.23.1-1ubuntu4+esm1
  • twig Ubuntu Pro 18.04 LTS 2.4.6-1ubuntu0.1~esm1
  • php-twig Ubuntu Pro 20.04 LTS 2.12.5-1ubuntu0.1~esm1
  • php-twig Ubuntu Pro 22.04 LTS 3.3.8-2ubuntu4+esm1

ubuntu advisories UBUNTU-CVE-2022-39261

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Is CVE-2022-39261 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.

Check with Fencer

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2022-39261 updated cvss 7.5

twig: Possibility to load a template outside a configured directory when using the filesystem loader

  • Red Hat All currently supported Red Hat products
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
yes
Technical impact
partial
Assessed
last yr.

Exploit prediction

3.17% chance of exploitation in the next 30 days, higher than 88% of all scored CVEs (FIRST EPSS, 2026-11-09).

CVSS scores

assigned by version score vector
CNA 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
GitHub 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
NVD 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
OSV 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Affected packages

ecosystem package affected fixed in
packagist twig/twig
>=1.0.0, <1.44.7
>=2.0.0, <2.15.3
>=3.0.0, <3.4.3
1.44.7
2.15.3
3.4.3
bitnami drupal
>=8.0.0, <9.3.22
>=9.4.0, <9.4.7
9.3.22
9.4.7
packagist drupal/core
>=8.0.0, <9.3.22
>=9.4.0, <9.4.7
9.3.22
9.4.7

Affected products

  • twigphp Twig

Classification

Weakness
  • CWE-22 Improper Limitation of a Pathname to a Restricted Directory

References

Sources

Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.