CVE-2022-39261

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

HIGH
7.5
CVSS Score
Published: September 28, 2022 at 12:00 AM UTC
Updated: June 17, 2026 at 04:58 AM UTC
5 products affected across 5 vendorsDebian LinuxFedoraDrupal

Using Twig by twigphp?

Get instant alerts when new vulnerabilities affect Twig - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.5
Exploit prediction
EPSS 3%
SSVC
No known exploit

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

8.0.0 ≤ v < 9.3.229.4.0 ≤ v < 9.4.7
Affected range stops below 9.3.22, so it looks safe — our inference, not a vendor statement
Affected range stops below 9.4.7, so it looks safe — our inference, not a vendor statement
1.0.0 ≤ v < 1.44.72.0.0 ≤ v < 2.15.33.0.0 ≤ v < 3.4.3
Affected range stops below 1.44.7, so it looks safe — our inference, not a vendor statement
Affected range stops below 2.15.3, so it looks safe — our inference, not a vendor statement
Affected range stops below 3.4.3, so it looks safe — our inference, not a vendor statement
v < 1.44.7v < 2.15.3v < 3.4.3
Affected range stops below 1.44.7, so it looks safe — our inference, not a vendor statement
Affected range stops below 2.15.3, so it looks safe — our inference, not a vendor statement
Affected range stops below 3.4.3, so it looks safe — our inference, not a vendor statement

SSVC — Action Prioritization

SSVCNo known exploitAutomatablePartial impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

7.5HIGHGitHub_M
Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
HIGH
Integrity
NONE
Availability
NONE
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-22

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card