# CVE-2026-41901: Thymeleaf: Improper recognition of unauthorized syntax patterns in sandboxed Thymeleaf expressions

> Attackers can achieve Server-Side Template Injection and execute arbitrary code if developers pass unsanitized input to sandboxed Thymeleaf contexts.

- **Severity:** Critical 9.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 May 2026
- **Updated:** 13 May 2026
- **Also known as:** CLSA-2026-1788881357, CLSA-2026-1788887721, CLSA-2026-1789561134, CLSA-2026-1789577899, GHSA-c9ph-gxww-7744

## What is CVE-2026-41901?

CVE-2026-41901 is a critical code injection vulnerability in thymeleaf, published on 12 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Thymeleaf is a server-side Java template engine for web and standalone environments. Prior to 3.1.5.RELEASE, a security bypass vulnerability exists in the expression execution mechanisms of Thymeleaf. Although the library provides mechanisms to avoid the execution of potentially dangerous expressions in some specific sandboxed (restricted) contexts, it fails to properly neutralize specific constructs that allow this kind of expressions to be executed. If an application developer passes to the template engine unsanitized variables that contain such expressions, and these values are used in sandboxed contexts inside the templates, these expressions can be executed achieving Server-Side Template Injection (SSTI). This vulnerability is fixed in 3.1.5.RELEASE.

Weakness: CWE-917 (Improper Neutralization of Special Elements used in an Expression Language Statement), CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine)

## Which versions are affected by CVE-2026-41901?

6 open source packages ship an affected version, including org.thymeleaf:thymeleaf, org.thymeleaf:thymeleaf-spring5 and org.thymeleaf:thymeleaf-spring6.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.thymeleaf:thymeleaf` | Maven | All versions | 3.1.5.RELEASE |
| `org.thymeleaf:thymeleaf` | Maven | All versions | 3.1.5.RELEASE |
| `org.thymeleaf:thymeleaf-spring5` | Maven | All versions | 3.1.5.RELEASE |
| `org.thymeleaf:thymeleaf-spring5` | Maven | All versions | 3.1.5.RELEASE |
| `org.thymeleaf:thymeleaf-spring6` | Maven | All versions | 3.1.5.RELEASE |
| `org.thymeleaf:thymeleaf-spring6` | Maven | All versions | 3.1.5.RELEASE |

## How do I fix CVE-2026-41901?

Upgrade org.thymeleaf:thymeleaf to 3.1.5.RELEASE or later.

## Is CVE-2026-41901 being exploited?

There is no known exploitation of CVE-2026-41901 in the wild and no public exploit code.

Public exploit code:

-  CVE-2026-41901 (github_poc): https://github.com/HORKimhab/CVE-2026-41901

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-41901 and fix it if it is affected.

What it is: CVE-2026-41901 is a critical code injection vulnerability in thymeleaf, published on 12 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-41901 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.thymeleaf:thymeleaf (Maven): affected all versions; fixed in 3.1.5.RELEASE
- org.thymeleaf:thymeleaf (Maven): affected all versions; fixed in 3.1.5.RELEASE
- org.thymeleaf:thymeleaf-spring5 (Maven): affected all versions; fixed in 3.1.5.RELEASE
- org.thymeleaf:thymeleaf-spring5 (Maven): affected all versions; fixed in 3.1.5.RELEASE
- org.thymeleaf:thymeleaf-spring6 (Maven): affected all versions; fixed in 3.1.5.RELEASE
- org.thymeleaf:thymeleaf-spring6 (Maven): affected all versions; fixed in 3.1.5.RELEASE

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-41901/ (Markdown: https://insights.sbomify.com/CVE-2026-41901/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-41901
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-41901
- OSV: https://osv.dev/vulnerability/CVE-2026-41901

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-41901/
Summaries are generated and may contain mistakes; the official description above is the record.
