p PatchFirst

CVE-2026-133767

CVE-2026-133767 · Sandbox allow-list and `__toString()` bypass via a dynamic `embed` parent expression

CVSS 5.3 · Medium · EPSS 0.5% · Fix available

Compare with your installed version

Affected products and known fixed versions are public information. Compare them with your installed version.

Check the installed version:

dpkg-query -W -f='${source:Package} ${binary:Package} ${Version}\n' | awk '$1=="php-twig"'

Assess your server’s risks

The free check gives you a rating and a risk summary by technology stack, without signing up. It does not answer whether this particular vulnerability affects you.

Monitoring matches public information against your servers’ software. Detailed findings for your servers include the order of updates.

curl -fsSL https://patchfirst.dev/check.sh | sh
Check your server for free →

Channels carry general technology news; monitoring reports new findings on your servers in your dashboard, through browser notifications, in Telegram or via a webhook.

This page contains facts from public vulnerability sources. Check the original advisory before updating.

When the parent of an embed tag was an expression other than a string or a variable, the sandbox didn't see that expression. The functions, filters and tests of the expression weren't checked against the policy, and neither were its conversions to strings. A sandboxed template allowed to use embed could therefore call any function, filter or test, and any __toString() method:

{% embed 'leak_' ~ app_secret() %}{% endembed %}

Method calls and property reads were not affected, since they're checked at runtime.

The sandbox now checks the parent expression of embed like any other expression of the template.

Published
Updated

Stack: system

Affected products and versions

  • twig/twig

    Versions
    • ≥ 0, < 3.31.1: Affected (semver)

    Update to 3.31.1

  • php-twig Debian 12

    Versions
    • 3.10.1-1
    • 3.10.3-1
    • 3.11.0-1
    • 3.13.0-1
    • 3.14.0-1
    • 3.14.0-2
    All versions (63)
    • 3.14.0-3
    • 3.14.0-4
    • 3.14.2-1
    • 3.14.2-2
    • 3.14.2-3
    • 3.15.0-1
    • 3.15.0-2
    • 3.17.1-1
    • 3.17.1-2
    • 3.18.0-1
    • 3.18.0-2
    • 3.18.0-4
    • 3.18.0-5
    • 3.18.0-6
    • 3.18.0-7
    • 3.19.0-1
    • 3.19.0-1~bootstrap
    • 3.20.0-1
    • 3.20.0-1~bootstrap
    • 3.20.0-2
    • 3.21.1-1
    • 3.21.1-2
    • 3.21.1-3
    • 3.22.0-1
    • 3.22.0-2
    • 3.22.1-1
    • 3.22.1-2
    • 3.22.1-3
    • 3.22.2-1
    • 3.22.2-2
    • 3.23.0-1
    • 3.23.0-2
    • 3.24.0-1
    • 3.26.0-1
    • 3.27.0-1
    • 3.27.1-1
    • 3.28.0-1
    • 3.30.0-1
    • 3.31.0-1
    • 3.31.1-1
    • 3.5.1-1
    • 3.5.1-1+deb12u1
    • 3.5.1-1+deb12u2
    • 3.5.1-1+deb12u3
    • 3.6.0-1
    • 3.6.1-1
    • 3.7.0-1
    • 3.7.1-1
    • 3.7.1-2
    • 3.7.1-3
    • 3.8.0-1
    • 3.8.0-2
    • 3.8.0-3
    • 3.8.0-4
    • 3.9.3-1
    • 4.0.0~alpha1-1
    • 4.0.0~beta1-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • php-twig Debian 13

    Versions
    • 3.20.0-2
    • 3.21.1-1
    • 3.21.1-2
    • 3.21.1-3
    • 3.22.0-1
    • 3.22.0-2
    All versions (25)
    • 3.22.1-1
    • 3.22.1-2
    • 3.22.1-3
    • 3.22.2-1
    • 3.22.2-2
    • 3.23.0-1
    • 3.23.0-2
    • 3.24.0-1
    • 3.26.0-0+deb13u1
    • 3.26.0-1
    • 3.27.0-0+deb13u1
    • 3.27.0-1
    • 3.27.1-1
    • 3.28.0-1
    • 3.30.0-1
    • 3.31.0-1
    • 3.31.1-1
    • 4.0.0~alpha1-1
    • 4.0.0~beta1-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • php-twig Debian 14

    Versions
    • 3.20.0-2
    • 3.21.1-1
    • 3.21.1-2
    • 3.21.1-3
    • 3.22.0-1
    • 3.22.0-2
    All versions (20)
    • 3.22.1-1
    • 3.22.1-2
    • 3.22.1-3
    • 3.22.2-1
    • 3.22.2-2
    • 3.23.0-1
    • 3.23.0-2
    • 3.24.0-1
    • 3.26.0-1
    • 3.27.0-1
    • 3.27.1-1
    • 3.28.0-1
    • 3.30.0-1
    • 3.31.0-1
    Affected ranges
    • ECOSYSTEM: < 3.31.1-1

    Update to 3.31.1-1

  • php-twig Ubuntu Pro 20.04 LTS

    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
    All versions (7)
    • 2.12.5-1ubuntu0.1~esm2
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • php-twig Ubuntu Pro 22.04 LTS

    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
    All versions (7)
    • 3.3.8-2ubuntu4+esm2
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • php-twig Ubuntu Pro 24.04 LTS

    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
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • php-twig Ubuntu 26.10

    Versions
    • 3.23.0-2build7
    • 3.27.1-1
    • 3.28.0-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • php-twig Ubuntu Pro 26.04 LTS

    Versions
    • 3.20.0-2ubuntu1
    • 3.23.0-2build5
    • 3.23.0-2build7
    • 3.23.0-2ubuntu0.1~esm1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

Original sources

Check your server →