T09 · Insecure Skill Coding Practices
- Location
scripts/minimax_websearch.js:38- Finding
Arbitrary Command Execution Through MINIMAX_PYTHON
- Content
View full analysis
Vulnerability Details
File Location:
scripts/minimax_websearch.js:38-42andscripts/minimax_websearch.js:65-72
Vulnerability Type: OS command injection through an environment-controlled executable path
Risk Level: HighVulnerable Code
js // Python interpreter (default to E:\.uv-venv on Windows) const defaultPy = process.platform === 'win32' ? 'E:\\.uv-venv\\Scripts\\python.exe' : path.join(process.env.HOME || '/usr/local', '.uv-venv', 'bin', 'python'); const pythonExe = process.env.MINIMAX_PYTHON || defaultPy; const apiHost = process.env.MINIMAX_API_HOST || 'https://api.minimaxi.com';js const result = execSync(`"${pythonExe}" -m minimax_mcp.server`, { env: { ...process.env, MINIMAX_API_KEY: apiKey, MINIMAX_API_HOST: apiHost, FASTMCP_LOG_LEVEL: 'ERROR', REQUESTS_CA_BUNDLE: VENV_CERTIFI_CA }, input, maxBuffer: 10 * 1024 * 1024, timeout: 30000, shell: true, windowsHide: true });Technical Analysis
The value of
MINIMAX_PYTHONis copied directly from the process environment and interpolated into a command string passed toexecSync. The invocation explicitly enablesshell: true, causing the resulting string to be interpreted by the platform command shell rather than invoking the Python executable directly.Wrapping the value in double quotes does not provide adequate protection. An attacker who can modify the skill's environment or its OpenClaw configuration can insert a closing quote and shell control characters into
MINIMAX_PYTHON, escape the intended executable argument, and append an arbitrary command.This is especially significant because the child environment includes all existing process environment variables and explicitly contains
MINIMAX_API_KEY. Any injected process would execute in that environment and could access the credential.Attack Path
- The attacker obtains the ability to influence the OpenClaw environment conf ...[truncated 1171 chars]
- Remediation
View remediation
Remediation Suggestions
Replace shell-based execution with an argument-based child-process API:
js const { execFileSync } = require('child_process'); const result = execFileSync(pythonExe, ['-m', 'minimax_mcp.server'], { env: { ...process.env, MINIMAX_API_KEY: apiKey, MINIMAX_API_HOST: apiHost, FASTMCP_LOG_LEVEL: 'ERROR', REQUESTS_CA_BUNDLE: VENV_CERTIFI_CA }, input, maxBuffer: 10 * 1024 * 1024, timeout: 30000, windowsHide: true, shell: false });Additional hardening should include:
- Resolve
pythonExeto an absolute path. - Verify that the resolved path exists and is a regular executable file.
- Optionally restrict the interpreter to an administrator-approved path or directory.
- Reject values containing null bytes and avoid passing executable paths through a shell under all circumstances.
- Construct a minimal child environment instead of inheriting every variable through
...process.env, where operationally feasible.
- Resolve
