Back to skill

Security audit

Remember All Prompts Daily

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed memory tool, but it persistently stores and replays conversation history in plaintext with weak user controls.

Review before installing. This skill may save sensitive chats, credentials, and prior instructions into plaintext files and bring them back into later sessions. Install only if you explicitly want durable local transcript memory, and consider adding redaction, strict file permissions, retention/deletion controls, and manual review before any ingestion.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (3)

T01 · Skill Instruction Hijacking

Warning
Location
scripts/ingest_prompts.py:21
Finding
Archived Conversation Content Is Reintroduced Without Trust-Boundary Controls## Vulnerability Details **File Location**: `scripts/ingest_prompts.py:21-44` **Vulnerability Type**: Cross-session instruction injection **Risk Level**: Medium ### Vulnerable Code ```python content = archive_path.read_text() # Parse the file to get the latest session lines = content.split('\n') latest_session = [] in_session = False for line in reversed(lines): if line.startswith("###"): in_session = True latest_session.insert(0, line) elif in_session and (line.startswith("##") or line.startswith("#")): break elif in_session: latest_session.insert(0, line) return '\n'.join(latest_session) if latest_session else None def format_for_ingestion(session_content): """Format archived session for ingestion as context.""" if not session_content: return None ingest_text = """ --- ## 📚 PREVIOUS SESSION CONTEXT (Archived) This is your previous conversation, archived before token compaction. Continue naturally from here. """ ingest_text += session_content ``` ### Technical Analysis The implementation reads raw conversation content from the persistent archive and places it directly inside text explicitly intended for ingestion into a subsequent Agent session. No trust-boundary marker, content sanitization, role preservation, instruction filtering, or structured summarization is applied. Conversation content is attacker-influenceable whenever an untrusted participant can submit a message to the archived session. Such a message can contain instructions targeting a future Agent, including requests to ignore current policies, invoke tools, disclose context, or treat attacker-provided statements as trusted state. The script itself only creates and prints an ingestion document; it does not directly call an Agent API. Exploitation therefore depends on the generated content being ingested manually or by the integrati ...[truncated 1278 chars]
Remediation
## Remediation Suggestions 1. Treat all archived conversation text as untrusted data, not executable instructions. 2. Preserve message roles and boundaries in a structured format such as JSON rather than concatenating raw Markdown. 3. Generate a constrained factual summary instead of restoring messages verbatim. 4. Remove or neutralize embedded tool directives, role-change requests, system-prompt imitations, and instructions directed at future sessions. 5. Prepend an explicit control instruction stating that archived content is quoted historical data and that instructions inside it must not be followed. 6. Require explicit user review before supplying generated content to an Agent. 7. Where supported, pass historical messages through a dedicated data/context channel that cannot override system or developer instructions.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/export_prompts.py:48
Finding
Sensitive Conversation History Is Stored and Reproduced in Plaintext## Vulnerability Details **File Location**: `scripts/export_prompts.py:48-79`; `scripts/ingest_prompts.py:54-82` **Vulnerability Type**: Insecure storage and output of sensitive conversation data **Risk Level**: Medium ### Vulnerable Code ```python def export_to_archive(history, session_label=""): """Export history to daily archive file.""" if not history: print("No history to export") return False archive_path = Path.home() / ".clawd" / "memory" / "remember-all-prompts-daily.md" archive_path.parent.mkdir(parents=True, exist_ok=True) today = datetime.now().strftime("%Y-%m-%d") current_time = datetime.now().strftime("%H:%M:%S") # Format session content session_content = f"### Session {current_time} {session_label}\n\n" for idx, msg in enumerate(history, 1): session_content += format_message(msg, idx) # Check if file exists and if today's section exists existing_content = "" if archive_path.exists(): existing_content = archive_path.read_text() # Check if today's date already has entries today_marker = f"## [DATE: {today}]" if today_marker not in existing_content: # New day, add date marker new_content = existing_content + f"\n{today_marker}\n\n" + session_content else: # Append to today's section parts = existing_content.split(today_marker) new_content = parts[0] + today_marker + parts[1] + session_content # Write back archive_path.write_text(new_content) ``` ```python def save_ingestion_prompt(content): """Save the ingestion prompt to a file for manual reference.""" ingest_file = Path.home() / ".clawd" / "memory" / ".session-ingest.md" ingest_file.parent.mkdir(parents=True, exist_ok=True) ingest_file.write_text(content) print(f"✅ Ingestion context saved to {ingest_file}") return ingest_file if __name__ == "__main__": print("🔍 Checking for archived ...[truncated 2841 chars]
Remediation
## Remediation Suggestions 1. Require informed, explicit consent before enabling conversation archival. 2. Create the memory directory with mode `0700` and archive files with mode `0600`; validate and repair permissions on existing files before use. 3. Avoid printing archived conversation content to standard output. 4. Apply secret detection and redaction for API keys, bearer tokens, passwords, private keys, cookies, and other credential formats. 5. Allow users to exclude messages or sessions from archival. 6. Encrypt archives at rest using a key stored outside the archive directory. 7. Implement configurable retention, rotation, deletion, and secure cleanup. 8. Avoid creating the redundant `.session-ingest.md` plaintext copy, or delete it immediately after approved ingestion. 9. Prevent duplicate exports of the same session and document exactly what data is retained.

