Packagist (PHP)Worst: Critical24 advisories

twig/twig: known vulnerabilities

twig/twig has 24 reviewed security advisories in the GitHub Advisory Database — 1 critical, 8 high, 8 moderate, 7 low. The most recent was published 2026-07-14. Each one below lists the affected version range, the release that fixes it, its CVE and severity. SkyShield matches these against the twig/twig versions running across your servers, containers and images, and ranks what to patch first.

How to fix twig/twig

Upgrade twig/twig to a release at or above the fixed version shown for each advisory below. For Packagist (PHP):

composer require twig/twig:^3.26.0 (composer audit)

SkyShield checks the installed version on every machine and container, so you can see which hosts are still on an affected release after you roll the fix out.

Advisories (24)

Twig: PHP code injection via `{% use %}` template name Critical 9.8 CWE-94 — Affected: from 1.15.1 up to 3.26.0. Fixed in 3.26.0. Published 2026-07-14. GHSA-7p85-w9px-jpjp · CVE-2026-46633
Twig: Sandbox filter, tag and function allow-list bypass when sandbox state changes between renders for a cached `Template` High CWE-693 CWE-863 — Affected: before 3.27.0. Fixed in 3.27.0. Published 2026-07-01. GHSA-529h-vh3j-85hq · CVE-2026-49981
Twig: Sandbox `__toString()` policy bypass via dynamic mapping keys Moderate CWE-693 CWE-863 — Affected: before 3.27.0. Fixed in 3.27.0. Published 2026-06-30. GHSA-5v5v-ww74-355v · CVE-2026-48806
Twig: Sandbox `__toString()` policy bypass via `Traversable` in `join` and `replace` filters Moderate CWE-693 CWE-863 — Affected: before 3.27.0. Fixed in 3.27.0. Published 2026-06-30. GHSA-8x9c-rmqh-456c · CVE-2026-48807
Twig: Sandbox property allowlist bypass via the `column` filter under `SourcePolicyInterface` Moderate CWE-693 CWE-863 — Affected: before 3.27.0. Fixed in 3.27.0. Published 2026-06-30. GHSA-h8vq-8gpg-mhcg · CVE-2026-48808
Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php` Low CWE-693 — Affected: before 3.27.0. Fixed in 3.27.0. Published 2026-06-30. GHSA-p42q-9prx-q5wq · CVE-2026-48805
Twig: XSS in profiler HtmlDumper via unescaped template and profile names Low CWE-79 — Affected: from 3.0.0 up to 3.26.0. Fixed in 3.26.0. Published 2026-06-05. GHSA-2g2g-8p8h-fgwm · CVE-2026-47730
Twig: Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points High CWE-20 — Affected: before 3.26.0. Fixed in 3.26.0. Published 2026-06-05. GHSA-pr2w-4gpj-cpq4 · CVE-2026-47732
Twig: `template_from_string()` escapes a SourcePolicy-driven sandbox via synthesized template name Moderate CWE-693 — Affected: from 3.9.0 up to 3.26.0. Fixed in 3.26.0. Published 2026-05-21. GHSA-24x9-r6q4-q93w · CVE-2026-46634
Twig: Arbitrary PHP code execution via `_self.(<string>)` macro-reference compilation High CWE-94 — Affected: from 3.15.0 up to 3.26.0. Fixed in 3.26.0. Published 2026-05-21. GHSA-45vw-wh46-2vx8 · CVE-2026-46640
Twig: The `spaceless` filter implicitly marks its output as safe Low CWE-116 — Affected: before 3.26.0. Fixed in 3.26.0. Published 2026-05-21. GHSA-4j38-f5cw-54h7 · CVE-2026-46628
Twig: `{% sandbox %}{% include %}` skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411) Moderate CWE-693 — Affected: before 3.26.0. Fixed in 3.26.0. Published 2026-05-21. GHSA-7fxw-r6jv-74c8 · CVE-2026-46638
Twig: Sandbox property and method bypass via object-destructuring assignment High CWE-693 — Affected: from 3.24.0 up to 3.26.0. Fixed in 3.26.0. Published 2026-05-21. GHSA-mm6w-gr99-p3jj · CVE-2026-46639
Twig: Sandbox property allowlist bypass via the `column` filter (array_column on objects) Low CWE-863 — Affected: before 3.26.0. Fixed in 3.26.0. Published 2026-05-21. GHSA-vcc8-phrv-43wj · CVE-2026-46635
Twig: Possible sandbox bypass when using a source policy High 8.8 CWE-693 — Affected: from 3.9.0 up to 3.26.0. Fixed in 3.26.0. Published 2026-05-20. GHSA-2q52-x2ff-qgfr · CVE-2026-24425
Twig security issue where escaping was missing when using null coalesce operator Moderate 4.3 CWE-74 — Affected: from 3.16.0 up to 3.19.0. Fixed in 3.19.0. Published 2025-01-29. GHSA-3xg3-cgvq-2xwr · CVE-2025-24374
Twig has unguarded calls to `__toString()` when nesting an object into an array Low 2.2 CWE-668 — Affected: from 3.12 up to 3.14.1. Fixed in 3.14.1. Published 2024-11-06. GHSA-6377-hfv9-hqf6 · CVE-2024-51754
Twig has unguarded calls to `__isset()` and to array-accesses when the sandbox is enabled Low 2.2 CWE-668 — Affected: from 3.12 up to 3.14.1. Fixed in 3.14.1. Published 2024-11-06. GHSA-jjxq-ff2g-95vh · CVE-2024-51755
Twig has a possible sandbox bypass Moderate 8.5 CWE-693 — Affected: from 3.0.0 up to 3.11.1. Fixed in 3.11.1. Published 2024-09-09. GHSA-6j75-5wfj-gh66 · CVE-2024-45411
Twig Path Traversal vulnerability in the filesystem loader Moderate 5.3 CWE-22 — Affected: from 1.0.0 up to 1.12.3. Fixed in 1.12.3. Published 2024-05-30. GHSA-7cvr-xhm5-x998
Twig may load a template outside a configured directory when using the filesystem loader High 7.5 CWE-22 — Affected: from 3.0.0 up to 3.4.3. Fixed in 3.4.3. Published 2022-09-28. GHSA-52m2-vc4m-jj33 · CVE-2022-39261
Twig Sandbox Information Disclosure Low 3.7 CWE-200 — Affected: from 2.0.0 up to 2.7.0. Fixed in 2.7.0. Published 2019-03-23. GHSA-vxrc-68xx-x48g · CVE-2019-9942
Twig remote code execution in templates High 8.1 CWE-74 — Affected: before 1.20.0. Fixed in 1.20.0. Published 2015-11-06. GHSA-xw83-pwrm-9j74 · CVE-2015-7809

Find twig/twig across your fleet

Install one agent per server and connect your cloud. SkyShield matches your packages and images against GHSA, CISA KEV and EPSS and shows the fix per machine. Free for one server, then from $49 per server a month. Start free.