Back to skill

Security audit

Memory V2 Skill

Security checks for vulnerabilities and agentic risk

Overview

This is a local memory skill, but it has unsafe input handling around database queries and cleanup operations that could expose or delete stored memory data.

Review this skill before installing. It appears designed for local memory rather than exfiltration, but it will persist potentially sensitive agent memory on disk and includes backup, rollback, and cleanup code that can overwrite or delete local data. Install only if you are comfortable managing the database file and backups, and prefer a fixed version with input validation and clearer retention controls.

Vulnerability Patterns
  • 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
  • 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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
modules/priority.js:132
Finding

SQL Injection in Priority Cleanup Can Delete All Priority Records

Content
View full analysis
Remediation
View remediation
3650) { throw new TypeError('days must be an integer between 0 and 3650'); } const result = await this.db.run( `DELETE FROM memory_priorities WHERE priority_level = 4 AND created_at < datetime('now', ?)`, [`-${days} days`] ); return { deleted: result.changes }; } ``` Additionally: - Do not expose destructive cleanup methods directly to untrusted callers. - Require explicit authorization for retention or deletion operations. - Consider a dry-run mode that reports the number of records to be removed. - Execute destructive maintenance in a transaction and maintain a recoverable backup. - Add tests using quotes, comments, SQL operators, negative values, decimals, and excessively large values. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
modules/decision.js:181
Finding

SQL Injection in Decision Review Query Bypasses Intended Record Filtering

Content
View full analysis
Remediation
View remediation
3650) { throw new TypeError('days must be an integer between 0 and 3650'); } const sql = ` SELECT * FROM memory_decisions WHERE outcome_status = 'pending' AND review_date <= datetime('now', ?) AND reviewed_at IS NULL ORDER BY review_date ASC `; return await this.db.all(sql, [`+${days} days`]); } ``` The public API should also validate input at its trust boundary. Add authorization checks if different callers or conversations are not supposed to read one another’s decision records, and add regression tests with SQL metacharacters and out-of-range values. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
modules/evolution.js:198
Finding

SQL Injection in Skill Growth Reporting Bypasses the Reporting Period

Content
View full analysis
= datetime('now', '-${days} days') ORDER BY experience_points DESC `; const recentSkills = await this.db.all(sql); const categories = await this.getCategoryStats(); ``` ### Technical Analysis The reporting period is directly concatenated into the SQL statement. The public `MemoryAPI.getSkillGrowthReport(days)` method forwards its argument without checking that it is an integer. A malicious value can close the `datetime()` expression and inject an alternate predicate. This allows the caller to bypass the intended date range and retrieve skill records outside the requested reporting period. The attack does not require stacked statements. Manipulating the existing `WHERE` expression is sufficient to alter the query result. ### Attack Path 1. An attacker controls or influences the `days` value supplied to `getSkillGrowthReport()`. 2. The public API forwards the value to `generateGrowthReport()`. 3. The module interpolates the value into the SQL query. 4. SQLite evaluates the attacker-modified `WHERE` clause. 5. Historical skill-use records outside the authorized or intended reporting period are returned and included in aggregate reporting. ### Impact Assessment The vulnerability can expose historical skill names, usage and failure counts, experience points, proficiency levels, and last-use timestamps beyond the intended reporting window. It can also distort report totals and averages. Its scope is limited to data avail ...[truncated 91 chars]
Remediation
View remediation
3650) { throw new TypeError('days must be an integer between 0 and 3650'); } const sql = ` SELECT skill_name, proficiency_level, experience_points, usage_count, success_count, failure_count, last_used_at FROM memory_evolution WHERE last_used_at >= datetime('now', ?) ORDER BY experience_points DESC `; const recentSkills = await this.db.all(sql, [`-${days} days`]); // Continue report generation. } ``` Apply validation both at the public API boundary and inside the module. If records belong to different users or conversations, add explicit ownership predicates rather than relying solely on a date filter. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
modules/version.js:193
Finding

SQL Injection in Backup Cleanup Can Expand Destructive File Deletion Scope

Content
View full analysis
Remediation
View remediation
3650) { throw new TypeError('days must be an integer between 0 and 3650'); } if (!Number.isInteger(keepLastN) || keepLastN < 0 || keepLastN > 1000) { throw new TypeError('keepLastN must be a bounded non-negative integer'); } const oldBackups = await this.db.all( `SELECT * FROM memory_versions WHERE version_type = 'full' AND created_at < datetime('now', ?) ORDER BY created_at DESC`, [`-${days} days`] ); // Continue only after path and authorization checks. } ``` Before deleting any file: - Resolve `backup.backup_path` with `fs.realpath()` or an equivalent canonicalization mechanism. - Resolve and canonicalize the configured backup directory. - Verify that the target is a regular file contained within that directory. - Reject symlinks and paths escaping the backup root. - Require explicit authorization for cleanup operations. - Use a transaction for metadata deletion and define recovery behavior when filesystem deletion or database deletion fails. - Consider moving backups to quarantine before permanent deletion. - Do not expose internal modules as an informal public API. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The code is consistent with part of the description's infrastructure claim—local SQLite storage with no external API calls—but the supplied chunk does not implement the substantive memory-system features listed in the declared purpose. Instead, it is a database bootstrap/helper module: it opens a SQLite DB, reads a local schema.sql file, executes statements, exposes run/get/all helpers, and performs a simple table health check. This is a materially narrower behavior than the declared feature set, so the description does not accurately represent what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code is consistent with part of the description: it is local, SQLite-backed, and performs priority analysis/tracking without external API calls. However, the declared description presents a broader memory system with learning progress, decision review scheduling, skill evolution monitoring, text search, and automatic backups. None of those capabilities are present in this chunk. Additionally, the code includes an undeclared cleanup/delete function that removes old low-priority records. Since the supplied code chunk materially implements only a subset of the advertised system and includes an unmentioned deletion behavior, the description does not accurately represent what this code chunk actually does.

