T07 · Tool Hijacking and Spoofing
- Location
SKILL.md:145- Finding
Execution of an Unbundled Relative Node.js Script
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:145-161
Vulnerability Type: Untrusted relative-path executable resolution
Risk Level: HighVulnerable Code
python # Feishu document operations import subprocess # ... # Read document result = subprocess.run([ "node", "index.js", "--action", "read", "--token", "doccnXXXXXXXX" ], capture_output=True, text=True) print(result.stdout) # ... # Create document result = subprocess.run([ "node", "index.js", "--action", "create", "--title", "Meeting Minutes" ], capture_output=True, text=True) print(f"Document token: {result.stdout.strip()}")Technical Analysis
The documented operations launch
index.jsusing a path relative to the process's current working directory. The audited project contains onlySKILL.md; it does not include the referencedindex.jsimplementation.Consequently, these examples either fail because the script is missing or execute whichever file named
index.jshappens to exist in the working directory. An attacker who can place or replace that file can cause legitimate-looking Feishu operations to run attacker-controlled JavaScript through Node.js. Using an argument array prevents shell metacharacter injection, but it does not prevent the relative-path substitution issue.Attack Path
- An attacker gains the ability to place a file in the directory from which the Agent or user will execute the documented command. This may be a shared workspace, extracted archive, cloned repository, or attacker-supplied project.
- The attacker creates a malicious file named
index.js. - The user or Agent follows the Skill's documented read or create workflow.
subprocess.run()launchesnode index.jswithout resolving the script against a trusted Skill directory.- Node.js executes the attacker's script with the privileges and environment of the Agent process.
Impact Asses
...[truncated 523 chars]
- Remediation
View remediation
Remediation Suggestions
- Include the required implementation in the package and place it in a fixed, documented location.
- Resolve the script path relative to the trusted Skill installation directory rather than the current working directory:
python from pathlib import Path import subprocess skill_dir = Path(__file__).resolve().parent script = (skill_dir / "index.js").resolve() if not script.is_file() or script.parent != skill_dir: raise RuntimeError("Trusted index.js implementation is missing") result = subprocess.run( ["node", str(script), "--action", "read", "--token", token], capture_output=True, text=True, check=True, cwd=str(skill_dir), timeout=60, ) - Verify the packaged script's integrity using signed release artifacts or a trusted manifest containing cryptographic hashes.
- Do not search the current directory or other writable locations for missing executable components.
- Run the implementation with least privilege, a restricted environment, an explicit executable path, and network/file-system sandboxing where available.
- Fail closed when the expected script is missing or fails integrity validation.
