CVE-2026-40478: Improper neutralization of specific syntax patterns for unauthorized expressions in Thymeleaf
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.
Security readout for executives and security teams
Plain-English summary
A flaw in Thymeleaf can let an unauthenticated attacker turn attacker-controlled template input into unauthorized server-side expressions. Successful exploitation could expose or alter sensitive data and disrupt services. Risk is conditional: the application must pass unvalidated user input directly into an affected template engine.
Executive priority
Treat as urgent for internet-facing applications that dynamically process user-controlled template content. Prioritize inventory and data-flow review immediately, then upgrade confirmed affected deployments. Systems using Thymeleaf only with fixed, trusted templates may have lower practical exposure, but still require version verification because the potential impact is severe.
Technical view
Thymeleaf versions before 3.1.4.RELEASE inadequately neutralize certain expression syntax, allowing protections against expression injection to be bypassed. This can produce server-side template injection in vulnerable data flows. Thymeleaf, thymeleaf-spring5, and thymeleaf-spring6 artifacts are listed as affected. CVSS 3.1 is 9.1, with high confidentiality, integrity, and availability impact.
Likely exposure
Exposure is highest in internet-facing Java applications using affected Thymeleaf versions where untrusted request data reaches template parsing or expression evaluation without validation. Merely having the dependency does not establish exploitability; application data flow and configuration must be reviewed. Applications using 3.1.4.RELEASE or later are outside the stated affected range.
Exploitation context
The source bundle does not establish active exploitation, and the CVE is not listed as KEV. Exploitation requires a vulnerable application pattern and is rated high complexity, but needs no authentication or user interaction. A successful bypass may execute unauthorized expressions with severe effects in the application’s server context.
Researcher notes
The weakness maps to CWE-1336 and CWE-917. The decisive exposure condition is attacker-controlled input reaching the template engine as executable template or expression material, not ordinary value substitution alone. Public sources supplied here confirm the affected range and fixed version but do not provide evidence of exploitation in the wild or a detection signature.
Mitigation direction
Upgrade Thymeleaf, thymeleaf-spring5, and thymeleaf-spring6 dependencies to 3.1.4.RELEASE or later.
Stop passing unvalidated user-controlled content directly into template parsing or expression execution paths.
Inventory transitive dependencies to identify affected Thymeleaf artifacts embedded by frameworks or application components.
Consult Thymeleaf and relevant platform vendor advisories for supported upgrade guidance.
Validation and detection
Confirm deployed artifacts and runtime dependency trees contain no Thymeleaf version earlier than 3.1.4.RELEASE.
Trace untrusted input flows into template construction, preprocessing, parsing, and expression evaluation.
Run defensive regression tests ensuring user input is treated as data, never executable template syntax.
Review application logs for unexpected template parsing failures or expression-evaluation activity; sources provide no definitive detection signature.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-1336: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
5Timeline events
2ADP providers
6Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-1336 · source CWE mapping
Improper Neutralization of Special Elements Used in a Template Engine
Improper Neutralization of Special Elements Used in a Template Engine represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')
Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.