Back to skill

Security audit

File Compression

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward local PDF and image compression skill with normal dependency-installation risks and no evidence of hidden or destructive behavior.

Before installing, review and approve any pip, npm, brew, or sudo apt command, preferably inside an isolated environment. For stronger supply-chain safety, pin dependency versions and use lockfiles or hashes before processing sensitive documents.

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

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding
Unpinned and Unlocked Third-Party Dependencies Permit Non-Reproducible Installations<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1-2`, `package.json:7-9`, `SKILL.md:37-45`, and `SKILL.md:112-118` **Vulnerability Type**: Third-party supply-chain risk caused by permissive version constraints and missing integrity controls **Risk Level**: Medium ### Complete Code Snippets `requirements.txt:1-2`: ```text pikepdf>=8.15.0 pillow>=10.0.0 ``` `package.json:7-9`: ```json "dependencies": { "sharp": "^0.34.4" } ``` `SKILL.md:37-45`: ```bash python3 -m pip install -r {baseDir}/requirements.txt ``` ```bash cd {baseDir} npm install ``` `SKILL.md:112-118`: ```text 4. Python deps when needed: - `pip install pikepdf` - `pip install pillow` 5. Node deps when needed: - `npm install` ``` ### Technical Analysis The documented installation workflow retrieves and installs third-party packages while allowing dependency versions to change over time: - Python uses lower-bound-only constraints (`>=`) with no upper bounds or cryptographic hashes. - npm uses a compatible version range (`^`) rather than an exact version. - No `package-lock.json` or equivalent npm lockfile was present in the audited project. - Python requirements do not include package hashes suitable for use with `pip --require-hashes`. - The fallback instructions recommend completely unpinned `pip install` commands. As a result, two users running the same documented commands at different times may install different artifacts. Package installation and subsequent package imports can execute code supplied by those dependencies, including native build steps or npm lifecycle behavior where applicable. The reviewed dependency names—`pikepdf`, `pillow`, and `sharp`—do not appear to be typosquatted or intentionally disguised. No malicious dependency source, custom registry, or deliberate remote payload was identified. The finding is therefore a supply-chain hardening weakness rather than evidence that the current dependencies are malicious. ### Attack Path 1. ...[truncated 1527 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace permissive Python constraints with reviewed exact versions, for example: ```text pikepdf==<reviewed-version> pillow==<reviewed-version> ``` 2. Generate and verify hashes for every Python package and transitive dependency. Install with: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 3. Pin Sharp to an exact reviewed version rather than using a caret range: ```json "sharp": "0.34.4" ``` 4. Generate and commit `package-lock.json`, review changes to it, and use deterministic installation: ```bash npm ci ``` 5. Replace the unpinned fallback commands in `SKILL.md` with installation commands based on the locked manifests. Avoid recommending direct commands such as `pip install pillow` without an exact version and integrity verification. 6. Use trusted, explicitly configured package registries and enforce TLS. Where feasible, use an internal package mirror containing reviewed artifacts. 7. Run dependency installation as an unprivileged user in an isolated environment or container. Do not use `sudo pip`, elevated npm installation, or accounts with access to unrelated sensitive files. 8. Add automated dependency vulnerability and provenance checks to CI, and require manual review for lockfile or package-hash changes. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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
96% confidence
Finding
The code is consistent with part of the description: it compresses images, supports resizing and format conversion, uses a Python-first approach via Pillow, and includes a Node.js fallback. However, the declared purpose explicitly says the skill supports both PDF compression and image compression. In the provided code chunk, there is no PDF handling at all—only image formats jpg/jpeg/png/webp are accepted. That is a material description-to-behavior mismatch because an advertised core capability is absent from the actual code shown.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The code’s primary behavior is PDF-only compression using Ghostscript or pikepdf. That partially matches the description’s PDF-compression claim, but the declared description materially overstates capabilities by also claiming image compression and a Node.js fallback path. The code does not process images, invoke any Node.js toolchain, or provide non-PDF compression behavior. There are no suspicious undeclared capabilities beyond PDF compression and related file operations, but the declared purpose is broader than the actual implemented functionality in this chunk.

Chaining Abuse

High
Category
Tool Misuse
Content
Ghostscript install examples:

- macOS: `brew install ghostscript`
- Ubuntu/Debian: `sudo apt-get update && sudo apt-get install -y ghostscript`

Safety note:
Confidence
86% confidence
Finding
The chained command `sudo apt-get update && sudo apt-get install -y ghostscript` encourages multi-step privileged execution as a single action. Command chaining reduces review opportunities between steps and makes it easier for an agent or user to execute state-changing operations without validating intermediate results, increasing the blast radius of mistakes or malicious modification.

Ae1

High
Category
analysis-evasion
Content
PDF Node (`scripts/compress_pdf_node.mjs`):
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Image Node (`scripts/compress_image_node.mjs`):
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill clearly instructs the agent to run shell commands (`python3`, `node`, `gs`, `pip install`, `npm install`, and package-manager installs), yet it declares no explicit tool scope such as `permissions` or `allowed-tools`. In an agent environment, undeclared shell capability increases the chance of over-broad execution, unexpected command use, and weaker policy enforcement around package installation and file-system access.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Ghostscript install examples:

- macOS: `brew install ghostscript`
- Ubuntu/Debian: `sudo apt-get update && sudo apt-get install -y ghostscript`

Safety note:
Confidence
84% confidence
Finding
The skill includes a `sudo apt-get update && sudo apt-get install -y ghostscript` command, normalizing privileged package installation within agent workflow instructions. In agent-assisted environments, prompting or automating sudo use can lead to system-wide modification, privilege misuse, and higher-impact compromise if command parameters, package sources, or surrounding context are tampered with.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
f"-sOutputFile={output_pdf}",
        str(input_pdf),
    ]
    proc = subprocess.run(cmd, capture_output=True, text=True)
    if proc.returncode != 0:
        stderr = proc.stderr.strip() or proc.stdout.strip() or "unknown error"
        raise RuntimeError(f"Ghostscript failed: {stderr}")
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
f"-sOutputFile={output_pdf}",
        str(input_pdf),
    ]
    proc = subprocess.run(cmd, capture_output=True, text=True)
    if proc.returncode != 0:
        stderr = proc.stderr.strip() or proc.stdout.strip() or "unknown error"
        raise RuntimeError(f"Ghostscript failed: {stderr}")
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"description": "Node fallback utilities for file-compression skill",
  "type": "module",
  "dependencies": {
    "sharp": "^0.34.4"
  }
}
Confidence
94% confidence
Finding
The dependency uses a caret range (^0.34.4) instead of an exact pinned version, which weakens build reproducibility and can cause different installs to resolve to different patch releases over time. In a security-sensitive supply-chain context, this makes it harder to verify exactly which code is being installed and whether a vulnerable transitive artifact is present.

Unverifiable Dependency: sharp has 4 known advisory(ies) (GHSA-54xq-cgqr-rpm3 (sharp vulnerability in libwebp dependency CVE-2023-4863); GHSA-f88m-g3jw-g9cj (sharp inherited vulnerabilities in libvips: CVE-2026-33327, CVE-2026-33328, CVE-); CVE-2022-29256 (sharp vulnerable to Command Injection in post-installation over build environmen) +1 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
84% confidence
Finding
The manifest references sharp without an exact version pin, while sharp has had multiple advisories including issues in bundled/native dependencies and past installation-time risks. Because the version is not pinned, consumers cannot verify from this file whether the deployed package is a fixed or affected release, increasing supply-chain uncertainty for a skill that processes untrusted user files.

Unpinned Dependencies

Low
Category
Supply Chain
Content
pikepdf>=8.15.0
pillow>=10.0.0
Confidence
96% confidence
Finding
The dependency is specified with a lower bound only, so future installs may resolve to different versions over time. This weakens reproducibility and can allow unexpectedly vulnerable or breaking releases to be pulled into the environment through normal dependency resolution or supply-chain compromise.

Unverifiable Dependency: pikepdf has 2 known advisory(ies) (CVE-2021-29421 (Improper Restriction of XML External Entity Reference in pikepdf); CVE-2021-29421 (models/metadata.py in the pikepdf package 1.3.0 through 2.9.2 for Python allows )), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
88% confidence
Finding
pikepdf has known historical advisories, and because the manifest does not pin an exact version, there is no assurance that deployments will avoid affected releases. Since this skill processes PDFs, dependency security matters more because malformed documents are attacker-controlled inputs and can exercise vulnerable parsing paths.

Unpinned Dependencies

Low
Category
Supply Chain
Content
pikepdf>=8.15.0
pillow>=10.0.0
Confidence
97% confidence
Finding
Using an unpinned Pillow version means installations are not deterministic and may consume a newly published version with undiscovered issues or incompatible behavior. In a file-processing skill that handles untrusted images, dependency drift increases supply-chain and runtime risk.

Unverifiable Dependency: pillow has 16 known advisory(ies) (CVE-2016-2533 (Pillow buffer overflow in ImagingPcdDecode); CVE-2023-50447 (Arbitrary Code Execution in Pillow); CVE-2021-27922 (Pillow Uncontrolled Resource Consumption) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
93% confidence
Finding
Pillow has multiple known advisories, including issues relevant to parsing untrusted image files, and the unpinned requirement makes it impossible to verify that only fixed versions will be installed. In a compression skill that directly handles attacker-supplied images, this raises the chance of denial of service or worse if a vulnerable build is resolved.

Static analysis

No suspicious patterns detected.