Back to skill

Security audit

lean4-memories

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for Lean 4 proof-memory workflows, but it needs review because it encourages persistent storage of project metadata and uses an unpinned npx-launched memory server.

Before installing, decide whether you are comfortable keeping durable Lean project memories that may include repository paths, theorem names, tactics, failed attempts, and preferences. Pin or locally install the MCP memory server instead of using unpinned `npx -y`, and review/clear stored memories regularly.

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:370
Finding

Unpinned MCP Server Package Execution Through npx

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 370–371
Vulnerability Type: Unpinned third-party dependency execution
Risk Level: Medium

Vulnerable Code

json
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]

Technical Analysis

The documented MCP configuration invokes npx with the automatic-confirmation flag (-y) and references @modelcontextprotocol/server-memory without an exact version or integrity constraint.

When this configuration is used, npm can resolve, download, and execute a package version selected by the registry at invocation time. Therefore, the code ultimately executed can change after the Skill has been reviewed. The -y option also suppresses the normal installation confirmation.

This creates a supply-chain trust boundary: compromise of the package publisher, registry account, package dependencies, or package resolution path could cause unreviewed code to execute locally. No evidence indicates that the package is currently malicious; the confirmed issue is the unsafe, mutable dependency execution pattern.

Attack Path

  1. A user copies the documented configuration into an MCP client.
  2. The MCP client launches npx -y @modelcontextprotocol/server-memory.
  3. npx resolves the unpinned package and its transitive dependencies through the configured npm registry.
  4. If a resolved package release or dependency has been compromised, npm downloads and executes its lifecycle or runtime code without an interactive installation prompt.
  5. The malicious code runs under the MCP client's operating-system account and can act within that account's permissions.

Impact Assessment

Successful exploitation could provide arbitrary code execution with the privileges of the user running the MCP client. Depending on the execution environment and its restrictions, the compromised package could access readable project files, environment variables, MCP configuration, and memory data, or mo ...[truncated 240 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin the MCP server to an exact reviewed version rather than relying on registry-time resolution.
  2. Install dependencies through a controlled project setup process using a committed lockfile and npm integrity metadata.
  3. Configure the MCP client to invoke the verified local executable directly instead of using npx -y at runtime.
  4. Remove automatic confirmation where practical so unexpected package installation is visible to the user.
  5. Review and update the pinned package and its transitive dependencies through a documented dependency-update process.
  6. Run the MCP server with least privilege and restrict its access to sensitive files, credentials, environment variables, and unrelated project directories.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (9)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

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

md
- Confidence: high (proof clean, no warnings)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

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

md
### Memory Hygiene

**Confidence scoring:**
- **High (0.8-1.0)** - Clean proof, no warnings, well-tested
- **Medium (0.5-0.8)** - Works but has minor issues
- **Low (0.0-0.5)** - Hacky solution, needs refinement

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

Scanner excerpt · references/memory-patterns.md (reported line 589)May include surrounding context.

md
### Memory Hygiene

**Confidence scoring:**
- **High (0.8-1.0)** - Clean proof, no warnings, well-tested
- **Medium (0.5-0.8)** - Works but has minor issues
- **Low (0.0-0.5)** - Hacky solution, needs refinement

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This skill is explicitly designed to persist project memories and user preferences across sessions, but it does not present a clear user-facing warning about retention, visibility, or privacy consequences before encouraging storage. In this context, the danger is unintended long-term collection of potentially sensitive workflow preferences, research context, and project details without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The examples instruct storing absolute project paths such as a full /Users/... repository path, which can disclose usernames, directory structure, organization names, and internal project identifiers when persisted externally. Because this skill integrates with an MCP memory server, the leakage is more concerning than a local transient note: path data may become durable metadata that aids fingerprinting or correlation across sessions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The storage guidance recommends persisting file, module, theorem name, and proof history context without clearly warning that repository structure and development history metadata may be retained. In formalization or proprietary codebases, this metadata can reveal sensitive project internals even if full source text is not stored.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The examples explicitly store absolute local project paths, theorem work history, failed attempts, and user preferences in persistent memory, but provide no privacy, minimization, retention, or consent guidance. In an agent setting, this can leak sensitive filesystem structure, behavioral data, and project metadata across sessions or to external memory backends, especially if memory is shared, logged, or synced.

Content

No source excerpt is available for this finding.