Back to skill

Security audit

PDF Watermark

Security checks for vulnerabilities and agentic risk

Overview

This PDF watermark skill does what it claims, but its URL-download workflow is under-scoped enough that users should review it before installing.

Install only if you are comfortable with the agent downloading PDFs from URLs on your behalf. Prefer local files or trusted HTTPS sources, avoid internal/private URLs, and use a private temporary directory with unique filenames when processing sensitive documents.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:52
Finding

Unrestricted Server-Side Retrieval of User-Controlled URLs

Content
View full analysis
" -o /tmp/temp_input.pdf python3 scripts/add_pdf_watermark.py /tmp/temp_input.pdf "<水印文字>" /tmp/output_watermarked.pdf ``` ### Technical Analysis The skill directs the agent to retrieve an arbitrary user-supplied URL using `curl -L`. It does not require validation of the URL scheme, hostname, resolved IP address, redirect targets, response size, content type, or file signature. Because redirects are followed automatically, validating only the initial URL would also be insufficient. An attacker-controlled public endpoint could redirect the request to a loopback, link-local, private-network, or cloud metadata address. Although the retrieved content is not executed as code, the request originates from the agent's environment and may therefore reach services unavailable to the requester. If an internal service returns a valid PDF, the skill can process that file and return its contents to the requester as a watermarked document. ### Attack Path 1. An attacker asks the agent to watermark a PDF at a crafted URL. 2. The URL directly targets an internal address or redirects to one. 3. Following the documented workflow, the agent invokes `curl -L`. 4. The request is issued from the agent's network context. 5. An internal or otherwise restricted resource responds. 6. If the response is a parseable PDF, the skill watermarks it and sends the resulting document to the attacker. 7. Even when the response is not a PDF, response behavior may permit internal service discovery or cause resource exhaustion. ### Impact Assessment A successful exploit can allow access to HTTP resources available from the agent's network environment, including loopback services, private-network applications, and potentially cloud metadata endpoints. The practic ...[truncated 334 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:57
Finding

Predictable Shared Temporary Files Permit Collisions and Symlink Attacks

Content
View full analysis
" -o /tmp/temp_input.pdf python3 scripts/add_pdf_watermark.py /tmp/temp_input.pdf "<水印文字>" /tmp/output_watermarked.pdf ``` A second documented workflow repeats the same pattern with predictable names: ```bash curl -L "http://example.com/doc.pdf" -o /tmp/doc.pdf python3 scripts/add_pdf_watermark.py /tmp/doc.pdf "<水印文字>" /tmp/doc_watermarked.pdf ``` ### Technical Analysis The documented workflow stores input and output documents at fixed, predictable paths in the shared `/tmp` directory. It does not create a private per-run directory, use exclusive file creation, check for symbolic links, set restrictive permissions, or clean up sensitive files after processing. On a multi-user or concurrent system, another local process can pre-create these paths, replace them with symbolic links, monitor them, or race the watermarking operation. Concurrent legitimate invocations can also overwrite or consume one another's input and output files. The output operation in `scripts/add_pdf_watermark.py` uses ordinary write mode: ```python with open(output_path, 'wb') as output_file: writer.write(output_file) ``` Consequently, an existing destination is truncated, and the script itself does not provide exclusive-creation or symlink protections. ### Attack Path 1. A local attacker predicts one of the documented paths, such as `/tmp/temp_input.pdf` or `/tmp/output_watermarked.pdf`. 2. The attacker pre-creates the path, creates a symbolic link at that path, or repeatedly replaces it during processing. 3. The agent follows the documented commands and writes the downloaded or generated document to that path. 4. The write collides with another job or follows the attacker-controlled filesystem object. 5. Depending on runtime permissions and platform protections, the attacker ...[truncated 781 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly instructs downloading a user-supplied URL with curl and then processing the fetched content, without any restrictions, validation, or warning about external network access. This creates SSRF-style risk, enables retrieval of untrusted content from internal or sensitive endpoints, and increases exposure to downstream parser exploits in the PDF-processing script.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file-level description and all CLI usage/output strings are written in Chinese, which effectively imposes a specific language on users of the skill. There is no indication that the tool is intended only for a Chinese-speaking environment, nor any option to select another language.

Content

No source excerpt is available for this finding.