Back to skill

Security audit

AI Code Verification Guard

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent verification purpose, but it automatically runs repository-controlled test and lint commands in the user's environment without enough containment or confirmation.

Install only if you are comfortable with the agent automatically running project test/lint/typecheck commands. Use extra caution on newly cloned, third-party, or untrusted repositories, because package scripts can run arbitrary code with your local account's access. Prefer reviewing the exact commands first or running this in a sandboxed workspace without sensitive credentials.

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
scripts/verify.mjs:30
Finding

Automatic Execution of Attacker-Controlled Repository Commands

Content
View full analysis

Vulnerability Details

File Location: scripts/verify.mjs:30-32, with supporting execution flow at scripts/verify.mjs:83-87, scripts/verify.mjs:139-190, and scripts/verify.mjs:250-253; mandatory invocation is defined in SKILL.md:27-39
Vulnerability Type: Command injection and unsafe execution of untrusted project scripts
Risk Level: High

Relevant Code

Mandatory automatic invocation:

markdown
1. BEFORE changing code (any change touching logic, interfaces, or tests), run in the project root:

node /scripts/verify.mjs snapshot

text

2. BEFORE reporting completion to the user, run in the project root:

node /scripts/verify.mjs run

text

Shell execution sink:

javascript
function runCmd(cmd) {
  try {
    const out = execSync(cmd, { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 600000, maxBuffer: 64 * 1024 * 1024 });
    return { status: 'pass', output: out };

Repository-controlled script loading and classification:

javascript
if (has('package.json')) {
  let pkg = {};
  try { pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')); } catch { notes.push('package.json 解析失败'); }
  const scripts = pkg.scripts || {};
javascript
for (const [key, cmd] of Object.entries(scripts)) {
  if (key === 'test') continue;
  if (/(^|[:._-])only$/.test(key.toLowerCase())) {
    notes.push(`脚本 "${key}" 疑似部分执行脚本(-only 后缀),依赖手动前置步骤,跳过`);
    continue;
  }
  const cat = classify(key, String(cmd));
  if (cat && !isUnsafe(key, String(cmd))) candidates.push({ key, cat, cmd: String(cmd) });
}

const hasComposite = candidates.some((c) => c.key === 'check');
const queued = new Set();
for (const c of candidates) {
  if (hasComposite && c.key !== 'check' && /^check($|:)/.test(c.key.toLowerCase())) continue;
  if (queued.has(c.cmd)) continue;
  queued.add(c.cmd);
  const dup = checks.filter((x) => x.name === c.cat).length;
  checks.push({ name: dup > 0 ? `$
...[truncated 3771 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require informed confirmation for repository code execution

    • Display the exact checks and command bodies that will run.
    • Require explicit user approval before executing scripts from a newly opened or otherwise untrusted repository.
    • Do not treat the general request to modify code as implicit authorization to execute arbitrary repository-defined commands.
  2. Use process APIs without shell interpretation

    • Replace shell command strings with spawnSync() or execFileSync() using an executable and argument array.
    • Set shell: false.
    • For NPM scripts, pass the script name as a discrete argument, such as spawnSync("npm", ["run", "--", key], options).
    • Validate script keys against a conservative allowlist even when argument-based process execution is used.
  3. Do not infer command safety from substring classification

    • Treat classification only as discovery.
    • Parse and reject command chaining, command substitution, redirection, shell pipelines, and unrelated secondary commands.
    • Prefer known checker binaries invoked directly with fixed arguments rather than running arbitrary package scripts.
  4. Sandbox verification

    • Run repository checks in an isolated container or restricted worker.
    • Mount only the target repository, preferably with read-only access except for an explicitly designated output directory.
    • Remove unrelated credentials and environment variables.
    • Disable network access unless a specific check requires it and the user approves it.
    • Apply CPU, memory, process, and execution-time limits.
  5. Use a review-first workflow

    • List detected checks and report that they are untrusted until reviewed.
    • Allow the user to approve checks individually.
    • Preserve UNVERIFIED as the outcome when safe execution cannot be guaranteed rather than automatically running repository-controlled commands.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (7)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 19)May include surrounding context.

md
The arbiter is `scripts/verify.mjs`, shipped with this skill — `<skill-path>` below means this skill's install directory. The agent only invokes the script and

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 70)May include surrounding context.

md
The arbiter is `scripts/verify.mjs`, shipped with this skill — `<skill-path>` below means this skill's install directory. The agent only invokes the script and

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill advertises very broad trigger phrases such as 'verify this', 'run the tests', 'fix bugs', and 'confirm it works', which are common in normal coding conversations and can cause unintended activation. In context, that can make an agent invoke repository-defined verification commands or the bundled verifier in situations the user did not explicitly intend, increasing the chance of surprise command execution and workflow manipulation.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

md
- If the script fails or the project structure is unrecognized, quote UNVERIFIED as-is; never pass off verbal inspection as verification.
- Baselines are written to `.verification/` in the project root; suggest the user add it to `.gitignore`.
- Docs-only, comment-only, or formatting-only changes may skip verification, but the skip reason must be stated to the user.
- Without a baseline, `run` still executes every check — just without regression comparison. Never retroactively fabricate a baseline.

---

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language comments and operational output entirely in Chinese, including usage, verdict text, and remediation guidance. The file does not indicate that language selection is optional or region-specific, which can violate a language/locale policy requiring user choice or opt-in.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script's emitted verdicts, notes, and operator instructions are presented in Chinese only, such as scope descriptions and disposition guidance. Because these are user-visible runtime strings and no language choice is offered, this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/verify.mjs:32