Summary
OpenTelemetry Java Instrumentation versions prior to 2.26.1 register a custom RMI endpoint that deserializes incoming data without applying serialization filters, exposing a critical unsafe deserialization flaw on JDK 16 and earlier.
When an attacker can reach a configured JMX/RMI management port on an instrumented JVM and a suitable gadget chain is present on the classpath, this condition may allow arbitrary remote code execution with the JVM's privileges.
Affected context
This vulnerability manifests in Java applications where:
- OpenTelemetry Java Instrumentation is attached as a Java agent (
-javaagent) on JDK 16 or earlier. - JMX/RMI remote management is explicitly enabled and bound to a reachable interface via
-Dcom.sun.management.jmxremote.port. - The RMI-based OpenTelemetry instrumentation endpoint is active and processes serialized RMI calls.
- One or more libraries on the application classpath expose gadget chains that can be abused during Java deserialization.
In such environments, the instrumented JVM's management port becomes a potential remote deserialization entry point.
Exploit preconditions
- Attack surface: Network-accessible JMX/RMI management port on the JVM instrumented with OpenTelemetry Java Instrumentation.
- Required access: Ability to open a TCP connection to the configured JMX/RMI port (no direct in-application authentication is handled by the RMI endpoint itself).
- Runtime environment:
- OpenTelemetry Java Instrumentation running as a Java agent (
-javaagentoption). - JVM version 16 or earlier (JDK 17+ is not affected in this way).
- Configuration conditions:
- JMX/RMI port explicitly configured via
-Dcom.sun.management.jmxremote.portand bound to an interface reachable by the attacker. - RMI instrumentation not disabled (i.e.,
-Dotel.instrumentation.rmi.enabledis unset ortrue). - Application conditions:
- Presence of at least one gadget-chain-compatible library on the classpath that can be leveraged during deserialization.
- Why exploitation is possible:
- The custom RMI endpoint deserializes attacker-controlled data without applying Java serialization filters or equivalent constraints.
- Classic Java deserialization behavior allows construction and invocation of gadget chains during object read, enabling attacker-controlled code paths.
Why this happens
The root cause is an unsafe Java deserialization pattern in the OpenTelemetry RMI instrumentation, corresponding to CWE-502: Deserialization of Untrusted Data.
The instrumentation exposed a custom RMI endpoint that accepted serialized objects from remote clients and passed them directly into the Java deserialization mechanism without:
- Enforcing serialization filters or whitelists to constrain which classes can be instantiated, or
- Applying an alternative, non-deserialization-based protocol.
In Java, default object deserialization can invoke arbitrary code paths (e.g., readObject, readResolve, or other lifecycle hooks), and when gadget-chain-compatible libraries are on the classpath, these hooks can be composed into exploit chains.
Because the endpoint sits on a remotely accessible JMX/RMI port, the deserialization boundary effectively trusts unvetted network input, allowing an attacker to trigger execution of those gadget chains in the context of the instrumented JVM.
Potential impact
- Remote execution of arbitrary code within the JVM process.
- Full compromise of the application running on the instrumented JVM.
- Reading, modification, or deletion of data handled by the compromised application.
- Use of the compromised JVM as a pivot point for lateral movement within the network.
- Disruption of services through process crashes, resource exhaustion, or intentional sabotage.
- Planting of backdoors or persistence mechanisms in the affected environment.
General mitigation guidance
Effective mitigation focuses on removing unsafe deserialization pathways and shrinking the remote management attack surface:
- Avoid deserialization of untrusted data:
- Prefer protocols that use structured, non-executable data formats (e.g., JSON, protobuf) instead of Java native serialization for remote management or telemetry channels.
- Where Java serialization cannot be easily removed, strictly limit which classes may be deserialized using serialization filters or explicit allowlists.
- Constrain RMI/JMX exposure:
- Avoid exposing JMX/RMI ports directly to untrusted networks; restrict them to loopback or dedicated management networks using host-level firewall rules or network segmentation.
- Require strong authentication and encryption on management interfaces (e.g., secure JMX configurations, TLS, and access controls) so that only authorized operators can reach the endpoint.
- Harden the instrumentation layer:
- Disable unneeded integration points in instrumentation agents (e.g., turn off RMI-related instrumentation when RMI-based management is not essential).
- Favor secure-by-default instrumentation settings that do not introduce new remotely reachable endpoints that process serialized data.
- Reduce gadget-chain availability:
- Review the application classpath for libraries known to contain powerful deserialization gadgets, especially older or broad-utility libraries.
- Remove or update libraries where possible, and avoid adding unnecessary libraries that expand the gadget surface.
- Apply least privilege:
- Run JVM processes with minimal OS-level privileges so that, even if code execution is achieved, the attacker's capabilities are constrained.
- Separate high-sensitivity components (e.g., databases, secrets stores) behind additional access controls so they are not directly reachable by a compromised JVM process.
How teams detect issues like this
Organizations can detect and monitor for this class of vulnerability using a combination of code-centric and operational approaches:
- Static analysis and code scanning:
- Search for usage of RMI or custom JMX/RMI handlers that call
ObjectInputStreamor equivalent serialization APIs on network inputs. - Flag deserialization operations that are not paired with explicit serialization filters or class allowlists.
- Create rules for instrumented codebases that inspect third-party agents (including OpenTelemetry) for deserialization entry points.
- Configuration and policy checks:
- Periodically inventory JVM processes to identify those that:
- Run on JDK 16 or earlier, and
- Use
-javaagentwith OpenTelemetry Java Instrumentation, and - Expose
-Dcom.sun.management.jmxremote.porton non-local interfaces. - Enforce policies prohibiting direct exposure of JMX/RMI ports to untrusted networks, validated via configuration management and network scans.
- Runtime and network monitoring:
- Monitor JMX/RMI ports for unexpected or anomalous connection patterns, such as repeated failed calls or unusual traffic from unrecognized sources.
- Log and alert on deserialization exceptions or unexpected class loading patterns that may indicate probing of gadget chains.
- Use host-based intrusion detection to watch for abnormal child processes or command executions originating from JVM-based services.
- Automated review in CI/CD:
- Integrate automated security checks into build pipelines to detect unsafe deserialization patterns and insecure remote management configurations.
- Include reviews of agent configuration files and JVM startup options to ensure they conform to secure operational standards.