T06 · System Persistence

Note
Location
scripts/setup_cron.py:10
Finding
Setup Permanently Modifies the Agent Heartbeat Configuration## Vulnerability Details **File Location**: `scripts/setup_cron.py:10-27` **Vulnerability Type**: Persistent recurring Agent hook **Risk Level**: Low ### Vulnerable Code ```python def setup_heartbeat_check(): """Add token check to HEARTBEAT.md""" hb_path = Path.home() / ".clawd" / "HEARTBEAT.md" heartbeat_entry = """ ### 🧠 Token Usage & Archive (Every Session) - Run `python skills/remember-all-prompts-daily/scripts/check_token_usage.py` - If usage > 95%: exports current session to archive - If usage < 5%: fresh session, ready to ingest previous context """ if hb_path.exists(): content = hb_path.read_text() if "Token Usage & Archive" not in content: hb_path.write_text(content + "\n" + heartbeat_entry) print(f"✅ Added to {hb_path}") else: hb_path.write_text(heartbeat_entry) print(f"✅ Created {hb_path}") ``` ### Technical Analysis Running the setup script modifies `~/.clawd/HEARTBEAT.md`, a persistent Agent configuration file, so the token-monitoring command is requested every session. The modification survives completion of the setup process and may cause future conversation history to be archived automatically. This behavior supports the Skill's declared automatic-monitoring functionality, and the optional cron configuration is not installed by the script. However, the heartbeat modification occurs immediately when setup is run, without a dedicated confirmation prompt, backup, disable option, or uninstall routine. The setup script inserts a fixed command rather than attacker-controlled content, so no direct command-injection path was identified. The security concern is persistence and continuing collection rather than arbitrary code execution. ### Attack Path 1. A user runs `scripts/setup_cron.py`, potentially expecting only configuration guidance. 2. The script creates or modifies `~/.clawd/HEARTBEAT.md`. 3. The inserted heartbeat entry persis ...[truncated 746 chars]
Remediation
## Remediation Suggestions 1. Display the exact persistent configuration change and require explicit confirmation before modifying `HEARTBEAT.md`. 2. Keep automatic monitoring disabled by default. 3. Back up the original heartbeat file before modification. 4. Add an uninstall command that removes only the block owned by this Skill and restores the prior state. 5. Mark inserted configuration with unique begin/end comments for reliable removal. 6. Verify the referenced script using an absolute, installation-specific path rather than relying on the current working directory. 7. Provide a status command showing whether recurring monitoring is active. 8. Clearly distinguish heartbeat persistence from the optional cron configuration in documentation and setup output.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • 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
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description claims a continuity-preservation mechanism that automatically exports at 95% and 1%, archives prompts with date-wise entries, and ingests archived summaries on restart to restore context. This code chunk is narrower: it only checks token usage via `clawdbot session-status --json`, runs an export script when usage is >=95%, and prints a message when usage is <=5% indicating previous context is available. There is no implementation here for ingestion/restoration, no 1% trigger, and no direct prompt extraction/date-wise archiving logic in this chunk. While delegating export is acceptable in principle, the declared purpose materially overstates what this specific code actually does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The description presents a two-way continuity system: export before compaction and ingest archived summaries after restart to restore context. The supplied code implements only a partial export utility. It attempts to fetch current session history through an optional API and appends formatted messages to a daily markdown archive under ~/.clawd/memory/remember-all-prompts-daily.md. There is no code for detecting token thresholds, no new-session trigger, no reading of archived summaries, and no restoration of context into a restarted session. Additionally, the script truncates messages over 500 characters, which conflicts with the claim to archive all prompts. The core implemented behavior is therefore materially narrower than the declared purpose.

Ssd 3

High
Confidence
98% confidence
Finding
The skill's core purpose is persistent archiving of all prompts and responses across sessions, creating a durable replayable record of potentially sensitive user conversations. In this context, that is dangerous because it converts transient chat data into a long-lived plaintext memory store that may contain secrets, personal data, internal instructions, or other confidential material.

Ssd 3

High
Confidence
98% confidence
Finding
The workflow explicitly instructs collecting complete session history with timestamps and restoring it later, which increases both confidentiality risk and the chance of propagating stale or sensitive context into future sessions. Re-ingesting archived content also broadens exposure by resurfacing old data to later prompts, tools, or users with access to the environment.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill describes reading archives, writing conversation history to disk, and invoking Python scripts, but it does not declare any explicit tool scope or permissions. That makes the capability boundary unclear and increases the chance the skill will be run with broader file and shell access than users expect, especially because it handles sensitive conversation content.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill promotes automatic archival of full prompts and responses to disk without a prominent warning about privacy, retention, or the possibility of storing secrets, credentials, or regulated data. Because the archive is intended to preserve complete session continuity, it can easily accumulate highly sensitive material and expose it to later compromise or unintended reuse.

