Skip to main content

Twig is a template language for PHP. (CVE-2026-49981)

0
Medium
Published: 07/14/2026 (07/14/2026, 22:17:00 UTC)
Source: GCVE Database
Product: twig

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

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
None
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N

Affected software

Ubuntu:Pro:16.04:LTSmore threats →ghsa
twig
pkg:deb/ubuntu/twig?arch=source&distro=esm-apps/xenial
Affected versions
=1.20.0-1=1.23.1-1ubuntu1=1.23.1-1ubuntu4=1.23.1-1ubuntu4+esm1
Ubuntu:Pro:18.04:LTSmore threats →ghsa
twig
pkg:deb/ubuntu/twig?arch=source&distro=esm-apps/bionic
Affected versions
=1.24.0-2ubuntu1=2.4.4-2ubuntu1=2.4.6-1=2.4.6-1ubuntu0.1~esm1
Ubuntu:Pro:20.04:LTSmore threats →ghsa
php-twig
pkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/focal
Affected versions
=2.11.3-2=2.12.1-1=2.12.2-1=2.12.3-1=2.12.5-1=2.12.5-1ubuntu0.1~esm1=2.12.5-1ubuntu0.1~esm2
Ubuntu:Pro:22.04:LTSmore threats →ghsa
php-twig
pkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/jammy
Affected versions
=3.3.2-1ubuntu3=3.3.4-1=3.3.6-1=3.3.7-1=3.3.8-2ubuntu4=3.3.8-2ubuntu4+esm1=3.3.8-2ubuntu4+esm2
Ubuntu:Pro:24.04:LTSmore threats →ghsa
php-twig
pkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/noble
Affected versions
=3.7.0-1=3.7.1-1=3.8.0-2=3.8.0-2ubuntu0.1~esm1=3.8.0-2ubuntu1=3.8.0-2ubuntu1+esm1
Ubuntu:26.10more threats →ghsa
php-twig
pkg:deb/ubuntu/php-twig?arch=source&distro=stonking
Affected versions
=3.23.0-2build7=3.27.1-1=3.28.0-1
Ubuntu:Pro:26.04:LTSmore threats →ghsa
php-twig
pkg:deb/ubuntu/php-twig?arch=source&distro=esm-apps/resolute
Affected versions
=3.20.0-2ubuntu1=3.23.0-2build5=3.23.0-2build7=3.23.0-2ubuntu0.1~esm1

Run 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

AILast updated: 10/18/2026, 01:02:41 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses