---
id: CVE-2026-46636
title: Twig is a template language for PHP
summary: >-
  Twig is a template language for PHP. From version 1.0.0 to before version
  3.27.0, SecurityPolicy::checkMethodAllowed() unconditionally whitelists all
  method calls on instances of Twig\Markup. Twig\Markup is not final, so
  subclasses inher…
severity: high
cvss: 8.7
cvssVector: 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N'
cwe:
  - CWE-1336
vendor: twigphp
product: Twig
affected:
  - 'Twig >= 1.0.0, < 3.27.0'
published: '2026-09-04'
updated: '2026-09-25'
sourceUpdated: '2026-09-25T14:23:59.847'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-46636'
references:
  - url: 'http://github.com/twigphp/Twig/releases/tag/v3.27.0'
    label: security-advisories@github.com
  - url: 'https://github.com/twigphp/Twig/security/advisories/GHSA-64jr-qjx4-w2fh'
    label: security-advisories@github.com
  - url: 'https://security-tracker.debian.org/tracker/CVE-2026-46636'
    label: security-advisories@github.com
  - url: 'https://security-tracker.debian.org/tracker/DSA-6311-1'
    label: security-advisories@github.com
  - url: >-
      https://symfony.com/blog/cve-2026-46636-sandbox-filter-tag-and-function-allow-list-bypass-when-sandbox-state-changes-between-renders
    label: security-advisories@github.com
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-46636.json
  - url: 'https://access.redhat.com/security/cve/CVE-2026-46636'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2026-46636'
tags:
  - nvd
  - cve.org
  - csaf
  - vex
  - red-hat
epss: 0.0057
epssPercentile: 0.44842
ssvc:
  exploitation: none
  automatable: 'yes'
  technicalImpact: partial
  timestamp: '2026-09-08T17:37:04.193009Z'
cvssSource: cna
scores:
  cna: 8.7
  vendor: 8.6
ingestedAt: '2026-09-08T18:07:34.885Z'
---

## Overview

Twig is a template language for PHP. From version 1.0.0 to before version 3.27.0, SecurityPolicy::checkMethodAllowed() unconditionally whitelists all method calls on instances of Twig\Markup. Twig\Markup is not final, so subclasses inherit the bypass. An application that passes an object of a Markup-derived class into a sandboxed template (typically to mark a chunk of HTML as safe) inadvertently exposes every public method of that subclass to template authors, regardless of the configured allowedMethods list. This issue has been patched in version 3.27.0.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.

## Vendor advisories

- **Red Hat VEX** · updated 2026-09-14 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-46636.json)
