Back to skill

Security audit

磁盘空间盘点与清理建议

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real disk-cleanup reporter, but it includes under-disclosed deletion tooling and unsafe copy-paste cleanup commands that could delete or expose local files if used carelessly.

Install only if you are comfortable with a local disk scanner that records detailed file-path reports and presents destructive commands. Do not run the bundled cleaner.py or copied rm/Remove-Item/sudo commands unless you have reviewed the exact target paths, and treat generated reports as sensitive local inventories.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/scanner.py:685
Finding

Stored JavaScript Injection in Generated HTML Reports

Content
View full analysis
const reportData = {{REPORT_DATA}}; const shell = reportData.shell_type || 'bash'; ``` ### Technical Analysis The report contains filesystem-derived values, including file names, directory paths, usernames, hostnames, and artifact paths. These values are serialized with `json.dumps()` and inserted directly into an HTML `` terminates an HTML script element even when the sequence appears inside a valid JavaScript string. Consequently, an attacker-controlled file or directory name such as the following can escape the report's script block: ```text ``` The report is automatically opened by `scanner.py`, making exploitation possible immediately after scanning: ```python webbrowser.open(f"file://{report_path}") ``` Escaping values later with `escHtml()` does not prevent this vulnerability because execution occurs while the browser initiall ...[truncated 1722 chars]
Remediation
View remediation
{{REPORT_DATA}} ``` 3. Before embedding the serialized JSON, escape HTML-significant characters: ```python report_json = json.dumps(all_data, ensure_ascii=False) report_json = ( report_json .replace("&", "\\u0026") .replace("<", "\\u003c") .replace(">", "\\u003e") .replace("\u2028", "\\u2028") .replace("\u2029", "\\u2029") ) ``` 4. Parse the non-executable data explicitly: ```javascript const reportData = JSON.parse( document.getElementById('report-data').textContent ); ``` 5. Add a restrictive Content Security Policy that prohibits network access and unauthorized script execution. For a self-contained report, consider: ```html ``` Prefer moving JavaScript to a separately packaged local file so that `unsafe-inline` is not required for scripts. 6. Add regression tests using file names containing ``, HTML tags, quotes, backticks, Unicode separators, and multiline content. 7. Avoid automatically opening the report until report generation and validation complete successfully. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/scanner.py:298
Finding

Shell Command Injection Through Crafted File and Directory Names

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cleaner.py:74
Finding

Unrestricted Permanent and JSON-Driven File Deletion

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (29)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documentation repeatedly claims the skill 'never auto-deletes' and is cross-platform, but the packaged contents explicitly include a cleaner script and destructive deletion commands. This kind of description-behavior mismatch is dangerous because users and orchestration systems may trust the safe-sounding description while invoking functionality that can remove files or behave differently than promised.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

Providing a direct 'rm -rf' deletion pattern as a recommended command is a high-risk design choice because small path mistakes, variable substitution issues, or quoting changes can cause irreversible deletion of unintended files. The danger is amplified here because the skill markets itself as safe and advisory, which may lower user caution around executing the generated command.

Content

Scanner excerpt · SKILL.md (reported line 147)May include surrounding context.

md
mv "/path/to/cache" ~/.Trash/

# 彻底删除(不可恢复)
rm -rf "/path/to/cache"

