@n0zer0d4y/vulcan-file-ops 1.1.2 → 1.1.3

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/CHANGELOG.md CHANGED
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.1.3] - 2025-11-13
9
+
10
+ ### Security
11
+
12
+ - CRITICAL: Fixed shell execution directory bypass vulnerability that allowed arbitrary command execution in unapproved directories
13
+ - Shell commands without explicit workdir parameter now properly validate process.cwd() against allowed directories
14
+ - All shell executions now require at least one approved directory to be configured
15
+ - Added mandatory directory validation for both explicit and default working directories
16
+ - Enhanced error messages with clear guidance for users
17
+ - This is a breaking change by design for security: users must configure approved directories or provide explicit workdir parameters
18
+
19
+ ### Added
20
+
21
+ - 7 comprehensive security tests for shell execution directory validation
22
+ - Root Cause Analysis document: local_docs/RCA-Shell-Execution-Directory-Bypass-Vulnerability.md
23
+ - Security fix verification document: local_docs/SECURITY-FIX-VERIFICATION.md
24
+
25
+ ### Changed
26
+
27
+ - Updated execute_shell tool description to explicitly document security requirements
28
+ - Updated 10+ existing tests to comply with enhanced security model
29
+
30
+ ### Fixed
31
+
32
+ - Shell execution no longer bypasses directory validation when workdir parameter is omitted
33
+ - Process working directory is now validated against allowed directories in all cases
34
+
8
35
  ## [1.1.2] - 2025-01-12
9
36
 
10
37
  ### Fixed
package/README.md CHANGED
@@ -692,12 +692,16 @@ Execute shell commands with security controls
692
692
 
693
693
  - `command` (string): Shell command to execute
694
694
  - `description` (string, optional): Command purpose
695
- - `workdir` (string, optional): Working directory (must be within allowed directories)
695
+ - `workdir` (string, optional): Working directory (must be within allowed directories). If not provided, process.cwd() is used and validated
696
696
  - `timeout` (number, optional): Timeout in milliseconds (default: 30000)
697
697
 
698
698
  **Output:** Exit code, stdout, stderr, and execution metadata
699
699
 
700
- **Security:** All file/directory paths in command arguments are automatically extracted and validated against allowed directories. Commands referencing paths outside approved directories are blocked, preventing directory restriction bypasses.
700
+ **Security:**
701
+ - At least one approved directory must be configured before executing shell commands
702
+ - Working directory (whether explicit or default process.cwd()) is always validated against allowed directories
703
+ - All file/directory paths in command arguments are automatically extracted and validated against allowed directories
704
+ - Commands referencing paths outside approved directories are blocked, preventing directory restriction bypasses
701
705
 
702
706
  ### Multi-File Edit Examples
703
707
 
@@ -855,6 +859,7 @@ This server has been audited against known vulnerabilities:
855
859
  - ✅ CVE-2025-54795 (Command Injection) - **PROTECTED**
856
860
  - ✅ CVE-2025-53109 (Symlink Attacks) - **PROTECTED**
857
861
  - ✅ CVE-2025-53110 (Directory Containment Bypass) - **PROTECTED**
862
+ - ✅ Shell Execution Directory Bypass - **FIXED** (November 2024)
858
863
 
859
864
  For detailed security analysis, see [Vulnerability Research Findings](docs/VULNERABILITY_RESEARCH_FINDINGS.md).
860
865
 
@@ -52,9 +52,14 @@ export function getShellTools() {
52
52
  description: `Execute shell commands on the host system with security controls. ` +
53
53
  `Commands are executed as '${shellConfig.shell} ${shellConfig.args.join(" ")} <command>' on ${shellConfig.platform}. ` +
54
54
  `\n\nThe tool captures stdout, stderr, exit codes, and signals. ` +
55
- `Working directory can be specified (must be within allowed directories). ` +
56
55
  `Commands exceeding the timeout will be automatically terminated. ` +
57
- `\n\n⚠️ SECURITY: Command substitution and certain dangerous patterns may be restricted.` +
56
+ `\n\n⚠️ SECURITY REQUIREMENTS:\n` +
57
+ `- At least ONE approved directory must be configured before executing any shell commands\n` +
58
+ `- Working directory (workdir parameter or process.cwd()) MUST be within allowed directories\n` +
59
+ `- All file/directory paths in command arguments are validated against allowed directories\n` +
60
+ `- Command substitution and dangerous patterns may be restricted\n` +
61
+ `\n` +
62
+ `If no workdir is specified, the server's current working directory will be used and validated.` +
58
63
  approvedCommandsText +
59
64
  `\n\nIMPORTANT: Always provide a clear description of what the command does and why it's needed.`,
60
65
  inputSchema: zodToJsonSchema(ShellCommandArgsSchema),
@@ -120,17 +125,36 @@ export async function handleShellTool(name, args) {
120
125
  : ""}` +
121
126
  `To approve, add these commands to --approved-commands or .env configuration.`);
122
127
  }
123
- // Validate working directory if provided
124
- let workdir = process.cwd();
125
- if (validatedArgs.workdir) {
126
- try {
127
- workdir = await validatePath(validatedArgs.workdir);
128
- }
129
- catch (error) {
130
- throw new Error(`Invalid working directory: ${validatedArgs.workdir}\n` +
131
- `Error: ${error instanceof Error ? error.message : String(error)}\n` +
132
- `Working directory must be within allowed directories.`);
133
- }
128
+ // SECURITY FIX: Validate working directory ALWAYS (not just if provided)
129
+ // This prevents bypass via process.cwd() when workdir is omitted
130
+ const allowedDirs = getAllowedDirectories();
131
+ // Require at least one approved directory for shell execution
132
+ if (allowedDirs.length === 0) {
133
+ throw new Error(`Access denied: Shell execution requires at least one approved directory.\n` +
134
+ `No allowed directories are currently configured.\n` +
135
+ `\n` +
136
+ `To execute shell commands, you must first configure allowed directories using:\n` +
137
+ ` 1. --approved-folders CLI argument when starting the MCP server, OR\n` +
138
+ ` 2. register_directory tool to add directories at runtime\n` +
139
+ `\n` +
140
+ `Example: register_directory with path "C:/path/to/your/project"`);
141
+ }
142
+ // Always validate working directory against allowed directories
143
+ let workdir = validatedArgs.workdir || process.cwd();
144
+ try {
145
+ workdir = await validatePath(workdir);
146
+ }
147
+ catch (error) {
148
+ throw new Error(`Access denied: Working directory is not within allowed directories.\n` +
149
+ `Attempted directory: ${workdir}\n` +
150
+ `Error: ${error instanceof Error ? error.message : String(error)}\n` +
151
+ `\n` +
152
+ `Allowed directories:\n` +
153
+ allowedDirs.map(d => ` - ${d}`).join('\n') +
154
+ `\n\n` +
155
+ `To execute commands in this directory:\n` +
156
+ ` 1. Register the directory using register_directory tool, OR\n` +
157
+ ` 2. Specify a workdir parameter within an approved directory`);
134
158
  }
135
159
  // Extract and validate paths from command arguments
136
160
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n0zer0d4y/vulcan-file-ops",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "MCP server that gives Claude Desktop and other AI assistants filesystem superpowers—read, write, edit, and manage files like AI coding assistants",
5
5
  "license": "MIT",
6
6
  "author": "Lloyd Barcatan",