Ssd 3

Medium
Confidence
96% confidence
Finding
The archive format and script description reinforce storage of all prompts, responses, timestamps, message IDs, and metadata, increasing the fidelity and sensitivity of the retained dataset. Even if intended for continuity, this level of detail makes the archive more valuable to an attacker and more harmful if leaked or mishandled.

Ssd 3

Medium
Confidence
95% confidence
Finding
The ingestion step reads archived conversation data and injects it into a new session as context, which can re-expose sensitive information and revive untrusted prior content in future interactions. This is especially risky because archived prompts may include secrets, misleading instructions, or adversarial content that gets carried forward automatically.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The cron-based automation enables unattended background writes of conversation history, but the documentation does not clearly warn users that sensitive chats may be exported periodically without a fresh confirmation. This increases the risk of silent data retention and surprise persistence beyond what a user expects from an interactive assistant session.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
try:
        # Call session_status via Clawdbot
        # This assumes clawdbot CLI is available
        result = subprocess.run(
            ['clawdbot', 'session-status', '--json'],
            capture_output=True,
            text=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def trigger_export():
    """Trigger the export script."""
    try:
        result = subprocess.run(
            ['python', 'skills/remember-all-prompts-daily/scripts/export_prompts.py'],
            capture_output=True,
            text=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The skill description promises two automatic behaviors: pre-compaction export at high usage and restart-time ingestion/restoration at low usage. In this file, the high-usage path invokes an export script, but the low-usage path only prints informational messages and returns True, so the claimed automatic ingest/restore behavior is not implemented here.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script exports the full session history, including user and assistant prompts, into a persistent local archive under the user's home directory without any consent prompt, redaction, or sensitivity filtering. Conversation history commonly contains secrets, personal data, credentials, or proprietary content, so silently persisting it increases exposure to local compromise, backup leakage, or unintended reuse by later tooling.

Ssd 3

Medium
Confidence
93% confidence
Finding
The script automatically reads archived prior-session content from a persistent file and returns the latest session for reuse in a new session. This creates a confidentiality risk because previously disclosed prompts or sensitive user data can be reintroduced outside their original context, increasing the chance of unintended retention, resurfacing, or disclosure.

Ssd 3

Medium
Confidence
95% confidence
Finding
The ingestion wrapper explicitly tells the consumer to treat archived conversation text as previous context and to continue naturally from it, which encourages wholesale reuse of prior prompts and disclosures. In a memory skill specifically designed to preserve all prompts across sessions, this materially increases the risk that stale, sensitive, or instruction-bearing content is trusted and propagated into later interactions.

Ssd 3

Medium
Confidence
97% confidence
Finding
Printing the full archived session context to stdout exposes prior user prompts in plain text to anyone with terminal access and may also leak into shell logs, recordings, CI logs, or monitoring systems. Because this skill archives and replays all prompts daily, the console output can unnecessarily disclose a large amount of sensitive historical conversation data.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The module docstring says this script will 'Set up cron jobs to monitor token usage' and 'enable automatic prompt archiving.' In reality, the code's primary effect is writing instructions into ~/.clawd/HEARTBEAT.md and creating ~/.clawd/memory, while the cron-related function only displays JSON and a suggested command rather than installing a scheduled task.

Ssd 3

Medium
Confidence
94% confidence
Finding
The script explicitly promotes archiving all prompts and later re-ingesting prior session context, which can capture secrets, personal data, tokens, and sensitive instructions from unrelated conversations. Persisting and replaying full prompt history increases the chance of cross-session data leakage and prompt-context poisoning, especially because old untrusted content may be reintroduced automatically into future sessions.

Ssd 3

Medium
Confidence
96% confidence
Finding
The heartbeat instructions direct routine export of session prompts when token usage is high, creating a recurring mechanism to persist potentially sensitive conversation contents to local storage. Because the collection is framed as automatic session maintenance, users may not realize that confidential prompts, embedded secrets, or adversarial instructions are being saved for later reuse.

Ssd 3

Medium
Confidence
97% confidence
Finding
The setup output tells the user that prompts will auto-export and previous context will be ingested in future sessions, reinforcing a design that persists and replays conversation history across boundaries. This is dangerous because it can leak sensitive information into later tasks and lets malicious or irrelevant prior instructions contaminate future model context without adequate trust separation.

Intent-Code Divergence

Low
Confidence
80% confidence
Finding
The function documentation and embedded heartbeat text describe when context restoration should occur, but the threshold in the inserted content is '< 5%' rather than the manifest's '1% (new sprint start).' This is an intent-level contradiction between the skill's documented behavior and what this setup script actually configures users to run.

Static analysis

No suspicious patterns detected.