CVE-2022-39261

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

Published Sep 28, 2022 CVSS 3.1 · 7.5 High EPSS 3.2% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-3147-1 twig security update
EUVD EUVD EUVD-2022-6700 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.
Github GHSA Github GHSA GHSA-52m2-vc4m-jj33 Twig may load a template outside a configured directory when using the filesystem loader
Ubuntu USN Ubuntu USN USN-5947-1 Twig vulnerabilities
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Apr 23, 2025, 4:54 PM
Reserved
Sep 2, 2022, 12:00 AM
Status
Modified
Published
Sep 28, 2022, 2:15 PM
Modified
Jun 17, 2026, 4:58 AM