CVE-2026-40478: Thymeleaf Improper Neutralization Of Specific Syntax Vulnerability
CRITICALCVE-2026-40478 is a CRITICAL (CVSS 9.0) improper neutralization of specific syntax vulnerability (CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')) affecting Thymeleaf libraries in the Maven ecosystem. The issue involves improper neutralization of specific syntax patterns for unauthorized expressions in thymeleaf. Remediation is available by upgrading affected packages to version 3.1.4.RELEASE.
CVE-2026-40478 at a Glance
Security Impact
CVSS: 9.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2026-40478
To remediate this vulnerability, upgrade all affected Thymeleaf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring6</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.thymeleaf
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2026-40478, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.thymeleaf
Analyze the terminal output to locate any version of Thymeleaf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.4.RELEASE), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.thymeleaf command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection'), where the product constructs all or part of an expression language (el) statement in a framework such as a java server page (jsp) using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended el statement before it is executed. In Thymeleaf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-40478 Affected Thymeleaf Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.thymeleaf:thymeleaf
|
Maven |
< 3.1.4.RELEASE
|
3.1.4.RELEASE
|
|
org.thymeleaf:thymeleaf-spring5
|
Maven |
< 3.1.4.RELEASE
|
3.1.4.RELEASE
|
|
org.thymeleaf:thymeleaf-spring6
|
Maven |
< 3.1.4.RELEASE
|
3.1.4.RELEASE
|
References
Frequently Asked Questions
What is CVE-2026-40478?
Which Thymeleaf versions are affected?
What version fixes CVE-2026-40478?
Is thymeleaf affected?
Is thymeleaf-spring5 affected?
What is the CVSS score of CVE-2026-40478?
What CWE is associated with CVE-2026-40478?
How can I check Maven dependencies for CVE-2026-40478?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xjw8-8c5c-9r79",
"modified" : "2026-04-24T20:53:26Z",
"published" : "2026-04-15T19:46:23Z",
"aliases" : [ "CVE-2026-40478" ],
"summary" : "Improper neutralization of specific syntax patterns for unauthorized expressions in Thymeleaf",
"details" : "### Impact\nA security bypass vulnerability exists in the expression execution mechanisms of Thymeleaf up to and including 3.1.3.RELEASE. 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).\n\n### Patches\nThis has been fixed in Thymeleaf 3.1.4.RELEASE.\n\n### Workarounds\nNo workaround is available beyond ensuring applications do not pass unvalidated user input directly to the template engine. Upgrading to 3.1.4.RELEASE is strongly recommended in any case.\n\n### Credits\nThanks to Dawid Bakaj (VIPentest.com) for responsible disclosure.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.thymeleaf:thymeleaf"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.1.4.RELEASE"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.1.3.RELEASE"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.thymeleaf:thymeleaf-spring5"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.1.4.RELEASE"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.1.3.RELEASE"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.thymeleaf:thymeleaf-spring6"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.1.4.RELEASE"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.1.3.RELEASE"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/thymeleaf/thymeleaf/security/advisories/GHSA-xjw8-8c5c-9r79"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40478"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/thymeleaf/thymeleaf"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336", "CWE-917" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-15T19:46:23Z",
"nvd_published_at" : "2026-04-17T22:16:33Z"
}
}