Java RMI or JMX Exposed Without Authentication
A Java RMI registry or JMX management service accepts connections from any host without authentication, which can allow remote code execution in the Java process.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 9.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-502: Deserialization of Untrusted Data |
| OWASP Top 10 | A08:2025 Software or Data Integrity Failures |
| MITRE ATT&CK | T1210 Exploitation of Remote Services, T1190 Exploit Public-Facing Application |
| Category | Insecure Deserialisation |
Description
Java Remote Method Invocation (RMI) lets a Java process publish objects whose methods other systems can call over the network, usually with an RMI registry, by default on TCP port 1099, that tells clients where each object can be reached. Java Management Extensions (JMX) commonly uses RMI as its remote transport, so that monitoring tools can read and change the managed beans (MBeans) of a running application server, message broker or other Java service. The weakness arises when remote JMX is enabled with authentication switched off, or when RMI services are reachable from networks that have no need of them.
Two properties may each let an attacker who reaches the service run arbitrary code in the Java process without credentials. An unauthenticated JMX service lets the caller invoke MBean operations, and on many Java versions this includes creating an MLet MBean that loads and runs Java code from a URL the caller supplies. RMI also passes arguments as serialised Java objects, so a crafted object sent to a method that accepts objects can run code during deserialisation through classes, known as gadget chains, present on the server's classpath. Java releases that include the JEP 290 serialisation filters restrict what the registry and the distributed garbage collector accept, but application methods that take object parameters remain exposed.
That code can run operating system commands with the privileges of the service account, and as Java application servers and middleware usually have broad access to application data, configuration secrets and other internal systems, this commonly gives a foothold for further compromise. Through JMX alone, an attacker can also read and change the application's runtime settings or stop it. Success depends on the Java version, the classes available on the server and, for some techniques, whether the server can make outbound connections to the attacker.
The weakness is identified with a service scan, where Nmap reports the RMI registry and its rmi-dumpregistry script lists the names bound in it, and confirmed with tools that enumerate and test RMI and JMX endpoints, such as remote-method-guesser and beanshooter. Scanners report it under names such as an insecure JMX agent configuration or an exposed RMI registry.
Remediation
Remove the exposure first, then add authentication where remote management is genuinely needed:
- Disable remote JMX and RMI services that are not required. Remote JMX is switched on by JVM options such as
com.sun.management.jmxremote.portin the start-up scripts or service definitions of the application; remove them where only tools on the same host need access, as local monitoring tools can attach without a network port. - Where remote JMX is needed, require authentication and TLS with
com.sun.management.jmxremote.authenticate=trueandcom.sun.management.jmxremote.ssl=true, and use the password and access files to give monitoring accounts read-only access. Never run withcom.sun.management.jmxremote.authenticate=falseoutside a development workstation. - Restrict the RMI and JMX ports with host and network firewalls so that only the management systems that need them can connect. As well as the registry port, RMI uses a second port for the exported objects, which is chosen dynamically unless it is fixed (for JMX, with
com.sun.management.jmxremote.rmi.port) so that it can be filtered. - Keep Java up to date, set a process-wide serialisation filter with
jdk.serialFilterthat accepts only the classes the application expects, and remove unused libraries that provide known gadget classes.
Confirm the fix by scanning the host again from the networks that previously had access and checking that the ports are closed, or that the service rejects connections without valid credentials.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.