CVE-2025-23026
JSON

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 packageVersionsReported by
casid jte< 3.1.16CVE List
gg.jte:jte (Maven)before 3.1.16GitHub Advisory Database
gg.jte:jte-runtime (Maven)before 3.1.16GitHub Advisory Database

All scores

GitHub_M6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79CWE-150

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

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
  1. 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>
    
  2. 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

SourceRecordLicence
CVE ListCVE-2025-23026 changed 2025-01-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-vh22-6c6h-rm8q changed 2025-01-13CC-BY-4.0
NVDCVE-2025-23026 changed 2026-06-17Public domain