Back to skill

Security audit

管理体系文件审核技能

Security checks for vulnerabilities and agentic risk

Overview

This Chinese document-audit skill reads user-provided management-system documents and writes a local Markdown report, with no hidden network, credential, persistence, or destructive behavior found.

Install only if a Chinese-language management-system audit/reporting workflow is what you want. Treat supplied documents as sensitive because their contents and analysis can be written into a local Markdown report; review generated reports carefully before sharing, especially when input came from untrusted parties that could inject misleading Markdown links, headings, or images.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_report.py:63
Finding

Unescaped User-Controlled Content Injection into Markdown Reports

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_report.py, lines 63-67
Vulnerability Type: Markdown content injection
Risk Level: Medium

Vulnerable Code

python
if files:
    report += "| 序号 | 文件编号 | 文件名称 | 版本 | 文件类型 | 关键要素 |\n"
    report += "|------|---------|---------|------|---------|--------|\n"
    for idx, f in enumerate(files, 1):
        report += f"| {idx} | {f.get('code', '-')} | {f.get('name', '-')} | {f.get('version', '-')} | {f.get('type', '-')} | {f.get('summary', '-')} |\n"
else:
    report += "*未提供文件清单*\n"

The same unsafe interpolation pattern also occurs in other report sections, including gap entries, risk entries, compliance clauses, suggestions, and conclusions.

Technical Analysis

Values parsed from the --files and --analysis JSON arguments are inserted directly into Markdown without contextual escaping or validation. Table delimiters, newline characters, headings, links, and image syntax are therefore interpreted as report markup rather than inert text.

For example, an attacker-controlled summary value could contain newline characters followed by a forged heading, deceptive audit conclusion, phishing link, or remote image. This content would become part of the generated report. If the Markdown viewer automatically retrieves remote images, opening the report could initiate a request to an attacker-controlled server.

This is a content-injection vulnerability rather than direct operating-system command execution. The script does not execute injected Markdown, but the resulting report can misrepresent audit findings or expose the report viewer to unsafe external content.

Attack Path

  1. An attacker supplies a document or metadata containing crafted Markdown syntax.
  2. The crafted value is preserved in a file-list or analysis JSON field such as summary, description, suggestion, or overall.
  3. generate_report.py parses the JSON and interpo ...[truncated 932 chars]
Remediation
View remediation

Remediation Suggestions

  1. Implement context-specific escaping before inserting untrusted values:
    • Escape pipe characters in table cells.
    • Replace embedded carriage returns and newlines with safe text or HTML line breaks.
    • Escape Markdown control characters used for headings, links, images, and emphasis.
  2. Create separate sanitization functions for table cells, headings, paragraphs, and list items rather than applying one generic transformation.
  3. Reject or neutralize remote image syntax and unsafe URI schemes. If links are permitted, allow only explicitly approved schemes such as https.
  4. Validate parsed JSON against a strict schema, including expected object types, field types, lengths, and nesting depth.
  5. Consider generating a structured intermediate representation and rendering it through a Markdown library configured to disable raw HTML and unsafe links.
  6. Add regression tests using payloads containing pipes, newlines, forged headings, raw HTML, links, and remote images.
  7. Apply the remediation consistently to every interpolated field in the file list, architecture analysis, responsibility analysis, process analysis, gaps, risks, compliance clauses, suggestions, and conclusions.
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared purpose is document analysis, but the behavior includes undeclared file writing and report-generation side effects. This mismatch is dangerous because users and policy systems may grant the skill broader trust than warranted, enabling unexpected filesystem modifications and possible leakage of analyzed content into generated artifacts or stdout.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill instructs the agent to generate a Markdown report via scripts/generate_report.py, which implies file-write capability, but it does not declare any permissions or allowed-tools scope. This creates a trust and containment gap: a reviewer or runtime may assume the skill is read-only, while it can cause persistent side effects by writing files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill says users can provide file paths and later triggers report generation, but it does not warn that those paths will be read or that a report file will be written. This weakens informed consent and increases the chance of unintended exposure of sensitive document contents through local file access and persistent report artifacts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire skill file is written in Chinese and does not indicate that language selection is optional or user-configurable. Under the natural-language policy rule, imposing a specific language without user opt-in can be a locale/language policy violation unless the constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python file contains natural-language strings indicating the report is generated in Chinese and all user-facing argument descriptions are Chinese-only. Under the language/locale policy rule, forcing a specific language without user opt-in is a policy concern unless the locale restriction is explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains natural-language content exclusively in Chinese, and there is no indication that the user can select another language or that the content is intentionally limited to a Chinese-speaking audience. Under the language/locale policy, forcing a specific language without user opt-in can be a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The entire skill reference is written in Chinese and does not indicate that users may choose another language or locale. Under the stated policy, a skill that effectively mandates a specific language without opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file is written entirely in Chinese, beginning with the title on L001, and does not indicate that the user can choose another language or that the content is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy rule for natural-language constraints, a forced locale without opt-in can be a language policy violation.

Content

No source excerpt is available for this finding.