Java Debug Wire Protocol (JDWP) Exposed
A Java process accepts debugger connections over the network, and because the debug protocol has no authentication, anyone who can connect can run code in it.
| Severity | Critical |
| CVSS 3.1 | 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 9.3 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-489: Active Debug Code |
| OWASP Top 10 | A02:2025 Security Misconfiguration |
| MITRE ATT&CK | T1210 Exploitation of Remote Services, T1190 Exploit Public-Facing Application |
| Category | Broken Access Control |
Description
The Java Debug Wire Protocol (JDWP) is the protocol a debugger uses to control a running Java Virtual Machine. It is switched on with a start-up option such as -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000, or the older -Xrunjdwp form, and is intended for development. JDWP has no authentication or encryption: any client that connects to the debug port and completes the protocol's simple handshake gains full debugger control of the virtual machine.
The exposure usually arises when a debug option used during development or troubleshooting is left in a production start-up script, a container image or an application server's configuration. Ports 8000 and 5005 are common, though any port can be used. Since Java 9, an address given as a port number alone listens only on the loopback interface, so remote exposure normally reflects an explicit wildcard or host address in the option, or an older Java version.
An attacker who can reach the port can use that control to run arbitrary code in the Java process, and through it operating system commands with the privileges of the account the process runs as, without credentials; public tools such as jdwp-shellifier and a Metasploit module automate this. They can also read and change data held in the virtual machine's memory, including credentials, session data and keys, or stop the application. Where the process runs as root or SYSTEM, or in a container with access to its host, the compromise extends further. Exposure to the internet greatly increases the likelihood of compromise, as such ports are found by routine scanning.
The service is identified by connecting to the port and sending the string JDWP-Handshake, which a JDWP agent echoes back. Nmap's service detection and its jdwp-version script recognise it, and vulnerability scanners report it as an exposed Java debugging service.
Remediation
Remove the debugging agent from every environment where interactive debugging is not actively taking place:
- Remove
-agentlib:jdwp,-Xrunjdwpand-Xdebugoptions from start-up scripts, service definitions, environment variables such asJAVA_TOOL_OPTIONSandJAVA_OPTS, container images and deployment manifests, then restart the affected processes. - Keep development and production start-up configurations separate in build and deployment pipelines, so that debug options cannot reach production by mistake.
- Where remote debugging is genuinely needed for a period, bind the agent to the loopback interface, for example
address=127.0.0.1:8000, reach it through an authenticated SSH tunnel, and remove it when the work is finished. - Block debugging ports at host and network firewalls, so that a debug option left in place by mistake cannot be reached.
As an interim measure, restrict the port with a firewall to the specific administrative hosts that need it. Confirm the fix by checking the running process's command line for JDWP options, and by scanning from the networks that previously had access to confirm that the port no longer answers the handshake.
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.