T07 · Tool Hijacking and Spoofing
- Location
scripts/summarize.py:265- Finding
PATH-Resolved External Tool Receives Feishu Credentials and the Full Process Environment
- Content
View full analysis
Vulnerability Details
File Location:
scripts/summarize.py, lines 265-269 and 293-297
Vulnerability Type: PATH-based executable hijacking and excessive environment disclosure
Risk Level: MediumVulnerable Code
python result = subprocess.run( ["feishu-docs", "create", title, "--auth", "tenant"], capture_output=True, text=True, timeout=30, env={**os.environ, "FEISHU_APP_ID": APP_ID, "FEISHU_APP_SECRET": APP_SECRET} )python update_result = subprocess.run( ["feishu-docs", "update", doc_id, "--auth", "tenant", "--body", tmp_md], capture_output=True, text=True, timeout=60, env={**os.environ, "FEISHU_APP_ID": APP_ID, "FEISHU_APP_SECRET": APP_SECRET} )Technical Analysis
The code invokes
feishu-docsby name rather than through a verified absolute path. The operating system therefore resolves the executable using the invoking process'sPATH. If an attacker can place a malicious executable namedfeishu-docsearlier in that search path, the malicious program will run with the privileges of the user executing the Skill.Both invocations explicitly pass a copy of the entire process environment to the external executable. This includes
FEISHU_APP_ID,FEISHU_APP_SECRET, and any unrelated credentials or tokens inherited by the Python process. During the update invocation, the external process also receives the path to the temporary file containing the complete chat transcript.Although using an external Feishu document client is consistent with the declared document-creation feature, resolving an unpinned executable through
PATHand exposing the entire environment exceed the minimum privileges required for that operation.Attack Path
- An attacker obtains the ability to write to a directory that appears before the legitimate client in the victim's
PATH. - The attacker creates a malicious executable named
feishu-docsin that directory.
...[truncated 1259 chars]
- An attacker obtains the ability to write to a directory that appears before the legitimate client in the victim's
- Remediation
View remediation
Remediation Suggestions
- Resolve the expected executable once from a trusted installation location and invoke it through an absolute path.
- Pin the supported
feishu-docsversion and document installation from an authenticated official source. - Where feasible, verify the executable's ownership, permissions, and cryptographic digest before execution.
- Replace the inherited environment with a minimal allowlist. Pass only variables strictly required by the client, such as the Feishu credentials and a controlled runtime
PATH. - Avoid passing unrelated environment variables to child processes.
- Prefer direct use of the official Feishu document API from the existing Python process, removing the additional executable trust boundary.
- Run the Skill under a dedicated, minimally privileged account and use narrowly scoped Feishu application permissions.
- Store application secrets in a dedicated secret manager where available and rotate them if an untrusted
feishu-docsexecutable may have run.
