@remnux/mcp-server 0.1.72 → 0.1.73

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
@@ -342,9 +342,12 @@ All three connection modes (docker, ssh, local) execute commands inside a dispos
342
342
  | Archive zip-slip (path traversal in archives) | Analysis session | Post-extraction validation rejects path escape attempts |
343
343
  | SSH injection | SSH connection | Proper shell escaping using single quotes |
344
344
  | Host-side file read via `upload_from_host` (docker/ssh mode) | Analyst's workstation (outside isolation) | Opt-in `--sandbox` confines the source to `--ingest-root` (realpath-resolved). See the disclosure below. |
345
+ | Host-side command execution via a file transfer (docker mode) | Analyst's workstation (outside isolation) | Every host-side `docker` invocation runs as an argument vector with no shell, so a path can never be parsed as a command. See "The server process is part of the trusted computing base" below. |
345
346
 
346
347
  **Where `upload_from_host` reads from, and why it matters.** The relevant boundary is **connector mode (`local` vs `docker`/`ssh`), not transport**. In `local` mode (including HTTP transport with the local connector), the AI already has shell-level read on the REMnux box by design: `run_tool` executes arbitrary commands there, so `upload_from_host` reading a file outside the samples directory adds nothing beyond what the model already grants. In `docker`/`ssh` mode, `upload_from_host` is the one tool that reads from the machine where the server runs, the analyst's workstation, via `docker cp` or SFTP. That read happens outside the container/VM isolation that bounds everything else, so a prompt-injected client could stage a host file such as `~/.ssh/id_rsa` or `~/.aws/credentials` into REMnux. Enable `--sandbox` with `--ingest-root=<host staging dir>` to confine that read. In docker/ssh mode, `--ingest-root` is required when `--sandbox` is set, because the samples directory lives inside REMnux rather than on the host.
347
348
 
349
+ **The server process is part of the trusted computing base.** Container/VM isolation is the boundary, and in docker/ssh mode this server is the control plane that mediates it: it runs on the analyst's workstation, outside that isolation, and it handles paths and filenames that originate inside REMnux. So the code that invokes `docker` is itself security-relevant, independent of anything the container can or cannot do. Every host-side `docker` call is therefore executed as an argument vector (`execFileSync`, no shell), which is what keeps a filename a filename. Building those calls as shell command strings was [GHSA-qp43-2vqh-w88w](https://github.com/REMnux/remnux-mcp-server/security/advisories/GHSA-qp43-2vqh-w88w): POSIX single-quote escaping is inert under `cmd.exe`, so on a Windows workstation a crafted filename reached by `download_file` became host command execution. The mitigation is removing the shell, not escaping better. Escaping is shell-specific and was silently wrong on one platform, and a filter strict enough to be safe under `cmd.exe` would have to reject characters that are legal in filenames analysts really encounter (`%VAR%` alone is expanded before metacharacters are parsed). Argument-vector execution makes the question moot: a filename stays a filename.
350
+
348
351
  **Other considerations:** A theoretical TOCTOU race exists between path validation and tool execution; container isolation is the primary mitigation (use immutable sample storage for high-security contexts). The `upload_from_host` confinement closes its own check-vs-read race by reading the realpath it validated. Tool description poisoning is mitigated by using build-time constants rather than runtime lookups from external sources.
349
352
 
