Back to skill

Security audit

Shadcn Ui

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent shadcn/ui implementation guide, with a normal but notable supply-chain caution around unpinned npm commands.

Before installing or using this skill, review any npm commands it suggests. Prefer pinning shadcn and other dependencies to reviewed versions, run generators in a normal project sandbox without production secrets, and inspect generated component diffs before committing.

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:39
Finding
Mutable and Unpinned npm Dependencies May Execute Unreviewed Code## Vulnerability Details **File Location**: `SKILL.md:39-56`, `SKILL.md:131`, `SKILL.md:324-325`, and `SKILL.md:558` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium **Vulnerable code snippets:** `SKILL.md:39-56`: ```bash # Initialize shadcn/ui in a Next.js project npx shadcn@latest init # Add individual components npx shadcn@latest add button npx shadcn@latest add card npx shadcn@latest add dialog npx shadcn@latest add form npx shadcn@latest add input npx shadcn@latest add select npx shadcn@latest add table npx shadcn@latest add toast npx shadcn@latest add dropdown-menu npx shadcn@latest add sheet npx shadcn@latest add tabs npx shadcn@latest add sidebar # Add multiple at once npx shadcn@latest add button card input label textarea select checkbox ``` `SKILL.md:131`: ```bash npx shadcn@latest add form input select textarea checkbox button ``` `SKILL.md:324-325`: ```bash npm install next-themes npx shadcn@latest add dropdown-menu ``` `SKILL.md:558`: ```bash npx shadcn@latest add sonner ``` ### Technical Analysis The Skill repeatedly recommends invoking `shadcn` through `npx` with the mutable `latest` distribution tag. This means the package version executed by a user or agent is selected at invocation time rather than being fixed to a version reviewed with this Skill. `npx` can download and execute npm package code immediately. npm package installation can also execute lifecycle scripts under the invoking user's account. Therefore, future changes to the resolved package, a compromised upstream release, or a package-registry account compromise could cause commands copied from this Skill to execute code that was never reviewed as part of the audited artifact. The unversioned `npm install next-themes` command similarly resolves a version dynamically unless the surrounding project imposes an effective lockfile constraint. No lockfile, integrity h ...[truncated 1784 chars]
Remediation
## Remediation Suggestions 1. Replace every `npx shadcn@latest` command with an exact, reviewed version, such as `npx shadcn@X.Y.Z`, after independently verifying the selected release. 2. Pin `next-themes` and other dependencies to exact audited versions rather than relying on floating version ranges. 3. Add and commit an npm lockfile containing resolved versions and integrity metadata. 4. In automated or reproducible environments, install dependencies with `npm ci` from the committed lockfile rather than resolving new versions dynamically. 5. Prefer installing reviewed tools as project-local development dependencies and invoking the locked local binary instead of allowing `npx` to retrieve an arbitrary current release. 6. Verify package provenance, publisher identity, release signatures or attestations where available, and registry integrity before updating pinned versions. 7. Review dependency changes and generated component diffs before committing or deploying them. 8. Run package installation and code-generation commands in a restricted environment without production credentials or unnecessary filesystem access. 9. Consider disabling lifecycle scripts during dependency review where operationally feasible, then explicitly enable only required and verified installation behavior.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (18)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger list includes broad terms such as `dialog`, `sheet`, `toast`, `theming`, `dark mode`, `component library`, and `data table`, which are not unique to shadcn/ui. In an agent-routing context, overly broad triggers can cause unintended invocation, leading the wrong skill to steer implementation choices or inject unsafe instructions into unrelated tasks.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The skill repeatedly instructs users to run `npx shadcn@latest ...`, which fetches and executes the latest publisher-controlled package version at runtime. In a skill context, this creates a supply-chain risk because future package updates or account compromise could cause arbitrary code execution on the developer machine when they follow the instructions.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
This command uses `npx shadcn@latest` rather than a pinned version, so it executes mutable third-party code directly from the registry. If the upstream package is compromised or a malicious release is published, users following the skill can unknowingly run attacker-controlled code.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
Invoking `npx shadcn@latest` for component generation executes whatever code is current in the npm registry at the time of use. Because the skill is instructional content, this broadens the blast radius by encouraging many users to run an unpinned remote package.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
Using `@latest` in executable package instructions is a genuine supply-chain weakness because the referenced code can change after the skill is published. That makes the skill non-reproducible and allows future malicious or vulnerable releases to be executed by users.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
This example instructs runtime execution of an unpinned npm package. In practical terms, a compromised maintainer account, dependency confusion, or malicious upstream release could turn a harmless setup step into local code execution on the operator's workstation.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The command is a true positive because it relies on mutable remote code (`@latest`) during execution. The danger is amplified by the skill format: users may copy-paste commands without independently validating what version will run.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
This line tells users to execute the latest shadcn package, which is a standard but insecure pattern for security-sensitive documentation. Because execution happens immediately, any upstream compromise can directly affect local development environments.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The package invocation is not version-pinned, so the skill delegates trust to a moving registry target. That is a real vulnerability pattern in documentation and agent skills because it can silently convert trusted instructions into arbitrary code execution paths later.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
This command is vulnerable for the same supply-chain reason: `npx ...@latest` executes code that may differ over time and has not been pinned or reviewed in the skill. In a developer tooling context, that can lead to system compromise, credential theft, or source tampering if the upstream package is malicious.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The risk here is not the specific component being added but the execution of an unpinned remote package. Since users are likely to trust setup snippets in a UI skill, this creates a realistic avenue for supply-chain exploitation.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
This is a true vulnerability because the instruction causes direct execution of mutable third-party code from npm. The skill context makes it more dangerous than a casual mention, since it is presented as authoritative implementation guidance for copy-paste use.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The example references `npx shadcn@latest`, which creates a live dependency on whatever code the registry serves at execution time. That is a legitimate supply-chain issue because the command can later execute different or malicious code without any change to the skill file itself.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
This line continues the pattern of unpinned executable package use. While likely not malicious, it is negligent from a supply-chain security perspective because it normalizes running mutable registry code in development environments.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The multi-component install command still executes `npx shadcn@latest`, so it has the same supply-chain exposure as the single-component examples. Because it may be copy-pasted as a convenience shortcut, it can encourage widespread execution of unreviewed current code.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
This installation example again relies on `npx shadcn@latest`, making the behavior non-deterministic and vulnerable to upstream compromise. In an agent skill, repeated unsafe examples reinforce insecure operator behavior and increase exposure.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
The theme setup section includes another unpinned executable dependency reference. Even though the topic is UI theming, the security risk remains local code execution through a mutable npm package, so the context does not materially reduce danger.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding
The `sonner` add command again uses `npx shadcn@latest`, preserving the same supply-chain weakness seen throughout the skill. Repetition increases the chance users will habitually execute unpinned code from the registry without review.

Static analysis

No suspicious patterns detected.