Skip to content
RCE Write-up Advanced

Unexpected Deserialization Pt.1 – JMS

The application used IBM MQ's JMSMessage.getBody() method to retrieve message contents, which deserialises ObjectMessage payloads without restricting dangerous classes. An attacker able to send a crafted JMS message could achieve remote code execution.

blog.silentsignal.eu

Published on blog.silentsignal.eu

On a recent engagement our task was to assess the security of a service built on IBM Integration Bus, an integration platform for Java Messaging Services. These scary looking enterprise buzzwords usually hide systems of different complexities connected with Message Queues.

The author, on blog.silentsignal.eu

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the IBM MQ JMS client deserialises ObjectMessage bodies without a class allowlist, and Spring's default message converters pass such messages to this unsafe deserialisation.

Impact

An attacker who can send a JMS message to the application could execute arbitrary code, provided the classpath contains suitable gadget classes; ActiveMQ blocked the same attack by rejecting dangerous classes.

What the attacker needed

Ability to send JMS messages to the broker; classpath contains gadget classes; IBM MQ as transport

How it was found

  1. Set up a test environment using IBM's message broker Docker image.
  2. Run the JMET tool against the test environment.
  3. Observe that a calculator was launched, indicating code execution.

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 write-up has not been written yet. The Original tab links to the source.

Java can turn saved objects back into live objects, a process called deserialisation. If an attacker controls the saved data, they can sometimes make the program run their own code. Here, a messaging library automatically deserialised incoming messages without checking whether the classes inside were safe.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.