Vulnerabilities in pkg:maven/io.jstach/jstachio
PACKAGECVE-2023-33962 is a MODERATE (CVSS 5.4) unescaped single quotes vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting JStachio XSS vulnerability libraries in the Maven ecosystem. The issue involves unescaped single quotes. Remediation is available by upgrading affected packages to version 1.0.1.
pkg:maven/io.jstach/jstachio
Vulnerability advisories affecting package pkg:maven/io.jstach/jstachio. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-gwxv-jv83-6qjr | CVE-2023-33962 | MODERATE | JStachio XSS vulnerability: Unescaped single quotes |
CVE-2023-33962 at a Glance
Security Impact
CVSS: 5.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2023-33962
To remediate this vulnerability, upgrade all affected JStachio XSS vulnerability dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>io.jstach</groupId>
<artifactId>jstachio</artifactId>
<version>1.0.1</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=io.jstach
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2023-33962, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=io.jstach
Analyze the terminal output to locate any version of JStachio XSS vulnerability in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.1), your application is affected.
Note: The mvn dependency:tree -Dincludes=io.jstach command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In JStachio XSS vulnerability, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-33962 Affected JStachio XSS vulnerability Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
io.jstach:jstachio
|
Maven |
< 1.0.1
|
1.0.1
|
References
Frequently Asked Questions
What is CVE-2023-33962?
Which JStachio XSS vulnerability versions are affected?
What version fixes CVE-2023-33962?
Is jstachio affected?
What is the CVSS score of CVE-2023-33962?
What CWE is associated with CVE-2023-33962?
How can I check Maven dependencies for CVE-2023-33962?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gwxv-jv83-6qjr",
"modified" : "2023-06-06T00:45:18Z",
"published" : "2023-06-06T00:45:18Z",
"aliases" : [ "CVE-2023-33962" ],
"summary" : "JStachio XSS vulnerability: Unescaped single quotes",
"details" : "### Impact\n\n#### Description:\nJStachio fails to escape single quotes `'` in HTML, allowing an attacker to inject malicious code.\n\n#### Reproduction Steps:\nUse the following template code:\n```html\n<div attr='{{value}}'></div>\n```\n\nSet the value variable to `' onblur='alert(1)`.\n\n```java\npublic class Escaping {\n\n public static void main(String[] args) {\n Model model = new Model(\"' onblur='alert(1)\");\n String result = AttributeTemplate.of().execute(model);\n System.out.println(result);\n }\n\n @JStache(template = \"<div attr='{{value}}'></div>\",\n name=\"AttributeTemplate\")\n @JStacheConfig(contentType= Html.class)\n public static class Model {\n\n public final String value;\n\n public Model(String value) {\n this.value = value;\n }\n\n public String getValue() {\n return value;\n }\n }\n}\n```\n\nExpected Result:\nThe resulting output should have properly escaped the single quotes and not execute the injected JavaScript code.\n\nActual Result:\nThe resulting output is vulnerable and renders as follows:\n```html\n<div attr='' onblur='alert(1)'></div>\n```\n\n#### Impact and Risk:\nThis vulnerability can be exploited by an attacker to execute arbitrary JavaScript code in the context of other users visiting pages that use this template engine. This can lead to various consequences, including session hijacking, defacement of web pages, theft of sensitive information, or even the propagation of malware.\n\n#### Proposed Solution:\nTo mitigate this vulnerability, the template engine should properly escape special characters, including single quotes. Common practice is to escape `'` as `'`.\n\n### Patches\n-\n\n### Workarounds\nAs long as users stick with double quotes `\"` for HTML attributes, they should not be affected.\n\n### References\nFor instance, [Rocker's general purpose HTML escaping](https://github.com/fizzed/rocker/blob/d749fbf68179b31a64d541f5e18e0e25bc5c2d1b/rocker-runtime/src/main/java/com/fizzed/rocker/runtime/DefaultHtmlStringify.java#L64)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "io.jstach:jstachio"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/jstachio/jstachio/security/advisories/GHSA-gwxv-jv83-6qjr"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-33962"
}, {
"type" : "WEB",
"url" : "https://github.com/jstachio/jstachio/issues/157"
}, {
"type" : "WEB",
"url" : "https://github.com/jstachio/jstachio/pull/158"
}, {
"type" : "WEB",
"url" : "https://github.com/jstachio/jstachio/commit/7b2f78377d1284df14c580be762a25af5f8dcd66"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/jstachio/jstachio"
}, {
"type" : "WEB",
"url" : "https://github.com/jstachio/jstachio/releases/tag/v1.0.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-06-06T00:45:18Z",
"nvd_published_at" : "2023-05-30T22:15:10Z"
}
}