Content

No source excerpt is available for this finding.

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · modules/evolution.js (reported line 54)May include surrounding context.

js
const newLevel = this.calculateLevel(newXP);
        const oldLevel = skill.proficiency_level;

        // Update skill record
        await this.db.run(
            `UPDATE memory_evolution 
             SET usage_count = usage_count + 1,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly promotes a local SQLite memory system and shows APIs that store message, conversation, learning, and decision data, but it does not clearly warn users that potentially sensitive conversation content will be persisted on disk. In an agent-memory skill, this omission can cause operators to unknowingly retain prompts, user data, secrets, or internal reasoning artifacts in a local database, increasing privacy, compliance, and forensic exposure if the host is shared or compromised.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module persists decision questions, context, rationale, options, and expected outcomes to a local SQLite database, but the code shown contains no user-facing notice, consent check, or data-minimization control before storage. Because this skill is explicitly a long-term memory system, users or upstream agents may provide sensitive strategic, financial, or personal content that gets retained longer than expected, creating a privacy and data-governance risk even without external exfiltration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module persists learning topics and notes to a local SQLite database without any indication in this code that the user is informed or has consented to storage. Because learning topics can reveal sensitive interests, goals, or behavioral history, silent retention creates a privacy risk, especially in an agent memory system designed to accumulate longitudinal data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The cleanupOldLowPriority function performs a DELETE operation that irreversibly removes records from memory_priorities. Although the method name and comments describe the behavior for developers, there is no user-facing confirmation, warning, or visible disclosure in this file before executing the destructive action.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module logs raw search queries directly to stdout, which can expose sensitive user input such as secrets, personal data, or operational context in terminal history, log aggregators, or hosted runtime logs. In a memory system, queries are likely to reference stored agent knowledge and may contain especially sensitive text, making this more risky than generic debug logging.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The rollback operation copies a backup directly onto the active database path, which is a destructive file write that can replace current data. Although comments describe the step for developers, there is no user-facing confirmation, logging, or disclosure in this file before performing the overwrite.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The cleanup routine permanently deletes backup files with fs.unlinkSync and removes associated metadata records from the database. The code includes error logging on failure, but no user disclosure, confirmation, or warning that retention cleanup will irreversibly remove backups.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file documents restoreBackup(backupPath) as a simple restore operation but does not warn that restoring a backup can overwrite or replace current database state. For markdown files, destructive or system-integrity-affecting behavior should be disclosed so users understand the risk before invoking it.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The cleanupBackups(keepCount = 10) description states that old backups are cleaned up, but it does not clearly warn users that backup files will be permanently removed. In markdown documentation, irreversible deletion behavior should be called out explicitly because it can affect data recovery and system integrity.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The top-of-file comment frames this code as an extension of a different system ("Lossless Claw") rather than the declared "Memory Lucia" SQLite-based memory skill for OpenClaw agents. This is an intent/documentation mismatch that can mislead reviewers about the skill's identity and intended integration context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The query in generateGrowthReport interpolates the days value directly into the SQL string instead of binding it as a parameter. If an attacker can influence days, this can break the intended query structure and may enable SQL injection or query manipulation against the local SQLite database. Because this skill stores agent memory locally, compromising query integrity could expose, alter, or disrupt all stored memory data.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency uses a caret range (^5.1.6) instead of an exact version, so builds may resolve to different sqlite3 patch/minor releases over time. This weakens supply-chain reproducibility and can unexpectedly introduce vulnerable or unreviewed code, even though the package itself is a common legitimate dependency.

Content

Scanner excerpt · package.json (reported line 25)May include surrounding context.

json
"author": "Chief of Staff",
  "license": "MIT",
  "dependencies": {
    "sqlite3": "^5.1.6"
  },
  "repository": {
    "type": "git",

Unverifiable Dependency: sqlite3 has 2 known advisory(ies) (CVE-2022-21227 (Denial-of-Service when binding invalid parameters in sqlite3); CVE-2022-43441 (sqlite vulnerable to code execution due to Object coercion)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
83% confidence
Finding

The manifest does not pin sqlite3 to an exact version, so it is not possible to verify from this file alone whether the installed package includes versions affected by known advisories. In a local SQLite memory skill, this is somewhat constrained by the lack of external API exposure, but malformed local inputs or unsafe object coercion paths could still trigger denial of service or worse if a vulnerable build is installed.

Content

No source excerpt is available for this finding.