Back to skill

Security audit

Aggressive Context Optimizer

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for reducing OpenClaw token usage, but it can persistently rewrite agent configuration after broad triggers without an in-script confirmation step.

Review the proposed config changes before using --apply, especially --apply --aggressive. The skill appears aimed at token-cost reduction rather than data theft or destructive behavior, but it can change how OpenClaw recalls memory, prunes context, and limits tool output across future sessions.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill instructs the agent to run a local Python script and describes behavior that implies file reads, file writes, and shell execution, but it does not declare any explicit tool scope or permissions boundaries. This creates a mismatch between advertised behavior and enforcement, increasing the chance that an agent will execute filesystem or shell actions without clear least-privilege constraints or user visibility.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The invocation text uses broad natural-language triggers like 'uses too many tokens,' 'wasteful,' or 'slow responses in long sessions,' which can match many ordinary complaints and cause the skill to activate in situations the user did not intend. Because this skill is 'aggressive and opinionated' and recommends config-changing actions, over-triggering can lead to unnecessary or premature system modifications.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/context_optimizer.py (reported line 63)May include surrounding context.

python
def _run(cmd: list[str]) -> str:
    return subprocess.check_output(cmd, text=True).strip()


def _extract_config_path(output: str) -> Path:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/context_optimizer.py (reported line 173)May include surrounding context.

python
def validate_config() -> tuple[bool, str]:
    proc = subprocess.run(
        ["openclaw", "config", "validate"],
        text=True, capture_output=True, check=False,
    )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This is a code file, so SQP-2 applies to safety-relevant file writes. The script performs a persistent configuration change via save_json() and rollback only covers validation failure, not user intent errors; there is no confirmation prompt before modifying the file and no explicit warning at the write point that the user's config will be changed.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.