Back to skill

Security audit

Codemod

Security checks for vulnerabilities and agentic risk

Overview

This is a legitimate codemod helper, but it asks agents to run broad, unpinned Codemod CLI commands that may fetch executable code at runtime.

Review this skill before installing in sensitive repositories. Prefer a trusted, locally installed or pinned Codemod CLI, run codemods in a constrained workspace, inspect dry-run output, and avoid exposing unnecessary credentials while using it.

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

Unpinned Codemod Package Retrieval and Execution

Content
View full analysis

Vulnerability Details

File Locations:

  • SKILL.md:4-6
  • SKILL.md:30-34
  • commands/codemod.md:9-13
  • commands/codemod.md:22

Vulnerability Type: T08: Insecure Dependencies
Risk Level: Medium

Vulnerable Code

SKILL.md:4-6:

yaml
allowed-tools:
  - Bash(codemod *)
  - Bash(npx codemod *)

SKILL.md:30-34:

markdown
- Dump AST shape: `echo 'const x = 23;' | npx codemod ai dump-ast --`
- Dump AST for a file: `npx codemod ai dump-ast src/App.tsx`
- Inspect node types for a language: `npx codemod ai node-types tsx`
- List docs resources: `npx codemod ai docs`
- Read/search docs: `npx codemod ai docs codemod-creation-workflow`

commands/codemod.md:9-13:

