Read the docs
TI-2022-18637 Aliases CVE-2022-39261GHSA-52m2-vc4m-jj33

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

Priority MEDIUM 45CWE-22Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
Low
Impact type
Information disclosure
Confidentiality · integrity · availability
High · None · None
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-22 and the CVSS impact.

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.03174 88th percentileScored 2026-11-07
Fix Fixed Twig (twigphp): 2.15.3, 3.4.3twig/twig (Packagist): 1.44.7, 2.15.3, 3.4.3

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
Yes
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
symfonyTwig=> 1.0.0, < 1.44.7; 2.0.0 to before 2.15.3; 3.0.0 to before 3.4.32.15.3, 3.4.3Patch availableCNA
—twig/twig (Packagist)1.0.0 to before 1.44.71.44.7Patch availableGHSA-52m2-vc4m-jj33
—twig/twig (Packagist)2.0.0 to before 2.15.32.15.3Patch availableGHSA-52m2-vc4m-jj33
—twig/twig (Packagist)3.0.0 to before 3.4.33.4.3Patch availableGHSA-52m2-vc4m-jj33
  • Twig Vendorsymfony Affected => 1.0.0, < 1.44.7; 2.0.0 to before 2.15.3; 3.0.0 to before 3.4.3 Fixed in 2.15.3, 3.4.3 Patch available CNA
  • twig/twig (Packagist) Vendor— Affected 1.0.0 to before 1.44.7 Fixed in 1.44.7 Patch available GHSA-52m2-vc4m-jj33
  • twig/twig (Packagist) Vendor— Affected 2.0.0 to before 2.15.3 Fixed in 2.15.3 Patch available GHSA-52m2-vc4m-jj33
  • twig/twig (Packagist) Vendor— Affected 3.0.0 to before 3.4.3 Fixed in 3.4.3 Patch available GHSA-52m2-vc4m-jj33

CPE configurations NVD · 7

CPEVersionsRoleVendor
cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*1.0.0 to before 1.44.7; 2.0.0 to before 2.15.3; 3.0.0 to before 3.4.3Vulnerablesymfony
cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:*8.0.0 to before 9.3.22; 9.4.0 to before 9.4.7VulnerableDrupal
cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*35VulnerableFedoraproject
cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*36VulnerableFedoraproject
cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:*37VulnerableFedoraproject
cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*10.0VulnerableDebian
cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*11.0VulnerableDebian
  • cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:* Versions 1.0.0 to before 1.44.7; 2.0.0 to before 2.15.3; 3.0.0 to before 3.4.3 Vulnerable ·symfony
  • cpe:2.3:a:drupal:drupal:*:*:*:*:*:*:*:* Versions 8.0.0 to before 9.3.22; 9.4.0 to before 9.4.7 Vulnerable ·Drupal
  • cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* Versions 35 Vulnerable ·Fedoraproject
  • cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* Versions 36 Vulnerable ·Fedoraproject
  • cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:* Versions 37 Vulnerable ·Fedoraproject
  • cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* Versions 10.0 Vulnerable ·Debian
  • cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* Versions 11.0 Vulnerable ·Debian

Remediation

  • Fix · CNA Twig (twigphp) Fixed in 2.15.3, 3.4.3
  • Fix · GHSA-52m2-vc4m-jj33 twig/twig (Packagist) Fixed in 1.44.7 Advisory →
  • Fix · GHSA-52m2-vc4m-jj33 twig/twig (Packagist) Fixed in 2.15.3 Advisory →
  • Fix · GHSA-52m2-vc4m-jj33 twig/twig (Packagist) Fixed in 3.4.3 Advisory →

Vendor assessments

Red Hat

Red Hat's page for this CVE →

Not affected: 1 product
  • Red Hat

Timeline

  1. 2026-10-02 Threatist record created from CVE-2022-39261
  2. 2026-10-03 Alias added: GHSA-52m2-vc4m-jj33

References

  • TI-2026-34283 Twig: The `spaceless` filter implicitly marks its output as safe CVSS 4.0MEDIUM 5.1
  • TI-2022-07667 Code injection in Twig CVSS 3.1CRITICAL 9.8
  • TI-2018-10028 Twig before 2.4.4 allows Server-Side Template Injection (SSTI) via the search search_key… CVSS 3.0CRITICAL 9.8
  • TI-2026-34292 Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation CVSS 4.0HIGH 8.7
  • TI-2026-34285 Twig: PHP code injection via `{% use %}` template name CVSS 4.0HIGH 8.7
  • TI-2026-19691 Twig 2.16.x & 3.9.0-3.25.x Sandbox Bypass via SourcePolicyInterface CVSS 4.0HIGH 8.7
See all 24 →

Sources