T09 · Insecure Skill Coding Practices
- Location
scripts/archive_reader.py:190- Finding
Unsafe TAR Extraction Allows Writes Outside the Destination Directory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This archive utility has a coherent purpose, but it gives the agent risky extraction, dependency installation, helper-executable discovery, and usage-memory behavior that need review before installation.
Review this skill carefully before installing. Use it only on trusted archives or in a disposable workspace, avoid RAR handling unless the helper executable path is explicitly trusted, and do not allow automatic pip installs or persistent learning unless you accept those environment and privacy side effects.
scripts/archive_reader.py:190Unsafe TAR Extraction Allows Writes Outside the Destination Directory
scripts/archive_reader.py:49RAR Helper Discovery Can Execute Attacker-Planted Binaries
SKILL.md:177Unpinned Runtime Package Installation Creates Supply-Chain Risk
scripts/archive_reader.py:145Archive Preview Fully Decompresses Entries Before Applying the Size Limit
该技能的核心用途总体上仍然是压缩包读取与解压,和声明的大方向一致,因此不存在完全不同的主用途。但描述中包含多项未兑现或明显夸大的能力:最明显的是 7z 支持只在 SUPPORTED 文本映射中声明,list/peek/extract 实际都没有 7z 分支;搜索功能完全不存在;图片显示也不存在;自动学习只定义了 load/save 函数和学习文件路径,但没有任何命令调用这些函数,不会在每次使用时学习。另一个次要差异是 RAR 并非真正“直接读取”,预览和解压依赖本地外部 unrar/7z 工具,并主动扫描多个本地路径查找这些工具。基于这些描述与行为的实质性不一致,应判定为 mismatch。
The listed trigger words include broad phrases like “解压”, “压缩包”, and “查看压缩包”, which can match many ordinary user requests without clearly delimiting when this specific skill should activate. The manifest provides no exclusion conditions or narrower context, increasing the risk of unintended invocation.
The skill explicitly states it will remember usage habits and improve over time, implying cross-session persistence of user behavior. This is dangerous because it normalizes retention of potentially sensitive operational data in a utility whose expected function does not require profiling, increasing privacy and data-leak risks.
The self-improvement system introduces persistent profiling and adaptive behavior beyond the narrowly expected archive-reading scope. This is dangerous because it stores usage patterns and preferences across sessions, changes future behavior without clear review, and increases privacy and predictability risks for a tool that users would reasonably expect to be stateless.
The skill persistently records activity in a local learning-memory file without a prominent upfront warning in the main description. This is dangerous because users may provide sensitive archive paths, filenames, and behavioral data without informed consent, especially given the skill's broad triggers and archive-focused context where confidential files are common.
The documentation describes automatic logging of every use and learned patterns into a persistent local file. This is dangerous because archive operations often involve sensitive filenames, project names, or confidential materials, and routine persistence creates unnecessary data accumulation that could later be exposed or misused.
The learning schema stores error details including lastPath, which can reveal sensitive filesystem structure, usernames, project names, or confidential file locations. This is dangerous because path data is often more sensitive than expected and can be harvested from a supposedly benign utility's memory file.
Recording user preferences and operation history goes beyond what is necessary for archive inspection and introduces behavioral profiling. This is dangerous because such profiling can reveal work patterns and priorities over time, and it changes the trust model of a simple file utility into a stateful monitor.
Automatically installing dependencies at runtime expands the skill's behavior from archive handling into arbitrary system modification and code retrieval from package repositories. This is dangerous because it can execute unreviewed third-party install scripts, alter the host environment without explicit approval, and create a supply-chain risk surface unrelated to the user's immediate request.
The skill omits a clear warning that it may automatically install dependencies on the user's system. This is dangerous because users invoking a document/archive reader do not reasonably expect software installation or environment changes, and the lack of notice defeats informed consent for a high-risk side effect.
The workflow instructs that each operation should be recorded into learned memory, making persistence part of the normal execution path rather than an exceptional feature. This is dangerous because it guarantees accumulation of potentially sensitive archive-access metadata across sessions without necessity for the core function.
This code presents its primary description and multiple CLI messages entirely in Chinese, with no indication that users can choose another language or locale. That creates a natural-language locale constraint that is not documented as region-specific or offered as an opt-in choice.
The manifest description explicitly states support for reading 7z archives, and the SUPPORTED map also lists '.7z', but the actual dispatch logic in list_archive, peek_file, extract_all, and extract_file contains no 7z implementation. In practice, 7z inputs fall through as unsupported, so the documented capability does not match actual behavior.
The extraction routine calls zipfile.extractall, rarfile.extractall, and tarfile.extractall on untrusted archives without validating member paths. This enables path traversal and unsafe extraction behaviors, allowing archive entries containing absolute paths, '..' segments, or links to write outside the intended directory and potentially overwrite sensitive files.
This JSON manifest-like file indicates automatic tool detection via toolAutoDetected: true without clarifying when detection should or should not occur. In a manifest/plain-data context, that is an ambiguous activation condition because it does not define boundaries, exclusions, or negative examples for the behavior.
The module docstring says the script supports '学习记忆管理', and the manifest says it '自动学习改进', but the runtime paths only define load_learning/save_learning helpers and never call them. This creates an intent/documentation divergence because the documented self-improving behavior is not actually carried out by the code.
Single-file extraction writes attacker-controlled archive content to an arbitrary caller-supplied output_path with no safety policy, confirmation, or path restrictions. While less severe than bulk traversal in extract_all because the target path is explicit, it still enables accidental overwrite of sensitive files and, in an agent context, could be abused to place malicious files in impactful locations.