Dark sides of Java remote protocols
An Trinh (Researcher · Viettel Cyber Security)
ZeroNights 2019 · Day 1
Overview
In this compelling talk from ZeroNights, An Trinh, a researcher from Viettel Cyber Security, unveils a series of critical, often overlooked, and sometimes unacknowledged vulnerabilities within popular Java remote protocols: Java Remote Method Invocation (RMI) over Java Remote Messaging Protocol (JRMP) and Common Object Request Broker Architecture (CORBA) over Internet Inter-ORB Protocol (IIOP). Trinh's extensive research, which involved analyzing numerous products, revealed that a staggering 100% of the tested applications were vulnerable to at least one of the identified issues. For seven to eight of these products, including offerings from VMware, Dell, Apache Tomcat, and IBM WebSphere, he successfully achieved Remote Code Execution (RCE).

Key moments
- 0:00 Introduction and 100% vulnerable products
- 8:00 Past RMI serialization exploits and Java's filters
- 12:00 First attack vector: client-side RMI deserialization
- 16:00 Vendors ignore recommendations, custom service RCE
- 22:00 CORBA IIOP deserialization, unaffected by Java filters
- 30:00 RMI registry rebind attack, credential capture
- 38:00 Demo: Tomcat RCE via JMX after MitM
- 43:00 Key mitigations for Java remote protocols
Dark sides of Java remote protocols
Speakers: An Trinh, Researcher, Viettel Cyber Security
Conference: ZeroNights
YouTube: https://www.youtube.com/watch?v=tj6MdgfjQTU
Overview
In this compelling talk from ZeroNights, An Trinh, a researcher from Viettel Cyber Security, unveils a series of critical, often overlooked, and sometimes unacknowledged vulnerabilities within popular Java remote protocols: Java Remote Method Invocation (RMI) over Java Remote Messaging Protocol (JRMP) and Common Object Request Broker Architecture (CORBA) over Internet Inter-ORB Protocol (IIOP). Trinh's extensive research, which involved analyzing numerous products, revealed that a staggering 100% of the tested applications were vulnerable to at least one of the identified issues. For seven to eight of these products, including offerings from VMware, Dell, Apache Tomcat, and IBM WebSphere, he successfully achieved Remote Code Execution (RCE).
The presentation delves deep into the architecture and underlying mechanisms of these pervasive protocols, exposing how fundamental design choices and insufficient developer guidance have created a fertile ground for high-impact security flaws. Trinh highlights how even after significant security updates, such as Java Enhancement Proposal (JEP) 290, vendors frequently fail to implement necessary defenses, leaving a vast landscape of enterprise applications exposed. This talk is crucial for anyone involved in Java application development, security auditing, or infrastructure defense, providing actionable insights into complex deserialization exploits and man-in-the-middle attack vectors.
Background
▶ Watch: Introduction and 100% vulnerable products (0:00)
Java RMI and CORBA are foundational technologies for distributed Java applications, enabling seamless communication and method invocation across different processes or machines. RMI over JRMP is a Java-specific protocol, allowing Java objects to be invoked remotely. Its architecture typically involves a client, a registry service (which keeps records of available services), a DGC service (for distributed garbage collection), and custom services where the application's core logic resides. Methods are invoked via Remote Method Invocation (RMI) calls, which are essentially TCP request-response pairs, with arguments and return values serialized using Java's built-in serialization mechanism.
CORBA, on the other hand, is a language-agnostic specification, implemented in Java as RMI over IIOP. It allows objects written in various languages (including C++ and Java) to interoperate. Similar to RMI, CORBA also relies on a serialization-like process for marshaling complex object types over the wire. The fundamental problem exploited across both protocols is deserialization, where untrusted data sent over the network is converted back into objects, often leading to arbitrary code execution if proper validation is not in place.
Past exploits in Java deserialization, particularly the YSOSerial toolkit, have highlighted the severe risks. Moritz Beller's 2016 exploit targeting the RMI registry service and another lesser-known exploit against the DGC service demonstrated how attackers could leverage Java serialization to achieve RCE. These exploits were eventually patched in Java Runtime Environment (JRE) version 8u121 (Java 8 Update 121) with the introduction of JEP 290, which added an ObjectInputFilter API to ObjectInputStream. This API was designed to allow applications to impose class-based whitelists during deserialization, thereby mitigating common deserialization gadget chain attacks. However, as Trinh's research reveals, the implementation and adoption of JEP 290 have been inconsistent and often flawed, leaving many applications still vulnerable. Furthermore, the inherent design of RMI and CORBA, particularly their handling of remote object references and reliance on centralized naming services, introduces additional attack surfaces beyond mere deserialization.
Key Findings
▶ Watch: First attack vector: client-side RMI deserialization (12:00)
An Trinh's research uncovered a spectrum of vulnerabilities, categorizing them into several key findings that demonstrate the persistent insecurity of Java remote protocols:
- Client-Side RMI Deserialization: A novel attack vector that turns a server-side RMI call into a client-side deserialization exploit. This technique leverages RMI's proxy interface and specific gadgets (
RemoteObjectInvocationHandler,UnicastRemoteObject) to force the client to deserialize an attacker-controlled stream on an unfilteredObjectInputStream, bypassing JEP 290 protections. - Widespread Custom Service Deserialization Vulnerabilities: Despite JEP 290, most vendors failed to implement
ObjectInputFilteron custom RMI services. This negligence allows attackers to exploit traditional deserialization gadget chains (e.g., Apache Commons Collections, Apache Commons BeanUtils, JDK-only gadgets) to achieve RCE on a vast array of products, including VMware's offerings. - JMX RMI Weaknesses: The Java Management Extensions (JMX) protocol, often running over RMI, exhibited several vulnerabilities. These included potential authentication bypasses (though impractical due to random object IDs), post-authentication deserialization flaws due to missing filters, and a critical lack of documentation regarding how to secure JMX RMI services with JEP 290.
- RMI Registry Man-in-the-Middle (MITM) Attacks: Trinh detailed how the RMI registry's
rebindmethod, intended for service modification, can be maliciously exploited. Several bypasses for thecheckAccesslocal-only restriction were identified, including leveraging thenumfield (CVE-assigned for sandbox escape, but applicable here) and an HTTP proxy feature that makes remote hosts appear local. This allows attackers to redirect legitimate client connections to rogue services, capturing credentials or escalating privileges. - CORBA/IIOP Deserialization Beyond JEP 290: The internal deserialization mechanism used by CORBA's IIOP protocol is distinct from Java's
ObjectInputStreamand is therefore unaffected by JEP 290. This means that even updated JREs remain vulnerable to CORBA-specific deserialization exploits, as demonstrated in IBM WebSphere. - CORBA Naming Service Rebinding: Similar to RMI, the CORBA Naming Service was found to allow arbitrary rebinding of services without proper access checks, opening the door to MITM attacks and service manipulation.
Technical Deep Dive
▶ Watch: CORBA IIOP deserialization, unaffected by Java filters (22:00)
The talk provides a granular look into the technical underpinnings of these exploits, dissecting the protocols and the vulnerabilities.
RMI/JRMP Protocol and Deserialization Exploits
The RMI/JRMP protocol begins with a header containing a magic number, version, protocol, and an operation type (e.g., call or ping). Crucially, an Object ID uniquely identifies the RMI service, while a method hash references the specific method to be invoked. The num field, though deprecated, was found to be critical for certain bypasses. Arguments and return values are serialized using standard Java serialization.
JEP 290 introduced ObjectInputFilter to ObjectInputStream in JRE 8u121. This API allows developers to specify a whitelist of classes permitted during deserialization. However, Trinh demonstrated that this defense mechanism was often poorly implemented or completely ignored.
Client-Side Deserialization Attack
This novel attack turns the tables, forcing a client to deserialize malicious data. The core idea is to leverage the RMI's proxy interface feature. A Java proxy allows an interface method call to be redirected to an InvocationHandler. In this case, the RemoteObjectInvocationHandler (part of the RMI package and thus whitelisted by JEP 290 filters on the registry) is used. The gadget chain involves UnicastRemoteObject acting as a "trampoline" to jump into an interface method call. When this method is invoked, it proxies the call into an RMI client-side invocation, which then triggers a readObject call on an unfiltered stream. This allows an attacker to send a malicious serialized object that the client will deserialize without any class checks, enabling RCE. This method also has the advantage of allowing the attacker to read the return value, making it a viable exfiltration channel.
Custom Service Deserialization
Beyond the registry and DGC services, custom RMI services handle the application's specific business logic. JEP 290 documentation stated that developers must manually configure an ObjectInputFilter on the input stream for these services. Trinh's research revealed that "every product we research on" failed to do this, including VMware, Dell, Apache Cassandra, Apache Tomcat, and others. This means that a simple replacement of a legitimate argument (e.g., a String object) with a serialized gadget chain (e.g., Commons Collections, Commons BeanUtils, or JDK-only gadgets) could lead to RCE.
An illustrative example was gaining RCE on VMware vRealize Operations Manager. This product used RMI extensively and was running JRE 8u121 (meaning JEP 290 was present for registry/DGC). However, it used a Security Manager which blocked common gadget chains relying on TemplatesImpl (e.g., from Commons Collections). Trinh modified the BeanUtils gadget to invoke JdbcRowSetImpl, a class within java.sql that can make remote JNDI calls. For Java versions prior to 8u191, this specific JNDI call led to CVE-2018-3149, allowing remote class loading and RCE.
JMX RMI Vulnerabilities
JMX, when exposed remotely, often operates over RMI. The authentication flow involves fetching RMI records from the registry and then authenticating via a newClient method. Historically, vulnerabilities existed due to improper handling of argument types. While Trinh noted that brute-forcing the random Object IDs for authentication bypass is impractical, he found that post-authentication, JMX RMI services still lacked ObjectInputFilter implementation. This allowed authenticated users to achieve arbitrary deserialization. Furthermore, a specific attribute introduced after JRE 10 to whitelist classes for JMX deserialization was undocumented, and JRE 8 lacked this feature entirely, leaving it vulnerable.
CORBA/IIOP Protocol and Deserialization Exploits
CORBA is a more complex, language-independent protocol. Its Java implementation, RMI over IIOP, uses a different internal serialization mechanism than ObjectInputStream. This means JEP 290 has no effect on CORBA deserialization vulnerabilities, making them particularly stealthy and unknown to many vendors.
A prime example was IBM WebSphere, a popular application server that uses RMI/IIOP extensively. IBM had even modified the core CORBA API in the JRE to implement its own authentication. Trinh's goal was to find a pre-authentication endpoint that handled CORBA 2.3 objects. By reversing the protocol, he identified an Interceptor class that would read CORBA 2.3 objects before authentication.
Escalating this to RCE was challenging due to WebSphere's hardened environment (Security Manager, strict classloaders). Trinh identified two key gadgets:
- Apache Access CORBA arbitrary file write: This gadget allowed writing serialized data to an arbitrary file on the server. While initially attempted for a web shell, the serialized data's non-text first byte prevented IBM WebSphere from recognizing it as a valid JSP file. However, it could still be used for Denial of Service by overwriting configuration files.
- JNDI loading of BTree classes: Many JNDI calls in IBM CORBA allowed instantiation of
BTreeclasses from any Java package via afilewrapper protocol. To load a malicious class from an attacker-controlled server, Trinh leveraged the Windows UNC path feature, which allows thefileprotocol to wrap an SMB connection (\\attacker_ip\share), loading arbitrary classes over SMB port 445. These bugs were disclosed and would take "a lot of time to fix" due to the sheer size of the IBM CORBA codebase.
Another CORBA-specific vulnerability involved Security Manager bypasses. A previous BlackHat talk in 2016 discussed how deserializing CORBA ID objects could allow remote class loading and instantiation. If a Security Manager is present and allows, for instance, socket connections, this could escalate to RCE.
RMI Registry Man-in-the-Middle (MITM) Attacks
The RMI registry, a central component, allows clients to look up remote objects. Its rebind method allows modifying existing records, making it a prime target for MITM. An attacker can connect to the registry and rebind a legitimate service entry to point to a rogue, attacker-controlled agent. When a legitimate client attempts to connect to the original service, it will be redirected to the attacker, who can then capture credentials or serve malicious objects.
The rebind method is protected by checkAccess, which ideally restricts modifications to local connections. However, Trinh identified several bypasses:
numfield bypass (CVE-assigned): If thenumfield in the RMI packet (which is controllable by the attacker) is set to a value less than zero, it bypasses thecheckAccessflow, allowing remoterebindoperations. This vulnerability was previously assigned a CVE for a sandbox escape, but its applicability to remote registry modification was overlooked.- HTTP proxy bypass: RMI allows proxying over HTTP. If the protocol is detected as HTTP, the remote host is internally set to
0.0.0.0(orlocalhost), effectively bypassing thecheckAccesslocal-only restriction. This was also reported by another researcher as a Client-Side Request Forgery but its MITM implications were not fully explored.
These MITM attacks have significant implications:
- Credential Capture: Demonstrated with JMX service authentication (passing credentials over the wire) and VMware vSphere Data Protection.
- RCE Escalation: For instance, against Apache Tomcat. After capturing JMX credentials via MITM, an attacker could manipulate the
AccessLogValveMBean. By modifying thelockPatternto include HTTP headers, sending a crafted HTTP request (e.g., with a webshell payload in a custom header), and then triggering a log rotation, the attacker could write an arbitrary web shell to a controlled location on the Tomcat web root, leading to RCE.
CORBA Naming Service Rebinding
Similar to the RMI registry, the CORBA Naming Service allows services to be bound and rebound. Trinh found that in a "hello world" CORBA application, there were "absolutely no access checks involved," allowing free rebinding of CORBA services and enabling similar MITM attack scenarios as with the RMI registry. While he hadn't found a vulnerable product in his research during the talk, he believes such products exist.
Demo / Proof of Concept
▶ Watch: RMI registry rebind attack, credential capture (30:00)
The talk included a live demonstration of the RMI Registry MITM attack leading to RCE on Apache Tomcat. The setup involved a Tomcat instance on the right side of the screen (representing a legitimate server) and an attacker's terminal on the left.
The demonstration proceeded as follows:
- Registry Rebind: The attacker first used one of the identified bypasses (e.g., the
numfield or HTTP proxy bypass) to connect to the legitimate Tomcat's RMI registry andrebindits JMX RMI service to point to an attacker-controlled rogue agent. - Credential Capture: A legitimate administrator then logged into the Tomcat administration panel. As the administrator's client attempted to connect to the JMX RMI service, it was transparently redirected to the attacker's rogue agent. The attacker's agent captured the administrator's JMX credentials (username and password) in plain text, which were then displayed on the attacker's screen.
- Web Shell Deployment (RCE): With the captured credentials and
read/writeprivileges on the JMX protocol, the attacker then executed a custom Java tool. This tool connected to the JMX service (now authenticated) and manipulated theAccessLogValveMBean.
- First, the
AccessLogValve'spatternattribute was modified to include arbitrary HTTP headers in the access log entries. - Next, the attacker sent an HTTP request to Tomcat with a specially crafted header containing a Java web shell payload. This caused the web shell code to be written into the access log file.
- Finally, the
rotatemethod of theAccessLogValvewas invoked via JMX, forcing the log file (now containing the web shell) to be written to an arbitrary location within the Tomcat web root (e.g.,webapps/ROOT/shell.jsp).
- Web Shell Execution: The attacker then accessed the deployed web shell via a web browser, demonstrating command execution on the Tomcat server (e.g., a calculator popping up), confirming successful RCE.
The demo vividly illustrated how a series of seemingly disparate vulnerabilities—RMI registry bypasses, credential capture, and JMX MBean manipulation—could be chained together to achieve full system compromise.
Defensive Implications
▶ Watch: Key mitigations for Java remote protocols (43:00)
The findings presented by An Trinh have profound implications for defenders and Java developers:
- Implement
ObjectInputFilterExtensively: Developers must conduct an extensive review of all RMI services, including custom services, for proper implementation ofObjectInputFilteras specified by JEP 290. This means defining strict whitelists of allowed classes during deserialization to prevent gadget chain attacks. This applies to both RMI/JRMP and, where applicable, JMX RMI. - Address CORBA/IIOP Deserialization Separately: Recognize that JEP 290's
ObjectInputFilterdoes not apply to CORBA/IIOP's internal serialization mechanisms. Developers using CORBA must implement alternative, custom deserialization validation or filtering methods. This is a significant blind spot that Oracle needs to address by providing suitable APIs. - Minimize Sensitive Data Over Remote Protocols: Applications should be redesigned to minimize or eliminate the transmission of sensitive data, especially credentials, over RMI and CORBA connections, particularly before robust authentication and encryption are established. If credentials must be sent, ensure they are handled securely and not vulnerable to MITM interception.
- Keep JRE Up-to-Date: While not a panacea, keeping the Java Runtime Environment updated to the latest stable version is crucial. Newer JRE versions often contain patches for known deserialization vulnerabilities and may introduce new security features or stricter default configurations. However, as shown, this alone is often insufficient.
- Secure RMI and CORBA Naming Services: Implement strong access controls and authentication for RMI registries and CORBA naming services. The
rebindmethod in particular should be heavily restricted. Oracle'sSingleEntryRegistryAPI, which prevents registry modification, is unfortunately package-private, limiting its use by external developers. This highlights a need for Oracle to provide public, secure APIs for registry management. - Review JMX Configurations: Secure JMX installations by implementing authentication and authorization. Carefully review which MBeans are exposed and ensure that
ObjectInputFilter(or equivalent for older JREs) is applied to JMX RMI services. The lack of documentation for JEP 290 in JMX is a critical oversight that needs correction. - Audit for Custom Gadgets: Be aware that sophisticated attackers may develop custom gadget chains or modify existing ones (like the
BeanUtilstoJdbcRowSetImplmodification) to bypass security managers or specific classloader restrictions. Regular security audits and penetration testing should look for these advanced techniques.
Key Takeaways
- Java's core remote protocols (RMI/JRMP and CORBA/IIOP) remain highly vulnerable to deserialization and MITM attacks due to design flaws, poor implementation practices, and insufficient developer guidance.
- JEP 290 and
ObjectInputFilterare widely ignored or misunderstood by vendors for custom RMI services, leaving numerous enterprise applications exposed to RCE via common deserialization gadget chains. - CORBA/IIOP deserialization is unaffected by JEP 290, presenting a unique and often overlooked attack surface requiring custom defensive measures and highlighting a significant gap in Java's security framework.
- RMI Registry and CORBA Naming Service MITM attacks are feasible through various bypasses (e.g.,
numfield, HTTP proxy), allowing credential capture and privilege escalation, as demonstrated with Tomcat RCE. - Hardened environments (e.g., Security Manager, strict classloaders) can be bypassed with modified or specific gadget chains, requiring a deeper understanding of the application's runtime dependencies and available classes.
- Comprehensive security requires more than just JRE updates; it demands rigorous application-level security reviews, proper implementation of serialization filters, and secure configuration of remote services like JMX.
About the Speaker(s)
An Trinh is a researcher at Viettel Cyber Security, specializing in application security. He is known for discovering remote code execution vulnerabilities, including a recent one in the Zimbra email application. His expertise extends to bug bounties and vulnerability selling, contributing to a safer digital landscape. His work, as demonstrated in this talk, focuses on uncovering deep-seated security flaws in widely used software and protocols.
Reviews
Dr. Zero (Offensive Security Researcher) — MUST SEE
An Trinh tears Java remote protocols down to the studs. He proves Oracle's JEP 290 mitigation is basically a suggestion that enterprise vendors like VMware and IBM completely ignored, dropping novel exploit chains for both RMI and CORBA. This is exactly the kind of deep-weeds protocol research that makes defenders drink.
Heather Calloway (CISO) — SOLID
An Trinh’s research proves that major enterprise vendors have systematically failed to implement Java’s core deserialization defenses for years. While this is a deep-technical talk, the business implication is severe: standard JRE updates will not protect your enterprise Java infrastructure from remote code execution.