@remnux/mcp-server 0.1.30 → 0.1.31
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
CHANGED
|
@@ -34,7 +34,7 @@ The server gives AI assistants structured access to REMnux tools with features p
|
|
|
34
34
|
|
|
35
35
|
- **Unified connection layer** — Docker exec, SSH, and local execution behind one interface. Switch deployment scenarios without changing how your AI assistant interacts with tools.
|
|
36
36
|
- **File-type-aware analysis** — `analyze_file` detects file types and runs the appropriate tool chain automatically, returning structured output with IOC extraction. `suggest_tools` lets the AI agent request recommendations and decide what to run.
|
|
37
|
-
- **Defense-in-depth guardrails** — Pattern blocking catches
|
|
37
|
+
- **Defense-in-depth guardrails** — Pattern blocking catches prompt injection via command substitution (`$()`, backticks, `${}`). Optional path sandboxing (`--sandbox`) restricts file operations to the samples and output directories. These complement the container or VM isolation that serves as the primary security boundary.
|
|
38
38
|
- **Browsable tool registry** — MCP resources at `remnux://tools`, `remnux://tools/by-tag/{tag}`, and `remnux://tools/{name}` let the AI agent discover available tools and their metadata without external lookups.
|
|
39
39
|
|
|
40
40
|
## Architecture
|
|
@@ -549,7 +549,7 @@ All three connection modes (docker, ssh, local) execute commands inside a dispos
|
|
|
549
549
|
|
|
550
550
|
| Threat | Target | Defense |
|
|
551
551
|
|--------|--------|---------|
|
|
552
|
-
| Command injection (prompt injection tricks AI into shell execution) | Analyst's workflow | Anti-injection patterns (
|
|
552
|
+
| Command injection (prompt injection tricks AI into shell execution) | Analyst's workflow | Anti-injection patterns (`$()`, backticks, `${}`, etc.) |
|
|
553
553
|
| Dangerous pipes (attacker code piped to interpreters) | Analyst's workflow | Container/VM isolation; AI system prompt guidance |
|
|
554
554
|
| Catastrophic commands (`rm -rf /`, `mkfs`) | Analysis session | Narrow pattern guards for root wipes and filesystem formatting |
|
|
555
555
|
| Resource exhaustion (tools hang or consume excessive resources) | AI assistant / analysis session | Timeout enforcement (default 5 min), output budgets (40KB/tool default, 120KB total) |
|
|
@@ -566,10 +566,10 @@ All three connection modes (docker, ssh, local) execute commands inside a dispos
|
|
|
566
566
|
|
|
567
567
|
**Blocked command patterns (anti-injection):**
|
|
568
568
|
- Null bytes (truncate paths in C functions)
|
|
569
|
-
- Shell escape:
|
|
570
|
-
- Shell sourcing: `source`
|
|
569
|
+
- Shell escape: backticks, `$()`, `${}`, process substitution `<()` `>()`
|
|
571
570
|
|
|
572
571
|
**Deliberately NOT blocked (legitimate shell syntax):**
|
|
572
|
+
- `eval`, `exec`, `source` — same threat class as pipe-to-interpreter (already allowed); without `$()` or backticks, these only operate on literal strings; container/VM isolation handles residual risk
|
|
573
573
|
- Simple `$VAR` references (needed for shell loops: `for f in *; do file "$f"; done`)
|
|
574
574
|
- Newlines/carriage returns (enables multi-line scripts; container isolation is the security boundary)
|
|
575
575
|
|
|
@@ -599,6 +599,7 @@ These commands are intentionally allowed because REMnux is disposable and contai
|
|
|
599
599
|
| `dd` | Legitimate forensics tool for disk/memory carving |
|
|
600
600
|
| `curl`, `wget` | Network tools needed for analysis |
|
|
601
601
|
| `\| python`, `\| bash`, `\| perl`, etc. | Container isolation handles code execution; blocking prevented legitimate workflows |
|
|
602
|
+
| `eval`, `exec`, `source` | Same threat class as pipe-to-interpreter; `$()` blocking already covers injection vectors |
|
|
602
603
|
| `/etc/`, `/proc/`, `/sys/`, `/dev/` | Container's own filesystem; useful for forensics |
|
|
603
604
|
| `crontab`, `nohup`, `screen`, `tmux` | Ephemeral environment; timeouts still apply |
|
|
604
605
|
| `tee`, `xargs` | Essential for saving output and batch operations |
|
|
@@ -606,12 +607,11 @@ These commands are intentionally allowed because REMnux is disposable and contai
|
|
|
606
607
|
### Defense in Depth
|
|
607
608
|
|
|
608
609
|
1. **Container/VM isolation**: REMnux runs isolated — the primary security boundary (user responsibility)
|
|
609
|
-
2. **Anti-injection**: Shell escape patterns block prompt injection from executing arbitrary code
|
|
610
|
-
3. **
|
|
611
|
-
4. **
|
|
612
|
-
5. **
|
|
613
|
-
6. **
|
|
614
|
-
7. **Path sandboxing** (opt-in via `--sandbox`): Restricts file operations to samples/output dirs
|
|
610
|
+
2. **Anti-injection**: Shell escape patterns block prompt injection from executing arbitrary code via `$()`, backticks, `${}`, and process substitution
|
|
611
|
+
3. **Shell escaping**: Proper single-quote escaping for SSH commands
|
|
612
|
+
4. **Timeouts**: Long-running processes terminated (default 5 min)
|
|
613
|
+
5. **Output budgets**: Per-tool (40KB default) and total (120KB) limits prevent AI context exhaustion
|
|
614
|
+
6. **Path sandboxing** (opt-in via `--sandbox`): Restricts file operations to samples/output dirs
|
|
615
615
|
|
|
616
616
|
### Prompt Injection from Malware
|
|
617
617
|
|
|
@@ -748,7 +748,7 @@ This server is self-sufficient for most workflows: `suggest_tools` recommends th
|
|
|
748
748
|
### Why blocklist-only (no allowlist)?
|
|
749
749
|
|
|
750
750
|
- **Container isolation** is the real security boundary, not this server's guardrails
|
|
751
|
-
- **Anti-injection patterns** prevent prompt injection from triggering arbitrary code execution
|
|
751
|
+
- **Anti-injection patterns** prevent prompt injection from triggering arbitrary code execution via `$(cmd)`, backticks, `${}`, and process substitution
|
|
752
752
|
- **Simpler maintenance**: No need to parse salt-states or fetch remote tool lists
|
|
753
753
|
- **Works offline**: No dependency on docs.remnux.org for tool validation
|
|
754
754
|
- **Flexible**: Any installed tool can be used without updating an allowlist
|
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This module prevents:
|
|
9
9
|
* 1. Shell injection — malware output containing prompt injection could trick
|
|
10
|
-
* the AI into executing arbitrary code via
|
|
11
|
-
*
|
|
10
|
+
* the AI into executing arbitrary code via $(), backticks, ${}, etc.
|
|
11
|
+
*
|
|
12
|
+
* eval/exec/source are NOT blocked (removed 2026-02): same threat class as
|
|
13
|
+
* pipe-to-interpreter (already allowed). Without $() or backticks, these can
|
|
14
|
+
* only operate on literal strings — equivalent to typing commands directly.
|
|
15
|
+
* Container/VM isolation handles the residual risk.
|
|
12
16
|
*
|
|
13
17
|
* Path sandboxing (isPathSafe, validateFilePath) is available as an opt-in
|
|
14
18
|
* workflow aid via --sandbox, not as a security control.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocklist.d.ts","sourceRoot":"","sources":["../../src/security/blocklist.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"blocklist.d.ts","sourceRoot":"","sources":["../../src/security/blocklist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAqB5C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAmCjE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAMnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAAc,EAAO,CAAC;AAE5D;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAqBhF"}
|
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This module prevents:
|
|
9
9
|
* 1. Shell injection — malware output containing prompt injection could trick
|
|
10
|
-
* the AI into executing arbitrary code via
|
|
11
|
-
*
|
|
10
|
+
* the AI into executing arbitrary code via $(), backticks, ${}, etc.
|
|
11
|
+
*
|
|
12
|
+
* eval/exec/source are NOT blocked (removed 2026-02): same threat class as
|
|
13
|
+
* pipe-to-interpreter (already allowed). Without $() or backticks, these can
|
|
14
|
+
* only operate on literal strings — equivalent to typing commands directly.
|
|
15
|
+
* Container/VM isolation handles the residual risk.
|
|
12
16
|
*
|
|
13
17
|
* Path sandboxing (isPathSafe, validateFilePath) is available as an opt-in
|
|
14
18
|
* workflow aid via --sandbox, not as a security control.
|
|
@@ -20,8 +24,6 @@ export const BLOCKED_PATTERNS = [
|
|
|
20
24
|
// Newlines allowed: enables multi-line scripts; container isolation is security boundary
|
|
21
25
|
{ pattern: /\x00/, category: "null byte injection" },
|
|
22
26
|
// Shell escape / code execution — prevents prompt injection from triggering arbitrary code
|
|
23
|
-
{ pattern: /\beval\b/i, category: "shell escape" },
|
|
24
|
-
{ pattern: /(?<!-)\bexec\b/i, category: "shell escape" },
|
|
25
27
|
{ pattern: /`[^`]+`/, category: "shell escape (backtick)" },
|
|
26
28
|
{ pattern: /\$\([^)]+\)/, category: "shell escape (command substitution)" },
|
|
27
29
|
{ pattern: /\$\{[^}]+\}/, category: "shell escape (variable expansion)" },
|
|
@@ -30,8 +32,6 @@ export const BLOCKED_PATTERNS = [
|
|
|
30
32
|
{ pattern: /\$[0-9?$!@#]/, category: "shell escape (special variable)" },
|
|
31
33
|
// Process substitution
|
|
32
34
|
{ pattern: /[<>]\s*\(/, category: "process substitution" },
|
|
33
|
-
// Shell sourcing
|
|
34
|
-
{ pattern: /\bsource\b/i, category: "shell escape" },
|
|
35
35
|
// Catastrophic command guard — prevents AI from accidentally destroying the analysis session
|
|
36
36
|
// Only blocks root-level wipes (rm -rf /), not targeted deletes (rm -rf subdir/)
|
|
37
37
|
{ pattern: /rm\s+-[rR].*\s\/\s*$/, category: "catastrophic command (root wipe)" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocklist.js","sourceRoot":"","sources":["../../src/security/blocklist.ts"],"names":[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