JDWP Remote Code Execution in PayPal
The JDWP debug protocol was exposed without authentication on port 8000 of a PayPal marketing server. An attacker could connect and execute arbitrary system commands as root.
Published on vulnerability-lab.com
References (Source): ==================== http://www.vulnerability-lab.com/getcontent.php?id=1474
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.
What the report shows
This advisory describes a remote code execution issue in the JDWP protocol of the PayPal Marketing online service web-server. The affected product is listed as the Marketing Application & Service (HK) 2015 Q2, and the exploitation technique is remote. The researcher is Milan A Solanki, the advisory was released on 2015-04-28, and the severity is given as critical with a CVSS score of 9.3.
The researcher states that the tool used was jdwp-shellifier. The marketing site was scanned, port 8000 was found open and reachable pre-authentication, and after the connection was accepted the researcher executed commands and obtained remote code execution.
The reproduction steps in the report are:
- Scan the site with the jdwp-shellifier tool (https://github.com/IOActive/jdwp-shellifier)
- Open port 8000 and connect to the service without auth
- Execute own server-side commands as root user
- Successful reproduce of the vulnerability!
The report links a proof of concept demo video.
The disclosure timeline is:
| Date | Event |
|---|---|
| 2015-04-05 | Researcher notification and coordination (Milan A Solanki) |
| 2015-04-06 | Vendor notification (PayPal Security & Bug Bounty Team) |
| 2015-04-07 | Vendor response/feedback |
| 2015-04-09 | Vendor fix/patch (PayPal Developer Team) |
| 2015-04-28 | Public disclosure (Vulnerability Laboratory) |
The report does not state a bounty amount. The timeline records a vendor fix/patch on 2015-04-09.
Root cause
The report points to the JDWP listener itself: the Java Debug Wire Protocol is exposed on port 8000 and, as the advisory puts it, JDWP does not use any authentication. A debugger interface that anyone can reach is by design able to control the target VM, so an unauthenticated network-reachable JDWP port is effectively remote code execution. The report does not describe how the port came to be exposed, so the deployment mistake behind it is not documented.
Impact
The report states that the vulnerability allows remote attackers to execute system specific code against a target system to compromise the webserver, and that the researcher executed server-side commands as the root user. No user account or user interaction was needed. The advisory does not describe what data or systems were reachable beyond the web-server itself.
How this kind of bug works
JDWP is the wire protocol between a debugger and the Java VM being debugged, and it is one layer of the Java Platform Debugger Architecture. A JVM started with a debug agent listening on a network interface accepts JDWP connections and lets the attached debugger inspect and modify the running program: read and write fields, call methods, and load classes. There is no authentication layer in the protocol, so reachability is the only control. When the agent is bound to a public interface, anyone who can open a TCP connection can attach, and because a debugger can invoke arbitrary methods inside the VM, that access converts into code execution in the context of the JVM process, which is often a privileged service account.
The usual cause is a debug option left in a start-up script or container image, or a firewall rule that exposes the debug port alongside the application port. The defences are to never enable the debug agent in production, to bind it to the loopback interface when it is needed, and to block the port at the network boundary.
How to test for it
This is a network service test rather than a web request test. The general method:
- During reconnaissance, look for ports that do not belong to the application itself. Debug agents commonly sit on well-known or configured ports near the application, and a port that accepts a TCP connection but does not speak HTTP is worth a second look.
- Confirm what is listening. A JDWP endpoint responds to the protocol handshake rather than to HTTP, so an HTTP request to it will fail or hang while a protocol-aware client gets a reply. Tools such as jdwp-shellifier automate the handshake and can report the JVM version and whether the connection is usable.
- Establish impact carefully. A positive result is an accepted JDWP connection that lets you read the target VM state or invoke a harmless method, for example one that returns a system property. Do not run destructive commands; demonstrating that the debugger can invoke a method is enough to show code execution.
- Record the evidence: the port, the handshake response, and the output of the harmless invocation.
Common false positives: a port that is open but speaks a different protocol, a JDWP listener that is reachable only from an address you do not control, or a service that answers the handshake but rejects further commands. A bare open port is not a finding; the accepted, usable debugger session is.
How it is fixed
The standard fixes are to disable the Java debug agent in production, to remove the debug start-up flags from deployed configurations, and to bind any debug listener to the loopback interface so it is not reachable from the network. Where a debug port must exist, restrict it with firewall or security-group rules to trusted management hosts. Rotating credentials and reviewing the host for activity during the exposure window is prudent, since an unauthenticated debugger session leaves little trace by itself.
Hunting notes
This class of bug hides in places where environments drift: staging and marketing hosts that copy production start-up scripts, container images built with debug flags, and application servers where a JVM is started by a wrapper script that someone edited while troubleshooting. Recon signals include non-HTTP ports in scan results, JVM-related banners, and hosts that respond on a port adjacent to the application port. Because the impact is code execution, a report is strongest when it shows the accepted debugger connection and a harmless method invocation with its output, plus a clear statement of the process context. Keep the demonstration minimal and stop at proof; the value of the finding is the reachable, unauthenticated debugger, not what you can do with it.
What happened, in plain words
This advisory describes a remote code execution issue in the JDWP protocol of the PayPal Marketing online service web-server. The affected product is listed as the Marketing Application & Service (HK) 2015 Q2. The researcher is Milan A Solanki, the advisory was released on 2015-04-28, and the severity is given as critical with a CVSS score of 9.3.
A few of those words need unpacking. A web-server is the computer program that answers when your browser asks for a page. Remote code execution means someone on another machine can make that server run commands of their choosing, which is about as bad as it gets. JDWP is a debugging channel built into Java, the language many large services run on. A debugger is a tool a programmer attaches to a running program to look inside it, pause it, read its memory and change it. JDWP is the language that debugger and program speak to each other. Think of it as a service hatch into the engine room: useful for the mechanic, dangerous if it is left unlocked on the street side of the building.
The researcher states that the tool used was jdwp-shellifier. The marketing site was scanned, port 8000 was found open and reachable pre-authentication, and after the connection was accepted the researcher executed commands and obtained remote code execution. A port is a numbered door on a machine; the web page normally comes through one door, and other services listen on other doors. Pre-authentication means no username or password was asked for at all.
The reproduction steps in the report are:
- Scan the site with the jdwp-shellifier tool (https://github.com/IOActive/jdwp-shellifier)
- Open port 8000 and connect to the service without auth
- Execute own server-side commands as root user
- Successful reproduce of the vulnerability!
Step 1 matters because scanning is how you discover which doors are open before you try any of them. Step 2 matters because the absence of any login prompt is the heart of the bug: the debugger hatch was simply unlocked. Step 3 matters because root is the all-powerful administrator account, so commands run as root can do anything on that server. Step 4 is the confirmation that the whole chain worked.
The report links a proof of concept demo video.
The disclosure timeline is:
| Date | Event |
|---|---|
| 2015-04-05 | Researcher notification and coordination (Milan A Solanki) |
| 2015-04-06 | Vendor notification (PayPal Security & Bug Bounty Team) |
| 2015-04-07 | Vendor response/feedback |
| 2015-04-09 | Vendor fix/patch (PayPal Developer Team) |
| 2015-04-28 | Public disclosure (Vulnerability Laboratory) |
The report does not state a bounty amount. The timeline records a vendor fix/patch on 2015-04-09.
Root cause
The report points to the JDWP listener itself: the Java Debug Wire Protocol is exposed on port 8000 and, as the advisory puts it, JDWP does not use any authentication. A debugger interface that anyone can reach is by design able to control the target VM, so an unauthenticated network-reachable JDWP port is effectively remote code execution. The report does not describe how the port came to be exposed, so the deployment mistake behind it is not documented.
Impact
The report states that the vulnerability allows remote attackers to execute system specific code against a target system to compromise the webserver, and that the researcher executed server-side commands as the root user. No user account or user interaction was needed. The advisory does not describe what data or systems were reachable beyond the web-server itself.
In general, how this kind of bug works
JDWP is the wire protocol between a debugger and the Java VM being debugged, and it is one layer of the Java Platform Debugger Architecture. A VM (virtual machine) here is the runtime that executes Java programs. A JVM started with a debug agent listening on a network interface accepts JDWP connections and lets the attached debugger inspect and modify the running program: read and write fields, call methods, and load classes. There is no authentication layer in the protocol, so reachability is the only control. When the agent is bound to a public interface, anyone who can open a TCP connection can attach, and because a debugger can invoke arbitrary methods inside the VM, that access converts into code execution in the context of the JVM process, which is often a privileged service account.
The usual cause is a debug option left in a start-up script or container image, or a firewall rule that exposes the debug port alongside the application port. The defences are to never enable the debug agent in production, to bind it to the loopback interface when it is needed, and to block the port at the network boundary.
How to test for it
This is a network service test rather than a web request test. The general method:
- During reconnaissance, look for ports that do not belong to the application itself. Debug agents commonly sit on well-known or configured ports near the application, and a port that accepts a TCP connection but does not speak HTTP is worth a second look.
- Confirm what is listening. A JDWP endpoint responds to the protocol handshake rather than to HTTP, so an HTTP request to it will fail or hang while a protocol-aware client gets a reply. Tools such as jdwp-shellifier automate the handshake and can report the JVM version and whether the connection is usable.
- Establish impact carefully. A positive result is an accepted JDWP connection that lets you read the target VM state or invoke a harmless method, for example one that returns a system property. Do not run destructive commands; demonstrating that the debugger can invoke a method is enough to show code execution.
- Record the evidence: the port, the handshake response, and the output of the harmless invocation.
Common false positives: a port that is open but speaks a different protocol, a JDWP listener that is reachable only from an address you do not control, or a service that answers the handshake but rejects further commands. A bare open port is not a finding; the accepted, usable debugger session is.
How it is fixed
The standard fixes are to disable the Java debug agent in production, to remove the debug start-up flags from deployed configurations, and to bind any debug listener to the loopback interface so it is not reachable from the network. Where a debug port must exist, restrict it with firewall or security-group rules to trusted management hosts. Rotating credentials and reviewing the host for activity during the exposure window is prudent, since an unauthenticated debugger session leaves little trace by itself.
Hunting notes
This class of bug hides in places where environments drift: staging and marketing hosts that copy production start-up scripts, container images built with debug flags, and application servers where a JVM is started by a wrapper script that someone edited while troubleshooting. Recon signals include non-HTTP ports in scan results, JVM-related banners, and hosts that respond on a port adjacent to the application port. Because the impact is code execution, a report is strongest when it shows the accepted debugger connection and a harmless method invocation with its output, plus a clear statement of the process context. Keep the demonstration minimal and stop at proof; the value of the finding is the reachable, unauthenticated debugger, not what you can do with it.
Glossary
- Web-server: the program that receives browser requests and returns web pages.
- Remote code execution: a flaw that lets someone on another machine run commands on the target.
- JDWP: the Java Debug Wire Protocol, the channel a debugger uses to talk to a running Java program.
- Debugger: a tool that attaches to a running program to inspect and change it.
- Java VM (JVM): the runtime that executes Java programs.
- Java Platform Debugger Architecture (JPDA): the overall Java debugging framework, of which JDWP is one layer.
- Port: a numbered door on a machine through which a particular service is reached.
- Pre-authentication: reachable without any login or credential check.
- Root: the all-powerful administrator account on a Linux system.
- Scanning: probing a host to discover which ports and services are open.
- Handshake: the opening exchange two programs use to agree they speak the same protocol.
- Loopback interface: the internal network address a machine uses to talk to itself, not reachable from outside.
- Firewall / security group: rules that decide which network traffic is allowed in or out.
- False positive: a result that looks like a vulnerability but is not one.
- CVSS: a standard scoring system for the severity of a vulnerability.
- Proof of concept (PoC): a minimal demonstration that a vulnerability is real.