CVE-2026-40478 Improper neutralization of specific syntax patterns for unauthorized expressions in Thymeleaf

Critical 9.1 Published Updated

An unauthenticated remote attacker can achieve Server-Side Template Injection and execute arbitrary code by bypassing expression protections in Thymeleaf.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-40478?

CVE-2026-40478 is a critical code injection vulnerability in org.thymeleaf:thymeleaf-spring5, published on 17 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Thymeleaf is a server-side Java template engine for web and standalone environments. Versions 3.1.3.RELEASE and prior contain a security bypass vulnerability in the the expression execution mechanisms. Although the library provides mechanisms to prevent expression injection, it fails to properly neutralize specific syntax patterns that allow for the execution of unauthorized expressions. If an application developer passes unvalidated user input directly to the template engine, an unauthenticated remote attacker can bypass the library's protections to achieve Server-Side Template Injection (SSTI). This issue has ben fixed in version 3.1.4.RELEASE.

Weakness: CWE-917, CWE-1336

Which versions are affected by CVE-2026-40478?

6 open source packages ship an affected version, including org.thymeleaf:thymeleaf-spring5, org.thymeleaf:thymeleaf and org.thymeleaf:thymeleaf-spring6. It affects 1 product.

PackageAffectedFixed in
org.thymeleaf:thymeleaf-spring5 MavenAll versions3.1.4.RELEASE
org.thymeleaf:thymeleaf-spring5 MavenAll versions3.1.4.RELEASE
org.thymeleaf:thymeleaf MavenAll versions3.1.4.RELEASE
org.thymeleaf:thymeleaf MavenAll versions3.1.4.RELEASE
org.thymeleaf:thymeleaf-spring6 MavenAll versions3.1.4.RELEASE
org.thymeleaf:thymeleaf-spring6 MavenAll versions3.1.4.RELEASE

Products include Thymeleaf Thymeleaf.

How do I fix CVE-2026-40478?

Upgrade org.thymeleaf:thymeleaf-spring5 to 3.1.4.RELEASE or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-40478 being exploited?

There is no known exploitation of CVE-2026-40478 in the wild and no public exploit code.

Sources

Also known as GHSA-xjw8-8c5c-9r79.

Is CVE-2026-40478 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free