twig/twig vulnerabilities

Twig, the flexible, fast, and secure template language for PHP

Registry
Composer
Latest
3.30.0
License
BSD-3-Clause

24 known advisories

The latest version, 3.30.0, is not affected by any of them. Projects on older versions may be.

Update to the latest version:composer require twig/twig:^3.30.0

Is your project on an affected twig/twig?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Security advisories for twig/twig

  • HighCVE-2026-49981GHSA-529h-vh3j-85hq1 Jul 2026

    Twig: Sandbox filter, tag and function allow-list bypass when sandbox state changes between renders for a cached `Template`

    Affected
    <3.27.0
    Fixed in
    3.27.0
  • MediumCVE-2026-48808GHSA-h8vq-8gpg-mhcg30 Jun 2026

    Twig: Sandbox property allowlist bypass via the `column` filter under `SourcePolicyInterface`

    Affected
    <3.27.0
    Fixed in
    3.27.0
  • MediumCVE-2026-48807GHSA-8x9c-rmqh-456c30 Jun 2026

    Twig: Sandbox `__toString()` policy bypass via `Traversable` in `join` and `replace` filters

    Affected
    <3.27.0
    Fixed in
    3.27.0
  • MediumCVE-2026-48806GHSA-5v5v-ww74-355v30 Jun 2026

    Twig: Sandbox `__toString()` policy bypass via dynamic mapping keys

    Affected
    <3.27.0
    Fixed in
    3.27.0
  • LowCVE-2026-48805GHSA-p42q-9prx-q5wq30 Jun 2026

    Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php`

    Affected
    <3.27.0
    Fixed in
    3.27.0
  • HighCVE-2026-47732GHSA-pr2w-4gpj-cpq45 Jun 2026

    Twig: Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points

    Affected
    <3.26.0
    Fixed in
    3.26.0
  • LowCVE-2026-47730GHSA-2g2g-8p8h-fgwm5 Jun 2026

    Twig: XSS in profiler HtmlDumper via unescaped template and profile names

    Affected
    >=3.0.0 <3.26.0
    Fixed in
    3.26.0
  • HighCVE-2026-24425GHSA-2q52-x2ff-qgfr5 Jun 2026

    Twig: Possible sandbox bypass when using a source policy

    Affected
    >=2.16.0 <=2.16.1 · >=3.9.0 <3.26.0
    Fixed in
    3.26.0
  • HighCVE-2026-46640GHSA-45vw-wh46-2vx821 May 2026

    Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation

    Affected
    >=3.15.0 <3.26.0
    Fixed in
    3.26.0
  • HighCVE-2026-46639GHSA-mm6w-gr99-p3jj21 May 2026

    Twig: Sandbox property and method bypass via object-destructuring assignment

    Affected
    >=3.24.0 <3.26.0
    Fixed in
    3.26.0
  • MediumCVE-2026-46638GHSA-7fxw-r6jv-74c821 May 2026

    Twig: `{% sandbox %}{% include %}` skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411)

    Affected
    <3.26.0
    Fixed in
    3.26.0
  • LowCVE-2026-46635GHSA-vcc8-phrv-43wj21 May 2026

    Twig: Sandbox property allowlist bypass via the `column` filter (array_column on objects)

    Affected
    <3.26.0
    Fixed in
    3.26.0
  • MediumCVE-2026-46634GHSA-24x9-r6q4-q93w21 May 2026

    Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name

    Affected
    >=3.9.0 <3.26.0
    Fixed in
    3.26.0
  • CriticalCVE-2026-46633GHSA-7p85-w9px-jpjp21 May 2026

    Twig: PHP code injection via `{% use %}` template name

    Affected
    >=1.15.1 <3.26.0
    Fixed in
    3.26.0
  • LowCVE-2026-46628GHSA-4j38-f5cw-54h721 May 2026

    Twig: The `spaceless` filter implicitly marks its output as safe

    Affected
    <3.26.0
    Fixed in
    3.26.0
  • MediumCVE-2025-24374GHSA-3xg3-cgvq-2xwr29 Jan 2025

    Twig security issue where escaping was missing when using null coalesce operator

    Affected
    >=3.16.0 <3.19.0
    Fixed in
    3.19.0
  • LowCVE-2024-51755GHSA-jjxq-ff2g-95vh6 Nov 2024

    Twig has unguarded calls to `__isset()` and to array-accesses when the sandbox is enabled

    Affected
    <3.11.2 · >=3.12 <3.14.1
    Fixed in
    3.11.2, 3.14.1
  • LowCVE-2024-51754GHSA-6377-hfv9-hqf66 Nov 2024

    Twig has unguarded calls to `__toString()` when nesting an object into an array

    Affected
    <3.11.2 · >=3.12 <3.14.1
    Fixed in
    3.11.2, 3.14.1
  • MediumCVE-2024-45411GHSA-6j75-5wfj-gh669 Sept 2024

    Twig has a possible sandbox bypass

    Affected
    >=1.0.0 <1.44.8 · >=2.0.0 <2.16.1 · >=3.12.0 <3.14.0 · >=3.0.0 <3.11.1
    Fixed in
    1.44.8, 2.16.1, 3.11.1, 3.14.0
  • MediumGHSA-7cvr-xhm5-x99830 May 2024

    Twig Path Traversal vulnerability in the filesystem loader

    Affected
    >=1.0.0 <1.12.3
    Fixed in
    1.12.3
  • HighCVE-2022-39261GHSA-52m2-vc4m-jj3330 Sept 2022

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

    Affected
    >=1.0.0 <1.44.7 · >=2.0.0 <2.15.3 · >=3.0.0 <3.4.3
    Fixed in
    1.44.7, 2.15.3, 3.4.3
  • HighCVE-2015-7809GHSA-xw83-pwrm-9j7414 May 2022

    Twig remote code execution in templates

    Affected
    <1.20.0
    Fixed in
    1.20.0
  • LowCVE-2019-9942GHSA-vxrc-68xx-x48g26 Mar 2022

    Twig Sandbox Information Disclosure

    Affected
    <1.38.0 · >=2.0.0 <2.7.0
    Fixed in
    1.38.0, 2.7.0
  • HighCVE-2022-23614GHSA-5mv2-rx3q-4w2v10 Feb 2022

    Code injection in Twig

    Affected
    >=2.0.0 <2.14.11 · >=3.0.0 <3.3.8
    Fixed in
    2.14.11, 3.3.8

Is your twig/twig version vulnerable?

Which of your client projects still run an old twig/twig?

NPMscan reads the composer.lock in every GitHub repo you pick and checks each installed version against these advisories, including the packages your packages pull in. Each finding comes with the command that fixes it.

Other Composer packages

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily. Package details from the Composer registry.