Pentesting JDWP - Java Debug Wire Protocol
Leer & oefen AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Leer & oefen GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Onmiddellik beskikbare opstelling vir kwesbaarheidsassessering & penetrasietoetsing. Voer 'n volledige pentest vanaf enige plek uit met 20+ gereedskap & funksies wat van rekognisie tot verslagdoening strek. Ons vervang nie pentesters nie - ons ontwikkel pasgemaakte gereedskap, opsporing & eksplorasie modules om hulle weer 'n bietjie tyd te gee om dieper te delf, shells te pop, en pret te hê.
Exploiting
JDWP eksplorasie hang af van die protokol se gebrek aan outentisering en versleuteling. Dit word oor die algemeen op poort 8000 gevind, maar ander poorte is moontlik. Die aanvanklike verbinding word gemaak deur 'n "JDWP-Handshake" na die teikenpoort te stuur. As 'n JDWP diens aktief is, antwoord dit met dieselfde string, wat sy teenwoordigheid bevestig. Hierdie handshake dien as 'n vingerafdrukmetode om JDWP dienste op die netwerk te identifiseer.
In terme van prosesidentifikasie, kan die soek na die string "jdwk" in Java prosesse 'n aktiewe JDWP sessie aandui.
Die gereedskap om te gebruik is jdwp-shellifier. Jy kan dit met verskillende parameters gebruik:
I found that the use of --break-on 'java.lang.String.indexOf'
make the exploit more stabiel. And if you have the change to upload a backdoor to the host and execute it instead of executing a command, the exploit will be even more stable.
More details
This is a summary of https://ioactive.com/hacking-java-debug-wire-protocol-or-how/. Check it for further details.
JDWP Oorsig:
It's a packet-based network binary protocol, primarily synchronous.
Lacks authentication and encryption, making it vulnerable when exposed to hostile networks.
JDWP Handshake:
A simple handshake process is used to initiate communication. A 14-character ASCII string “JDWP-Handshake” is exchanged between the Debugger (client) and the Debuggee (server).
JDWP Kommunikasie:
Messages have a simple structure with fields like Length, Id, Flag, and CommandSet.
CommandSet values range from 0x40 to 0x80, representing different actions and events.
Eksploitatie:
JDWP allows loading and invoking arbitrary classes and bytecode, posing security risks.
The article details an exploitation process in five steps, involving fetching Java Runtime references, setting breakpoints, and invoking methods.
Regte Lewe Eksploitatie:
Despite potential firewall protections, JDWP services are discoverable and exploitable in real-world scenarios, as demonstrated by searches on platforms like ShodanHQ and GitHub.
The exploit script was tested against various JDK versions and is platform-independent, offering reliable Remote Code Execution (RCE).
Sekuriteitsimplikasies:
The presence of open JDWP services on the internet underscores the need for regular security reviews, disabling debug functionalities in production, and proper firewall configurations.
References:
http://www.secdev.org/projects/scapy(no longer active)
http://www.hsc-news.com/archives/2013/000109.html (no longer active)
https://github.com/search?q=-Xdebug+-Xrunjdwp&type=Code&ref=searchresults
Instantly available setup for vulnerability assessment & penetration testing. Run a full pentest from anywhere with 20+ tools & features that go from recon to reporting. We don't replace pentesters - we develop custom tools, detection & exploitation modules to give them back some time to dig deeper, pop shells, and have fun.
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated