Back to skill

Security audit

Claw Service Hub

Security checks for vulnerabilities and agentic risk

Overview

The skill is a plausible service-hub CLI, but it overstates implemented security features and uses under-scoped plaintext network/service-management behavior.

Review this before installing or deploying. Use it only with trusted local hubs or protected networks unless TLS and authentication are added, avoid sending sensitive call parameters through it, and verify the missing server/auth components come from a trusted package.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
cli.py:14
Finding

Unsafe Module Resolution Enables Local Python Module Hijacking

Content
View full analysis

Vulnerability Details

File Location: cli.py:14-16 and cli.py:93-108
Vulnerability Type: Python import path manipulation and untrusted external module loading
Risk Level: Medium

Vulnerable Code

python
# Add project root to path for imports
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
python
# Import and run the server
import sys
import os

# Ensure project root is in path
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_root not in sys.path:
    sys.path.insert(0, project_root)

# Set port environment variables
os.environ.setdefault("HUB_PORT", str(port))
os.environ.setdefault("HUB_HTTP_PORT", str(http_port))

try:
    from server.main import HubServer

Technical Analysis

The CLI places the parent of the package directory at the beginning of sys.path and subsequently imports the generic module name server.main. The audited project does not contain a corresponding server package.

Because the injected directory receives the highest import precedence, Python will load a server/main.py file found there before modules from ordinary dependency locations. Python executes module-level statements during import, so a malicious or compromised module can run arbitrary code before HubServer is instantiated.

This is an unsafe dependency-resolution pattern. Exploitation requires the attacker to be able to create or modify a server package in the injected parent directory.

Attack Path

  1. An attacker obtains write access to the directory inserted at the beginning of sys.path.
  2. The attacker creates server/__init__.py and server/main.py in that directory.
  3. The malicious server/main.py contains attacker-controlled module-level Python code and a compatible HubServer symbol.
  4. A user invokes the start CLI command.
  5. from server.main import HubServer resolv ...[truncated 592 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove both modifications to sys.path.

  • Package the server implementation inside the same Python distribution.

  • Use an explicit package-relative import, for example:

    python
    from .server.main import HubServer
    
  • If the server is intentionally supplied by another distribution, use a uniquely named, pinned dependency and import it through its canonical package name.

  • Define and verify dependencies through standard packaging metadata with version constraints and integrity controls.

  • Fail safely with a clear error when the server component is unavailable rather than searching generic filesystem locations.

  • Run the service under a dedicated, least-privileged operating-system account to reduce the impact of any future import compromise.

T09 · Insecure Skill Coding Practices

Warning
Location
cli.py:25
Finding

Service Registration and Invocation Data Transmitted over Plaintext Protocols

Content
View full analysis

Vulnerability Details

File Location: cli.py:25-57
Vulnerability Type: Unencrypted HTTP and WebSocket communications
Risk Level: Medium

Vulnerable Code

python
def get_http_url(host: str = DEFAULT_HOST) -> str:
    """Get REST API URL"""
    return f"http://{host}:{DEFAULT_HTTP_PORT}"


async def call_api(endpoint: str, method: str = "GET", data: Optional[dict] = None):
    """Make HTTP request to server REST API"""
    url = f"{get_http_url()}{endpoint}"
    async with aiohttp.ClientSession() as session:
        try:
            if method == "GET":
                async with session.get(url) as resp:
                    return await resp.json()
            elif method == "POST":
                async with session.post(url, json=data) as resp:
                    return await resp.json()
            elif method == "DELETE":
                async with session.delete(url) as resp:
                    return await resp.json()
        except aiohttp.ClientError as e:
            click.echo(f"Error connecting to server: {e}", err=True)
            return None


async def ws_send_and_wait(host: str, message: dict) -> Optional[dict]:
    """Send message via WebSocket and wait for response"""
    ws_url = f"ws://{host}:{DEFAULT_PORT}"
    try:
        async with websockets.connect(ws_url) as ws:
            await ws.send(json.dumps(message))

            # Wait for response with timeout
            try:
                response = await asyncio.wait_for(ws.recv(), timeout=WS_TIMEOUT)
                return json.loads(response)

Technical Analysis

The client constructs REST and WebSocket endpoints using http:// and ws://. Neither protocol provides transport encryption, endpoint authentication, or message-integrity protection.

The WebSocket helper accepts a caller-selected host and transmits complete JSON messages. These messages can include service registrat ...[truncated 1598 chars]

Remediation
View remediation

Remediation Suggestions

  • Use https:// for REST requests and wss:// for WebSocket connections.
  • Require valid TLS certificates and hostname verification; do not disable certificate validation.
  • Accept a complete, explicitly configured Hub URL rather than constructing URLs from an unrestricted host and fixed plaintext scheme.
  • Reject plaintext connections to non-loopback addresses by default.
  • If plaintext is necessary for local development, require a clearly named opt-in flag such as --allow-insecure, accompanied by a warning.
  • Forward the selected host and port consistently to REST helpers instead of silently using the default localhost value.
  • Add authentication and message-level authorization in addition to TLS, particularly for registration, invocation, and deletion operations.
  • Avoid placing credentials or highly sensitive values in request bodies until secure transport and endpoint authentication are established.
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description describes a substantial service hub core with multiple runtime capabilities. However, the provided code chunk is only an init.py file containing a module docstring, version/author metadata, and an import/export of a CLI symbol. Based on this chunk alone, the actual behavior is limited to package initialization and CLI exposure. Therefore, the supplied code does not match the declared purpose in any material way.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

The description claims this is the core of the OpenClaw service marketplace, including service registration, discovery, calling, WebSocket tunnel invocation, and key authorization. The provided code does support service registration, listing/discovery, calling, unregistering, status checks, and launching a server, using REST and WebSocket communications. However, the chunk is specifically a command-line interface and thin client for interacting with a hub, not the core hub implementation itself. It also does not show any key-based authorization mechanism, authentication checks, or explicit provider/consumer role logic. Because an important declared capability (key authorization) is absent and the primary role of this code chunk is a CLI rather than the core service-market server logic, this is a material description-to-code mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares environment-variable requirements and documents networked/WebSocket functionality, but it does not declare an explicit tool scope such as permissions or allowed-tools. That omission can lead to overbroad execution in agent environments, where the skill may access network or environment resources without clear user visibility or policy constraints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill explicitly supports service registration, discovery, and WebSocket-based invocation over the network, yet it provides no warning about privacy, trust boundaries, exposed services, or system-impact risks. In an agent context, this can cause users to connect to untrusted endpoints or expose local services without understanding the security implications.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

Natural-language policy issues apply to all file types, including markdown. Here the description and the rest of the document are effectively fixed to Chinese, with no indication that users can choose another language or that the skill is intentionally limited to a Chinese-speaking context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The help text and default value for --price-unit use Chinese-only examples and default to 次, which imposes a specific language/locale in the user-facing interface. There is no indication that the tool is region-specific or that users can choose a preferred locale beyond manually overriding the raw value.

Content

No source excerpt is available for this finding.