Back to skill

Security audit

Bundlephobia Analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a normal bundle-size helper, but it tells agents to run an npm packaging command that can execute project-controlled scripts without warning or safeguards.

Review before installing or using this skill on untrusted repositories. If used, require `npm pack --dry-run --json --ignore-scripts` or run the check in a disposable sandbox with no sensitive credentials, and be aware that the referenced helper files are absent from this artifact.

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

Error
Location
SKILL.md:18
Finding

Untrusted npm Lifecycle Scripts May Execute During Package-Size Analysis

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 18 and 57
Vulnerability Type: Unsafe execution of package lifecycle scripts
Risk Level: High

Vulnerable Code

markdown
- Local package publishing footprint: run `npm pack --dry-run --json`.
markdown
- `pack --repo <path>`: Run `npm pack --json --dry-run` and report packed tarball, unpacked size, file count, and largest included files.

Technical Analysis

The skill directs the agent to execute npm pack --dry-run against a user-supplied repository. Despite the --dry-run option, npm packaging can invoke package lifecycle scripts, including repository-controlled prepack, prepare, and postpack commands.

Consequently, the packaging measurement crosses from passive file inspection into execution of code supplied by the repository being audited. No instruction requires --ignore-scripts, explicit user confirmation, isolation, restricted credentials, network controls, or a sandbox. An attacker can therefore place an arbitrary shell command in a lifecycle script and wait for the package-size workflow to invoke it.

The absent referenced helper script cannot be evaluated to determine whether it adds mitigations. The documented direct command itself remains unsafe when used on an untrusted repository.

Attack Path

  1. An attacker prepares or modifies a repository containing a package.json.
  2. The attacker adds a malicious lifecycle entry, such as a prepack or prepare script.
  3. A user asks the agent to audit the repository's npm publishing footprint or run the broad package-size audit.
  4. Following SKILL.md, the agent runs npm pack --json --dry-run in that repository.
  5. npm invokes the attacker-controlled lifecycle script.
  6. The script executes with the operating-system privileges and environment available to the agent process.

Impact Assessment

Successful exploitation permits arbitrary command e ...[truncated 719 chars]

Remediation
View remediation

Remediation Suggestions

  1. Disable lifecycle scripts for package inspection:

    sh
    npm pack --dry-run --json --ignore-scripts
    
  2. Ensure the referenced helper always passes --ignore-scripts; do not rely solely on documentation or caller behavior.

  3. Treat repositories being audited as untrusted input and run npm operations inside an isolated sandbox or disposable container.

  4. Restrict the sandbox to the target repository, use a read-only filesystem where practical, and deny access to host credentials and unrelated files.

  5. Disable outbound network access unless it is essential to the requested analysis.

  6. Remove npm, cloud, source-control, and SSH credentials from the command environment.

  7. If lifecycle execution is explicitly required for an accurate package measurement, disclose that project code will run and obtain user confirmation before proceeding.

  8. Consider implementing a passive packaging-footprint estimator based on npm inclusion rules and filesystem metadata when executing npm is unnecessary.

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