GHSA-vh22-6c6h-rm8q

Suggest an improvement
Source
https://github.com/advisories/GHSA-vh22-6c6h-rm8q
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/01/GHSA-vh22-6c6h-rm8q/GHSA-vh22-6c6h-rm8q.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-vh22-6c6h-rm8q
Aliases
Published
2025-01-13T16:57:59Z
Modified
2025-01-13T22:00:48Z
Severity
  • 6.1 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
jte's HTML templates containing Javascript template strings are subject to XSS
Details

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.

Database specific
{
    "cwe_ids":  [
        "CWE-150",
        "CWE-79"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2025-01-13T16:57:59Z",
    "nvd_published_at":  "2025-01-13T20:15:30Z",
    "severity":  "MODERATE"
}
References

Affected packages

Maven / gg.jte:jte

Package

Name
gg.jte:jte
View open source insights on deps.dev
Purl
pkg:maven/gg.jte/jte

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
3.1.16

Affected versions

1.*
1.0.0
1.1.0
1.2.0
1.3.0
1.4.0
1.5.0
1.5.1
1.5.2
1.6.0
1.7.0
1.8.0
1.9.0
1.10.0
1.11.0
1.11.1
1.11.2
1.11.3
1.11.4
1.12.0
1.12.1
2.*
2.0.0
2.0.1
2.0.2
2.0.3
2.0.4
2.1.0
2.1.1
2.1.2
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.2.6
2.3.0
2.3.1
2.3.2
3.*
3.0.0
3.0.1
3.0.2
3.0.3
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.1.6
3.1.7
3.1.8
3.1.9
3.1.10
3.1.11
3.1.12
3.1.13
3.1.14
3.1.15

Database specific

last_known_affected_version_range
"<= 3.1.15"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/01/GHSA-vh22-6c6h-rm8q/GHSA-vh22-6c6h-rm8q.json"

Maven / gg.jte:jte-runtime

Package

Name
gg.jte:jte-runtime
View open source insights on deps.dev
Purl
pkg:maven/gg.jte/jte-runtime

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
3.1.16

Affected versions

1.*
1.0.0
1.1.0
1.2.0
1.3.0
1.4.0
1.5.0
1.5.1
1.5.2
1.6.0
1.7.0
1.8.0
1.9.0
1.10.0
1.11.0
1.11.1
1.11.2
1.11.3
1.11.4
1.12.0
1.12.1
2.*
2.0.0
2.0.1
2.0.2
2.0.3
2.0.4
2.1.0
2.1.1
2.1.2
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.2.6
2.3.0
2.3.1
2.3.2
3.*
3.0.0
3.0.1
3.0.2
3.0.3
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.1.6
3.1.7
3.1.8
3.1.9
3.1.10
3.1.11
3.1.12
3.1.13
3.1.14
3.1.15

Database specific

last_known_affected_version_range
"<= 3.1.15"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/01/GHSA-vh22-6c6h-rm8q/GHSA-vh22-6c6h-rm8q.json"