350
353
  **What does NOT need protection (container/VM's job):** REMnux filesystem, packages, services, privileges, network config, devices, mounts, and path traversal inside REMnux — all disposable and container-isolated.
@@ -353,7 +356,7 @@ All three connection modes (docker, ssh, local) execute commands inside a dispos
353
356
 
354
357
  1. **Container/VM isolation**: REMnux runs isolated — the primary security boundary (user responsibility)
355
358
  2. **Command guards**: Block null-byte injection and catastrophic session-wipe commands (`mkfs`, `rm -rf /`). Shell metacharacters (`$()`, backticks, `${}`, pipes) are intentionally allowed because container/VM isolation, not in-band filtering, is the boundary
356
- 3. **Shell escaping**: Proper single-quote escaping for SSH commands
359
+ 3. **No host-side shell**: Host-side `docker` invocations (including every `docker cp` file transfer) run as argument vectors with no shell, so paths and filenames cannot be parsed as commands on the analyst's workstation. Single-quote escaping applies only to commands sent to the remote POSIX shell inside REMnux, never to host-side execution
357
360
  4. **Timeouts**: Long-running processes terminated (default 5 min)
358
361
  5. **Output budgets**: Per-tool (40KB default) and total (120KB) limits prevent AI context exhaustion
359
362
  6. **Path sandboxing** (opt-in via `--sandbox`): Restricts file operations to samples/output dirs
@@ -12,6 +12,10 @@ export declare class DockerConnector implements Connector {
12
12
  buildTimeoutWrappedCommand(command: string[], timeoutMs: number): string[];
13
13
  buildRootChownArgv(remotePath: string): string[] | null;
14
14
  buildEnsureDirsArgvs(): string[][];
15
+ buildCopyToContainerArgv(hostPath: string, remotePath: string): string[];
16
+ buildCopyFromContainerArgv(remotePath: string, hostPath: string): string[];
17
+ private dockerBinary;
18
+ private resolveDockerBinary;
15
19
  private runDocker;
16
20
  private ensureBaseDirsOwned;
17
21
  private chownToExecUser;
@@ -1 +1 @@
1
- {"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/connectors/docker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAC;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKrE,qBAAa,eAAgB,YAAW,SAAS;IAC/C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,eAAe,CAAS;gBAQ9B,aAAa,EAAE,MAAM,EACrB,QAAQ,SAAW,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM;IA8BpB,sBAAsB,CACpB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,GAAE,WAAgB,GACxB,MAAM,CAAC,iBAAiB;IAkB3B,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAQ1E,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAQvD,oBAAoB,IAAI,MAAM,EAAE,EAAE;YAUpB,SAAS;YAQT,mBAAmB;YAenB,eAAe;IAUvB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkK1E,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MA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U,EAAE,MAAM,GAAG,MAAM,EAAE;IAMxE,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAO1E,OAAO,CAAC,YAAY,CAAuB;IAW3C,OAAO,CAAC,mBAAmB;YAgCb,SAAS;YAQT,mBAAmB;YAenB,eAAe;IAUvB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkK1E,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyC7D,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtE,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB7E,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC"}
@@ -2,6 +2,7 @@ import Docker from "dockerode";
2
2
  import { writeFileSync, unlinkSync, mkdtempSync } from "fs";
3
3
  import { tmpdir } from "os";
4
4
  import { join, basename } from "path";
5
+ import { resolveExecutable } from "./resolve-executable.js";
5
6
  // Output size limit (10MB)
6
7
  const MAX_OUTPUT_SIZE = 10 * 1024 * 1024;
7
8
  export class DockerConnector {
@@ -84,11 +85,62 @@ export class DockerConnector {
84
85
  ["exec", "-u", "0", this.containerName, "chown", this.execUser, ...this.baseDirs],
85
86
  ];
86
87
  }
88
+ // Build the `docker cp` argv that copies a host file INTO the container. Pure and
89
+ // testable. Each operand is a single argv element, so no character in a path is
90
+ // ever parsed as SHELL syntax. (Docker still parses its own options and the
91
+ // `container:path` notation — callers pass absolute host paths, and the
92
+ // container-side operand is always `name:`-prefixed, so no operand reads as a flag.)
93
+ buildCopyToContainerArgv(hostPath, remotePath) {
94
+ return ["cp", hostPath, `${this.containerName}:${remotePath}`];
95
+ }
96
+ // Build the `docker cp` argv that copies a container file OUT to the host. Same
97
+ // guarantee as above, and the direction that reaches the analyst's workstation.
98
+ buildCopyFromContainerArgv(remotePath, hostPath) {
99
+ return ["cp", `${this.containerName}:${remotePath}`, hostPath];
100
+ }
101
+ // Fully qualified path to the docker CLI, resolved from PATH on first use and
102
+ // cached for the life of this connector. Lazy rather than eager so constructing
103
+ // a connector never requires Docker to be installed.
104
+ dockerBinary = null;
105
+ // Resolve `docker` to an absolute path, deliberately NOT letting the platform
106
+ // do it. A bare name handed to execFileSync is resolved by libuv, which on
107
+ // Windows searches the process's current directory BEFORE PATH (and tries
108
+ // `.com` before `.exe`) — so a sample unpacked into the analyst's working
109
+ // directory could plant a `docker.com` that this server would then run on the
110
+ // host. See resolve-executable.ts for the libuv citation.
111
+ //
112
+ // Never falls back to the bare name: that would restore the very search this
113
+ // avoids. A missing docker is a startup-shaped problem and says so.
114
+ resolveDockerBinary() {
115
+ if (this.dockerBinary)
116
+ return this.dockerBinary;
117
+ const resolved = resolveExecutable("docker", {
118
+ pathEnv: process.env.PATH ?? process.env.Path,
119
+ platform: process.platform,
120
+ });
121
+ if (!resolved) {
122
+ throw new Error("Could not find the 'docker' executable in PATH. Install Docker, or add " +
123
+ "its directory to PATH using a fully qualified path. Note that the " +
124
+ "current working directory is intentionally not searched.");
125
+ }
126
+ this.dockerBinary = resolved;
127
+ return resolved;
128
+ }
87
129
  // Run `docker <argv>` via execFileSync — no shell, so values cannot inject commands.
88
- // Best-effort: callers swallow failures so ownership repair never blocks analysis.
130
+ // This is the security boundary for every host-side docker invocation, not a
131
+ // defense-in-depth nicety: the MCP server process runs on the analyst's workstation,
132
+ // outside the container isolation the threat model relies on, and it handles paths
133
+ // derived from container-side data. A shell here (cmd.exe on Windows, where POSIX
134
+ // single-quote escaping is inert) turns a filename into host command execution —
135
+ // GHSA-qp43-2vqh-w88w. `shell: false` is execFileSync's default and is passed
136
+ // explicitly so the invariant is visible and testable.
137
+ //
138
+ // Throws on failure. Callers that are best-effort (ownership repair) catch for
139
+ // themselves; the file-transfer callers deliberately do not, so a failed copy
140
+ // surfaces to the analyst.
89
141
  async runDocker(argv) {
90
142
  const { execFileSync } = await import("child_process");
91
- execFileSync("docker", argv, { stdio: "pipe" });
143
+ execFileSync(this.resolveDockerBinary(), argv, { stdio: "pipe", shell: false });
92
144
  }
93
145
  // Idempotently make the samples/output dirs owned by the exec user. Runs once per
94
146
  // connector. Best-effort: the dirs may already be correct, or docker may be
@@ -275,13 +327,9 @@ export class DockerConnector {
275
327
  try {
276
328
  // Write content to temp file
277
329
  writeFileSync(tempPath, content);
278
- // Use docker cp to copy into container
279
- // docker cp tempPath containerName:remotePath
280
- // Escape single quotes in paths for shell safety (defense-in-depth)
281
- const escapedTempPath = tempPath.replace(/'/g, "'\\''");
282
- const escapedRemotePath = remotePath.replace(/'/g, "'\\''");
283
- const { execSync } = await import("child_process");
284
- execSync(`docker cp '${escapedTempPath}' '${this.containerName}:${escapedRemotePath}'`, { stdio: "pipe" });
330
+ // Copy into the container as an argv — no shell, so nothing in either path
331
+ // can be parsed as a command (see runDocker).
332
+ await this.runDocker(this.buildCopyToContainerArgv(tempPath, remotePath));
285
333
  // docker cp preserves the host file's numeric UID/GID and mode (NOT the exec
286
334
  // user), so a file that is not world/group readable on the host would be
287
335
  // unreadable by a non-root exec user. Chown the copied path to the exec user so
@@ -302,19 +350,13 @@ export class DockerConnector {
302
350
  }
303
351
  async writeFileFromPath(remotePath, hostPath) {
304
352
  await this.ensureBaseDirsOwned();
305
- const escapedRemotePath = remotePath.replace(/'/g, "'\\''");
306
- const escapedHostPath = hostPath.replace(/'/g, "'\\''");
307
- const { execSync } = await import("child_process");
308
- execSync(`docker cp '${escapedHostPath}' '${this.containerName}:${escapedRemotePath}'`, { stdio: "pipe" });
353
+ await this.runDocker(this.buildCopyToContainerArgv(hostPath, remotePath));
309
354
  // docker cp preserves the host uid/mode, which may not grant the non-root exec
310
355
  // user access. Chown the copied path to the exec user so tools can read it.
311
356
  await this.chownToExecUser(remotePath);
312
357
  }
313
358
  async readFileToPath(remotePath, hostPath) {
314
- const escapedRemotePath = remotePath.replace(/'/g, "'\\''");
315
- const escapedHostPath = hostPath.replace(/'/g, "'\\''");
316
- const { execSync } = await import("child_process");
317
- execSync(`docker cp '${this.containerName}:${escapedRemotePath}' '${escapedHostPath}'`, { stdio: "pipe" });
359
+ await this.runDocker(this.buildCopyFromContainerArgv(remotePath, hostPath));
318
360
  }
319
361
  async executeShell(command, options = {}) {
320
362
  // Calculate shell timeout (slightly shorter than client timeout to fire first)
@@ -1 +1 @@
1
- {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/connectors/docker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGtC,2BAA2B;AAC3B,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,OAAO,eAAe;IAClB,MAAM,CAAS;IACf,aAAa,CAAS;IACtB,QAAQ,CAAS;IACjB,QAAQ,CAAS;IACjB,QAAQ,CAAW;IACnB,eAAe,GAAG,KAAK,CAAC;IAEhC,iFAAiF;IACjF,oFAAoF;IACpF,+EAA+E;IAC/E,6EAA6E;IAC7E,6BAA6B;IAC7B,YACE,aAAqB,EACrB,QAAQ,GAAG,QAAQ,EACnB,UAAmB,EACnB,SAAkB;QAElB,qEAAqE;QACrE,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC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MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,UAAU;QACd,wDAAwD;IAC1D,CAAC;CACF"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Shell-free executable resolution that never consults the current directory.
3
+ *
4
+ * WHY THIS EXISTS
5
+ *
6
+ * Handing a bare program name to child_process.execFile/spawn is not neutral on
7
+ * Windows. libuv's uv_spawn resolves it with its own search, and from
8
+ * libuv/src/win/process.c:
9
+ *
10
+ * "- If there's really only a filename, check the current directory for file,
11
+ * then search all path directories."
12
+ *
13
+ * if (NeedCurrentDirectoryForExePathW(L"")) {
14
+ * // The file is really only a name; look in cwd first, then scan path
15
+ *
16
+ * That branch is taken unless the NoDefaultCurrentDirectoryInExePath environment
17
+ * variable is set, which it is not by default. libuv also appends ".com" before
18
+ * ".exe" (path_search_walk_ext), so a planted `docker.com` wins over a genuine
19
+ * `docker.exe` sitting on PATH.
20
+ *
21
+ * This matters here specifically: an analyst plausibly runs their AI client from
22
+ * a directory where a malware sample was unpacked, which makes the process cwd
23
+ * attacker-influenced. A sample that drops `docker.com` next to itself would then
24
+ * be executed by this server, on the host, outside the container isolation the
25
+ * threat model depends on.
26
+ *
27
+ * Passing a FULLY QUALIFIED path removes the search entirely. libuv takes its
28
+ * `file_has_dir` branch (which consults neither cwd nor PATH), and
29
+ * search_path_join_test zeroes the cwd for an absolute path with a drive letter.
30
+ *
31
+ * The resolution below is therefore deliberately stricter than the platform's:
32
+ * only fully qualified PATH directories are considered, so no candidate can ever
33
+ * depend on where the process happens to be running.
34
+ *
35
+ * SCOPE. This removes cwd-dependent DISCOVERY of the executable. It does not
36
+ * establish that the resolved binary is trustworthy: a PATH directory writable by
37
+ * the attacker is still a PATH directory, and DLL search order for the resolved
38
+ * executable is the Windows loader's business, not ours.
39
+ */
40
+ export interface ResolveExecutableOptions {
41
+ /** Raw PATH value. Undefined or empty means "do not guess" — resolution fails. */
42
+ pathEnv: string | undefined;
43
+ platform: NodeJS.Platform;
44
+ /**
45
+ * Existence/executability probe. Injectable so both platform branches can be
46
+ * exercised on any runner; defaults to a real filesystem check.
47
+ */
48
+ isExecutableFile?: (candidate: string) => boolean;
49
+ }
50
+ /**
51
+ * True only for a path that resolves identically regardless of the process's
52
+ * current directory AND current drive.
53
+ *
54
+ * `path.win32.isAbsolute()` is NOT usable for this: it returns true for "\tools"
55
+ * and "/tools", which libuv resolves against the current drive
56
+ * (search_path_join_test sets cwd_len = 2 for them), leaving cwd in play.
57
+ */
58
+ export declare function isFullyQualified(entry: string, platform: NodeJS.Platform): boolean;
59
+ /**
60
+ * Split a raw PATH value into entries.
61
+ *
62
+ * Windows PATH entries may be quoted, and a quoted entry may itself contain the
63
+ * ';' delimiter — a naive split corrupts those. Empty entries are dropped: on
64
+ * both platforms an empty entry means "the current directory".
65
+ */
66
+ export declare function splitPathEnv(pathEnv: string | undefined, platform: NodeJS.Platform): string[];
67
+ /**
68
+ * Candidate filenames to try inside each directory, in libuv's order.
69
+ *
70
+ * From path_search_walk_ext: the literal name is tried first ONLY when it
71
+ * already carries a non-empty extension, then ".com" is appended, then ".exe".
72
+ * A bare "docker" is therefore never tried as an extensionless file, because
73
+ * CreateProcess cannot run one.
74
+ */
75
+ export declare function candidateNames(name: string, platform: NodeJS.Platform): string[];
76
+ /**
77
+ * Resolve a bare executable name to a fully qualified path using PATH only.
78
+ *
79
+ * Returns null when nothing is found. Callers MUST NOT fall back to the bare
80
+ * name on null: that hands resolution straight back to the cwd-first search
81
+ * this function exists to bypass.
82
+ */
83
+ export declare function resolveExecutable(name: string, options: ResolveExecutableOptions): string | null;
84
+ //# sourceMappingURL=resolve-executable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-executable.d.ts","sourceRoot":"","sources":["../../src/connectors/resolve-executable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,MAAM,WAAW,wBAAwB;IACvC,kFAAkF;IAClF,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAgBlF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ,GACxB,MAAM,EAAE,CA2CV;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAgBhF;AAkBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,wBAAwB,GAChC,MAAM,GAAG,IAAI,CAyBf"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Shell-free executable resolution that never consults the current directory.
3
+ *
4
+ * WHY THIS EXISTS
5
+ *
6
+ * Handing a bare program name to child_process.execFile/spawn is not neutral on
7
+ * Windows. libuv's uv_spawn resolves it with its own search, and from
8
+ * libuv/src/win/process.c:
9
+ *
10
+ * "- If there's really only a filename, check the current directory for file,
11
+ * then search all path directories."
12
+ *
13
+ * if (NeedCurrentDirectoryForExePathW(L"")) {
14
+ * // The file is really only a name; look in cwd first, then scan path
15
+ *
16
+ * That branch is taken unless the NoDefaultCurrentDirectoryInExePath environment
17
+ * variable is set, which it is not by default. libuv also appends ".com" before
18
+ * ".exe" (path_search_walk_ext), so a planted `docker.com` wins over a genuine
19
+ * `docker.exe` sitting on PATH.
20
+ *
21
+ * This matters here specifically: an analyst plausibly runs their AI client from
22
+ * a directory where a malware sample was unpacked, which makes the process cwd
23
+ * attacker-influenced. A sample that drops `docker.com` next to itself would then
24
+ * be executed by this server, on the host, outside the container isolation the
25
+ * threat model depends on.
26
+ *
27
+ * Passing a FULLY QUALIFIED path removes the search entirely. libuv takes its
28
+ * `file_has_dir` branch (which consults neither cwd nor PATH), and
29
+ * search_path_join_test zeroes the cwd for an absolute path with a drive letter.
30
+ *
31
+ * The resolution below is therefore deliberately stricter than the platform's:
32
+ * only fully qualified PATH directories are considered, so no candidate can ever
33
+ * depend on where the process happens to be running.
34
+ *
35
+ * SCOPE. This removes cwd-dependent DISCOVERY of the executable. It does not
36
+ * establish that the resolved binary is trustworthy: a PATH directory writable by
37
+ * the attacker is still a PATH directory, and DLL search order for the resolved
38
+ * executable is the Windows loader's business, not ours.
39
+ */
40
+ import { accessSync, statSync, constants } from "fs";
41
+ /**
42
+ * True only for a path that resolves identically regardless of the process's
43
+ * current directory AND current drive.
44
+ *
45
+ * `path.win32.isAbsolute()` is NOT usable for this: it returns true for "\tools"
46
+ * and "/tools", which libuv resolves against the current drive
47
+ * (search_path_join_test sets cwd_len = 2 for them), leaving cwd in play.
48
+ */
49
+ export function isFullyQualified(entry, platform) {
50
+ if (!entry)
51
+ return false;
52
+ if (platform !== "win32") {
53
+ return entry.startsWith("/");
54
+ }
55
+ // UNC: \\server\share or //server/share
56
+ if (/^[\\/]{2}[^\\/]/.test(entry))
57
+ return true;
58
+ // Drive-qualified: X:\... or X:/... — the separator after the colon is what
59
+ // separates this from the drive-RELATIVE "C:tools", which resolves against
60
+ // that drive's own working directory.
61
+ if (/^[A-Za-z]:[\\/]/.test(entry))
62
+ return true;
63
+ return false;
64
+ }
65
+ /**
66
+ * Split a raw PATH value into entries.
67
+ *
68
+ * Windows PATH entries may be quoted, and a quoted entry may itself contain the
69
+ * ';' delimiter — a naive split corrupts those. Empty entries are dropped: on
70
+ * both platforms an empty entry means "the current directory".
71
+ */
72
+ export function splitPathEnv(pathEnv, platform) {
73
+ if (!pathEnv)
74
+ return [];
75
+ const delimiter = platform === "win32" ? ";" : ":";
76
+ const entries = [];
77
+ let current = "";
78
+ let quote = null;
79
+ let atEntryStart = true;
80
+ for (const ch of pathEnv) {
81
+ // libuv only honours a quote that OPENS an entry:
82
+ // dir_start = dir_end; if (*dir_start == L'"' || *dir_start == L'\'') ...
83
+ // Treating a quote anywhere would make an apostrophe in an ordinary
84
+ // directory name (C:\Users\O'Brien\bin) swallow the following delimiter and
85
+ // merge it with the next entry, hiding a real Docker installation.
86
+ if (platform === "win32" && atEntryStart && quote === null && (ch === '"' || ch === "'")) {
87
+ quote = ch;
88
+ atEntryStart = false;
89
+ continue;
90
+ }
91
+ if (quote !== null && ch === quote) {
92
+ quote = null;
93
+ continue;
94
+ }
95
+ if (ch === delimiter && quote === null) {
96
+ entries.push(current);
97
+ current = "";
98
+ atEntryStart = true;
99
+ continue;
100
+ }
101
+ current += ch;
102
+ atEntryStart = false;
103
+ }
104
+ entries.push(current);
105
+ // Whitespace: cmd.exe preserves it, and so do we on POSIX, where a trailing
106
+ // space is a legal part of a directory name and trimming would silently point
107
+ // at a different directory. On Windows a path component cannot end in a space
108
+ // (the API strips it), while "C:\a; C:\b" spacing is common in real PATHs, so
109
+ // trimming there only helps find Docker and can never widen what we accept:
110
+ // every entry still has to clear isFullyQualified.
111
+ const cleaned = platform === "win32" ? entries.map((e) => e.trim()) : entries;
112
+ return cleaned.filter((e) => e.length > 0);
113
+ }
114
+ /**
115
+ * Candidate filenames to try inside each directory, in libuv's order.
116
+ *
117
+ * From path_search_walk_ext: the literal name is tried first ONLY when it
118
+ * already carries a non-empty extension, then ".com" is appended, then ".exe".
119
+ * A bare "docker" is therefore never tried as an extensionless file, because
120
+ * CreateProcess cannot run one.
121
+ */
122
+ export function candidateNames(name, platform) {
123
+ if (platform !== "win32")
124
+ return [name];
125
+ // libuv uses wcschr — the FIRST dot, not the last — and requires a character
126
+ // after it for the name to count as already having an extension.
127
+ const dot = name.indexOf(".");
128
+ const hasExtension = dot !== -1 && dot < name.length - 1;
129
+ // "Add a dot if the filename didn't end with one": a name already ending in a
130
+ // dot reuses it rather than gaining a second.
131
+ const join = (ext) => name.endsWith(".") ? `${name}${ext}` : `${name}.${ext}`;
132
+ return hasExtension
133
+ ? [name, join("com"), join("exe")]
134
+ : [join("com"), join("exe")];
135
+ }
136
+ function defaultIsExecutableFile(candidate, platform) {
137
+ try {
138
+ // statSync follows symlinks, which is required: package managers and Docker
139
+ // Desktop both install the CLI as a symlink in common setups.
140
+ if (!statSync(candidate).isFile())
141
+ return false;
142
+ if (platform === "win32")
143
+ return true;
144
+ accessSync(candidate, constants.X_OK);
145
+ return true;
146
+ }
147
+ catch {
148
+ return false;
149
+ }
150
+ }
151
+ /**
152
+ * Resolve a bare executable name to a fully qualified path using PATH only.
153
+ *
154
+ * Returns null when nothing is found. Callers MUST NOT fall back to the bare
155
+ * name on null: that hands resolution straight back to the cwd-first search
156
+ * this function exists to bypass.
157
+ */
158
+ export function resolveExecutable(name, options) {
159
+ const { pathEnv, platform } = options;
160
+ const probe = options.isExecutableFile ?? ((c) => defaultIsExecutableFile(c, platform));
161
+ const separator = platform === "win32" ? "\\" : "/";
162
+ const candidates = candidateNames(name, platform);
163
+ for (const entry of splitPathEnv(pathEnv, platform)) {
164
+ if (!isFullyQualified(entry, platform))
165
+ continue;
166
+ // Strip one trailing separator so we do not emit a doubled one. Backslash
167
+ // counts only on Windows: on POSIX it is an ordinary filename character,
168
+ // and treating it as a separator would point at a different directory.
169
+ const isTrailingSeparator = entry.endsWith("/") || (platform === "win32" && entry.endsWith("\\"));
170
+ const base = isTrailingSeparator ? entry.slice(0, -1) : entry;
171
+ for (const candidate of candidates) {
172
+ const full = `${base}${separator}${candidate}`;
173
+ if (probe(full))
174
+ return full;
175
+ }
176
+ }
177
+ return null;
178
+ }
179
+ //# sourceMappingURL=resolve-executable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-executable.js","sourceRoot":"","sources":["../../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AAG,CAAC;IACpD,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAElD,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QACpD,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC;YAAE,SAAS;QAEjD,0EAA0E;QAC1E,yEAAyE;QACzE,uEAAuE;QACvE,MAAM,mBAAmB,GACvB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACxE,MAAM,IAAI,GAAG,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAE9D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;YAC/C,IAAI,KAAK,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnux/mcp-server",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "packageManager": "pnpm@10.33.0",
5
5
  "description": "MCP server for using the REMnux malware analysis toolkit via AI assistants",
6
6
  "type": "module",