Back to skill

Security audit

Collect Session

Security checks for vulnerabilities and agentic risk

Overview

This skill is a documented session-history collector, but it automatically reads and stores broad OpenClaw session data and can send user-message excerpts plus a LiteLLM key to a configurable endpoint without strong privacy controls.

Install only if you want automatic long-term session logging. Keep the output directory out of shared or synced repositories, use --no-llm or leave LITELLM_API_KEY unset for sensitive work, restrict LITELLM_BASE_URL to a trusted local endpoint, and periodically delete or protect the generated Markdown and JSONL logs.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/collect-session.mjs:274
Finding

Session Content and API Credentials Can Be Sent to an Unvalidated Network Endpoint

Content
View full analysis
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Warning
Location
scripts/hook-handler.ts:15
Finding

Unvalidated Event Context Controls the JavaScript File Executed by the Hook

Content
View full analysis
((resolve) => { execFile("node", args, { timeout: 120_000 }, (err, stdout, stderr) => { ``` ### Technical Analysis The hook obtains `workspaceDir` from mutable event context and uses it to select a JavaScript file. It then invokes Node with that file as the executable script. The path is not canonicalized or checked against a trusted workspace root, and the target file's ownership and permissions are not verified. Using `execFile` rather than a shell prevents conventional shell metacharacter injection. However, it does not prevent executable payload substitution: if the workspace directory points to an attacker-controlled location, Node directly executes the attacker's `scripts/collect-session.mjs`. Exploitation requires the attacker to influence the relevant event context or trusted workspace configuration and to create a file at the derived path. The reviewed code does not establish that ordinary untrusted session me ...[truncated 1539 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (10)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 27)May include surrounding context.

md
Copy `scripts/collect-session.mjs` to your workspace scripts directory:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 36)May include surrounding context.

md
Copy `scripts/collect-session.mjs` to your workspace scripts directory:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly states it captures every session, including turns, tool calls, model usage, and writes rich Markdown summaries to disk, but it provides no privacy warning, scoping limits, retention guidance, or redaction controls. This can cause sensitive prompts, secrets, internal file paths, tool outputs, or personal data to be persistently stored in searchable local artifacts, increasing exposure after compromise or accidental sharing.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented behavior is to persist entire session contents and related telemetry into multiple local files, including a searchable index and JSONL log. Persisting comprehensive conversation and tool activity creates a durable record of potentially sensitive operational data that may later be accessed by other local users, backup systems, malware, or accidentally committed to source control.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 59)May include surrounding context.

Copy scripts/hook-handler.ts to your OpenClaw hooks directory and register it:

bash
mkdir -p ~/.openclaw/hooks/collect-session
cp hook-handler.ts ~/.openclaw/hooks/collect-session/handler.ts

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 126)May include surrounding context.

md
**Hook not firing on /new:** Check that `collect-session` is enabled in `openclaw.json` and the gateway was restarted. Look for `[collect-session]` lines in gateway logs.

**`LITELLM_API_KEY not configured` warning:** Set `LITELLM_API_KEY` env var or edit the CONFIG block. The script will fall back to heuristic titles but still write session files.

**Sessions directory not found:** The default sessions path is `~/.openclaw/agents/main/sessions`. If you use a custom agent name, update `SESSIONS_DIR` in the CONFIG block.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The enrichment flow intentionally extracts user message excerpts and forwards them to an LLM, then stores model-generated summaries and keywords derived from that content. This creates a data-sharing and data-retention chain for potentially sensitive session material, and the downstream summary may preserve or amplify confidential details that were present in the original conversation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script sends sampled user session content to a LiteLLM endpoint for title/keyword/summary generation without any explicit consent flow, sensitivity check, or redaction step. Even though the default endpoint is localhost, LiteLLM commonly proxies to third-party model providers, so private prompts, secrets, file paths, or other sensitive context can be disclosed outside the local machine.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The generated Markdown front matter and later JSONL logging preserve session identifiers, source filenames, full source paths, costs, and other session-derived details on disk. In an agent skill context, this is more dangerous because session files may contain traces of user activity and repository locations, and persistent logs broaden the attack surface beyond the original session artifact.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script persistently stores session-derived metadata, summaries, keywords, source paths, and usage details into Markdown and JSONL files without any warning about sensitivity or retention. Those files can accumulate confidential conversation content and filesystem information, increasing exposure if the workspace is shared, synced, backed up, or later exfiltrated.

Content

No source excerpt is available for this finding.