Back to skill

Security audit

clawrent-testing

Security checks for vulnerabilities and agentic risk

Overview

This skill automates Clawrent Telegram access, but its expired-rental handling can wipe the whole local Telegram allowlist instead of only one rental.

Review before installing. This skill should only be used if you are comfortable with Clawrent API data automatically approving Telegram pairings and changing local OpenClaw access-control files. The expired-rental logic should be fixed to remove only the relevant rental, the allowlist should be backed up, and CLAWRENT_URL should not be set to any untrusted endpoint.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
clawrent-approve.sh:27
Finding
Expired Rental Processing Deletes the Entire Telegram Allowlist<![CDATA[ ## Vulnerability Details **File Location**: `clawrent-approve.sh:27-30, 70-76` **Vulnerability Type**: Improper authorization revocation and excessive privilege **Risk Level**: High ### Vulnerable Code ```bash clear_allowlist() { mkdir -p "$(dirname "$ALLOW_FILE")" echo "[]" > "$ALLOW_FILE" } ``` The function is invoked for every expired approval: ```bash echo "Revoking expired lease: ${code:-unknown-code}" if clear_allowlist; then if mark_status "$approval_id" "expired"; then echo "Marked expired: $approval_id" else echo "Failed to mark expired: $approval_id" fi else echo "Failed to clear allowlist for expired lease: $approval_id" fi ``` ### Technical Analysis The declared functionality is to revoke access associated with expired rentals. However, `clear_allowlist` replaces the complete Telegram authorization file with an empty JSON array. It does not identify or remove only the user associated with the expired lease. Although each expired record includes an `id` and potentially a `code`, neither value is used to locate a corresponding entry in the local allowlist. Consequently, the remote expiration status grants broader control over local access than is necessary for the Skill's stated purpose. The credential-related path access is therefore security-sensitive and exceeds least privilege: the script modifies the entire Telegram allowlist when it only needs to revoke one rental. ### Attack Path 1. The Clawrent API returns at least one object in response to the `status=expired` query. 2. `process_expired` accepts the object after checking only that its `id` is nonempty and not `null`. 3. The script calls `clear_allowlist` without confirming that the record maps to an existing, locally tracked rental. 4. `clear_allowlist` overwrites `telegram-allowFrom.json` with `[]`. 5. Every Telegram identity in the allowlist loses access, including identities unrelated to the expired rental. 6. The script reports the remote approval as ...[truncated 784 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Associate every approved rental with a specific, stable Telegram identity rather than relying only on a pairing code or remote approval ID. - Parse the current allowlist and remove only the entry associated with the expired rental. - Verify that the remote expiration record maps to a locally tracked and currently active lease before changing local access-control state. - Preserve unrelated allowlist entries. - Write the updated JSON to a temporary file with restrictive permissions, validate it with `jq`, and atomically rename it over the original file. - Avoid creating a missing credential directory or allowlist automatically during revocation unless that behavior is explicitly required. - Preserve the original file and refrain from reporting the remote status as expired if targeted local revocation cannot be completed safely. - Consider maintaining a separate ledger of identities added by this Skill so it cannot revoke identities managed by administrators or other integrations. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
clawrent-approve.sh:4
Finding
Unvalidated API URL Override Can Exfiltrate the Clawrent Bearer Token<![CDATA[ ## Vulnerability Details **File Location**: `clawrent-approve.sh:4, 8-25` **Vulnerability Type**: Unrestricted credential destination **Risk Level**: Medium ### Vulnerable Code ```bash CLAWRENT_API="${CLAWRENT_URL:-https://clawrent.ai}/api/approvals" ``` The bearer token is sent to the resulting URL by both request functions: ```bash fetch_by_status() { local status="$1" curl -sf \ -H "Authorization: Bearer $CLAWRENT_TOKEN" \ -H "X-Clawrent-Skill: $SKILL_VERSION" \ "$CLAWRENT_API?status=$status" 2>/dev/null || echo "[]" } mark_status() { local approval_id="$1" local status="$2" curl -sf -X PATCH \ -H "Authorization: Bearer $CLAWRENT_TOKEN" \ -H "X-Clawrent-Skill: $SKILL_VERSION" \ -H "Content-Type: application/json" \ "$CLAWRENT_API" \ -d "{\"id\":\"$approval_id\",\"status\":\"$status\"}" >/dev/null } ``` ### Technical Analysis Using the bearer token with the default `https://clawrent.ai` endpoint is necessary for the declared synchronization behavior. The security issue is that `CLAWRENT_URL` can replace the trusted origin without any scheme, hostname, port, or transport validation. If an attacker can influence the Skill's execution environment or configuration, the attacker can set `CLAWRENT_URL` to an arbitrary server. The script then transmits `CLAWRENT_TOKEN` in the `Authorization` header to that server. It also permits a plaintext HTTP URL, which could expose the token to network interception. The attacker-controlled endpoint can return syntactically valid approval data. This creates a combined confidentiality and integrity risk: the endpoint can steal the API credential and influence local Telegram pairing approvals or expiration processing. ### Attack Path 1. An attacker gains control over, or causes a user to configure, the `CLAWRENT_URL` environment variable. 2. The attacker sets it to an attacker-operated HTTPS endpoint or a plaintext HTTP endpoint subject to interception. 3. The Skill co ...[truncated 1304 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Remove the `CLAWRENT_URL` override in production if custom endpoints are not required. - If endpoint customization is required, parse and validate the URL before any authenticated request. - Require the `https` scheme and reject plaintext HTTP. - Allowlist the expected hostname, such as `clawrent.ai`, and reject unapproved subdomains, ports, embedded credentials, fragments, and redirects to other origins. - Configure `curl` to reject cross-origin credential forwarding and avoid enabling redirect following unless every redirect target is validated. - Separate development credentials from production credentials when custom development endpoints are necessary. - Use a narrowly scoped, revocable token with the minimum API permissions required for fetching and updating approvals. - Fail closed when endpoint validation fails; do not send the authorization header or continue processing remote responses. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The declared purpose says the skill revokes expired rentals, but the observed behavior indicates it may clear the entire local Telegram allowlist rather than revoke only the expired rental or pairing. In this context, that is dangerous because the skill manages access control for paid Telegram pairings, so overbroad revocation can disrupt all pairings, alter credential state unexpectedly, and cause denial of service or unauthorized state changes beyond the advertised scope.

Description-Behavior Mismatch

High
Confidence
99% confidence
Finding
The expired-rental path calls clear_allowlist(), which overwrites the entire Telegram allowlist with an empty array instead of removing only the specific expired approval. In this skill’s context, one expired remote rental can revoke all local Telegram pairings, creating an overbroad destructive action and enabling denial of service or unintended access disruption.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill declares shell execution via `command-tool: exec` and raw arguments but does not define any `permissions` or `allowed-tools` scope. That means the skill can invoke powerful local commands and external binaries (`openclaw`, `curl`, `jq`) without an explicit capability boundary, increasing the risk of unintended command execution or broader system access than operators expect.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script makes HTTP requests with an Authorization bearer token and sends approval IDs and statuses to a remote API via curl. Although the code performs these actions directly, it provides no comment, docstring, or user-facing notice explaining that approval data and credentials are being transmitted off-host.

External Transmission

Medium
Category
Data Exfiltration
Content
local approval_id="$1"
  local status="$2"

  curl -sf -X PATCH \
    -H "Authorization: Bearer $CLAWRENT_TOKEN" \
    -H "X-Clawrent-Skill: $SKILL_VERSION" \
    -H "Content-Type: application/json" \
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
clear_allowlist overwrites the allowlist file with an empty JSON array, which is a destructive change to local credential-related state. While later logs mention revoking an expired lease, there is no direct disclosure at the write site or prior warning that the file will be reset.

Context-Inappropriate Capability

Medium
Confidence
86% confidence
Finding
The script executes a privileged local command, openclaw pairing approve telegram "$code" --notify, which changes local pairing state and triggers notifications. Because the skill description only mentions syncing approvals and revoking rentals at a high level, operators may not realize the script can directly perform local authorization actions based on remote API data, increasing the risk of unintended trust in external inputs.