T07 · Tool Hijacking and Spoofing
- Location
run.py:12- Finding
Unverified External Executable Controls the Skill's Effective Behavior
- Content
View full analysis
Vulnerability Details
File Location:
run.py, lines 12–17
Vulnerability Type: Untrusted external tool execution
Risk Level: MediumVulnerable Code
python p = subprocess.run( ["/usr/local/bin/tg_search", query, limit], capture_output=True, text=True )Technical Analysis
The skill delegates all substantive Telegram search behavior to
/usr/local/bin/tg_search, an executable located outside the reviewed project. The package does not bundle this executable, verify its cryptographic digest, validate its ownership or permissions, or otherwise confirm that it implements the documented behavior.Using an absolute path and passing arguments as an array prevents shell expansion and ordinary
PATH-based executable substitution. However, these protections do not address replacement or modification of the executable itself. If another deployment component or a sufficiently privileged attacker modifies/usr/local/bin/tg_search, subsequent skill invocations will execute the replacement under the skill runner's identity.The external executable also operates in an environment described as having access to an already-authorized Telethon session. Its actual use of that session cannot be validated from this package.
Attack Path
- An attacker obtains permission to create or modify
/usr/local/bin/tg_search, such as through a compromised deployment process, insecure file permissions, or privileged access. - The attacker replaces the expected executable with malicious code while retaining the same path and command-line interface.
- A user or agent invokes
run.pywith a Telegram search query. run.pyexecutes the attacker-controlled binary and supplies the query and limit.- The replacement executable runs with the privileges and environment of the skill runner and may access any Telegram credentials or session resources available to that process.
- Becaus ...[truncated 848 chars]
- An attacker obtains permission to create or modify
- Remediation
View remediation
Remediation Suggestions
- Bundle the Telegram search implementation with the skill so that its complete behavior can be reviewed and versioned.
- If an external executable is required, pin an approved version and verify its cryptographic digest before execution.
- Verify that the executable and all parent directories are owned by a trusted administrative account and are not writable by the skill runner or other unprivileged users.
- Execute the tool under a dedicated, least-privileged operating-system account.
- Use a narrowly scoped Telegram account that does not have access to private chats, administrative functions, or unrelated resources.
- Restrict the subprocess's environment, filesystem access, and network access through sandboxing or containerization.
- Log the verified executable version and digest for each invocation to support integrity monitoring.
- Treat subprocess output as untrusted data even after JSON parsing, and validate it against the documented output schema.
