AI Security Review
scanned 7h ago · by lpm-firewall-aiThe package runs a postinstall script that mutates broad user/home AI-agent control surfaces. It installs GraphFlow skill/rule/instruction files and registers MCP configuration for detected agents.
Static reason
High-risk behavior combination matched malicious policy.
Trigger
npm install, especially global install or first/version-changed install
Impact
Can plant package-supplied instructions/MCP registrations into existing agent environments without an explicit CLI opt-in.
Mechanism
unconsented lifecycle AI-agent control-surface mutation
Attack narrative
On npm postinstall, safe-postinstall.cjs detects installed AI tools and copies package-supplied skills/rules into their user/home control directories, writes a home version marker, and shells into an MCP installer that registers GraphFlow using an npx strategy. Under the firewall policy this lifecycle-triggered mutation of foreign/broad agent surfaces is blockable even if the content is product-aligned.
Rationale
Source inspection confirms package.json lifecycle execution and install-time writes/registration into Trae, Cursor, Claude/MCP-style agent surfaces outside the package namespace. This matches the policy’s unconsented lifecycle AI-agent control hijack category rather than a noisy scanner-only finding.
Evidence
package.jsonscripts/safe-postinstall.cjsdist/integrations/agent-mcp-installer.jsdist/surfaces/trae-skill/graphflow/SKILL.mddist/surfaces/cursor-rules/graphflow.mdcCLAUDE.md~/.graphflow-install-version~/.config/Trae/User/skills/graphflow/SKILL.md~/.config/Trae CN/User/skills/graphflow/SKILL.md~/.cursor/rules/graphflow.mdc%APPDATA%/Cursor/User/rules/graphflow.mdcCLAUDE.md agent instruction targets via installer
Decision evidence
public snapshotAI called this Malicious at 94.0% confidence as Dangerous Capability with low false-positive risk.
Evidence for block
- package.json defines postinstall: node scripts/safe-postinstall.cjs.
- scripts/safe-postinstall.cjs writes ~/.graphflow-install-version and copies package files into home AI-agent locations.
- postinstall invokes dist/integrations/agent-mcp-installer.js with strategy npx via spawnSync.
- scripts/safe-postinstall.cjs targets Trae skills, Cursor rules, and CLAUDE.md agent control surfaces.
Evidence against
- Postinstall checks version/global/install markers and existing app directories before many writes.
- No direct credential harvesting found in inspected lifecycle script.
- Network behavior observed is npx MCP registration command construction, not direct exfiltration.
Behavioral surface
ChildProcessCryptoDynamicRequireEnvironmentVarsFilesystemNetworkShell
HighEntropyStringsUrlStrings
Source & flagged code
4 flagged · loading sourcepackage.jsonView file
•scripts.postinstall = node scripts/safe-postinstall.cjs
High
Install Time Lifecycle Scripts
Package defines install-time lifecycle scripts.
package.jsonView on unpkgdist/core/dag-checkpoint.jsView file
18exports.computeDagId = computeDagId;
L19: const logger_1 = require("../utils/logger");
L20: const hash_1 = require("../utils/hash");
Medium
Dynamic Require
Package source references dynamic require/import behavior.
dist/core/dag-checkpoint.jsView on unpkg · L18scripts/safe-postinstall.cjsView file
1Install-time AI-agent control hijack evidence:
L1: #!/usr/bin/env node
L2: const { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync, unlinkSync } = require("node:fs");
L3: const { join } = require("node:path");
...
L34: try {
L35: writeFileSync(VERSION_FILE, version, "utf8");
L36: } catch {
...
L130:
L131: mkdirSync(skillDestDir, { recursive: true });
L132: copyFileSync(sk[redacted], skillDestFile);
L133:
...
L217: /**
L218: * 获取 CLAUDE.md 源文件路径
Payload evidence from dist/integrations/agent-mcp-installer.js:
L16: exports.formatModelConfigGuide = formatModelConfigGuide;
L17: const node_child_process_1 = require("node:child_process");
L18: const node_fs_1 = require("node:fs");
...
L21: function isWindows() {
L22: return process.platform === "win32";
L23: }
...
L54: try {
L55: const output = (0, node_child_process_1.execFileSync)("cmd.exe", ["/c", "echo %USERPROFILE%"], {
L56: encoding: "utf8",
...
L74: const home = (0, node_os_1.homedir)();
L75: const appData = process.env.APPDATA ?? (isWindows() ? (0, node_path_1.join)(home, "AppData", "Roaming") : "");
L76: const localAppData = process.env.LOCALAPPDATA ?? (isWindows() ? (0, node_path_1.join)(home, "AppData", "Loc…
Critical
Ai Agent Control Hijack
Install-time source drops package-supplied AI-agent/MCP control files or instructions.
scripts/safe-postinstall.cjsView on unpkg · L1wasm/tree-sitter-go.wasmView file
•path = wasm/tree-sitter-go.wasm
kind = wasm_module
sizeBytes = 235957
magicHex = [redacted]
Medium
Findings
1 Critical1 High5 Medium5 Low
CriticalAi Agent Control Hijackscripts/safe-postinstall.cjs
HighInstall Time Lifecycle Scriptspackage.json
MediumDynamic Requiredist/core/dag-checkpoint.js
MediumNetwork
MediumEnvironment Vars
MediumShips Wasm Modulewasm/tree-sitter-go.wasm
MediumStructural Risk Force Deep Review
LowNon Install Lifecycle Scripts
LowScripts Present
LowFilesystem
LowHigh Entropy Strings
LowUrl Strings