{"id":22121145,"url":"https://github.com/reajason/memshellparty","last_synced_at":"2025-05-15T13:08:31.392Z","repository":{"id":264383114,"uuid":"850550932","full_name":"ReaJason/MemShellParty","owner":"ReaJason","description":"Java 内存马开聚会 🎉","archived":false,"fork":false,"pushed_at":"2025-05-11T05:08:44.000Z","size":14277,"stargazers_count":845,"open_issues_count":17,"forks_count":80,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-11T06:19:52.992Z","etag":null,"topics":["asm","bytebuddy","javaagent","javasecurity","javassist","javaweb","memshell","payload","webshell"],"latest_commit_sha":null,"homepage":"https://party.memshell.news","language":"Java","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/ReaJason.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2024-09-01T05:17:19.000Z","updated_at":"2025-05-09T07:58:26.000Z","dependencies_parsed_at":"2024-11-23T21:27:21.870Z","dependency_job_id":"6c50ccca-435d-4ba5-8e68-307eceb1ea2d","html_url":"https://github.com/ReaJason/MemShellParty","commit_stats":null,"previous_names":["reajason/memshellparty"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReaJason%2FMemShellParty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReaJason%2FMemShellParty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReaJason%2FMemShellParty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReaJason%2FMemShellParty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReaJason","download_url":"https://codeload.github.com/ReaJason/MemShellParty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["asm","bytebuddy","javaagent","javasecurity","javassist","javaweb","memshell","payload","webshell"],"created_at":"2024-12-01T14:34:10.898Z","updated_at":"2025-05-15T13:08:26.371Z","avatar_url":"https://github.com/ReaJason.png","language":"Java","readme":"\u003ch1 align=\"center\"\u003eMemShellParty\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e中文 | \u003ca href=\"./docs/README.en.md\"\u003eEnglish\u003c/a\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![ci-test](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/test.yaml?label=Test%20CI\u0026branch=master\u0026style=flat-square)](https://github.com/ReaJason/MemShellParty/actions/workflows/test.yaml)\n[![ci-release](https://img.shields.io/github/actions/workflow/status/reajason/memshellparty/release.yaml?label=Release%20CD\u0026style=flat-square)](https://github.com/ReaJason/MemShellParty/actions/workflows/release.yaml)\n\u003c/div\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\n[![release](https://img.shields.io/github/v/release/reajason/memshellparty?label=Release\u0026style=flat-square)](https://github.com/ReaJason/MemShellParty/releases)\n[![MavenCentral](https://img.shields.io/maven-central/v/io.github.reajason/generator?label=MavenCentral\u0026style=flat-square)](https://central.sonatype.com/artifact/io.github.reajason/generator)\n[![docker-pulls](https://img.shields.io/docker/pulls/reajason/memshell-party?label=DockerHub%20Pulls\u0026style=flat-square)](https://hub.docker.com/r/reajason/memshell-party)\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![Telegram](https://img.shields.io/badge/Chat-Telegram-%2326A5E4?style=flat-square\u0026logo=telegram\u0026logoColor=%2326A5E4)](https://t.me/memshell)\n[![OnlinePartyWebSite](https://img.shields.io/badge/WebSite-OnlineParty-%23646CFF?style=flat-square\u0026logo=vite\u0026logoColor=%23646CFF)](https://party.memshell.news)\n\u003c/div\u003e\n\n\u003e [!WARNING]\n\u003e 本工具仅供安全研究人员、网络管理员及相关技术人员进行授权的安全测试、漏洞评估和安全审计工作使用。使用本工具进行任何未经授权的网络攻击或渗透测试等行为均属违法，使用者需自行承担相应的法律责任。\n\n\u003e [!TIP]\n\u003e 由于本人仅是安全产品研发，无实战经验，如使用或实现有相关疑问或者适配请求可提 issue 或加入 TG\n\u003e 交流群，欢迎一起学习交流\n\nMemShellParty 是一款可本地部署的一键生成常见中间件框架内存马的可视化平台，并且致力于打造内存马的全方位的学习平台。\n在遍地是轮子的时代，是时候造车，带着大伙加速冲冲冲了。\n\n希望你能从这个项目学会或尝试做的：\n\n1. 学会编写常见中间件框架的内存马。\n2. 学会使用 [Testcontainers](https://testcontainers.com/) 做 Java 应用的集成测试。\n3. 学会使用 GitHub Actions 编写 CI/CD，编写 CHANGELOG 并通过 CI 自动发布 Release。\n4. 尝试使用 [Byte Buddy](https://bytebuddy.net/) 生成类，编写 Agent。\n5. 尝试使用 Gradle 构建 Java 项目（platform 编写依赖版本管理，toolchain 可以在根项目设置 JDK17 环境下也能完成 JDK6 源代码的编译）\n\n![normal_generator](asserts/normal_generator.png)\n\n![agent_generator](asserts/agent_generator.png)\n\n## 主要特性\n\n- 无侵入性：生成的内存马不会影响目标中间件正常流量，即使同时注入十几个不同的内存马。\n- 高可用性：自带完备的 [CI 集成测试](https://github.com/ReaJason/MemShellParty/actions/workflows/test.yaml)\n- 最小化：尽可能精简内存马大小，高效传输。\n- 强兼容性：覆盖攻防场景下常见中间件和框架。\n\n## 快速使用\n\n### 在线站点\n\n\u003e 仅限尝鲜的小伙伴，对于其他暴露在公网的服务请谨慎使用，小心生成的内存马带后门\n\n可直接访问 [https://party.memshell.news](https://party.memshell.news)。每次 Release 都会自动部署最新的镜像。\n\n### 本地部署（推荐）\n\n\u003e 适合内网或本地快速部署，直接使用 Docker 启动服务方便快捷\n\n使用 docker 部署之后访问 http://127.0.0.1:8080\n\n```bash\n# 使用 Docker Hub 源，拉取最新的镜像\ndocker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party reajason/memshell-party:latest\n\n# 使用 Github Container Registry 源，拉取最新的镜像\ndocker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.io/reajason/memshell-party:latest\n\n# 网络质量不太好？使用南大 Github Container Registry 镜像源\ndocker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party ghcr.nju.edu.cn/reajason/memshell-party:latest\n```\n\n镜像是无状态的，在需要更新最新镜像时，直接移除新建就好了\n\n```bash\n# 移除之前部署的\ndocker rm -f memshell-party\n\n# 使用之前的部署命令重新部署（会自动拉取最新的镜像部署）\ndocker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party reajason/memshell-party:latest\n```\n\n### SDK 集成到现有工具中\n\n\u003e 适合集成到已有工具中，实现内存马 payload 的生成，支持 JDK8 以上版本，v1.7.0 开始支持\n\n1. 添加依赖，Maven Or Gradle\n\n```xml\n\u003c!-- Maven Repo--\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.reajason\u003c/groupId\u003e\n    \u003cartifactId\u003egenerator\u003c/artifactId\u003e\n    \u003cversion\u003e1.7.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n```groovy\n// Gradle Repo\nimplementation 'io.github.reajason:generator:1.7.0'\n```\n\n2. 生成 Tomcat Godzilla Filter 内存马示例\n\n```java\nShellConfig shellConfig = ShellConfig.builder()\n        .server(Server.Tomcat)\n        .shellTool(ShellTool.Godzilla)\n        .shellType(ShellType.FILTER)\n        .shrink(true) // 缩小字节码\n        .debug(false) // 关闭调试\n        .build();\n\nInjectorConfig injectorConfig = InjectorConfig.builder()\n//                .urlPattern(\"/*\")  // 自定义 urlPattern，默认就是 /*\n//                .shellClassName(\"com.example.memshell.GodzillaShell\") // 自定义内存马类名，默认为空时随机生成\n//                .injectorClassName(\"com.example.memshell.GodzillaInjector\") // 自定义注入器类名，默认为空时随机生成\n        .build();\n\nGodzillaConfig godzillaConfig = GodzillaConfig.builder()\n//                .pass(\"pass\")\n//                .key(\"key\")\n//                .headerName(\"User-Agent\")\n//                .headerValue(\"test\")\n        .build();\n\nGenerateResult result = MemShellGenerator.generate(shellConfig, injectorConfig, godzillaConfig);\n\nSystem.out.println(\"注入器类名：\"+result.getInjectorClassName());\nSystem.out.println(\"内存马类名：\"+result.getShellClassName());\n\nSystem.out.println(result.getShellConfig());\nSystem.out.println(result.getShellToolConfig());\n\nSystem.out.println(\"Base64 打包：\"+Packers.Base64.getInstance().pack(result));\nSystem.out.println(\"脚本引擎打包：\"+Packers.ScriptEngine.getInstance().pack(result));\n```\n3. 生成 Tomcat Godzilla AgentFilterChain 示例\n```java\nShellConfig shellConfig = ShellConfig.builder()\n        .server(Server.Tomcat)\n        .shellTool(ShellTool.Godzilla)\n        .shellType(ShellType.AGENT_FILTER_CHAIN)\n        .shrink(true) // 缩小字节码\n        .debug(false) // 关闭调试\n        .build();\n\nInjectorConfig injectorConfig = InjectorConfig.builder()\n//                .urlPattern(\"/*\")  // 自定义 urlPattern，默认就是 /*\n//                .shellClassName(\"com.example.memshell.GodzillaShell\") // 自定义内存马类名，默认为空时随机生成\n//                .injectorClassName(\"com.example.memshell.GodzillaInjector\") // 自定义注入器类名，默认为空时随机生成\n        .build();\n\nGodzillaConfig godzillaConfig = GodzillaConfig.builder()\n//                .pass(\"pass\")\n//                .key(\"key\")\n//                .headerName(\"User-Agent\")\n//                .headerValue(\"test\")\n        .build();\n\nGenerateResult result = MemShellGenerator.generate(shellConfig, injectorConfig, godzillaConfig);\n\nSystem.out.println(\"注入器类名：\" + result.getInjectorClassName());\nSystem.out.println(\"内存马类名：\" + result.getShellClassName());\n\nSystem.out.println(result.getShellConfig());\nSystem.out.println(result.getShellToolConfig());\n\nbyte[] agentJarBytes = ((JarPacker) Packers.AgentJar.getInstance()).packBytes(result);\nFiles.write(Paths.get(\"agent.jar\"), agentJarBytes);\n```\n4. 封装统一生成接口可参考 [GeneratorController.java](boot/src/main/java/com/reajason/javaweb/boot/controller/GeneratorController.java)\n\n## 适配情况\n\n已兼容 Java6 ~ Java8、Java9、Java11、Java17、Java21\n\n### 中间件以及框架\n\n| Tomcat（5 ~ 11）       | Jetty（6 ~ 11）          | GlassFish（3 ~ 7）     | Payara（5 ~ 6）        |\n|----------------------|------------------------|----------------------|----------------------|\n| Servlet              | Servlet                | Filter               | Filter               |\n| Filter               | Filter                 | Listener             | Listener             |\n| Listener             | Listener               | Valve                | Valve                |\n| Valve                | ServletHandler - Agent | FilterChain - Agent  | FilterChain - Agent  |\n| FilterChain - Agent  |                        | ContextValve - Agent | ContextValve - Agent |\n| ContextValve - Agent |                        |                      |                      |\n\n| Resin（3 ~ 4）        | SpringMVC                | SpringWebFlux   | XXL-JOB      |\n|---------------------|--------------------------|-----------------|--------------|\n| Servlet             | Interceptor              | WebFilter       | NettyHandler |\n| Filter              | ControllerHandler        | HandlerMethod   |              |\n| Listener            | FrameworkServlet - Agent | HandlerFunction |              |\n| FilterChain - Agent |                          | NettyHandler    |              |\n\n| JBossAS（4 ~ 7）       | JBossEAP（6 ~ 7）            | WildFly（9 ~ 30）        | Undertow               |\n|----------------------|----------------------------|------------------------|------------------------|\n| Filter               | Filter                     | Servlet                | Servlet                |\n| Listener             | Listener                   | Filter                 | Filter                 |\n| Valve                | Valve(6)                   | Listener               | Listener               |\n| FilterChain - Agent  | FilterChain - Agent (6)    | ServletHandler - Agent | ServletHandler - Agent |\n| ContextValve - Agent | ContextValve - Agent (6)   |                        |                        |\n|                      | ServletHandler - Agent (7) |                        |                        |\n\n| WebSphere（7 ~ 9）      | WebLogic （10.3.6  ~ 14） |\n|-----------------------|-------------------------|\n| Servlet               | Servlet                 |\n| Filter                | Filter                  |\n| Listener              | Listener                |\n| FilterManager - Agent | ServletContext - Agent  |\n\n| BES（9.5.x）           | TongWeb（6 ~ 7）       | InforSuite AS （9 ~ 10） | Apusic AS （9） |\n|----------------------|----------------------|------------------------|---------------|\n| Filter               | Filter               | Filter                 | Servlet       |\n| Listener             | Listener             | Listener               | Filter        |\n| Valve                | Valve                | Valve                  | Listener      |\n| FilterChain - Agent  | FilterChain - Agent  | FilterChain - Agent    |               |\n| ContextValve - Agent | ContextValve - Agent | ContextValve - Agent   |               |\n\n### 内存马功能\n\n- [x] [Godzilla 哥斯拉](https://github.com/BeichenDream/Godzilla)\n- [x] [Behinder 冰蝎](https://github.com/rebeyond/Behinder)\n- [x] 命令执行\n- [x] [Suo5](https://github.com/zema1/suo5)\n- [x] [AntSword 蚁剑](https://github.com/AntSwordProject/antSword)\n- [x] [Neo-reGeorg](https://github.com/L-codes/Neo-reGeorg)\n- [x] Custom\n\n### 封装方式\n\n- [x] BASE64\n- [x] GZIP BASE64\n- [x] JSP\n- [x] JSPX\n- [x] JAR\n- [x] BCEL\n- [x] 内置脚本引擎、Rhino 脚本引擎\n- [x] EL、SpEL、OGNL、Aviator、MVEL、JEXL、Groovy、JXPath、BeanShell\n- [x] Velocity、Freemarker、JinJava\n- [x] 原生反序列化（CB 和 CC 链）\n- [x] Agent\n- [x] XXL-JOB Executor\n- [x] Hessian、Hessian2 反序列化（XSLT链）\n- [ ] JNDI\n- [ ] JDBC 连接\n- [ ] 其他常见反序列化\n\n## 本地构建\n\n### 源代码构建\n\n\u003e 适合想编写代码的小伙伴，使用 Git Clone 下载到本地，并构建前后端项目以供使用\n\n首先需要下载 [bun](https://bun.sh/)，这是一款用于构建前端服务的工具。\n\n1. 使用 Git Clone 项目\n```bash\ngit clone https://github.com/ReaJason/MemShellParty.git\n```\n2. 构建前端项目，build 结束会将静态资源自动移动到 Spring Boot 中以供使用\n```bash\ncd MemShellParty/web\n\nbun install\n\nbun run build\n```\n3. 构建后端项目，确保使用 JDK17 环境\n```bash\ncd MemShellParty/boot\n\n./gradlew :boot:bootjar -x test\n```\n\n构建完之后，可直接启动 jar 包，jar 包位于 `MemShellParty/boot/build/libs/boot-1.0.0.jar`\n\n```bash\ncd MemShellParty/boot\n\njava -jar \\\n     --add-opens=java.base/java.util=ALL-UNNAMED \\\n     --add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED \\\n     --add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.runtime=ALL-UNNAMED \\\n     build/libs/boot-1.0.0.jar\n```\n\n也可这基础上再继续构建容器来使用\n\n```bash\ncd MemShellParty/boot\n\ndocker buildx build -t memshell-party:latest . --load\n\ndocker run -it -d --name memshell-party -p 8080:8080 memshell-party:latest\n```\n\n### Dockerfile 一键构建\n\n\u003e 适合于希望构建自定义访问路径的小伙伴，例如 NGINX 反代的场景（[#44](https://github.com/ReaJason/MemShellParty/issues/44)）\n\n下载项目根目录的 [Dockerfile](./Dockerfile)\n\n- VERSION: 版本信息，随意，建议用最新的 tag 号，仅作前端展示\n- ROUTE_ROOT_PATH: 前端根路由配置\n- CONTEXT_PATH: 后端访问前缀\n\n```bash\n# 基础构建\ndocker buildx build \\\n    --build-arg VERSION=1.6.0 \\\n    -t memshell-party:latest . --load\n\n# 基础镜像启动，访问 127.0.0.1:8080\ndocker run -it -d -p 8080:8080 memshell-party:latest\n\n# 自定义访问路径构建\ndocker buildx build \\\n    --build-arg VERSION=1.6.0 \\\n    --build-arg ROUTE_ROOT_PATH=/memshell-party \\\n    --build-arg CONTEXT_PATH=/memshell-party \\\n    -t memshell-party:latest . --load\n    \n# 自定义路径构建镜像启动，访问 127.0.0.1:8080/memshell-party\ndocker run -it -p 8080:8080 \\\n    -e BOOT_OPTS=--server.servlet.context-path=/memshell-party \\\n    memshell-party:latest\n```\n\n如果需要使用 NGINX 反代，请先使用自定义访问路径构建容器，并配置 NGINX 如下：\n\n其中 `location /memshell-party`、`ROUTE_ROOT_PATH=/memshell-party`、`CONTEXT_PATH=/memshell-party` 和\n`BOOT_OPTS=--server.servlet.context-path=/memshell-party` 都要一致才行。\n\n```text\nlocation /memshell-party {\n  proxy_pass http://127.0.0.1:8080;\n  proxy_set_header Host $http_host;\n  proxy_set_header X-Forwarded-By $server_addr:$server_port;\n  proxy_set_header X-Forwarded-For $remote_addr;\n  proxy_http_version 1.1;\n  proxy_connect_timeout 3s;\n  proxy_read_timeout 300s;\n  proxy_send_timeout 300s;\n  proxy_buffer_size 16k;\n  proxy_buffers 8 64k;\n  proxy_busy_buffers_size 128k;\n}\n```\n\n## Contribute\n\n\u003e 你的任何反馈以及 issue 交流都是对当前项目的贡献\n\n\u003e It will be so nice if you want to contribute. 🎉\n\n1. 如果你有高超的 Docker 环境构建技术，可以尝试添加 CVE 相关的集成测试用例。\n2. 如果你有高超的内存马编写技术，可以尝试添加一个内存马试试。\n3. 如果你有丰富的实战经验，可以尝试写写 issue 来提提建议。\n\n项目结构目录、构建和编译可参考 [CONTRIBUTING.md](CONTRIBUTING.md)。\n\n## Thanks\n\n- [pen4uin/java-memshell-generator](https://github.com/pen4uin/java-memshell-generator)\n\n### Let's start the party 🎉\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freajason%2Fmemshellparty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freajason%2Fmemshellparty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freajason%2Fmemshellparty/lists"}