CVE-2026-40477: Improper restriction of the scope of accessible objects in Thymeleaf expressions
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.
Security readout for executives and security teams
Plain-English summary
Thymeleaf versions before 3.1.4.RELEASE contain a protection bypass. In affected apps, a remote unauthenticated attacker may turn unsafe user-controlled template input into server-side template injection. Business risk is highest where Thymeleaf renders user-supplied templates or expressions; ordinary static template rendering is not enough by itself.
Executive priority
Treat as urgent for applications that use Thymeleaf with user-controlled template content. The issue is critical, but real exposure depends on implementation. Start with internet-facing Java services and products that allow template customization or preview workflows.
Technical view
The flaw is an expression-execution security bypass: accessible object scope is not restricted enough, allowing sensitive objects to be reached from templates. Preconditions matter: the advisory describes impact when developers pass unvalidated user input directly to the template engine. Affected artifacts include thymeleaf, thymeleaf-spring5, and thymeleaf-spring6 before 3.1.4.RELEASE.
Likely exposure
Java applications using Thymeleaf 3.1.3.RELEASE or earlier, especially Spring integrations, are candidates for review. Exposure is more likely in custom template, email, CMS, admin, or preview features that accept user-controlled template content or expressions.
Exploitation context
The CVE is not listed as KEV in the provided bundle, and no cited source here confirms active exploitation. CVSS is 9.1 with network attack vector and no privileges required, but attack complexity is high and depends on unsafe application integration.
Researcher notes
Focus validation on dependency versions and application data flow into Thymeleaf rendering. The source bundle supports SSTI risk under specific unsafe input handling, not universal compromise of every Thymeleaf deployment. Avoid assuming exploit activity without KEV or cited evidence.
Mitigation direction
Upgrade Thymeleaf components to 3.1.4.RELEASE or later.
Check Red Hat advisory RHSA-2026:21772 if consuming packaged Red Hat dependencies.
Remove or constrain user-controlled input passed directly to template rendering.
Review vendor guidance before applying compensating controls not named in advisories.
Validation and detection
Inventory direct and transitive Thymeleaf dependencies across applications.
Confirm deployed artifacts no longer include Thymeleaf versions before 3.1.4.RELEASE.
Review template-rendering paths for unvalidated user-controlled templates or expressions.
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.