Cyber Resilience

CVE-2026-40477

RCE in Thymeleaf ≤ 3.1.4

Published
17 April 2026
Modified
04 August 2026
Patch / advisory
CVSS Score v3.1 9.0
Click a component to see what it means
Raw vectorCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
EPSS Score 0.0085 55th percentile
Risk Priority 65 floored blend · peak EPSS

Summary

CVE-2026-40477 is a critical-severity Expression Language Injection (CWE-917) vulnerability in Thymeleaf Thymeleaf. Its CVSS base score is 9.0 (Critical).

Operationally, exploitation aligns with the MITRE ATT&CK technique Template Injection (T1221); ranked in the top 45% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog.

The strongest mitigations our analysis identified map to SA-11 (Developer Testing and Evaluation) and SI-10 (Information Input Validation) — see the control section below for these in your framework.

Deeper analysis AI-assisted summary

Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.

CVE-2026-40477 is a security bypass vulnerability in the expression execution mechanisms of Thymeleaf, a server-side Java template engine used in web and standalone environments. It affects versions 3.1.3.RELEASE and prior. Although Thymeleaf provides mechanisms to prevent expression injection, it fails to properly restrict the scope of accessible objects, allowing potentially sensitive objects to be reached from within a template. Published on 2026-04-17, the vulnerability carries a CVSS v3.1 base score of 9.0 (AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H) and maps to CWE-917 (Expression/Command Injection with Improper Escaping) and CWE-1336 (Improper Neutralization of Special Elements).

An unauthenticated remote attacker can exploit this vulnerability if an application developer passes unvalidated user input directly to the Thymeleaf template engine. By injecting crafted expressions, the attacker bypasses the library's protections to achieve Server-Side Template Injection (SSTI), potentially leading to high-impact confidentiality, integrity, and availability compromises across a changed scope.

The vulnerability has been fixed in Thymeleaf version 3.1.4.RELEASE. Additional details are available in the GitHub security advisory at https://github.com/thymeleaf/thymeleaf/security/advisories/GHSA-r4v4-5mwr-2fwr.

OWASP Top 10 for Web (2025)

EU & UK References

Vulnerability Data

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…

more

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.

CWE(s)

Related Threats

MITRE ATT&CK Enterprise Techniques

T1221 Template Injection Stealth
Adversaries may create or modify references in user document templates to conceal malicious code or force authentication attempts.
T1190 Exploit Public-Facing Application Initial Access
Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network.
Derived from this CVE’s CWE(s) via the direct CWE→ATT&CK cross-walk.

CVEs Like This One

CVE-2026-40478Same product: Thymeleaf Thymeleaf
CVE-2026-41901Shared CWE-1336, CWE-917
CVE-2023-38286Same product: Thymeleaf Thymeleaf
CVE-2026-44209Shared CWE-1336, CWE-917
CVE-2025-2040Shared CWE-1336
CVE-2026-27641Shared CWE-1336
CVE-2026-3725Shared CWE-1336
CVE-2026-9498Shared CWE-1336
CVE-2026-5559Shared CWE-1336
CVE-2026-33130Shared CWE-1336

Affected Assets

thymeleaf
thymeleaf
≤ 3.1.4

Mitigating Controls

Control response

Prevent
Stop it (NIST 800-53)

Detect
Catch it (NIST detect / respond)

Harden
Shrink the surface (DISA STIG)

Validate
Prove the fix (OWASP ASVS)
  • V1.3.2
  • V1.3.7
  • V1.3.10
  • V1.1.2

Mitigating Controls (NIST 800-53 r5) AI

Developer testing and static analysis can discover missing neutralization of template directives.

Input validation directly requires checking and neutralizing special elements in externally influenced data before it is used to build executable statements such as EL expressions.

Security engineering principles include requirements for safe construction and sanitization of dynamic statements, structurally preventing expression-language injection at design time.

Mitigating Controls (NIST CSF 2.0) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→CSF cross-walk (authority under review) — links open the control.

PR.PS-06 mostly match
prevents

Secure SDLC practices directly require input neutralization and safe EL construction to prevent injection flaws.

Mitigating Controls (ISO/IEC 27001:2022 Annex A) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→ISO cross-walk (authority under review) — links open the control.

finds

Security testing in development and acceptance can detect EL injection but does not itself implement the fix.

prevents

Secure SDLC mandates input validation and output encoding that directly prevent expression-language injection.

prevents

Application security requirements explicitly call for controls against injection flaws including EL injection.

prevents

Secure architecture principles reduce the attack surface but do not prescribe the specific neutralization techniques needed.

prevents

Secure coding standards require proper escaping and parameterization of expression-language statements.

References