Patchfirst
CVE-2026-40478 Critical · 9.1 EPSS 1.1%

Improper neutralization of specific syntax patterns for unauthorized expressions in Thymeleaf

Patch now:upgrade thymeleaf to 3.1.5.RELEASE or later also fixes CVE-2026-40477, CVE-2026-41901 Details ↓

thymeleaf · thymeleaf

Summary

Thymeleaf, the server-side Java template engine for web and standalone environments, contains a flaw in its expression execution mechanisms in versions 3.1.3.RELEASE and earlier, where specific syntax patterns are not properly neutralized, allowing unauthorized expressions to run. An unauthenticated remote attacker can exploit this when an application passes unvalidated user input directly to the template engine, bypassing the library's protections to achieve server-side template injection, with no user interaction required and a high-complexity attack.

Official description · CVE.org

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.

Breakdown
66.1 / 100
Exploited
Yes, in VulnCheck KEV
Reports
0
Tactics
0/15

First seen exploited 6 months after disclosure.

  1. Disclosedday 0
  2. First seen exploitedVulnCheck KEV evidenceEU database marks exploited+6 mo

3 fixes in thymeleaf over 4 weeks. The latest fix listed for thymeleaf is 3.1.5.RELEASE.

Fixes in thymeleafMaven package, by fixed version. Earlier and later fixes in the same package, not necessarily the same bug.

  1. 3.1.4.RELEASECVE-2026-4047717 Apr 2026
  2. 3.1.4.RELEASECVE-2026-4047817 Apr 2026
  3. 3.1.5.RELEASECVE-2026-4190112 May 2026Latest listed

Affected versions and fixes

as published in the CVE record

thymeleaf thymeleaf

Affected: < 3.1.4.RELEASE

thymeleaf org.thymeleaf:thymeleaf-spring5

Affected: < 3.1.4.RELEASE

thymeleaf org.thymeleaf:thymeleaf-spring6

Affected: < 3.1.4.RELEASE

Am I affected? What do I upgrade to?

From GitHub Security Advisories and OSV

3 packages in 1 ecosystem. Main package: org.thymeleaf:thymeleaf.

Mavenorg.thymeleaf:thymeleafGHSA-xjw8-8c5c-9r79

Upgrade to 3.1.5.RELEASE or later

Fixes this CVE and 2 other known vulnerabilities in this package (CVE-2026-40477, CVE-2026-41901).

Set the version to 3.1.5.RELEASE or later in your pom.xml or build.gradle.

First fixed in 3.1.4.RELEASE for CVE-2026-40478.

Affected versions

If you runUpgrade to
All versions before 3.1.4.RELEASE3.1.5.RELEASEfirst fix for this CVE: 3.1.4.RELEASE

“Up to” means the second version is the fix and is not affected.

Other packages that bundle this code (2)

Forks, repackagings and products that include the affected code. Each has its own fixed version.

  • Mavenorg.thymeleaf:thymeleaf-spring5
    Affected: All versions before 3.1.4.RELEASEUpgrade to 3.1.5.RELEASE or later
  • Mavenorg.thymeleaf:thymeleaf-spring6
    Affected: All versions before 3.1.4.RELEASEUpgrade to 3.1.5.RELEASE or later

Check your lockfile against all CVEs

What security researchers reported

Not named in any threat report yet

Also mentioned in 3 community threat pulses (AlienVault OTX)

Weaker evidence

Pulses are indicator collections that anyone can publish. A mention is not confirmation of exploitation.

References

5 links, grouped by NVD tag
↑ ↓ chooseEnter openEsc close