Back to skill

Security audit

ClawSergeant

Security checks for vulnerabilities and agentic risk

Overview

The skill is broadly aligned with agent training, but it gives LLM-generated content authority to message a real OpenClaw agent and write training state into future agent memory without enough user control.

Install only if you are comfortable with an LLM-generated trainer sending messages to the configured OpenClaw recipient and with training results being stored for later use. Use a test recipient or restricted OpenClaw profile first, avoid sensitive prompts or secrets, keep LLM_BASE_URL pointed at a trusted HTTPS provider, and review or disable any MEMORY.md write path before using it with a real agent workspace.

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
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (5)

T01 · Skill Instruction Hijacking

Error
Location
curriculum.py:145
Finding

Untrusted User Intent Is Converted into Instructions for an Autonomous Agent

Content
View full analysis
Curriculum: """Use the LLM to generate a training curriculum from a user intent string.""" prompt = CURRICULUM_DESIGN_PROMPT.format( stage_min=config.STAGE_COUNT_MIN, stage_max=config.STAGE_COUNT_MAX, tasks_min=config.TASKS_PER_STAGE_MIN, tasks_max=config.TASKS_PER_STAGE_MAX, ) conv = Conversation(system_prompt=prompt) conv.add( "user", f"Please design a training curriculum for the following requirement:\n\n" f"{user_intent}", ) logger.info("Generating training curriculum...") data = await llm.chat_json(conv, temperature=config.CURRICULUM_TEMPERATURE) return Curriculum.from_dict(data) ``` ```python if attempt == 1: instruction = ( f"Present the following training task to the Claw agent. " f"Craft a clear, well-structured message that the agent " f"will receive directly.\n\n" f"Task ID: {task.task_id}\n" f"Description: {task.description}\n" f"Scenario:\n{task.scenario}\n" f"Expected behavior: {task.expected_behavior}" ) else: instruction = ( f"The agent's previous response did not fully meet the " f"standards. Here is the evaluation:\n\n" f"Score: {result.score}/10\n" f"Weaknesses: {', '.join(result.weaknesses)}\n" f"Feedback: {result.feedback}\n" f"Suggestion: {result.suggestion}\n\n" f"Generate a follow-up message to help the agent improve. " f"You may rephrase the task, provide hints, or break it " f"into smaller steps — whatever you think will be most " f"effective as a trainer." ) trainer_msg ...[truncated 2436 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
trainer.py:241
Finding

Raw Agent Responses Can Inject Instructions into Trainer and Evaluator LLMs

Content
View full analysis
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
main.py:177
Finding

Attacker-Influenced Training Content Is Intended for Persistent Agent Memory

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
llm_handler.py:59
Finding

Configurable LLM Endpoint Receives the Bearer API Credential without Host Validation

Content
View full analysis
None: """Initialize the HTTP client.""" self._client = httpx.AsyncClient( base_url=self._base_url, headers={ "Authorization": f"Bearer {self._api_key}", "Content-Type": "application/json", }, timeout=httpx.Timeout(120.0, connect=10.0), ) ``` ### Technical Analysis `LLM_BASE_URL` is read from the environment and passed directly to `httpx.AsyncClient`. The bearer credential is configured as a default header for every request made by that client. There is no validation that the URL uses HTTPS, belongs to an approved provider, or matches the provider associated with the credential. An attacker who can alter the environment, `.env` file, deployment configuration, or launch command can redirect API traffic to an attacker-controlled endpoint and collect the bearer token. This issue does not independently give a remote attacker control over the environment. It turns configuration modification into direct credential disclosure and makes unsafe custom-endpoint configuration difficult to detect. ### Attack Path 1. An attacker gains the ability to modify `LLM_BASE_URL` in the process environment or `.env` file. 2. The attacker sets it to an HTTP or HTTPS server under their control. 3. The application loads the ...[truncated 712 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Dependency Versions Are Not Reproducibly Pinned

Content
View full analysis
=0.27 loguru>=0.7 python-dotenv>=1.0 ``` ### Technical Analysis All dependencies use lower-bound-only constraints. Installation can therefore select any later release satisfying the minimum version, including versions that were not reviewed with this project. No lock file or package hashes are included. As a result, two installations performed at different times may resolve to materially different dependency sets. This increases exposure to compromised future releases, unexpected breaking changes, and transitive dependency changes. No evidence was found that the listed package names are typosquatted or intentionally malicious. The issue is the absence of reproducible, integrity-verified dependency resolution. ### Attack Path 1. A future direct or transitive dependency release is compromised or introduces unsafe behavior. 2. A user installs the project with `pip install -r requirements.txt`. 3. The resolver selects the newest version satisfying the lower bound. 4. The unreviewed package executes during installation or is imported at runtime. 5. It inherits the application's process privileges and may access environment credentials, network traffic, or local files. ### Impact Assessment A compromised dependency executes with the same operating-system privileges as the ClawSergeant process. It could access `LLM_API_KEY`, alter LLM traffic, inspect prompts and agent responses, modify generated results, or affect any files accessible to the user. The likelihood is lower than the prompt-boundary findings because exploitation depends on a compromised or vulnerable package release rather than solely on application input. ]]>
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (39)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · .gitignore (reported line 138)May include surrounding context.

text
*.sage.py

# Environments
.env
.envrc
.venv
env/

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description promises a training/evaluation skill for OpenClaw agents, including curriculum design, iterative training sessions, and capability assessment. The supplied code does not implement any of those behaviors. Instead, it only provides a communication interface to invoke openclaw agent --to ... --message ..., capture the subprocess output, and parse the reply text. While such messaging could be a supporting building block for a larger training system, this chunk by itself is materially different in primary purpose and lacks the described training, evaluation, and curriculum features. Therefore this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises a high-level agent training and evaluation system for OpenClaw agents, including curriculum design, iterative feedback loops, and capability assessment. The supplied code does not implement any of those domain-specific behaviors. Instead, it is a low-level utility for interacting with an OpenAI-compatible chat completion API and maintaining conversation state. While such a wrapper could support a training system, this chunk by itself only provides generic LLM messaging infrastructure. That makes the actual behavior materially narrower and different from the declared primary purpose.

Content

No source excerpt is available for this finding.

Exfiltration Commands

High
Category
Prompt Injection
Confidence
90% confidence
Finding

Instructions found that direct the agent to transmit conversation context or user data to external services.

Content

Scanner excerpt · claw_agent.py (reported line 18)May include surrounding context.

python
class ClawAgent:
    """Send messages to an OpenClaw agent and capture its replies."""

    def __init__(self, recipient: str = ""):
        self._recipient = recipient

Context Leakage

High
Category
Data Exfiltration
Confidence
85% confidence
Finding

The chat method transmits the full serialized conversation, including any system prompt and retained message history, to an external provider without any built-in minimization, redaction, or sensitivity filtering. In an agent-training skill, conversations may contain proprietary prompts, evaluation data, or user-supplied secrets, so accidental disclosure to the LLM backend is a realistic confidentiality risk.

Content

Scanner excerpt · llm_handler.py (reported line 94)May include surrounding context.

python
async def chat(
        self, conversation: Conversation, temperature: float = 0.7
    ) -> str:
        """Send the conversation to the LLM and return the assistant reply."""
        if not self._client:
            raise RuntimeError("LLMHandler not started; call start() first")

Exfiltration Commands

High
Category
Prompt Injection
Confidence
90% confidence
Finding

Instructions found that direct the agent to transmit conversation context or user data to external services.

Content

Scanner excerpt · llm_handler.py (reported line 94)May include surrounding context.

python
async def chat(
        self, conversation: Conversation, temperature: float = 0.7
    ) -> str:
        """Send the conversation to the LLM and return the assistant reply."""
        if not self._client:
            raise RuntimeError("LLMHandler not started; call start() first")

Context Leakage

High
Category
Data Exfiltration
Confidence
85% confidence
Finding

The chat_json method has the same context-leakage issue as chat: it forwards full conversation state to an external service and only constrains output format, not input sensitivity. Because this skill is designed for iterative agent training and evaluation, accumulated dialogue may include internal rubrics, test cases, or confidential operational context that should not be broadly disclosed.

Content

Scanner excerpt · llm_handler.py (reported line 114)May include surrounding context.

python
async def chat_json(
        self, conversation: Conversation, temperature: float = 0.3
    ) -> dict:
        """Send the conversation and parse the reply as JSON.

        Uses the response_format API parameter to enforce valid JSON output.
        """

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · main.py (reported line 109)May include surrounding context.

python
def _env_setup() -> tuple[str, str, str, str]:
    """Load .env and return (api_key, base_url, model, recipient)."""
    load_dotenv()
    api_key = os.getenv("LLM_API_KEY", "")
    base_url = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · main.py (reported line 116)May include surrounding context.

python
def _env_setup() -> tuple[str, str, str, str]:
    """Load .env and return (api_key, base_url, model, recipient)."""
    load_dotenv()
    api_key = os.getenv("LLM_API_KEY", "")
    base_url = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test_phases.py (reported line 40)May include surrounding context.

python
def _env_setup() -> tuple[str, str, str, str]:
    """Load .env and return (api_key, base_url, model, recipient)."""
    load_dotenv()
    api_key = os.getenv("LLM_API_KEY", "")
    base_url = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test_phases.py (reported line 57)May include surrounding context.

python
api_key, base_url, model, *_ = _env_setup()
    if not api_key:
        sys.exit("[FAIL] LLM_API_KEY not set in .env")

    print(f"\n=== Phase 1: LLM Connection Test ===")
    print(f"Base URL : {base_url}")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test_phases.py (reported line 87)May include surrounding context.

python
api_key, base_url, model, *_ = _env_setup()
    if not api_key:
        sys.exit("[FAIL] LLM_API_KEY not set in .env")

    print(f"\n=== Phase 1: LLM Connection Test ===")
    print(f"Base URL : {base_url}")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test_phases.py (reported line 129)May include surrounding context.

python
api_key, base_url, model, *_ = _env_setup()
    if not api_key:
        sys.exit("[FAIL] LLM_API_KEY not set in .env")

    print(f"\n=== Phase 1: LLM Connection Test ===")
    print(f"Base URL : {base_url}")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test_phases.py (reported line 158)May include surrounding context.

python
api_key, base_url, model, *_ = _env_setup()
    if not api_key:
        sys.exit("[FAIL] LLM_API_KEY not set in .env")

    print(f"\n=== Phase 1: LLM Connection Test ===")
    print(f"Base URL : {base_url}")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test_phases.py (reported line 160)May include surrounding context.

python
api_key, base_url, model, *_ = _env_setup()
    if not api_key:
        sys.exit("[FAIL] LLM_API_KEY not set in .env")

    print(f"\n=== Phase 1: LLM Connection Test ===")
    print(f"Base URL : {base_url}")

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
70% confidence
Finding

Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.

Content

Scanner excerpt · trainer.py (reported line 250)May include surrounding context.

python
eval_conv = Conversation(
            system_prompt=(
                "You are an objective AI training evaluator. "
                "Always respond in valid JSON."
            )
        )
        eval_conv.add(

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill describes capabilities involving environment variables, file writes, network access, and shell/CLI execution, but it does not declare any tool scope or permission boundaries. This creates an implicit over-privilege risk: a caller or host may invoke the skill without clear restrictions, increasing the chance of unintended command execution, data access, or outbound transmission.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The invocation text is broad enough to match many generic requests about improving or evaluating AI agents, which can cause the skill to activate in contexts where the user did not intend persistent logging, network use, or agent communication. Over-broad triggering increases the risk of unnecessary exposure of prompts, transcripts, and operational side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill states that evaluations, stage results, and summaries are written to local lesson logs and MEMORY.md, but it does not prominently warn users that transcripts and outputs will be persisted. This can lead to unintentional storage of sensitive prompts, agent responses, credentials, or proprietary data in locations that may later be accessed by other tools or users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code posts the full serialized conversation to a remote chat completions endpoint, which may include user-provided or system data. While the module docstrings describe LLM communication, there is no user-facing disclosure, confirmation, or explicit warning in the file about external transmission of conversation contents.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The code pulls an environment-configured recipient for a real agent and later uses learning memory integration, giving it the ability to target external agent endpoints and persist outputs into shared workspace state. Those capabilities exceed a narrowly scoped local curriculum designer and increase the chance of unintended interaction with production-like agents or contamination of persistent memory.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill persists a training summary into an OpenClaw workspace MEMORY.md file, which changes state outside the immediate training run and can influence future agent behavior or downstream processes. In a training/evaluation tool, writing into shared workspace memory is more sensitive than ordinary result export because it creates durable side effects in another system context.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
"""Load .env and return (api_key, base_url, model, recipient)."""
    load_dotenv()
    api_key = os.getenv("LLM_API_KEY", "")
    base_url = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")
    model = os.getenv("LLM_MODEL", "gpt-4o")
    recipient = os.getenv("CLAW_RECIPIENT", "")
    return api_key, base_url, model, recipient

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · llm_handler.py (reported line 64)May include surrounding context.

python
"""Load .env and return (api_key, base_url, model, recipient)."""
    load_dotenv()
    api_key = os.getenv("LLM_API_KEY", "")
    base_url = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")
    model = os.getenv("LLM_MODEL", "gpt-4o")
    recipient = os.getenv("CLAW_RECIPIENT", "")
    return api_key, base_url, model, recipient

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · main.py (reported line 121)May include surrounding context.

python
"""Load .env and return (api_key, base_url, model, recipient)."""
    load_dotenv()
    api_key = os.getenv("LLM_API_KEY", "")
    base_url = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")
    model = os.getenv("LLM_MODEL", "gpt-4o")
    recipient = os.getenv("CLAW_RECIPIENT", "")
    return api_key, base_url, model, recipient