---
id: CVE-2026-24425
title: >-
  Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass
  vulnerability when using a SourcePolicyInterface that allows attackers with
  template rendering capabilities to pass arbitrary PHP callables to sort,
  filter, map, and …
summary: >-
  Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass
  vulnerability when using a SourcePolicyInterface that allows attackers with
  template rendering capabilities to pass arbitrary PHP callables to sort,
  filter, map, and …
severity: high
cvss: 8.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'
cwe:
  - CWE-693
vendor: symfony
product: twig
affected:
  - 'twig >= 2.16.0, <= 2.16.1'
  - 'twig >= 3.9.0, < 3.26.0'
patched:
  - twig 3.26.0
published: '2026-05-20'
updated: '2026-07-23'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-24425'
references:
  - url: 'https://github.com/twigphp/Twig/releases/tag/v3.26.0'
    label: disclosure@vulncheck.com
  - url: 'https://github.com/twigphp/Twig/security/advisories/GHSA-2q52-x2ff-qgfr'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/twig-x-x-sandbox-bypass-via-sourcepolicyinterface
    label: disclosure@vulncheck.com
tags:
  - nvd
epss: 0.00758
epssPercentile: 0.53225
ingestedAt: '2026-07-23T12:17:55.008Z'
---

## Overview

Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.

## Affected

- `twig >= 2.16.0, <= 2.16.1`
- `twig >= 3.9.0, < 3.26.0`

## Remediation

Upgrade past the affected range:

- `twig 3.26.0`
