Patchfirst
CVE-2026-40477 Public exploit Critical · 9.1 EPSS 0.9%

Improper restriction of the scope of accessible objects in Thymeleaf expressions

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

thymeleaf · thymeleaf

Summary

Thymeleaf, the Java server-side template engine, has an improper restriction of accessible objects in its expression execution mechanisms, affecting versions 3.1.3.RELEASE and prior. The flaw lets specific potentially sensitive objects be reached from within a template, despite the library's expression-injection protections. An unauthenticated remote attacker can exploit it to achieve Server-Side Template Injection when the application passes unvalidated user input directly to the template engine, with the attack complexity rated high.

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 expression execution mechanisms. Although the library provides mechanisms to prevent expression injection, it fails to properly restrict the scope of accessible objects, allowing specific potentially sensitive objects to be reached from within a template. 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
69.4 / 100
Exploited
Yes, in VulnCheck KEV
Reports
0
Tactics
0/15

First seen exploited 6 months after disclosure. Public exploit code (PoC-in-GitHub) appeared 5 months after disclosure.

  1. Disclosedday 0
  2. Public exploit codePoC-in-GitHub+5 mo
  3. First seen exploitedVulnCheck KEV evidenceEU database marks exploited+6 mo

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-r4v4-5mwr-2fwr

Upgrade to 3.1.5.RELEASE or later

Fixes this CVE and 2 other known vulnerabilities in this package (CVE-2026-40478, 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-40477.

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 2 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