6.1medium
HTML templates containing Javascript template strings are subject to XSS in jte
- Severity
- 6.1medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.38% (higher than 34% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-vh22-6c6h-rm8q
Description
jte (Java Template Engine) is a secure and lightweight template engine for Java and Kotlin. In affected versions Jte HTML templates with `script` tags or script attributes that include a Javascript template string (backticks) are subject to XSS. The `javaScriptBlock` and `javaScriptAttribute` methods in the `Escape` class do not escape backticks, which are used for Javascript template strings. Dollar signs in template strings should also be escaped as well to prevent undesired interpolation. HTML templates rendered by Jte's `OwaspHtmlTemplateOutput` in versions less than or equal to `3.1.15` with `script` tags or script attributes that contain Javascript template strings (backticks) are vulnerable. Users are advised to upgrade to version 3.1.16 or later to resolve this issue. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| casid jte | < 3.1.16 | CVE List |
| gg.jte:jte (Maven) | before 3.1.16 | GitHub Advisory Database |
| gg.jte:jte-runtime (Maven) | before 3.1.16 | GitHub Advisory Database |
All scores
| GitHub_M | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
What each source says
CVE List
jte (Java Template Engine) is a secure and lightweight template engine for Java and Kotlin. In affected versions Jte HTML templates with `script` tags or script attributes that include a Javascript template string (backticks) are subject to XSS. The `javaScriptBlock` and `javaScriptAttribute` methods in the `Escape` class do not escape backticks, which are used for Javascript template strings. Dollar signs in template strings should also be escaped as well to prevent undesired interpolation. HTML templates rendered by Jte's `OwaspHtmlTemplateOutput` in versions less than or equal to `3.1.15` with `script` tags or script attributes that contain Javascript template strings (backticks) are vulnerable. Users are advised to upgrade to version 3.1.16 or later to resolve this issue. There are no known workarounds for this vulnerability.
GitHub Advisory Database
Summary
Jte HTML templates with script tags or script attributes that include a Javascript template string (backticks) are subject to XSS.
Details
The javaScriptBlock and javaScriptAttribute methods in the Escape class (source) do not escape backticks, which are used for Javascript template strings. Dollar signs in template strings should also be escaped as well to prevent undesired interpolation.
PoC
- Use the Jte Gradle Plugin with the following code in
src/jte/xss.jte:@param String someMessage <!DOCTYPE html> <html lang="en"> <head> <title>XSS Test</title> <script>window.someVariable = `${someMessage}`;</script> </head> <body> <h1>XSS Test</h1> </body> </html> - Use the following Java code to demonstrate the XSS vulnerability:
final StringOutput output = new StringOutput(); JtexssGenerated.render(new OwaspHtmlTemplateOutput(output), null, "` + alert(`xss`) + `"); renderHtml(output);
Impact
HTML templates rendered by Jte's OwaspHtmlTemplateOutput in versions less than or equal to 3.1.15 with script tags or script attributes that contain Javascript template strings (backticks) are vulnerable.
NVD (es)
jte (Java Template Engine) es un motor de plantillas ligero y seguro para Java y Kotlin. En las versiones afectadas, las plantillas HTML de Jte con etiquetas `Script` y atributos MASK13**ript que incluyen una cadena de plantilla de Javascript (comillas invertidas) están sujetas a XSS. Los métodos `javaScriptBlock` y `javaScriptAttribute` en la clase `Escape` no escapan las comillas invertidas, que se utilizan para cadenas de plantilla de Javascript. Los signos de dólar en las cadenas de plantilla también deben escaparse para evitar una interpolación no deseada. Las plantillas HTML renderizadas por `OwaspHtmlTemplateOutput` de Jte en versiones menores o iguales a `3.1.15Script `scriScriptgs o los atributos de script que contienen cadenas de plantilla de Javascript (comillas invertidas) son vulnerables. Se recomienda a los usuarios que actualicen a la versión 3.1.16 o posterior para resolver este problema. No se conocen Workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-23026 changed 2025-01-13 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-vh22-6c6h-rm8q changed 2025-01-13 | CC-BY-4.0 |
| NVD | CVE-2025-23026 changed 2026-06-17 | Public domain |