Thymeleaf
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.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- < 3.1.4.RELEASE
Fixed in 3.1.4.RELEASE
- < 3.1.4.RELEASE
Fixed in 3.1.4.RELEASE
- < 3.1.4.RELEASE
Fixed in 3.1.4.RELEASE
Mitigation
Upgrade thymeleaf to 3.1.4.RELEASE or later.
Upgrade org.thymeleaf:thymeleaf-spring5 to 3.1.4.RELEASE or later.
Upgrade org.thymeleaf:thymeleaf-spring6 to 3.1.4.RELEASE or later.
References
- Vendor advisory github.com/thymeleaf/thymeleaf/security/adviso…
Timeline
Days relative to CVE publicationFirst public PoC 11 days after publication; not in CISA KEV. First PoC: bmvermeer/thymeleaf.CVE_2026_40478 (created 29 Apr 2026, found by us: backfilled).
PoC repositories
Found on GitHub.1 PoCs
PoCs 1
| Repository | Created | Stars | Assessment |
|---|---|---|---|
| bmvermeer/thymeleaf.CVE_2026_40478 | 29 Apr 2026 +11 d | 1 | PoC
Flags · score 15
Below the suspicion threshold (50); does not change the assessment. |
Only PoCs count toward the first-PoC date and the characteristics below. Do not run PoC code from unknown sources.
PoC characteristics
What to hunt for in your logs · from 1 PoC repoGET /greet/unsafe
GET /page/unsafe
Regex
Generated from PoC characteristics; not yet reviewed. Matches the request path and query.
(?i)^/greet/unsafe\?(?:.*&)?name=
(?i)^/page/unsafe\?(?:.*&)?page=
Suricata
Template generated from PoC characteristics. Review before deploying.
alert http any any -> $HOME_NET [8080] (msg:"GG PoC-Monitor CVE-2026-40478 thymeleaf thymeleaf exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/greet/unsafe"; http.uri; content:"name="; reference:url,poc.griffinguard.io/cve/CVE-2026-40478; classtype:web-application-attack; sid:9734059; rev:1;)
alert http any any -> $HOME_NET [8080] (msg:"GG PoC-Monitor CVE-2026-40478 thymeleaf thymeleaf exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/page/unsafe"; http.uri; content:"page="; reference:url,poc.griffinguard.io/cve/CVE-2026-40478; classtype:web-application-attack; sid:9636335; rev:1;)
Sigma
Template generated from PoC characteristics. Review before deploying.
title: thymeleaf thymeleaf exploit attempt (CVE-2026-40478)
id: gg-pocmon-cve-2026-40478-9734059
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-40478. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-40478
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/greet/unsafe'
cs-uri-query|contains|all:
- 'name='
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.40478
title: thymeleaf thymeleaf exploit attempt (CVE-2026-40478)
id: gg-pocmon-cve-2026-40478-9636335
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-40478. Generated, not reviewed.
references:
- https://poc.griffinguard.io/cve/CVE-2026-40478
logsource:
category: webserver
detection:
selection:
cs-method: GET
cs-uri-stem|contains|all:
- '/page/unsafe'
cs-uri-query|contains|all:
- 'page='
condition: selection
falsepositives:
- Authorized vulnerability scanning
level: critical
tags:
- attack.initial_access
- attack.t1190
- cve.2026.40478