Cloudanix VulnDB

CVE-2024-45411

None

CVSS

—

EPSS

0.8%

Published

Sep 9, 2024

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A flaw in the Twig template system used by many PHP applications can let untrusted templates skip important safety checks, which might allow harmful actions inside the app.

Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Moderate
Impact
Remote Code Execution
Component
Library
Class
Authorization Bypass
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The vulnerability bypasses Twig sandbox security checks under certain conditions, allowing user-supplied templates to execute operations normally restricted by the sandbox policy.

Why it matters to the business

Applications relying on Twig for rendering user-contributed templates face risk of unauthorized code execution or data access, though low exploit probability and absence from known campaigns reduce immediate operational urgency.

How an attack unfolds

An attacker supplies a crafted template to an application using a vulnerable Twig version; due to incomplete sandbox enforcement, the template evades restrictions and performs actions such as file access or function calls that should be blocked.

How to fix it

Upgrade twigphp/twig to version 1.44.8, 2.16.1, or 3.14.0; the fix is present in commit b1f009c449e435a0384814e67205d9190a4d050e.

How to confirm the fix worked

Confirm the installed Twig version meets or exceeds a fixed release, then re-test sandboxed templates with previously restricted operations to verify enforcement.

Typical attack path

  1. Locate a web application accepting user-controlled Twig templates
  2. Craft a template payload that targets missing sandbox checks
  3. Submit the template through normal input channels
  4. Observe or leverage the bypassed restrictions to access restricted resources or execute code

How to detect it

Examine application and web server logs for unusual template rendering activity or error patterns that indicate sandbox bypass attempts; correlate with template input sources.

What your security team should do

  • Prioritize upgrade of twigphp/twig to a fixed version across all instances
  • Audit code paths that render untrusted templates and ensure sandbox mode is consistently applied
  • Review dependency management to prevent reintroduction of vulnerable Twig releases

The record

Twig is a template language for PHP. Under some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions. This vulnerability is fixed in 1.44.8, 2.16.1, and 3.14.0.

Affected packages

Ecosystem Package Introduced Fixed
Packagist twig/twig 1.0.0 1.44.8
Packagist twig/twig 2.0.0 2.16.1
Packagist twig/twig 3.0.0 3.11.1
Packagist twig/twig 3.12.0 3.14.0
Debian:11 php-twig 0 2.14.3-1+deb11u3
Debian:12 php-twig 0 3.5.1-1+deb12u1
Debian:13 php-twig 0 3.8.0-4
Ubuntu:20.04:LTS php-twig 0 No fix
Ubuntu:22.04:LTS php-twig 0 No fix
Ubuntu:24.04:LTS php-twig 0 No fix
Ubuntu:24.04:LTS php-twig 0 3.8.0-2ubuntu1
Ubuntu:24.10 php-twig 0 No fix
Ubuntu:Pro:16.04:LTS twig 0 No fix
Ubuntu:Pro:18.04:LTS twig 0 No fix
Ubuntu:Pro:20.04:LTS php-twig 0 No fix
Ubuntu:Pro:22.04:LTS php-twig 0 3.3.8-2ubuntu4+esm2
Ubuntu:Pro:24.04:LTS php-twig 0 3.8.0-2ubuntu0.1~esm1
packagist twig/twig 1.0.0 1.44.8
packagist twig/twig 2.0.0 2.16.1
packagist twig/twig 3.0.0 3.11.1
packagist twig/twig 3.12.0 3.14.0

Related vulnerabilities