Back to skill

Security audit

文件下载服务器

Security checks for vulnerabilities and agentic risk

Overview

This skill does file sharing as advertised, but it can publicly expose files and open firewall ports by default without strong safeguards.

Install only if you are comfortable with a temporary unauthenticated public file server. Use it only on a tightly controlled directory containing non-sensitive files, prefer binding to 127.0.0.1 unless public access is explicitly needed, avoid automatic firewall opening, remove any firewall rules after use, stop daemon processes promptly, and do not use generated pages with untrusted filenames or descriptions.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/start_server.py:17
Finding

Unauthenticated directory server listens on all network interfaces

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/open_port.py:13
Finding

Unrestricted firewall ACCEPT rules are inserted without lifecycle cleanup

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_index.py:139
Finding

Generated download page permits stored HTML and script injection

Content
View full analysis
{args.description}' if args.description else '' content = f'''

文件名:{filename}

大小:{file_size}

上传时间:{upload_time}

⬇️ 点击下载文件 ''' ``` For directories, every filename is likewise inserted without HTML escaping or URL encoding: ```python elif os.path.isdir(args.path): # 目录 description_html = f'

{args.description}

' if args.description else '' # 列出目录中的文件 file_items = [] for item in sorted(os.listdir(args.path)): item_path = os.path.join(args.path, item) if os.path.isfile(item_path) and not item.startswith('.') and item != 'index.html': size = get_file_size(item_path) file_items.append(f'''
{item} ({size})
''') ``` The title and previously constructed fragments are then written into the final document: ```python # 生成 HTML html = HTML_TEMPLATE.format( title=args.title, description_html=description_html, content=content ) # 写入文件 with open(output_path, 'w', encoding='utf-8') as f: f.write(html) ``` ### Technical Analysis The page generator in ...[truncated 2271 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims it can start an HTTP download server, open firewall ports, and provide downloadable links, but the finding indicates the actual implementation does not perform those actions and may only generate static HTML. This mismatch is dangerous because users or downstream agents may rely on nonexistent protections or behaviors, causing accidental data exposure, broken workflows, or unsafe manual workarounds.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill is explicitly designed to expose local files over HTTP and open firewall ports, but the description does not foreground the privacy and external-network risks at the point of invocation. In this context, that omission is significant because users may unintentionally publish sensitive directories or make a host reachable from untrusted networks.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents shell commands and Python scripts that read files, write HTML output, and manipulate network exposure, but it declares no explicit tool scope or permissions boundary. In an agent setting, missing scope makes it easier for the skill to be invoked with broader-than-expected capabilities, increasing the chance of unsafe file access or shell execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad enough to match common requests about downloading or sending files, which can cause the skill to activate in contexts where the user did not intend to expose files over HTTP. In this skill's context, unintended activation is more dangerous because the documented behavior includes network exposure and firewall changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The quickstart explicitly instructs users to bind an HTTP file server to 0.0.0.0 and open the firewall with iptables, which exposes files to any reachable host without authentication, encryption, or scope warnings. In the context of a file-sharing skill, this is functional behavior, but the lack of clear cautions about public exposure, sensitive files, and network reachability makes accidental data disclosure reasonably likely.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code includes user-facing natural-language content that is fixed to Chinese, beginning with the module description and continuing throughout CLI help and generated HTML. The policy allows locale constraints only when they are opt-in or clearly justified, and this file does neither.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generated HTML displays fixed Chinese UI text such as the service status label, and similar hard-coded Chinese strings appear elsewhere in the page template. Because the file does not offer localization or an explicit justification for a Chinese-only experience, this is a language-policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The docstring, CLI description, argument help, and user-facing output are written only in Chinese, which imposes a specific language on all users. The file does not offer any language selection or explain that the skill is intended only for a Chinese-speaking or region-specific context.

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/open_port.py (reported line 23)May include surrounding context.

python
success_count = 0
    for port in args.ports:
        try:
            result = subprocess.run(
                ["iptables", "-I", "INPUT", "-p", "tcp", "--dport", str(port), "-j", "ACCEPT"],
                capture_output=True,
                text=True

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code presents its description, CLI help text, and user-facing messages exclusively in Chinese. Under the policy rule, forcing a specific language without offering user choice or documenting a justified locale restriction is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill goes beyond starting a temporary download server and modifies host firewall policy, which requires elevated privileges and changes the system's security posture. In this context, the danger is increased because the server also defaults to binding on 0.0.0.0, so opening the port can expose shared files to the entire reachable network or internet.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

This subprocess call inserts an iptables rule opening the chosen TCP port on the host firewall. Although the command is passed as an argument list rather than a shell string, it still performs a privileged security-sensitive action that broadens network exposure and can unintentionally make the file server reachable from untrusted networks.

Content

Scanner excerpt · scripts/start_server.py (reported line 39)May include surrounding context.

python
# 尝试开放防火墙端口
    try:
        result = subprocess.run(
            ["iptables", "-I", "INPUT", "-p", "tcp", "--dport", str(args.port), "-j", "ACCEPT"],
            capture_output=True,
            text=True

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/start_server.py (reported line 67)May include surrounding context.

python
if args.daemon:
        print("\n🚀 后台启动服务器...")
        # 后台运行
        process = subprocess.Popen(
            cmd,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,

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/start_server.py (reported line 81)May include surrounding context.

python
print("\n🚀 前台启动服务器(按 Ctrl+C 停止)...")
        print("")
        try:
            subprocess.run(cmd)
        except KeyboardInterrupt:
            print("\n\n👋 服务器已停止")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

Natural-language content throughout the file forces a specific language locale for all users without offering an alternative or documenting that the skill is intentionally region- or language-specific. This can violate organizational language-choice policy when users are not given an opt-in or fallback.

Content

No source excerpt is available for this finding.