CVE-2026-40478: Thymeleaf Improper Neutralization Of Specific Syntax Vulnerability

CRITICAL
Advisory Identifier: GHSA-xjw8-8c5c-9r79
CVSS 9.0
CWE-917 CWE-1336
Published
Advisory Summary

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

CVE Identifier CVE-2026-40478
GHSA Identifier GHSA-xjw8-8c5c-9r79
Severity CRITICAL
CVSS v3.1 Base Score 9.0
CWE Classification CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')
Affected Product Thymeleaf
Package Ecosystem Maven
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (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.

org.thymeleaf:thymeleaf fixed: 3.1.4.RELEASE
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf</artifactId>
    <version>3.1.4.RELEASE</version>
</dependency>
org.thymeleaf:thymeleaf-spring5 fixed: 3.1.4.RELEASE
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-spring5</artifactId>
    <version>3.1.4.RELEASE</version>
</dependency>
org.thymeleaf:thymeleaf-spring6 fixed: 3.1.4.RELEASE
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-spring6</artifactId>
    <version>3.1.4.RELEASE</version>
</dependency>
Verify Direct and Transitive Dependencies

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

### Impact A 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). ### Patches This has been fixed in Thymeleaf 3.1.4.RELEASE. ### Workarounds No 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. ### Credits Thanks to Dawid Bakaj (VIPentest.com) for responsible disclosure.

CVE-2026-40478 Affected Thymeleaf Versions

3 component(s)
Fixed Versions:
3.1.4.RELEASE
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?
CVE-2026-40478 is a security vulnerability in Thymeleaf involving Improper neutralization of specific syntax patterns for unauthorized expressions in Thymeleaf under CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection').
Which Thymeleaf versions are affected?
Affected versions include releases prior to 3.1.4.RELEASE across affected packages: org.thymeleaf:thymeleaf, org.thymeleaf:thymeleaf-spring5, org.thymeleaf:thymeleaf-spring6.
What version fixes CVE-2026-40478?
Upgrading to 3.1.4.RELEASE (or the latest patched release for your respective branch) resolves the vulnerability.
Is thymeleaf affected?
Yes, org.thymeleaf:thymeleaf is affected in releases prior to 3.1.4.RELEASE. Upgrade your dependency to 3.1.4.RELEASE or later.
Is thymeleaf-spring5 affected?
Yes, org.thymeleaf:thymeleaf-spring5 is affected in releases prior to 3.1.4.RELEASE. Upgrade your dependency to 3.1.4.RELEASE or later.
What is the CVSS score of CVE-2026-40478?
CVE-2026-40478 has a CVSS v3.1 base score of 9.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-40478?
CVE-2026-40478 is classified under CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection') (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.).
How can I check Maven dependencies for CVE-2026-40478?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.thymeleaf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}