Back to skill

Security audit

memory-checkup

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a read-only memory audit tool, but it reads agent control files that are not clearly included in its stated audit corpus.

Review before installing if your workspace AGENTS.md or HEARTBEAT.md contains sensitive instructions or operational state. The tool appears read-only and does not exfiltrate data, but its documented scan scope should be tightened or the extra control-file reads should require explicit opt-in.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Note
Location
scripts/memory_checkup.py:67
Finding

Undeclared Access to Agent Control Files

Content
View full analysis

Vulnerability Details

File Location: scripts/memory_checkup.py:67-78
Vulnerability Type: Excessive file-read scope
Risk Level: Low

Vulnerable Code

python
def load_files(memory_dir: Path):
    """Scan workspace-root markdown files plus the memory/ subdirectory only.
    Never recurse into other subdirectories (skills/, node_modules/, projects/)."""
    files = {}
    for name in ("MEMORY.md", "USER.md", "AGENTS.md", "HEARTBEAT.md"):
        p = memory_dir / name
        if p.exists():
            files[name] = p.read_text(encoding="utf-8", errors="replace")
    memsub = memory_dir / "memory"
    if memsub.exists() and memsub.is_dir():
        for p in sorted(memsub.glob("*.md")):
            files[str(p.relative_to(memory_dir))] = p.read_text(encoding="utf-8", errors="replace")
    return files

Technical Analysis

The documented audit corpus consists of MEMORY.md, USER.md, and Markdown files under memory/. However, load_files() also reads AGENTS.md and HEARTBEAT.md automatically whenever those files exist.

These additional files may contain agent instructions, operational schedules, or control-state information rather than user memory. Reading them violates least-privilege and declared-scope principles because they are not required by the documented memory-consistency task and no explicit opt-in is requested.

The loaded contents are processed by metric, path-reference, date, and orphan-detection logic. Findings derived from those files may consequently appear in human-readable or JSON output. The implementation does not transmit data over a network, execute content from these files, or acquire operating-system privileges beyond those already held by the invoking process.

Attack Path

  1. A user or agent invokes the script with --memory-dir pointing to an agent workspace.
  2. The workspace contains readable AGENTS.md or HEARTBEAT.md files.
  3. load_files() silently opens and reads those files despite th ...[truncated 869 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict the default root-file list to the documented corpus:
python
for name in ("MEMORY.md", "USER.md"):
    p = memory_dir / name
    if p.exists() and p.is_file():
        files[name] = p.read_text(encoding="utf-8", errors="replace")
  1. If auditing AGENTS.md or HEARTBEAT.md is a legitimate optional feature, require explicit consent through a flag such as --include-control-files.

  2. Clearly document every file category read by the script, including how content may be represented in human-readable and JSON reports.

  3. Consider accepting an explicit allowlist of root files rather than embedding an expanding list in the implementation.

  4. Add automated tests verifying that control files are not opened unless the corresponding opt-in option is enabled.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level documentation presents the skill as 'Memory Checkup' that will 'Audit and repair' the memory corpus. Later, the same README says 'The script is read-only' and that fixing is deliberately left to the agent and user, which directly contradicts the earlier stated behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest description states the skill will 'Audit and repair an AI agent's memory corpus,' implying direct modification capability. However, the README explicitly says 'The script is read-only' and that fixing is left to the agent and user, which means the implemented tool only audits and reports rather than performing repairs itself.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README says the skill triggers on requests like "check my memory," which is a common natural-language phrase and not strongly constrained to this specific tool or environment. The same line also says it triggers on "risky recall situations," which leaves activation boundaries somewhat open-ended.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README states the skill triggers on broad, everyday phrases such as “检查记忆”, “记忆审计”, and “体检记忆”, as well as vaguely defined “high-risk recall scenarios.” In an agent skill system, broad trigger phrases can cause unintended activation in normal conversation, leading the agent to inspect workspace memory when the user did not clearly request that operation and increasing the chance of unnecessary file access or disruptive behavior.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module docstring states the tool reports 'Contradictions' as a distinct issue type, and the issues structure includes a 'contradictions' bucket. However, the implementation only computes stale-number rankings and never appends any contradiction records or renders a contradictions section in output, so the advertised behavior is not actually implemented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

SQP-3 适用于所有文件。L50 写明“目前内置英文 + 中文数字模式”,体现出对语言/locale 的功能性限制,但文档未说明用户可选择其他语言支持方案,也未给出该限制的明确业务或合规理由。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation narrows the scan scope to MEMORY.md, USER.md, and Markdown files under memory/. In contrast, load_files also reads AGENTS.md and HEARTBEAT.md from the workspace root, which is an active contradiction about what content is audited.

Content

No source excerpt is available for this finding.