registry  /  peaks-loop  /  3.0.3

peaks-loop@3.0.3

Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration

AI Security Review

scanned 1d ago · by lpm-firewall-ai

The package mutates AI-agent control surfaces during npm postinstall. It installs bundled skills, output styles, and agent prompts into multiple home-directory IDE/agent locations without an explicit user command.

Static reason
High-risk behavior combination matched malicious policy.; previous stored version diff introduced dangerous source
Trigger
npm install lifecycle postinstall
Impact
Future AI-agent sessions may load package-supplied instructions, roles, output styles, and agent prompts from user home directories.
Mechanism
unconsented AI-agent skill/agent prompt installation
Attack narrative
On installation, npm runs scripts/install-skills.mjs. The script fans out across AI IDE profiles and writes or symlinks package-controlled skills, output styles, and agent prompts into home-directory agent loader paths, plus user config. Those artifacts can influence later AI-agent behavior outside the package invocation context.
Rationale
Although many capabilities are package-aligned for an AI workflow CLI, installing AI-agent control files at lifecycle time is an unconsented control-surface mutation. No exfiltration was found, but the postinstall behavior is sufficient to block under the firewall policy. Product guard normalized a concrete AI-agent control hijack publish_block to the blockable dangerous-capability shape.
Evidence
package.jsonscripts/install-skills.mjsagents/karpathy-reviewer.mdskills/peaks-solo/SKILL.mdoutput-styles/peaks-skill-swarm.mdskills/*/SKILL.md~/.claude/skills~/.claude/output-styles~/.claude/agents~/.codex/skills~/.codex/output-styles~/.cursor/skills~/.trae/skills~/.peaks/config.json

Decision evidence

public snapshot
AI called this Malicious at 94.0% confidence as Dangerous Capability with low false-positive risk.
Evidence for block
  • package.json defines postinstall: node ./scripts/install-skills.mjs
  • scripts/install-skills.mjs postinstall symlinks bundled skills into ~/.claude, ~/.codex, ~/.cursor, ~/.trae, ~/.qoder, etc.
  • scripts/install-skills.mjs copies agents/*.md into AI-agent loader dirs such as ~/.claude/agents
  • scripts/install-skills.mjs writes ~/.peaks/config.json and may auto-run peaks upgrade for detected 1.x projects
  • agents/karpathy-reviewer.md is an agent prompt with Bash tool permission and review-gate instructions
  • skills/peaks-solo/SKILL.md contains extensive autonomous workflow/control instructions for AI agents
Evidence against
  • Installer uses managed markers and symlink/path validation to avoid overwriting unmanaged files
  • No credential harvesting or external exfiltration endpoint found in inspected lifecycle code
  • Runtime child_process/npx usage is tied to explicit CLI commands like playwright start or upgrade
Behavioral surface
Source
ChildProcessCryptoDynamicRequireEnvironmentVarsFilesystemShell
Supply chain
HighEntropyStringsUrlStrings
ManifestNo manifest risk signals triggered.
scanned 445 file(s), 2.90 MB of source, external domains: api.anthropic.com, api.example.com, api.openai.com, github.com, gitlab.com, reactbits.dev, www.google.com, www.pulsemcp.com

Source & flagged code

7 flagged · loading source
package.jsonView file
scripts.postinstall = node ./scripts/install-skills.mjs
High
Install Time Lifecycle Scripts

Package defines install-time lifecycle scripts.

package.jsonView on unpkg
dist/src/shared/process.jsView file
1import { execFile } from 'node:child_process'; L2: export async function execCommand(command, args, options) {
High
Child Process

Package source references child process execution.

dist/src/shared/process.jsView on unpkg · L1
dist/src/services/upgrade/upgrade-service.jsView file
151// npm install postinstall creates `peaks` → `peaks.sh` on L152: // Windows). cmd.exe (the default Windows shell) cannot run L153: // `.sh` scripts directly, so the shim fails with "unknown
High
Shell

Package source references shell execution.

dist/src/services/upgrade/upgrade-service.jsView on unpkg · L151
dist/src/cli/commands/loop-eval-commands.jsView file
478// eslint-disable-next-line @typescript-eslint/no-var-requires L479: const fs = require('node:fs'); L480: let entries;
Medium
Dynamic Require

Package source references dynamic require/import behavior.

dist/src/cli/commands/loop-eval-commands.jsView on unpkg · L478
scripts/install-skills.mjsView file
1Install-time AI-agent control hijack evidence: L1: #!/usr/bin/env node L2: import { closeSync, constants, existsSync, fchmodSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readlinkSync, realpathSync, readdirSync, renameSync, symlinkSync, un... L3: import { spawnSync } from 'node:child_process'; ... L291: fchmodSync(fd, 0o600); L292: writeFileSync(fd, content, 'utf8'); L293: const writeFd = fd; ... L320: fchmodSync(fd, 0o600); L321: writeFileSync(fd, content, 'utf8'); L322: const writeFd = fd; ... L372: * cannot import the TS service at runtime. The dispatch: L373: * - Look for `.claude`, `.trae`, `.codex`, `.cursor`, `.qoder`, L374: * `.tongyi-lingma` in the project root in that insertion order Payload evidence from schemas/mcp-install-spec.schema.json: L1: { L2: "$schema": "https://json-schema.org/draft/2020-12/schema", L3: "title": "Peaks MCP Install Spec", ... L25: "items": { "type": "string" }, L26: "description": "Required env var names. Values are sourced from process.env at runtime and written as ${VAR} placeholders into settings.json." L27: }
Critical
Ai Agent Control Hijack

Install-time source drops package-supplied AI-agent/MCP control files or instructions.

scripts/install-skills.mjsView on unpkg · L1
dist/src/cli/commands/playwright-commands.jsView file
27* The CLI does NOT bundle `playwright-mcp`; it shells out to L28: * `npx playwright-mcp@latest` (G22 / NG3). peaks-loop is the lifecycle L29: * orchestrator, not the install medium. ... L31: import { createHash } from 'node:crypto'; L32: import { spawn } from 'node:child_process'; L33: import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, unlinkSync } from 'node:fs';
High
Runtime Package Install

Package source invokes a package manager install command at runtime.

dist/src/cli/commands/playwright-commands.jsView on unpkg · L27
dist/src/cli/commands/session-auto-compact-hook-command.jsView file
matchType = previous_version_dangerous_delta matchedPackage = peaks-loop@3.0.2 matchedIdentity = npm:cGVha3MtbG9vcA:3.0.2 similarity = 0.975 summary = stored previous version shares package body but lacks this dangerous source file
Critical
Previous Version Dangerous Delta

This package version adds a dangerous source file absent from the previous stored version; route for source-aware review.

dist/src/cli/commands/session-auto-compact-hook-command.jsView on unpkg

Findings

2 Critical4 High3 Medium5 Low
CriticalAi Agent Control Hijackscripts/install-skills.mjs
CriticalPrevious Version Dangerous Deltadist/src/cli/commands/session-auto-compact-hook-command.js
HighInstall Time Lifecycle Scriptspackage.json
HighChild Processdist/src/shared/process.js
HighShelldist/src/services/upgrade/upgrade-service.js
HighRuntime Package Installdist/src/cli/commands/playwright-commands.js
MediumDynamic Requiredist/src/cli/commands/loop-eval-commands.js
MediumEnvironment Vars
MediumStructural Risk Force Deep Review
LowNon Install Lifecycle Scripts
LowScripts Present
LowFilesystem
LowHigh Entropy Strings
LowUrl Strings