Back to skill

Security audit

long-horizon-planner

Security checks for vulnerabilities and agentic risk

Overview

The planner itself is local and coherent, but the skill also stores free-form preferences and encourages writing learned content back into its own instructions, which can affect future agent behavior.

Review before installing. The planner has no observed network or credential behavior, but its learning feature can preserve user preferences, error notes, and usage history in the skill directory and may lead future agents to treat that data as guidance. Install only if you are comfortable with that persistence, avoid storing sensitive project details in preferences or notes, and do not allow automatic SKILL.md write-back without human review.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Warning
Location
scripts/learner.py:72
Finding

Persistent Agent Memory Poisoning Through Unvalidated Learning Data

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:47-70; scripts/learner.py:72-92,108-116
Vulnerability Type: Persistent storage and reuse of attacker-controlled instructions
Risk Level: Medium

Vulnerable Code and Instructions

scripts/learner.py:72-92 accepts and persistently stores unrestricted error notes:

python
def record_op(skill_dir, capability, success=True, error=None, note=None):
    data = load_learning(skill_dir)
    data["totalOps"] += 1
    cap = data["capabilityStats"].setdefault(capability, {"count": 0, "success": 0, "fail": 0})
    cap["count"] += 1
    if success:
        cap["success"] += 1
    else:
        cap["fail"] += 1
        data["totalErrors"] += 1
    if error:
        ep = data["errorPatterns"].setdefault(error, {"count": 0, "lastNote": "", "lastTime": ""})
        ep["count"] += 1
        ep["lastNote"] = note or ""
        ep["lastTime"] = data["lastUpdated"] or datetime.datetime.now().strftime("%Y-%m-%dT%H:%M")
    rec = {"t": data["lastUpdated"], "cap": capability, "ok": success, "err": error, "note": note}
    data["recentOps"].append(rec)
    data["recentOps"] = data["recentOps"][-20:]
    save_learning(skill_dir, data)
    return data

scripts/learner.py:94-98 persistently stores unrestricted preference keys and values:

python
def record_preference(skill_dir, key, value):
    data = load_learning(skill_dir)
    data["preferences"][key] = value
    save_learning(skill_dir, data)
    return data

scripts/learner.py:108-116 reproduces the stored note in reflection output:

python
def self_reflect(skill_dir):
    data = load_learning(skill_dir)
    suggestions = []
    for err, info in data["errorPatterns"].items():
        if info["count"] >= THRESHOLD_ERROR:
            suggestions.append(
                f"⚠️ 错误「{err}」已出现 {info['count']} 次,建议增加预检/兜底步骤,"
                f"并将经验回写本技能 SKILL.md(lastNote: {info.get('lastNote','')})"
            )

SKILL.md:62-70 directs the agent t ...[truncated 2905 chars]

Remediation
View remediation

Remediation Suggestions

  1. Treat every value in learned_patterns.json as untrusted data rather than executable guidance.
  2. Remove the instruction to write learned content directly into SKILL.md. Keep immutable skill instructions separate from writable runtime state.
  3. Require explicit, informed human approval before a preference can alter future agent behavior.
  4. Define an allowlisted preference schema with recognized keys, constrained enum or typed values, and safe defaults. Reject unknown keys.
  5. Limit the length and character set of error names, notes, preference keys, and preference values.
  6. Store provenance for each entry, including who supplied it, when it was recorded, and whether it was reviewed.
  7. Render persisted values as quoted data and clearly label them as untrusted when producing insight or reflect output.
  8. Do not interpolate arbitrary notes into agent-facing recommendations. Summarize them through a trusted transformation or display them only in a non-instructional section.
  9. Add integrity controls and restrictive file permissions to the learning file where multiple users or processes can access the skill directory.
  10. Add tests proving that prompt-like preference values and notes cannot modify skill instructions or become authoritative directives in later sessions.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented purpose is a deterministic long-horizon planner, but the skill also introduces undeclared persistent learning, user preference storage, and self-modifying documentation behavior, while the core claimed planning capabilities are not actually evidenced here. This mismatch is dangerous because operators and downstream agents may trust the manifest and invoke the skill in sensitive contexts without understanding its actual data collection and file modification behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file implements a generic cross-skill telemetry and self-learning component that is materially outside the declared scope of a long-horizon planning engine. That scope mismatch is dangerous because it creates hidden data collection and persistence capabilities that operators and users would not reasonably expect from this skill, increasing the chance of covert profiling or lateral data reuse across skills.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill instructs the agent to run commands that write persistent files such as plan.json, plan.md, learned_patterns.json, and even modify SKILL.md, yet it declares no explicit tool scope or permission boundary. This creates an authorization and governance gap: a caller may invoke a supposedly planning-only skill that can also persist and alter local files without any declared restriction.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The invocation guidance says to call the skill whenever the user/agent needs multi-stage planning, dependency scheduling, critical path analysis, or avoiding drift, but it does not define specific trigger phrases, scope limits, or negative examples. This broad natural-language condition could overlap with many general planning requests and cause unintended invocation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation claims deterministic local planning with no external dependencies, but it also includes a persistent self-learning system that records usage history and user preferences. This inconsistency increases the chance that users will underestimate statefulness, reproducibility issues, and privacy exposure when using the skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Persistent collection of user preferences, error history, and usage data is not necessary for the stated function of computing DAG plans, topological order, or critical paths. Unnecessary retention expands the data exposure surface and can leak cross-task or cross-user context into future runs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill states that user preferences and history are stored persistently but does not warn about privacy, retention, or consent implications. In a public skill, this omission can lead to silent collection of potentially sensitive operational patterns and user-specific preferences without informed approval.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Persisting user preferences across sessions creates a natural-language memory channel that can retain sensitive or identifying information and surface it in later tasks. In a public planning skill, this is especially risky because planning artifacts often encode business priorities, constraints, mistakes, and internal project details.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module stores arbitrary user preferences, notes, error types, and operational history for any skill, even though the advertised capability is planning. In this context, the danger is unjustified data accumulation: free-form notes and preferences can capture sensitive information and enable long-term profiling without clear necessity or minimization.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

User preferences and operation notes are persisted to disk in learned_patterns.json with no user-facing disclosure, consent, or storage controls. This is risky because notes may contain sensitive user data or workflow details, and silent persistence increases the likelihood of privacy violations and unintended forensic exposure on shared systems.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The statement that the planning primitives are implemented as local deterministic algorithms suggests a constrained, auditable planning tool. Later guidance to automatically accumulate experience and write it back into SKILL.md introduces behavior beyond static deterministic planning, creating an intent-level inconsistency in how the skill is represented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The natural-language instructions and CLI-facing descriptions are entirely in Chinese, with no indication that language is configurable or chosen by the user. This can violate language/locale policy when a skill implicitly forces a specific language without opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.