Protection Mechanism Failure Affecting twig/twig package, versions >=1.0.0, <1.44.8 >=2.0.0, <2.16.1 >=3.0.0, <3.11.1 >=3.12.0, <3.14.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    EPSS
    0.05% (24th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-PHP-TWIGTWIG-7925183
  • published 10 Sep 2024
  • disclosed 9 Sep 2024
  • credit Fabien Potencier

How to fix?

Upgrade twig/twig to version 1.44.8, 2.16.1, 3.11.1, 3.14.0 or higher.

Overview

twig/twig is a flexible, fast, and secure template language for PHP.

Affected versions of this package are vulnerable to Protection Mechanism Failure due to the incomplete enforcement of sandbox security measures. An attacker can execute arbitrary code or access unauthorized data by crafting malicious templates that exploit this oversight.

Note:

Exploiting this vulnerability is possible when all these conditions are met:

  1. The sandbox is disabled globally;

  2. The sandbox is enabled via a sandboxed include() function which references a template name (like included.twig) and not a Template or TemplateWrapper instance;

  3. The included template has been loaded before the include() call but in a non-sandbox context (possibly as the sandbox has been globally disabled).

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
5.8 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Attack Requirements (AT)
    Present
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    None
  • Integrity (VI)
    None
  • Availability (VA)
    None
  • Confidentiality (SC)
    High
  • Integrity (SI)
    High
  • Availability (SA)
    High