Back to skill

Security audit

paper-architecture-diagram

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent paper-analysis purpose, but it uploads local files to Gemini and forces overwriting a local output file without strong path validation or overwrite safeguards.

Review this skill before installing. Use only trusted, simple paper_name values such as basenames without slashes or '..', expect the selected PDF to be uploaded to Gemini, and be aware that an existing analysis text file with the same name may be overwritten.

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
SKILL.md:5
Finding

Unsanitized Path Parameter Enables Directory Traversal, Unintended File Disclosure, and File Overwrite

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:5-6, 25, 79-81; parameter definition at config.yaml:9-12
Vulnerability Type: Path traversal caused by unsafe parameter interpolation
Risk Level: Medium

Vulnerable Code

SKILL.md:5-6:

markdown
- **Input file**: `/home/xie/桌面/papers/{{paper_name}}.pdf`
- **Output file**: `/home/xie/桌面/analysis/{{paper_name}}.txt`

SKILL.md:25:

markdown
Always use browser-file-upload to upload the file: `/home/xie/桌面/papers/{{paper_name}}.pdf`

SKILL.md:79-81:

markdown
- **Target path**: `/home/xie/桌面/analysis/{{paper_name}}.txt`
- **Write mode**: overwrite.

config.yaml:9-12:

yaml
  paper_name:
    type: string
    description: The paper filename without the .pdf or .txt suffix (for example: An_Evidential-Enhanced_Method)
    required: true

Technical Analysis

The required paper_name parameter is interpolated directly into local input and output paths. Its schema accepts an unrestricted string and does not prohibit path separators, .. components, absolute-path syntax, or other filesystem metacharacters. The workflow also explicitly instructs the agent to upload the resolved input file to an external Gemini service and overwrite the resolved output file.

A crafted value containing traversal components can therefore cause path resolution outside the intended papers or analysis directory. Appending fixed .pdf and .txt suffixes limits candidate filenames but does not prevent traversal to another file carrying the corresponding suffix.

Successful exploitation depends on the MCP tools accepting the resulting path and the service account having permission to read or write the targeted file.

Attack Path

  1. An attacker supplies a crafted paper_name, such as a value containing ../ path components.
  2. The skill concatenates that value into /home/xie/桌面/papers/{{paper_name}}.pdf without validation.
  3. The filesystem normalizes the traversal components, ...[truncated 971 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict paper_name to a filename basename using a strict allowlist, such as:

    regex
    ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$
    
  2. Explicitly reject:

    • / and \
    • .. path components
    • Absolute paths
    • NUL and control characters
    • Platform-specific drive or network-path prefixes
  3. Resolve each constructed path to its canonical form before use and verify containment under the expected canonical directory:

    • Input must remain under /home/xie/桌面/papers/.
    • Output must remain under /home/xie/桌面/analysis/.
  4. Verify that the input is a regular PDF file rather than a symbolic link, device, or other special file. Where supported, open it with protections equivalent to O_NOFOLLOW.

  5. Create output files safely:

    • Refuse symbolic-link targets.
    • Use least-privilege filesystem permissions.
    • Prefer atomic creation or replacement.
    • Require explicit confirmation before overwriting an existing file.
  6. Display the canonical input and output paths and obtain user confirmation before uploading data externally or overwriting a local file.

  7. Enforce validation in executable tooling or the MCP boundary rather than relying only on natural-language instructions in SKILL.md.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (1)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly instructs the agent to overwrite a local file at a fixed path using MCP, but it provides no safeguard against clobbering an existing file or warning the user that prior analysis output may be destroyed. Because the path is parameterized by paper name and the workflow treats writing as mandatory completion, the design increases the chance of unintended data loss during normal use.

Content

No source excerpt is available for this finding.