Twig is a template language for PHP. (CVE-2026-49981)
Description
Twig, a PHP template language, has a vulnerability prior to version 3.27.0 where the sandbox policy cache can persist incorrectly across renders. This allows a sandboxed render to reuse a template checked under a different or empty policy. The issue is fixed in version 3.27.0.
CVSS v3.1
Score 8.2high
Affected software
pkg:deb/ubuntu/twig?arch=source&distro=esm-apps/xenialpkg:deb/ubuntu/twig?arch=source&distro=esm-apps/bionicpkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/focalpkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/jammypkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/noblepkg:deb/ubuntu/php-twig?arch=source&distro=stonkingpkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/resoluteRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in Twig versions before 3.27.0 involves the caching of the per-template filter, tag, and function allow-list verdict at Template instance construction time. This cache can remain after sandbox state changes between renders, enabling a sandboxed render to reuse a template originally checked with a different or empty sandbox policy. This flaw could lead to unintended template execution under incorrect sandbox restrictions. The issue is resolved in Twig 3.27.0.
Potential Impact
An attacker could potentially bypass sandbox restrictions by causing a template to be reused with an incorrect or empty sandbox policy, leading to unauthorized code execution or information disclosure within the sandboxed environment. The CVSS score of 8.2 indicates a high impact on confidentiality with limited integrity impact and no availability impact.
Mitigation Recommendations
Upgrade Twig to version 3.27.0 or later, where this vulnerability is fixed. No other mitigation is indicated or required as the fix addresses the root cause.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- UBUNTU-CVE-2026-49981
- Osv Schema Version
- 1.7.0
- Ecosystems
- ["Ubuntu:Pro:16.04:LTS","Ubuntu:Pro:18.04:LTS","Ubuntu:Pro:20.04:LTS","Ubuntu:Pro:22.04:LTS","Ubuntu:Pro:24.04:LTS","Ubuntu:26.10","Ubuntu:Pro:26.04:LTS"]
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6ad3f6142cdf04f656664160
Added to database: 10/17/2026, 22:26:28 UTC
Last enriched: 10/18/2026, 01:02:41 UTC
Last updated: 10/18/2026, 01:02:41 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.