Back to skill

Security audit

icp-exemption-skill

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly does what it claims, but it can silently install a system font package and has weak controls around sensitive document inputs.

Review before installing. The skill is not showing evidence of theft or destructive intent, but users should only run it in an isolated, unprivileged environment, confirm they truly want the PDF before providing account-linked details, and avoid crafted markup-like characters in inputs until the generator escapes and validates fields. The package-install fallback should be removed or moved to an explicit setup step.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_pdf.py:129
Finding

Unescaped User Input Is Parsed as ReportLab Paragraph Markup

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_pdf.py, lines 129-204
Vulnerability Type: ReportLab markup injection
Risk Level: Medium

Vulnerable Code

python
info_data = [
    [Paragraph("Team ID(团队 ID)", info_key_style),
     Paragraph(f":{team_id}", info_val_style)],
    [Paragraph("账户持有人法定姓名", info_key_style),
     Paragraph(f":{name}", info_val_style)],
]
python
app_data = [
    [Paragraph("App ID(应用 ID)", info_key_style),
     Paragraph(f":{app_id}", info_val_style)],
]
python
declarations = [
    f"本人 {name},Team ID 为 {team_id},现就 App ID 为 {app_id} 的独立应用,向 Apple 申请中国大陆地区 ICP 备案豁免例外批准。本人声明如下:",
]
python
sign_data = [
    [Paragraph("手写签名:", sign_label_style),
     Paragraph(sig_line, sign_val_style),
     Paragraph("", sign_val_style)],
    [Paragraph("正楷姓名:", sign_label_style),
     Paragraph(name, sign_val_style),
     Paragraph("", sign_val_style)],
    [Paragraph("日  期:", sign_label_style),
     Paragraph(date, sign_val_style),
     Paragraph("", sign_val_style)],
]

Technical Analysis

The command-line values team_id, name, app_id, and date are passed directly to ReportLab Paragraph objects. A Paragraph does not treat its input exclusively as plain text; it parses a ReportLab-supported XML-like markup language.

Because the values are not escaped, an attacker who can control one of these arguments can inject markup elements. This can alter formatting, insert misleading content, hide or restructure parts of the legal declaration, or cause PDF generation to fail. Depending on the installed ReportLab version and enabled resource handlers, resource-bearing markup such as image elements may also cause the process to resolve an attacker-selected URL or local resource.

The same input can be rendered in several sections of the document, increasing the scope of document manipulation. Input is also accepted ...[truncated 1390 chars]

Remediation
View remediation

Remediation Suggestions

Treat all command-line values as untrusted plain text before passing them to Paragraph.

  1. Escape XML-sensitive characters with xml.sax.saxutils.escape:

    python
    from xml.sax.saxutils import escape
    
    safe_team_id = escape(team_id)
    safe_name = escape(name)
    safe_app_id = escape(app_id)
    safe_date = escape(date)
    
  2. Use only the escaped variables in all Paragraph content.

  3. Validate inputs before PDF generation:

    • Restrict Team ID to its documented character set and length.
    • Restrict App ID to the expected numeric or identifier format.
    • Parse and normalize the date using an explicit date format.
    • Apply reasonable maximum lengths to every field.
    • Reject control characters and line breaks where they are not required.
  4. Do not attempt to sanitize markup with a tag blacklist. Encoding the complete value as plain text is safer.

  5. Add tests using values containing &, <, >, quotes, malformed tags, resource tags, and oversized input to confirm they are rendered literally or rejected.

T08 · Insecure Dependencies

Note
Location
scripts/generate_pdf.py:57
Finding

PDF Generation Silently Installs an Unpinned System Package at Runtime

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_pdf.py, lines 57-70
Vulnerability Type: Unsafe runtime dependency installation
Risk Level: Low

Vulnerable Code

python
# If no CJK font found, try installing wqy-zenhei
if font_name == "Helvetica":
    try:
        import subprocess
        subprocess.run(
            ["apt-get", "install", "-y", "-q", "fonts-wqy-zenhei"],
            capture_output=True, timeout=60
        )
        font_path = "/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc"
        if os.path.exists(font_path):
            pdfmetrics.registerFont(TTFont("WQYZenHei", font_path))
            font_name = "WQYZenHei"
            bold_font_name = "WQYZenHei"
    except Exception:
        pass

Technical Analysis

When no supported CJK font is found, routine PDF generation automatically invokes apt-get install. This modifies the host environment and installs a package and its transitive dependencies from the repositories configured on that host.

The package version and repository origin are not pinned or verified by the project. The behavior is not declared in the Skill instructions and is unrelated to the core runtime responsibility of formatting a PDF. Suppressing command output and ignoring exceptions also obscures installation failures and unexpected repository behavior.

The command uses a fixed argument array, so this is not shell command injection. The risk instead arises from implicit host modification, environmental dependency resolution, and the possibility that the script is run with elevated privileges.

Attack Path

  1. The script runs on a host where none of the listed CJK font files exists.
  2. The fallback condition is reached automatically.
  3. The script executes apt-get install -y -q fonts-wqy-zenhei.
  4. APT selects the package and dependencies from the host's configured repositories.
  5. If the process has sufficient privileges, ...[truncated 872 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove all package-manager invocation from the PDF-generation code.

  2. Install required fonts during a controlled build or deployment phase.

  3. Bundle a license-compatible, reviewed font with the application when redistribution terms permit it.

  4. Pin package versions and trusted repository sources in the deployment configuration or container image.

  5. Verify downloaded or bundled artifacts with checksums or signed package metadata.

  6. If no suitable font is available, fail safely with an explicit setup error instead of modifying the host:

    python
    if font_name == "Helvetica":
        raise RuntimeError(
            "No supported CJK font is installed. Install an approved font during deployment."
        )
    
  7. Run the PDF generator as a dedicated, unprivileged account without package-management permissions.

  8. Log dependency failures clearly rather than suppressing all exceptions.

Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill invokes a shell command to run a local Python script, but it does not declare any explicit tool scope or allowed-tools boundary. This weakens least-privilege controls and makes it easier for the skill to obtain or be granted broader execution capability than necessary, especially if later modified or composed with other agent behaviors.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description says to trigger immediately when users mention broad ICP-related topics, even if they are only asking for advice or discussing compliance generally. Over-broad invocation can cause unnecessary collection of sensitive account data such as Team ID, legal name, and App ID without sufficient user intent or need.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger examples cover common ICP, compliance, and appeal phrases without requiring a concrete request for file generation. In context, this increases the chance of accidental activation and unnecessary solicitation of personally identifying and account-linked information during normal support conversations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script description and generated content are entirely fixed in Chinese, including date formatting and document text, with no option for the user to select language or locale. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Attempting to install system fonts via apt-get is not justified by the skill's stated purpose of generating a PDF. This behavior introduces side effects beyond file generation, can alter the execution environment, and may be abused in privileged contexts to perform unauthorized system-level changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script installs a system package without warning, consent, or any explicit operator acknowledgement. Silent environment modification is risky in automation contexts because users expect PDF creation, not package management, and the action may succeed unexpectedly when the process has elevated permissions.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The script invokes apt-get to install a system package at runtime, which changes the host environment and may require elevated privileges. For a document-generation utility, performing package installation is unnecessary and expands the attack surface, especially if this skill runs in shared or sensitive agent infrastructure.

Content

Scanner excerpt · scripts/generate_pdf.py (reported line 61)May include surrounding context.

python
if font_name == "Helvetica":
        try:
            import subprocess
            subprocess.run(
                ["apt-get", "install", "-y", "-q", "fonts-wqy-zenhei"],
                capture_output=True, timeout=60
            )