Thymeleaf SSTI Bypass Enables Expression Injection in Spring Java Apps
A critical flaw tracked as CVE-2026-40478 allows attackers to bypass Thymeleaf’s expression-injection protections and achieve server-side template injection (SSTI) in applications that pass unvalidated user input into the template engine. The vulnerability affects Thymeleaf 3.1.3.RELEASE and earlier and stems from improper neutralization of syntax patterns in expression execution, including a whitespace parsing mismatch that let attackers evade detection of the SpEL new keyword and an incomplete type blocklist that still allowed dangerous class instantiation. The issue is mapped to CWE-917 and CWE-1336, with a published CVSS v3.1 vector of AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H.
Researchers said successful exploitation can enable arbitrary file writes and potentially remote code execution in Spring-based Java applications, where Thymeleaf is commonly used as the default template engine in Spring Boot. The flaw can be exploited remotely without authentication when attacker-controlled input reaches Thymeleaf expression parsing, view names, or fragment selectors. The issue is addressed in 3.1.4.RELEASE, which normalizes whitespace before checks, expands external-access detection, restricts dangerous expression objects, and tightens type restrictions; defenders are urged to upgrade thymeleaf, thymeleaf-spring5, and thymeleaf-spring6 and review applications to ensure untrusted input is never interpreted as template expressions.

Get ahead of threats like this
Mallory correlates global threat intelligence with your attack surface — know if you’re exposed before adversaries strike.
How this story unfolded
2 events from the most recent confirmed update back to the earliest known activity.
CVE-2026-40478 is published for Thymeleaf expression injection bypass
A CVE was published for a security bypass in Thymeleaf 3.1.3.RELEASE and earlier that can let an unauthenticated remote attacker achieve server-side template injection when applications pass unvalidated user input into template expressions. The issue was mapped to CWE-917 and CWE-1336 and referenced GitHub Security Advisory GHSA-xjw8-8c5c-9r79.
Thymeleaf fixes SSTI sandbox bypass in version 3.1.4.RELEASE
Thymeleaf addressed CVE-2026-40478 in version 3.1.4.RELEASE, fixing expression-sandbox bypasses caused by whitespace parsing mismatches and insufficient type restrictions. The update normalized whitespace before checks, expanded external-access detection, restricted dangerous expression objects, and tightened type restrictions.
Related entities
Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.
Sources
3 references tracked. Mallory keeps watching after this page renders.
The Thymeleaf Template Injection That Only Hurts If You Let It : r/netsec
reddit.com
Open sourceCVE-2026-40478 - Improper neutralization of specific syntax patterns for unauthorized expressions in Thymeleaf
cvefeed.io
Open sourceIt's About Thyme: How a Whitespace Character Broke Thymeleaf's Expression Sandbox (CVE-2026-40478) | Blog | Endor Labs
endorlabs.com
Open sourceSee the full picture, correlated to your attack surface.
Map indicators from this story to your assets and identify affected systems in minutes.
Every observed campaign, victim, and pivot linked to actors named in this story.
Malware, exploits, and IOCs connected to the activity described here.
YARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Get matching new stories delivered to your team as they break — not the next morning.
Ask questions about this story and take action on the answers.


