Back to skill

Security audit

Claude Code Memory Kit

Security checks for vulnerabilities and agentic risk

Overview

This is mostly a Claude Code memory template guide, but it needs review because it creates persistent agent behavior and includes unsafe generic npm install guidance.

Review before installing. The memory templates are understandable for Claude Code users, but treat persistent CLAUDE.md rules as code-adjacent policy: keep them project-scoped, avoid secrets, review team-wide files, and document how to remove or override them. Do not run the generic npx or npm install -g --unsafe-perm=true examples unless you replace them with a trusted, pinned package and understand the risk.

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
TROUBLESHOOTING.md:126
Finding

Unpinned Arbitrary npm Package Execution with Unsafe Global Installation Guidance

Content
View full analysis

Vulnerability Details

File Location: TROUBLESHOOTING.md, lines 126-132
Vulnerability Type: Supply-chain risk from unpinned package execution and unsafe installation permissions
Risk Level: Medium

Vulnerable Code

bash
### "npm install fails"
```bash
# Use npx instead for one-off tools
npx @somepackage/command

# Or install globally with correct permissions
npm install -g @somepackage --unsafe-perm=true
text

### Technical Analysis

The troubleshooting guide recommends downloading and executing an unspecified npm package through `npx`. It also suggests globally installing that package with `--unsafe-perm=true`.

The package name and version are not pinned, and no publisher, integrity hash, lockfile, signature, or trusted registry requirement is provided. Consequently, the code ultimately executed depends on mutable registry content at installation time rather than reviewed project content.

npm packages may execute lifecycle scripts during installation. The `npx` command can retrieve and immediately run a package that is not locally installed. The global-install alternative broadens system impact, while `--unsafe-perm=true` allows package lifecycle scripts to retain the invoking process's privileges instead of applying npm's historical privilege-reduction behavior.

This can expose users to dependency confusion, typosquatting, publisher compromise, malicious package updates, or accidental execution of an unrelated package. The placeholder does not itself identify a malicious package, but the documented workflow is unsafe if users substitute an untrusted or misspelled package.

### Attack Path

1. A user encounters an npm installation problem and follows the troubleshooting guide.
2. The user replaces `@somepackage/command` with an attacker-controlled, compromised, or misspelled package name.
3. The user runs `npx`, causing npm to retrieve and execute registry-controlled code, or performs the global installation with `--unsafe-perm=tru
...[truncated 1116 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the generic recommendation to execute arbitrary package placeholders with npx.
  2. Document only packages that are actually required and have been reviewed.
  3. Pin every recommended package to an exact version, for example package-name@1.2.3.
  4. Prefer project-local, lockfile-controlled dependencies over global installations.
  5. Verify the package publisher, registry source, provenance, signature where available, and integrity metadata before installation.
  6. Avoid recommending --unsafe-perm=true; do not run package installation commands with administrative privileges.
  7. Use npx --no-install when execution must be restricted to an already installed and reviewed local dependency.
  8. Configure an approved npm registry and dependency allowlist in managed environments.
  9. Audit package lifecycle scripts and use installation controls such as --ignore-scripts when scripts are unnecessary.
  10. Replace the affected section with package-specific recovery steps that preserve least privilege and reproducible dependency resolution.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (10)

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · INSTALL.md (reported line 45)May include surrounding context.

text

### Step 4: Set Up Guardrails (Optional)
Add to `~/.claude/settings.json`:
```json
{
  "preToolGates": {

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · TROUBLESHOOTING.md (reported line 131)May include surrounding context.

text

### Step 4: Set Up Guardrails (Optional)
Add to `~/.claude/settings.json`:
```json
{
  "preToolGates": {

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · INSTALL.md (reported line 49)May include surrounding context.

json
{
  "preToolGates": {
    "Bash(git push --force)": "confirm",
    "Bash(rm -rf)": "confirm"
  }
}

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · TROUBLESHOOTING.md (reported line 92)May include surrounding context.

json
{
  "preToolGates": {
    "Bash(git push --force)": "confirm",
    "Bash(rm -rf)": "confirm"
  }
}

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · INSTALL.md (reported line 67)May include surrounding context.

git commit -m "Add Claude Code memory system"

text

2. **Create team-wide standards** in a shared CLAUDE.md at organization level

3. **Onboard new members:**
```bash

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · TROUBLESHOOTING.md (reported line 6)May include surrounding context.

md
## Common Issues & Solutions

### Issue: "Claude doesn't read my CLAUDE.md"
**Symptoms:** You create CLAUDE.md but Claude Code ignores it.
**Causes:**
- File in wrong location (must be in project root)
- Syntax errors in YAML frontmatter

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.

Rp1

Medium
Category
MCP Rug Pull
Confidence
81% confidence
Finding

Recommending npx @somepackage/command without a pinned version encourages execution of whatever version is current at install time, which creates avoidable supply-chain risk. In an agent-assistance context, users may copy commands directly, so unpinned package execution can lead to unexpected or malicious code being run if the package is compromised.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The guide recommends npm install -g ... --unsafe-perm=true without any warning that this relaxes npm's permission protections and may allow package lifecycle scripts to run with elevated privileges. If copied by users, this can significantly increase the impact of a malicious or compromised package.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This manifest description says the skill will 'Stop Claude Code from repeating mistakes' and 'enforce guardrails, preserve context, maintain consistency across sessions,' but it does not define when the skill should activate or what concrete triggers invoke it. In a manifest file, this kind of broad capability description can create ambiguous invocation boundaries and unintended matching.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.