Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Protecting Your Sites from Apache.Commons Vulnerabilities

Overview

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.

 

Which common application servers are vulnerable?

FoxGlove provides POC for attacks on the following servers:

  • WebSphere Application Server - CVE-2015-7450
  • Oracle WebLogic - CVE 2015-4852
  • JBoss Application Server - CVE-2015-7501
  • Jenkins CI - Continuous Integration and DevOps platform
  • OpenNMS - Open Source Network Management Software

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.

 

Which other applications are at risk?

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.

 

Known publicly available exploits

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.

 

General Guidelines for mitigation

  • For In-House Java Applications, Update Apache commons-collection.
  • For the top known vulnerable apps listed in the FoxGlove post, apply vendor fixes as they become available.

 

Guidelines for ModSecurity supported customers

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.

 

Additional detail - How to mitigate Oracle Weblogic 0-day CVE-2015-4852?

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.

Latest SpiderLabs Blogs

Cloudy with a Chance of Hackers: Protecting Critical Cloud Workloads

If you've been following along with David's posts, you'll have noticed a structure to the topics: Part I: The Plan, Part II: The Execution and now we move into Part III: Security Operations. Things...

Read More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update

Trustwave is proactively assessing and monitoring our clients who may have been impacted by CrowdStrike’s recently rolled-out update for its Windows users. The critical issue identified with...

Read More

Using AWS Secrets Manager and Lambda Function to Store, Rotate and Secure Keys

When working with Amazon Web Services (AWS), we often find that various AWS services need to store and manage secrets. AWS Secrets Manager is the go-to solution for this. It's a centralized service...

Read More