T01 · Skill Instruction Hijacking
- Location
scripts/clone.py:153- Finding
Untrusted Clone Packages Can Replace Agent Identity and Operational Instructions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill has a coherent clone/export purpose, but importing a package can overwrite agent files, write outside the intended workspace, and auto-install package-selected skills without enough user control.
Only import packages from sources you fully trust, and review their identity, config, memory, and skill lists before use. This version should be treated as Review-worthy because a package can change future agent behavior, install additional skills, and potentially write unintended files under the importer user's permissions.
scripts/clone.py:153Untrusted Clone Packages Can Replace Agent Identity and Operational Instructions
scripts/clone.py:180Clone Packages Can Inject Persistent Attacker-Controlled Memory
scripts/clone.py:153Package-Controlled Filenames Allow Arbitrary File Writes Through Path Traversal
scripts/clone.py:132Untrusted Packages Can Trigger Installation of Attacker-Selected Skills
The trigger phrases include very generic terms like "export," "import," and especially "clone," which can overlap with normal user conversation and cause the skill to activate unintentionally. In this skill, accidental activation is more dangerous than usual because the skill can export sensitive agent configuration or import and apply external configuration, potentially leading to configuration tampering or unintended disclosure.
The skill explicitly states that it will "Auto-install missing skills" during import, but it does not present a strong warning that imported packages may introduce untrusted code, unsafe prompts, or malicious skill behavior. In context, this makes the issue more dangerous because the skill is designed to clone agent configuration from externally provided packages, creating a direct path for supply-chain style compromise through imported skills.
The export logic advertises filtered configuration export, but it also includes raw contents of identity, config, and optionally memory files with no sensitive-data scrubbing. Those files may contain secrets, personal data, prompts, or operational details, so users may share the generated package under a false assumption that sensitive content was sanitized.
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
"""备份现有文件"""
if filepath.exists():
backup_path = filepath.with_suffix(filepath.suffix + '.bak')
shutil.copy2(filepath, backup_path)
return str(backup_path)
return None
The import routine writes attacker-supplied content to filenames taken directly from the package's identity, config, and memory dictionaries, with no allowlist or path normalization. An attacker can supply keys like '../../.bashrc' or absolute paths to overwrite arbitrary files accessible to the process, causing configuration corruption, persistence, or code execution.
def write_file(filepath, content):
"""写入文件"""
filepath.parent.mkdir(parents=True, exist_ok=True)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
def install_skill(slug):
The import path executes external installation commands as part of processing untrusted package data, and does so without a prior explicit warning or confirmation. In this context, automatic execution materially increases risk because clone packages are intended to be shared, making supply-chain abuse straightforward.
The import path installs skills from package-supplied slugs by invoking an external command without validating provenance, prompting the user, or restricting allowed identifiers. A crafted clone package can therefore trigger installation of untrusted or malicious skills, leading to arbitrary code execution in the broader skill installation pipeline.
"""安装skill"""
import subprocess
try:
result = subprocess.run(
['skillhub', 'install', slug],
capture_output=True,
text=True,
Importing package content silently overwrites workspace files after only creating backups, with no preview, confirmation, or trust check. A malicious or mistaken package can replace agent identity and configuration files, altering behavior, sabotaging operation, or planting harmful instructions for later use.
The optional memory import restores MEMORY.md directly from the package when a package-controlled flag is set, without clearly warning about personal-data replacement or behavioral effects. This can inject misleading memory/state, overwrite user data, or seed later prompt-manipulation through persisted memory content.
The top-level natural-language description is presented only in Chinese, indicating a language-specific skill experience without any opt-in or alternative locale. The policy requires flagging language or locale constraints when the skill forces a specific language without user choice or documented justification.
No suspicious patterns detected.