markdown
- Codemod AI tools are available through CLI commands even when MCP is not configured. Use `npx codemod ai docs`, `npx codemod ai dump-ast`, `npx codemod ai node-types`, `npx codemod ai tools`, `npx codemod ai call`, `npx codemod ai resources`, and `npx codemod ai resource` as the user-reproducible fallback or default path.
- For codemod authoring, read `codemod-creation-workflow-instructions` first via MCP or `npx codemod ai docs codemod-creation-workflow`. Before writing source-transform code, read `jssg-gotchas` and `ast-grep-gotchas` via MCP or CLI docs commands. Read `codemod-cli-instructions` only when exact command syntax is needed.
- If registry search shows no exact package, run `codemod init` immediately. In headless/non-interactive flows, use `codemod init <path> --no-interactive` and pass only flags that come from the user or task; do not invent author, license, description, or git repository metadata.
- Before stopping work on a codemod package, call `validate_codemod_package` via MCP or run `npx codemod ai call validate_codemod_package --input '{"package_path":"."}'`.
- If the authoring request uses Node/LLRT APIs, capability-gated modules, or non-trivial multi-file JSSG work, also read 
...[truncated 2745 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require a trusted, preinstalled Codemod CLI and invoke it with npx --no-install codemod or directly through a verified local binary.
  2. Pin Codemod to an exact audited version rather than allowing implicit resolution of the current registry version.
  3. Record the dependency and integrity metadata in a committed lockfile, and require immutable or frozen-lockfile installation.
  4. Restrict package retrieval to an explicitly trusted registry and prevent repository or environment configuration from silently redirecting resolution.
  5. Prefer reviewed MCP integrations where available instead of dynamically downloading a CLI package.
  6. Narrow Bash(npx codemod *) to the minimum reviewed commands and arguments required by the Skill.
  7. Pin and review registry codemod packages before running them, even when the CLI itself is trusted.
  8. Run codemods in a sandbox with minimal filesystem access, no unnecessary credentials, and restricted network access.
  9. Preserve the existing dry-run and verification requirements, but do not treat them as protection against malicious package initialization or command execution.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (22)

Rp1

Medium
Category
MCP Rug Pull
Confidence
97% confidence
Finding

The manifest explicitly permits Bash(npx codemod *), authorizing arbitrary subcommands of an unpinned package fetched from the registry at execution time. This is the most important instance because it creates a broad capability for remote code execution through supply-chain compromise, and the skill context makes actual execution likely during migrations and refactors.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding

The skill allows execution of npx codemod * without pinning a package version, so the agent may fetch and run whatever package version is current at execution time. Because this skill is specifically designed to execute code-transform and AI helper commands from the network, a compromised upstream package, malicious publish, or breaking release could lead to arbitrary code execution in the agent environment.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

This command example invokes npx codemod ai dump-ast without a version pin, which causes runtime resolution of the latest published package. In a skill that encourages direct CLI execution, that creates a supply-chain execution path where unreviewed code may run during normal use.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The file-level AST dump example uses unpinned npx codemod, so execution depends on mutable registry state at run time. Since npx may download and execute package code immediately, this exposes the environment to malicious or unexpected upstream releases.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

Using npx codemod ai node-types tsx without a version pin still executes package code resolved from the registry at run time. Although the immediate action is informational, the attack surface remains package execution, not just data retrieval.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The docs-listing command relies on unpinned npx codemod, allowing mutable package contents to be executed merely to read documentation. Even read-only workflows become code-execution paths when backed by unpinned remote packages.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

Reading docs via npx codemod ai docs ... without a fixed version executes whichever package release is fetched at the time. In automation or agent contexts, that can silently change behavior and introduce arbitrary code execution through an upstream compromise.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The npx codemod ai docs ast-grep-gotchas reference is likewise unpinned and may execute arbitrary code from the latest package release. Repetition of this pattern throughout the skill increases the likelihood that operators will normalize unsafe package execution.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The validation command uses unpinned npx codemod ai call ..., which is particularly risky because it is framed as a quality gate before stopping. An attacker controlling the fetched package could abuse that trusted validation step to execute arbitrary code in a repository context.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The runtime capabilities docs command uses unpinned npx codemod, preserving the same registry-based execution risk. Even though this appears to retrieve guidance, the underlying mechanism still executes package code from a mutable source.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The monorepo instructions example uses npx codemod without version pinning, exposing users to supply-chain compromise during routine maintenance tasks. In monorepo environments, successful exploitation could affect many packages at once.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The CLI instructions example remains unpinned, allowing package behavior to drift over time and enabling malicious releases to execute during normal guidance lookup. This undermines reproducibility as well as security.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The troubleshooting command executes an unpinned remote package, which is risky because users may invoke it when systems are already in an abnormal state and less closely monitored. A malicious package could exploit that trust to deepen compromise or alter repositories.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The import-helper docs example still uses bare npx codemod, preserving the same arbitrary-code-execution risk from mutable registry state. The frequency of these examples makes accidental unsafe usage very likely.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The sharding docs example is another unpinned npx invocation that may download and execute unreviewed package code. In an agent skill, such repeated instructions meaningfully increase exploitability because they guide actual runtime behavior rather than merely documenting possibilities.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The guidance to run codemod init immediately after a registry miss, combined with the manifest allowance for npx codemod *, means package scaffolding may occur through an unpinned executable. Since this action creates files and scripts in the repository, a malicious upstream package could seed unsafe content across the project.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

This line discourages rewriting package manager conventions to npx/npm, but it still references npx in a way the static rule correctly flags as an unpinned executable pattern. In context, it is descriptive rather than a direct instruction to execute a command, so the practical exploitability of this specific occurrence is low compared with executable examples.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file defines activation behavior, so SQP-1 applies. The instruction to treat "any text passed with /codemod as a codemod task" is broad and lacks constraints or negative examples, which could cause unintended invocation for casual or ambiguous uses of /codemod.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

This duplicate finding captures the same supply-chain exposure on line 10. In a tool intended to modify codebases, executing an attacker-controlled package could tamper with source, secrets, CI config, or local developer environments.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Line 11 again instructs npx codemod ... for reading documentation/workflow instructions without a version pin. Even 'docs' or metadata-oriented commands still require executing the package, so an upstream compromise would still yield arbitrary code execution before any benign subcommand behavior occurs.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The codemod init guidance on line 13 relies on the same unpinned npx codemod execution model. Since initialization commands often create files and project structure, a malicious package version could plant backdoors, scripts, or misleading metadata into the generated workspace.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

This duplicate finding corresponds to the second unpinned npx codemod occurrence on line 24. The repeated pattern shows the unsafe invocation style is systemic throughout the skill rather than an isolated typo, which increases operational exposure.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.