Vulnerability advisory

GHSA-52m2-vc4m-jj33

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

Published Updated OSV record ↗

Also known as BIT-drupal-2022-39261CVE-2022-39261DRUPAL-CORE-2022-016

Severity
  • CVSS 3.xCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Affected versions

AffectedFixed in
1.0.0 to before 1.44.71.44.7Advisories →
Also listed as affected (113)
2.0.0 to before 2.15.32.15.3Advisories →
Also listed as affected (57)
3.0.0 to before 3.4.33.4.3Advisories →
Also listed as affected (23)

Description

Description

When using the filesystem loader to load 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).

Resolution

We fixed validation for such template names.

Even if the 1.x branch is not maintained anymore, a new version has been released.

Credits

We would like to thank Dariusz Tytko for reporting the issue and Fabien Potencier for fixing the issue.

References

  • Codex
  • Claude Code
  • VS Code
  • GitHub Copilot
  • Cursor
  • Cline
  • Windsurf
  • Google Anti-gravity
  • OpenCode
  • Pi
  • Gemini CLI
  • Hermes Agent
  • Zed
  • Junie
  • Qwen Code
  • Kiro
  • Kilo Code
  • Factory Droid

Set up GitHits for your agents

Run this command:

<> bash
npx githits@latest init

What happens next:

  1. Opens your browser to authorize GitHits
  2. Asks whether to set up GitHits at the user or project level
  3. Detects your supported AI coding tools
  4. Lets you choose which tools to configure
  5. Configures the selected tools