GHSL-2023-052: Unsafe deserialization in XXL-RPC - CVE-2023-45146
The XXL-RPC framework's Netty server with Hessian serialization deserializes untrusted data without validation, allowing an attacker to send a malicious serialized object that can execute arbitrary code. This can lead to remote code execution and full control of the server.
Originally disclosed on GitHub Security Lab
XXL-RPC is a high performance, distributed RPC framework. With it, a TCP server can be set up using the Netty framework and the Hessian serialization mechanism.
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.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The server directly deserializes untrusted network data using the Hessian library without any validation or class filtering.
Impact
This issue may lead to Remote Code Execution (RCE), allowing an attacker to take control of the machine running the server.
What the attacker needed
XXL-RPC server using Netty and Hessian; Rome library in classpath; Remote class loading allowed
How it was found
- Set up an XXL-RPC server using NettyServer and HessianSerializer.
- Generate a malicious Hessian payload using marshalsec with a JNDI reference to an attacker-controlled LDAP server.
- Start a malicious LDAP server that returns a reference to a remote codebase hosting a malicious class.
- Host the malicious class file on an HTTP server.
- Send the payload to the Netty server via a TCP client, including the payload length and data.
- The server deserializes the payload, triggers JNDI lookup, loads the remote class, and executes its static initializer, achieving RCE.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program receives data over the network, it sometimes converts that data back into objects, a process called deserialization. If the data is not checked, an attacker can craft it so that the conversion runs harmful code. Here, the XXL-RPC server does exactly that, letting an attacker run commands on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.