T08 · Insecure Dependencies
Warning
- Location
- scripts/moltx_engage_gate.py:35
- Finding
- Untrusted Workspace Module Is Imported and Executed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/moltx_engage_gate.py`, lines 35-42 **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code ```python # Import MoltX client from local workspace skill ws = Path(__file__).resolve().parents[4] client_dir = ws / "skills" / "moltx-streamliner" / "scripts" if not client_dir.exists(): print(json.dumps({"ok": False, "error": "moltx-streamliner not found", "expected": str(client_dir)}, indent=2)) return 2 sys.path.insert(0, str(client_dir)) from moltx_client import session, API_BASE # type: ignore s = session() ``` ### Technical Analysis The script constructs a path to a sibling workspace Skill, prepends that directory to `sys.path`, and imports `moltx_client` without verifying the file's identity, integrity, ownership, or version. Importing a Python module executes its top-level code immediately. The imported module also supplies both `session` and `API_BASE`. Consequently, a modified or substituted dependency can run arbitrary Python code and can control the destination of subsequent authenticated HTTP requests. Exploitation requires the attacker to be able to create or modify files under the expected `skills/moltx-streamliner/scripts` directory. The issue does not independently grant an external attacker access to that directory, but it turns such local or supply-chain modification into code execution when the documented helper is invoked. ### Attack Path 1. An attacker gains write access to the workspace dependency directory or supplies a compromised `moltx-streamliner` Skill. 2. The attacker creates or modifies `skills/moltx-streamliner/scripts/moltx_client.py`. 3. A user runs `python scripts/moltx_engage_gate.py --mode minimal`. 4. The script places the dependency directory first in `sys.path`. 5. Python imports the attacker's module and executes its top-level code with the user's privileges. 6. The malicio ...[truncated 643 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Replace dynamic sibling-Skill loading with a packaged, reviewed, and version-pinned dependency. - If workspace loading is required, resolve the module path and verify that it is beneath an approved dependency directory. - Verify the expected module using a trusted cryptographic digest or signed manifest before importing it. - Validate that the dependency directory and module are not writable by untrusted users. - Restrict `API_BASE` to an explicit allowlist of HTTPS origins before sending requests. - Avoid inserting mutable workspace directories at the beginning of `sys.path`; load a verified module from a specific file when unavoidable. - Run the helper with minimal filesystem and credential access so that a compromised dependency has a reduced impact. ]]>
