Back to skill

Security audit

LessonLoop

Security checks for vulnerabilities and agentic risk

Overview

LessonLoop does what it says by storing agent lessons, but its persistent memory writes are too loosely controlled and its scripts can write outside the intended memory paths if invoked with unsafe arguments.

Install only if you want this skill to change persistent agent memory. Review captured lessons before promotion, avoid storing secrets or temporary context, and restrict or patch the scripts so dates are validated, workspaces are fixed to an approved directory, and lesson content is bounded and sanitized.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/apply_lesson.py:8
Finding

Unvalidated Date and Workspace Arguments Permit Arbitrary File Writes

Content
View full analysis
Remediation
View remediation
str: parsed = datetime.strptime(value, "%Y-%m-%d") canonical = parsed.strftime("%Y-%m-%d") if value != canonical: raise ValueError("Date must use canonical YYYY-MM-DD format") return canonical ``` 2. Reject absolute paths, path separators, null bytes, `.` components, and `..` components in any value used as a filename. 3. Resolve and verify every destination before writing: ```python root = (workspace / "memory").resolve() destination = (root / f"{date}.md").resolve() if not destination.is_relative_to(root): raise ValueError("Output path escapes the memory directory") ``` 4. Apply an equivalent containment check to the `memory/lessonloop` log directory. 5. Do not accept arbitrary workspaces in normal Agent operation. Obtain the workspace from trusted configuration or enforce containment beneath an approved root. 6. Refuse symlink output files or safely open files using platform facilities that prevent symlink following. 7. Use restrictive creation permissions and atomic writes for memory files. 8. Add regression tests covering absolute paths, `../` traversal, nested separators, symlinks, malformed dates, and unauthorized workspace roots. ]]>

T02 · Agent Memory Poisoning

Warning
Location
scripts/capture_lesson.py:7
Finding

Untrusted Multiline Lessons Can Poison Persistent Agent Memory

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

The code does implement a narrow part of the description: it records a lesson compactly into daily memory with low overhead. However, the declared purpose includes more substantive behavior-selection and memory-management claims that are not present in the code. The script does not inspect conversation context, determine whether user feedback qualifies, promote lessons into MEMORY.md, or perform any behavior-hardening beyond storing a string in a dated file. So the description overstates the implemented capability and primary scope.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description says this skill captures user feedback as lessons, hardens behavior, and may promote durable rules into MEMORY.md. The supplied code does none of that: it only lowercases CLI input, checks for presence of certain predefined keywords, and returns a JSON object with needsEscalation and a reason. This is a materially different primary purpose—an escalation/triage gate for high-stakes topics—rather than experience capture or memory management. No storage, memory-writing, lesson selection, or self-improvement logic is present.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description is about actively capturing corrective feedback and hardening future behavior by storing important lessons and possibly promoting them into MEMORY.md. The provided code does something materially different: it only summarizes existing LessonLoop activity from JSONL files and prints counts/statistics. It does not record lessons, evaluate whether a lesson is high-value, modify memory files, or implement the described trigger behavior. While it is related to the same LessonLoop domain, its primary purpose is reporting/analytics, which is not accurately represented by the declared description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README explicitly states that the skill writes lessons to daily memory and can promote them into long-term memory, but it does not warn users that this modifies persistent agent state. In a self-improvement or memory-oriented skill, silent persistence is security-relevant because users may provide sensitive, temporary, or context-specific feedback that later becomes durable behavior or stored data without clear consent.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill explicitly references scripts that write to daily memory and potentially update durable memory, but it declares no tool scope or permission boundaries. In an agent environment, undeclared file read/write capability weakens least-privilege controls and can allow the skill to modify memory files or other workspace content without transparent review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script persists arbitrary lesson content directly into workspace memory and log files as soon as it is invoked, with no built-in confirmation, approval gate, or validation that the lesson is appropriate to store. In the context of a behavior-hardening skill, this creates a real risk of unintended persistence of prompt-injected instructions, sensitive user data, or misleading operating rules that may later influence agent behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script enumerates lesson logs from a user workspace and prints aggregated metadata plus the latest lesson text without any access check, redaction, or disclosure guard. Those lesson entries may contain corrective feedback, behavioral rules, or other sensitive user-derived content, so running this report can expose private workspace history to anyone with terminal or log access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This code appends a JSONL record to a file under the user's workspace, which modifies persistent data. While the CLI description says it appends a log entry and the script prints the resulting path, there is no inline warning, confirmation, or comment/docstring explaining that it will create directories and write to disk in the specified workspace.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.