Back to skill

Security audit

subsession-delete

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent purpose, but its deletion script can be steered outside the intended OpenClaw session folder by unchecked identifiers.

Review before installing or using. Run only in dry-run mode first, use a verified session key rather than a hand-entered path-like session id, do not run with elevated privileges, and avoid --execute until the script validates agent and session identifiers and enforces that all targets remain inside the intended OpenClaw sessions directory.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/delete_subsession.py:24
Finding

Path Traversal Enables Arbitrary Local File Deletion and Index Modification

Content
View full analysis
str: if agent_id: return agent_id if session_key: m = SESSION_KEY_RE.match(session_key) if m: return m.group("agent") raise SystemExit("Could not determine agent id; pass --agent-id.") ``` ```python def find_session_id(data: Any, session_key: Optional[str], session_id: Optional[str]) -> str: if session_id: return session_id if not session_key: raise SystemExit("Provide --session-key or --session-id.") entry = data.get(session_key) if not isinstance(entry, dict) or not entry.get("sessionId"): raise SystemExit(f"Session key not found in sessions.json: {session_key}") return entry["sessionId"] ``` ```python agent_id = infer_agent_id(args.session_key, args.agent_id) sessions_dir = Path.home() / ".openclaw" / "agents" / agent_id / "sessions" sessions_json = sessions_dir / "sessions.json" if not sessions_json.exists(): raise SystemExit(f"sessions.json not found: {sessions_json}") data = load_json(sessions_json) target_session_id = find_session_id(data, args.session_key, args.session_id) file_candidates = [ sessions_dir / f"{target_session_id}.jsonl", sessions_dir / f"{target_session_id}.trajectory.jsonl", sessions_dir / f"{target_session_id}.trajectory-path.json", ] ``` ```python if args.execute: for path in file_candidates: if path.exists(): path.unlink() if index_changed: sessions_json.write_text(json.dumps(pruned, ensure_ascii=False, indent=2) + "\n") ``` ### Technical Analysis The script accepts `--agent-id` and `--session-id` as path-forming input without validating their synt ...[truncated 2792 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README provides direct instructions for executing a destructive deletion operation but does not clearly warn that the action is irreversible and may remove session transcripts, trajectory data, and index entries. In an agent-skill context, operators may copy commands from documentation verbatim, so omission of an explicit data-loss warning increases the chance of accidental destruction of valuable records.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill performs destructive filesystem operations and modifies session index state, but it does not declare any explicit tool scope or permissions boundary. That omission increases the chance an agent can invoke file read/write capabilities more broadly than intended, making accidental or unauthorized deletion easier, especially because the skill targets local session artifacts and metadata.

Content

No source excerpt is available for this finding.