Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More
A few weeks ago, FoxGlove Security released this important blog post that includes several Proof-of-Concepts for exploiting Java unserialized vulnerabilities.
A remote attacker can gain Remote Code Execution by sending a specially crafted payload to any endpoint expecting a serialized Java object. In some cases, the attack may be executed from an unauthorized and unauthenticated host. Apache Foundation released this detailed description.
FoxGlove provides POC for attacks on the following servers:
As these are application frameworks, URLs are vulnerable depending on actual implementation. However, there are common endpoints that may be exposed. In JBOSS, invoker/JMXInvokerServlet may be exposed, which is a bad idea but not uncommon.
Any custom Java application server that receives Java Serialized Objects and uses the Apache.Common.Collections library. For example, Legacy web applications developed with the JSF (Java Server Faces) Library. However, this vulnerability can possibly be exploited in Java applications which do not use Apache.Common.Collections. As quoted in the Apache Foundation blog:
"In these rather unfortunate situations, people have looked at the sample exploits. Frohoff provided "gadget chains" in sample payloads which combine classes from the Groovy runtime, Spring framework, or Apache Commons Collection. It is quite certain that you can combine more classes to exploit this weakness, but those are the chains readily available to attackers today."
We might be facing an evolving threat, based on using "gadget chains" from additional libraries. A recent update here lists possible vulnerabilities in many other libraries. This includes some common libraries: JSF 2.2, JasperReports, Apache Hadoop, OpenJPA, Apache Jena, Mule, Hadoop MapReduce, HBase and several others.
For JBoss Application Server - CVE-2015-7501 - there is already a publicly available exploit. There is also a publicly available Java tool that builds a payload to execute any command, as well as a public listing of vulnerable servers as detected by Shodan.
You can write a SecRule to protect known endpoints that receive Java Serialized Objects. For example, to protect endpoint "invoker/JmxInvoker, the rule could be written as follows:
SecRule REQUEST_LINE "@contains /invoker/JmxInvoker" "chain,phase:2,block,t:none,t:urlDecodeUni,capture, /
logdata:'%{matched_var}',severity:'9',id:999999,msg:'Apache-Commons', tag:'Apache-commons'"
SecRule REQUEST_BODY "@pmFromFile java_servuln.data"...
The relevant transformation should be used based on the location. For example, use t:base64Decode
when required. Java_servuln.data should include the following strings:
org/apache/commons/collections/Transformer
org.apache.commons.collections.Transformer
org.apache.commons.collections.functors.InvokerTransformer
org/apache/commons/collections4/functors/InvokerTransformer
org.apache.commons.collections4.functors.InvokerTransformer
org/codehaus/groovy/runtime/ConvertedClosure
org.codehaus.groovy.runtime.ConvertedClosure
com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl
com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl
In practice, it is difficult to determine which URIs to protect. We recommend customers perform an architecture review to determine where Java Serialization is used, and perform some profiling for known good data sent to these URIs, to avoid False Positives. Note that as stated in the "Which other applications are at risk?" section, it is impossible to cover all possible cases as additional libraries may be vulnerable.
We have also received questions regarding this CVE. This relates to JAVA RMI (Remote Method Invocation) used by Oracle WebLogic for Java-To-Java communication (including with admin console) over T3 binary protocol, port 7001. The best mitigation is to block access to 7001 port on this server from external networks or unknown IP addresses. The method depends on the customer architecture, and can be achieved by either configuring your firewall or other networking equipment with proper access control rules. Users of Weblogic can read up on the configuration for their environment over in this blog post.
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.