Skip to content
RCE Write-up Intermediate

Exposed JDWP Exploited in the Wild: What Happens When Debug Ports Are Left Open

An exposed Java Debug Wire Protocol (JDWP) interface on a TeamCity server allowed an attacker to execute arbitrary commands, leading to the deployment of a cryptomining payload and multiple persistence mechanisms.

Yaara Shriki Follow

Published on wiz.io

During routine monitoring, the Wiz Research Team observed an exploitation attempt targeting one of our honeypot servers running TeamCity, a popular CI/CD tool. Our investigation determined that the attacker had gained remote code execution by abusing an exposed Java Debug Wire Protocol (JDWP) interface, ultimately…

Yaara Shriki, on wiz.io

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 JDWP interface was exposed without authentication or access control, allowing unauthenticated remote code execution.

Impact

The attacker could execute arbitrary commands, leading to cryptomining and persistence, though the text does not specify the extent of data compromise.

What the attacker needed

JDWP exposed on a network port; No authentication on JDWP

How it was found

  1. Scan for open JDWP ports across the internet.
  2. Send a JDWP-Handshake request to confirm the interface is active.
  3. Query the JVM for available classes and methods, locating java.lang.Runtime and its getRuntime() and exec() methods.
  4. Create Java strings containing system commands to download and execute a script.
  5. Invoke Runtime.getRuntime() and pass the command string to exec() to execute the commands.

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.

JDWP is a debugging feature in Java that lets developers inspect and control a running Java program. If it is left open to the internet without protection, anyone can connect and run their own commands on the server. In this case, attackers found such an open port and used it to install a cryptocurrency miner and backdoors.

What is RCE?

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

More by Yaara Shriki

View all

2 more disclosed reports, best first.

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.