Back to skill

Security audit

Pi Workflow Orchestration

Security checks for vulnerabilities and agentic risk

Overview

This workflow skill is not deceptive or destructive, but it broadly instructs agents to persist session learnings and promote them into future-governing files without clear consent or review gates.

Install only if you want persistent self-improvement notes in your workspace. Before using it, decide where lessons may be written, do not log secrets or private user content, review diffs before running the sync script or git push, and require explicit approval before anything is promoted into AGENTS.md, SOUL.md, TOOLS.md, MEMORY.md, or published skill files.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Warning
Location
hooks/openclaw/handler.ts:45
Finding

Bootstrap Instructions Can Poison Persistent Agent Governance

Content
View full analysis

Vulnerability Details

File Location: hooks/openclaw/handler.ts:45-52
Additional Locations: hooks/openclaw/handler.js:44-51, references/phase1-phase2-enhanced-lessons.md:120, references/phase1-phase2-enhanced-lessons.md:303-325, SKILL.md:24-31
Vulnerability Type: Persistent agent memory and governance poisoning
Risk Level: Medium

Vulnerable Code

typescript
### Tracking Recurring Patterns
- Increment \`Recurrence-Count\` when you see same issue again
- When count ≥ 3 over 30 days → consider promoting to permanent rule in AGENTS.md

### Promotion Path
When a lesson becomes broadly applicable:
- **Behavioral patterns** → \`SOUL.md\`
- **Workflow improvements** → \`AGENTS.md\`
- **Tool gotchas** → \`TOOLS.md\`

The injected content is installed into the main agent's bootstrap context by the following handler logic:

typescript
if (Array.isArray(event.context.bootstrapFiles)) {
  event.context.bootstrapFiles.push({
    path: 'PI_WORKFLOW_REMINDER.md',
    content: REMINDER_CONTENT,
    virtual: true,
  });
}

The associated Skill instructions also mandate persistent lesson capture:

markdown
- After ANY correction from the user: update `tasks/lessons.md` with metadata
- Write rules for yourself that prevent the same mistake
- Review lessons at session start for relevant projects
- Track recurring patterns with Recurrence-Count

Technical Analysis

The bootstrap hook injects instructions into each main-agent session directing the agent to record corrections, errors, and observations in persistent workspace files. It further recommends promoting recurring observations into AGENTS.md, SOUL.md, and TOOLS.md, which can govern behavior across later sessions.

The workflow does not require explicit user approval, source-trust validation, sanitization, or provenance review before a lesson is promoted. Consequently, content originating from ...[truncated 2090 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require explicit user confirmation before writing to AGENTS.md, SOUL.md, TOOLS.md, MEMORY.md, or any other persistent governance file.
  2. Treat repository content, external documents, task descriptions, web content, and tool output as untrusted sources that cannot directly create or promote behavioral rules.
  3. Add provenance metadata to every lesson, including its source, originating session, trust level, related files, and the user who approved it.
  4. Store automatically captured lessons in a quarantined candidate file rather than an active memory or governance file.
  5. Require a review step that displays the exact proposed rule, its source evidence, and its expected behavioral impact before promotion.
  6. Sanitize promoted content by rejecting embedded instructions to override safety constraints, execute commands, expose secrets, modify permissions, or trust external inputs.
  7. Change mandatory wording such as “After ANY correction” to advisory wording that permits the agent to reject suspicious or task-specific corrections.
  8. Restrict hook instructions to documentation and reminders; do not instruct the agent to modify persistent governance files automatically.
  9. Maintain an auditable change history and provide a straightforward rollback mechanism for all promoted rules.
  10. Keep the hook disabled by default unless the user explicitly opts into persistent self-improvement behavior.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (22)

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 · HOOKS-INTEGRATION-COMPLETE.md (reported line 236)May include surrounding context.

md
### Hook shows outdated information

The reminder is injected at session start. If you edit SKILL.md or reference docs:
- Restart gateway: `openclaw gateway restart`
- The reminder references docs files, not hardcoded paths

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill's description presents it as a broad workflow and quality framework, but the concrete behavior includes persistent file logging and lesson synchronization mechanics that materially affect the filesystem. When a skill's declared purpose does not clearly match its operational behavior, users and orchestrators may activate it without understanding that it will store session-derived data or run sync-related actions, which undermines informed consent and safe review.

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 · HOOKS-INTEGRATION-COMPLETE.md (reported line 297)May include surrounding context.

md
### Quarterly
- Review all lessons in skill repository
- Consolidate related lessons
- Update SKILL.md if lessons reveal new patterns

## Integration with Workflow

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 · references/lessons_update_guide.md (reported line 130)May include surrounding context.

md
### Quarterly
- Review all lessons in skill repository
- Consolidate related lessons
- Update SKILL.md if lessons reveal new patterns

## Integration with Workflow

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 · HOOKS-INTEGRATION-COMPLETE.md (reported line 131)May include surrounding context.

event.context.bootstrapFiles.push({ path: 'PI_WORKFLOW_REMINDER.md', content: REMINDER_CONTENT, virtual: true, // No file system write });

text

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README says the skill is triggered when you need to do things like 'start a new project,' 'review code quality,' or 'capture and learn from mistakes,' which are broad situations rather than specific invocation phrases or constrained contexts. It does not provide clear boundaries, explicit trigger phrases, or exclusion examples, so the skill could be invoked more widely than intended.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill instructs the agent to read from and write to multiple workspace files (tasks/*.md, memory/*.md) and references executable commands, but it declares no explicit tool scope or permissions boundaries. In practice, this can cause an agent platform to grant or infer broader file capabilities than a user expects, increasing the risk of unauthorized persistence or modification of local data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The 'use when' description is very broad and can trigger the skill for routine development or general multi-step tasks. Because the skill also encourages persistent logging and workflow mutation, over-broad activation increases the chance that it will be invoked in contexts where users did not intend data retention or autonomous file updates.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The instruction to enter plan mode for 'ANY non-trivial task' is ambiguous catch-all language that effectively expands this skill's reach to a large fraction of user work. In context, that makes the persistence, logging, and autonomy features more dangerous because they may be applied by default rather than only in narrowly approved situations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly directs persistent logging of user corrections, command failures, feature requests, and session artifacts into workspace files, but it provides no privacy notice, retention policy, minimization rules, or consent checkpoint. This creates a real risk of storing sensitive user inputs, operational details, or secrets in durable plaintext files that may later be synced, shared, or committed to version control.

Content

No source excerpt is available for this finding.

Persistent Context Injection

Medium
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill injects content designed to persist in agent memory or context across interactions. Persistent injection can alter agent behavior long after the initial interaction.

Content

Scanner excerpt · hooks/openclaw/handler.js (reported line 45)May include surrounding context.

js
### Tracking Recurring Patterns
- Increment \`Recurrence-Count\` when you see same issue again
- When count ≥ 3 over 30 days → consider promoting to permanent rule in AGENTS.md

### Promotion Path
When a lesson becomes broadly applicable:

Persistent Context Injection

Medium
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill injects content designed to persist in agent memory or context across interactions. Persistent injection can alter agent behavior long after the initial interaction.

Content

Scanner excerpt · hooks/openclaw/handler.ts (reported line 46)May include surrounding context.

ts
### Tracking Recurring Patterns
- Increment \`Recurrence-Count\` when you see same issue again
- When count ≥ 3 over 30 days → consider promoting to permanent rule in AGENTS.md

### Promotion Path
When a lesson becomes broadly applicable:

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/lessons_update_guide.md (reported line 14)May include surrounding context.

  • Example:
    markdown
    ## Always Read API Docs First
    - **Pattern:** Assumed API behavior without checking docs
    - **Lesson:** Read documentation before writing code
    - **Why:** Saves debugging time, prevents wrong approach
    - **Applied to:** Project X authentication issue
    

Persistent Context Injection

Medium
Category
Memory Poisoning
Confidence
84% confidence
Finding

The guidance explicitly recommends promoting recurring lessons into AGENTS.md or SOUL.md as permanent rules, which can persistently alter future agent behavior. Because these lessons may originate from untrusted corrections, mistakes, or adversarial input, this creates a context-poisoning path where bad guidance becomes durable instruction and influences later tasks.

Content

Scanner excerpt · references/phase1-phase2-enhanced-lessons.md (reported line 120)May include surrounding context.

md
3. If not found:
   - Create new entry with `Recurrence-Count: 1`

**Promotion Trigger**: When `Recurrence-Count >= 3` over a 30-day window, consider promoting to a permanent rule in AGENTS.md or SOUL.md.

### Example: Complete Lesson Entry

Persistent Context Injection

Medium
Category
Memory Poisoning
Confidence
82% confidence
Finding

The summary reinforces the practice of promoting high-value lessons to permanent rules, normalizing persistence of behavioral instructions across sessions. In a workflow skill focused on self-improvement, that increases the risk that incorrect, overbroad, or adversarially seeded lessons become long-lived policy and silently shape future agent decisions.

Content

Scanner excerpt · references/phase1-phase2-enhanced-lessons.md (reported line 378)May include surrounding context.

md
- **Phase 1** adds metadata (Priority, Status, Area, Pattern-Key) for better filtering and recurring pattern detection
- **Phase 2** separates lessons, errors, and features into three files with clear intent
- No automation required—just structured markdown
- Review periodically to promote high-value lessons to permanent rules
- Sync monthly to skill repository for version control

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file includes invocation guidance that tells the agent to enter plan mode for 'ANY non-trivial task', but the threshold is still subjective and could apply to a wide range of ordinary requests. The description does not provide concrete exclusions or negative examples, making activation scope overly broad.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The instruction to update lessons after 'ANY correction from the user' creates an overly broad trigger for persistent recording of user interactions. This can cause sensitive, irrelevant, or personal information from routine corrections to be stored indefinitely without necessity, increasing privacy and prompt-injection persistence risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

These lines direct the agent to persist information into tasks/lessons.md after user corrections, but provide no warning that user-provided content may be retained across sessions. Persistent storage without transparency or minimization can leak sensitive information, preserve injected instructions, and create unintended long-term data retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly defines session logs and curated memory storage, but omits any privacy, consent, or retention guidance. In a workflow orchestration skill, this is risky because broad operational use increases the chance that sensitive project details, user inputs, or injected content will be written into durable memory artifacts.

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 · scripts/sync_lessons.py (reported line 48)May include surrounding context.

python
def save_file(path, content):
    """Save content to file, create parent dirs if needed"""
    path = Path(path)
    path.parent.mkdir(parents=True, exist_ok=True)
    with open(path, 'w') as f:

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The section at L333-L340 states that Phase 1+2 is 'manual and lightweight' with 'No shell hooks needed,' which suggests minimal tooling. However, L296-L300 and L348-L358 prescribe command-line execution of a Python sync script plus git commit/push steps, introducing operational automation beyond the plain 'just structured markdown' framing. This is a documentation-level contradiction rather than a direct security capability issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation provides commands that modify repository contents and publish them upstream without an explicit warning that they will change local files, create commits, and push data to a remote. In an agent-oriented workflow skill, this increases the chance of unintended publication of workspace-derived content or sensitive internal notes if copied and executed without scrutiny.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.