CVE-2026-46629: Twig: Unbounded formatter memoisation in twig/intl-extra keyed on template-controlled arguments

Published May 21, 2026
·
Updated

Description

IntlExtension memoises every \IntlDateFormatter and \NumberFormatter it creates in instance-level arrays keyed on a hash that includes locale, pattern, attrs and other values that are ordinary named arguments of the formatdatetime / formatdate / formattime / formatnumber / formatcurrency filters. There is no size limit and no eviction.

A template that iterates over many distinct pattern (or locale, or groupingused, ...) values therefore allocates one ICU formatter object per distinct value and pins it for the entire lifetime of the Twig\Environment. Because ICU allocates its backing buffers outside the Zend memory manager, this growth is not bounded by memorylimit. On long-running runtimes (RoadRunner, Swoole, FrankenPHP worker mode, ReactPHP) where the Environment outlives a single request, the cache also accumulates across requests.

Resolution

The formatter caches are now bounded in size (100 entries each) and evict on a FIFO basis.

Credits

Twig would like to thank Claude Mythos Preview (via Project Glasswing) for reporting the issue and providing the fix.

Other sources

Twig is a template language for PHP. Prior to 3.26.0, twig/intl-extra memoises IntlDateFormatter and NumberFormatter instances in arrays keyed by template-controlled filter arguments such as locale, pattern, and attrs, allowing a template to allocate many ICU formatter objects that remain pinned for the lifetime of the Twig\Environment. This issue is fixed in version 3.26.0.

MITRE

Affected Software

2 affected componentsFixes available
composer/twig/intl-extra<3.26.0
3.26.0
Symfony Twig<3.26.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/twig/intl-extra to a version that resolves this vulnerability.

    Fixed in 3.26.0
  2. Upgrade

    Upgrade twig/intl-extra to a version that resolves this vulnerability.

    Fixed in 3.26.0
  3. Compensating control

    On long-running PHP runtimes where a single Twig\Environment outlives requests (e.g., RoadRunner, Swoole, FrankenPHP worker mode, ReactPHP), avoid templates that vary template-controlled formatter arguments (such as locale, pattern, and attrs for format_datetime/format_date/format_time/format_number/format_currency filters) across requests until upgrading to twig/intl-extra 3.26.0.

Event History

May 21, 2026
Advisory Published
via GitHub·09:23 PM
Data Sourced
via GitHub·09:23 PM
DescriptionWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·09:22 PM
Data Sourced
via MITRE·09:22 PM
DescriptionWeakness
Data Sourced
via NVD·10:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-46629?

CVE-2026-46629 has a medium severity rating of 5.3 on the CVSS scale.

2

How do I fix CVE-2026-46629?

To remediate CVE-2026-46629, update the affected composer/twig/intl-extra package to the latest version that addresses this vulnerability.

3

What are the risks associated with CVE-2026-46629?

CVE-2026-46629 poses the risk of unbounded formatter memoization leading to potential denial of service in applications using Twig.

4

Which software is affected by CVE-2026-46629?

The vulnerability CVE-2026-46629 affects the composer/twig/intl-extra and Symfony Twig packages.

5

When was CVE-2026-46629 published?

CVE-2026-46629 was published on May 21, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203