# 清空废纸篓
rm -rf ~/.Trash/*

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

The command to recursively delete all trash contents is destructive and broad in scope, and users may run it without verifying what is currently staged there. Because the skill is meant to help under storage pressure, users are more likely to act quickly, making irreversible mistakes more probable.

Content

Scanner excerpt · SKILL.md (reported line 150)May include surrounding context.

rm -rf "/path/to/cache"

清空废纸篓

rm -rf ~/.Trash/*

text

---

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

The command to recursively delete all trash contents is destructive and broad in scope, and users may run it without verifying what is currently staged there. Because the skill is meant to help under storage pressure, users are more likely to act quickly, making irreversible mistakes more probable.

Content

Scanner excerpt · SKILL.md (reported line 150)May include surrounding context.

rm -rf "/path/to/cache"

清空废纸篓

rm -rf ~/.Trash/*

text

---

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script implements irreversible deletion through os.remove and shutil.rmtree, which directly contradicts the skill metadata claim that it 'NEVER auto-deletes' and only outputs copy-paste commands. In an AI-agent skill context, this mismatch is dangerous because downstream components or users may trust the manifest and invoke functionality that actually destroys data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

clean_all_green reads a JSON file and automatically performs cleanup actions on every listed path instead of merely generating commands for user review. In the context of a storage-analysis skill advertised as non-destructive, bulk action on externally supplied scan results can lead to unintended mass deletion or recycling of user data.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises executable behavior that relies on shell access, file reads, and report generation, yet the manifest declares no explicit tool scope or permissions boundaries. That mismatch increases the chance an agent runtime grants broader capabilities than users expect, especially for a skill that emits destructive cleanup commands and includes a cleaner component.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The docs say the skill only generates reports and copy-paste commands, yet the file list includes a 'cleaner.py' capable of deletions. Hidden or downplayed destructive functionality undermines informed consent and makes it easier for an agent or user to invoke deletion logic they did not expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Broad everyday trigger phrases such as low-disk or cleanup requests can cause the skill to activate in contexts where the user only wanted advice, not filesystem scanning or deletion command generation. In a storage-cleaning skill, over-triggering is more dangerous because the resulting workflow centers on destructive shell commands and potentially sensitive filesystem enumeration.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Allowing fuzzy matching without clear boundaries makes unintended invocation more likely, especially for common phrases about storage pressure. Because this skill can inspect user directories and recommend dangerous commands, ambiguous activation materially raises the risk of privacy exposure and accidental destructive guidance.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring explicitly states that the component 'Executes clean operations,' which conflicts with the skill description claiming no automatic deletion. This discrepancy increases the risk of unsafe deployment because operators, users, or orchestrators may rely on misleading metadata while the code is in fact destructive.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Multiple returned and printed messages are hard-coded in Chinese, and the CLI does not provide any language selection or explain that the tool is intentionally locale-specific. This can violate language/locale policy when users are not given an opt-in choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The permanent delete path allows destructive file and directory removal without any built-in confirmation, warning, or secondary approval step. In an agent-driven or UI-triggered workflow, a mistaken path selection or prompt injection into surrounding components could cause immediate irreversible data loss.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code uses Chinese-only user-facing labels and descriptions in output strings, indicating the skill is designed to present results in a specific language without any visible user opt-in or locale selection. The same pattern continues throughout the file, making the language constraint an embedded policy choice rather than a configurable preference.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest describes a cross-platform disk storage analyzer focused on filesystem space usage and cleanup suggestions. Calling the external Docker CLI adds a separate container-runtime inspection capability that is not mentioned in the stated purpose, even though it remains read-only here.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/scanner.py (reported line 552)May include surrounding context.

python
def scan_docker():
    """Check Docker disk usage if Docker is installed."""
    try:
        result = subprocess.run(
            ["docker", "system", "df", "--format", "json"],
            capture_output=True, text=True, timeout=15
        )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The tool writes a detailed JSON and HTML report containing host name, user name, disk layout, large file paths, old file paths, development artifact paths, and Docker usage to disk without an explicit warning or consent at the write point. In a disk-cleaning skill, collecting this information is contextually relevant, but persisting it increases privacy risk because the report becomes a durable inventory of sensitive local environment details.

Content

No source excerpt is available for this finding.

Tainted flow: 'json_path' from os.environ.get (line 836, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/scanner.py (reported line 677)May include surrounding context.

python
json_path = os.path.splitext(report_path)[0] + ".json"

    # Write JSON
    with open(json_path, "w", encoding="utf-8") as jf:
        json.dump(all_data, jf, ensure_ascii=False, indent=2)

    # Read template

Tainted flow: 'report_path' from os.environ.get (line 836, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/scanner.py (reported line 697)May include surrounding context.

python
json_rel = os.path.relpath(json_path, reports_dir)
    html_content = html_content.replace("{{REPORT_JSON_PATH}}", json_rel)

    with open(report_path, "w", encoding="utf-8") as f:
        f.write(html_content)

    return report_path, json_path

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The HTML document explicitly sets lang="zh-CN", which imposes a specific language/locale on all rendered content. The file does not offer any user opt-in, locale selection, or documented reason that this template must be China-specific.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
78% confidence
Finding

The template encourages users to copy and run privileged shell commands (sudo tmutil deletelocalsnapshots /) from the generated report. In this skill's context, the report is explicitly designed to produce copy-paste cleanup commands and even suggests asking the agent to execute them, which raises the risk that users run destructive privileged commands without sufficient validation of scope or safety.

Content

Scanner excerpt · templates/report_template.html (reported line 470)May include surrounding context.

html
} else if (sys === 'Darwin') {
            tips = [
                {title:'系统自带存储管理',desc:'Apple 菜单 → 系统设置 → 通用 → 存储空间 → 查看建议'},
                {title:'清理 Time Machine 本地快照',desc:'<code>sudo tmutil deletelocalsnapshots /</code> 可清理本地快照'},
                {title:'清理 Xcode 缓存',desc:'定期清理 <code>~/Library/Developer/Xcode/DerivedData</code>'},
                {title:'管理 iOS 备份',desc:'Finder → 位置 → 管理备份,删除旧设备备份'},
                {title:'清理 Homebrew 缓存',desc:'<code>brew cleanup -s</code> 清理旧版本和缓存'},

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

The report includes privileged package-cache cleanup commands such as sudo apt clean and sudo dnf clean all. Although these are common admin operations, embedding them in a cleanup report that promotes copy-paste execution increases the chance of users blindly running root commands produced by the skill or delegated through the agent.

Content

Scanner excerpt · templates/report_template.html (reported line 478)May include surrounding context.

html
];
        } else {
            tips = [
                {title:'清理包管理器缓存',desc:'<code>sudo apt clean</code> (Debian) 或 <code>sudo dnf clean all</code> (Fedora)'},
                {title:'删除旧内核',desc:'<code>dpkg --list | grep linux-image</code> 查看并清理旧内核'},
                {title:'清理日志文件',desc:'<code>sudo journalctl --vacuum-size=200M</code> 限制日志大小'},
                {title:'清理 Snap 旧版本',desc:'<code>sudo snap list --all | grep disabled</code> 然后清理旧版本'},

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
77% confidence
Finding

The template recommends sudo journalctl --vacuum-size=200M, a privileged system-level log-retention action. In isolation it is legitimate, but in this product context the HTML report is meant to drive operational cleanup actions, so offering root commands as convenient copy targets can lead to unintended evidence/log loss or unsafe execution by non-expert users.

Content

Scanner excerpt · templates/report_template.html (reported line 480)May include surrounding context.

html
tips = [
                {title:'清理包管理器缓存',desc:'<code>sudo apt clean</code> (Debian) 或 <code>sudo dnf clean all</code> (Fedora)'},
                {title:'删除旧内核',desc:'<code>dpkg --list | grep linux-image</code> 查看并清理旧内核'},
                {title:'清理日志文件',desc:'<code>sudo journalctl --vacuum-size=200M</code> 限制日志大小'},
                {title:'清理 Snap 旧版本',desc:'<code>sudo snap list --all | grep disabled</code> 然后清理旧版本'},
                {title:'使用 ncdu 分析',desc:'<code>ncdu ~</code> 交互式查看磁盘占用'},
                {title:'清理 Docker 占用',desc:'<code>docker system prune -a</code> 清理无用镜像/容器/卷'},

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
82% confidence
Finding

The report suggests sudo snap list --all | grep disabled as part of a cleanup workflow involving privileged package management. Even though the shown snippet is only enumerative, it conditions users to execute sudo commands from the report; given the skill's emphasis on copy-paste shell actions and possible agent-assisted execution, this meaningfully increases operational risk.

Content

Scanner excerpt · templates/report_template.html (reported line 481)May include surrounding context.

html
{title:'清理包管理器缓存',desc:'<code>sudo apt clean</code> (Debian) 或 <code>sudo dnf clean all</code> (Fedora)'},
                {title:'删除旧内核',desc:'<code>dpkg --list | grep linux-image</code> 查看并清理旧内核'},
                {title:'清理日志文件',desc:'<code>sudo journalctl --vacuum-size=200M</code> 限制日志大小'},
                {title:'清理 Snap 旧版本',desc:'<code>sudo snap list --all | grep disabled</code> 然后清理旧版本'},
                {title:'使用 ncdu 分析',desc:'<code>ncdu ~</code> 交互式查看磁盘占用'},
                {title:'清理 Docker 占用',desc:'<code>docker system prune -a</code> 清理无用镜像/容器/卷'},
            ];

Static analysis

No suspicious patterns detected.