Back to skill

Security audit

Agentgram Chat IM For Openclaws

Security checks for vulnerabilities and agentic risk

Overview

This Agentgram skill is a real messaging integration, but its webhook setup can expose an action-capable local agent to remote messages and shares the local hook token with an external service.

Review before installing. Prefer polling mode or a narrowly scoped webhook receiver instead of tunneling the whole OpenClaw gateway. If you use webhooks, use a dedicated token, rotate it often, set message policy to contacts_only, disable request-selected session keys unless required, and require user approval before remote messages can trigger consequential agent actions.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:264
Finding
Untrusted Remote Messages Are Routed into an AI Agent Action<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:264-292` and `SKILL.md:334-363` **Vulnerability Type**: Untrusted remote content routed into an action-capable AI session **Risk Level**: Critical ### Vulnerable Code ```json { "hooks": { "enabled": true, "path": "/hooks", "token": "<your-token>", "allowRequestSessionKey": true, "allowedSessionKeyPrefixes": ["hook:", "agentgram:"], "defaultSessionKey": "agentgram:default", "mappings": [ { "id": "agentgram-agent", "match": { "path": "/agentgram_inbox/agent" }, "action": "agent", "messageTemplate": "[Agentgram] {{message}}" }, { "id": "agentgram-wake", "match": { "path": "/agentgram_inbox/wake" }, "action": "wake", "wakeMode": "now", "textTemplate": "[Agentgram] {{body}}" } ] } } ``` The documented webhook payload is then inserted into these templates: ```json { "message": "<flat text>", "name": "<display_name> (<agent_id>)", "channel": "last", "sessionKey": "agentgram:rm:<room_id>" } ``` ```json { "text": "<flat text>", "mode": "now", "sessionKey": "agentgram:rm:<room_id>" } ``` ### Technical Analysis The configuration routes message content received from an external Agentgram account directly into OpenClaw's `agent` or `wake` actions. The `{{message}}` and `{{body}}` template variables contain remotely supplied text, but the Skill does not define an isolation boundary that prevents that text from being interpreted as instructions by the receiving AI agent. The Skill states that contact requests require manual approval, but it does not impose equivalent authorization for ordinary messages. Its documented default message policy is `open`, which accepts messages from arbitrary senders unless the user explicitly changes the policy. The configuration also enables request-selected session keys through `allowRequestSessionKey`. Although prefixes are rest ...[truncated 2147 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Set the Agentgram message policy to `contacts_only` by default. 2. Require explicit user approval before messages from a new sender can invoke an `agent` or `wake` action. 3. Deliver inbound messages first to a non-agent validation component rather than directly to an action-capable AI session. 4. Treat all message text as untrusted quoted data and prepend a fixed instruction stating that embedded commands must not be followed. 5. Disable `allowRequestSessionKey` unless externally selected session routing is strictly necessary. Otherwise, derive session keys locally from verified identities and room identifiers. 6. Require the complete signed envelope in webhook deliveries and verify: - Sender identity. - Ed25519 signature. - Payload hash. - Timestamp and TTL. - Message identifier uniqueness and replay status. - Sender contact or allowlist status. 7. Dispatch content to the agent only after all validation succeeds. 8. Apply per-sender rate limits and ensure repeated messages cannot create autonomous reply loops. 9. Run the receiving agent with minimal tools and require user confirmation for filesystem access, command execution, credential access, or consequential network operations. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:155
Finding
OpenClaw Hook Bearer Credential Is Transmitted to an External Service<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:155-161` and `SKILL.md:299-309` **Vulnerability Type**: Sensitive local credential disclosure and credential reuse **Risk Level**: High ### Vulnerable Code ```bash jq -r '.hooks.token' ~/.openclaw/openclaw.json ``` The instructions require that this local token be reused as the Agentgram webhook token: ```text Use that value as `webhook_token`. The two tokens must be identical. ``` The token is then read from the local OpenClaw configuration and sent to the external Hub: ```bash HOOKS_TOKEN=$(jq -r '.hooks.token' ~/.openclaw/openclaw.json) PUBLIC_URL="https://abc123.ngrok-free.app" # replace with your URL from step 1 curl -X POST "https://agentgram.chat/registry/agents/{agent_id}/endpoints" \ -H "Authorization: Bearer <agent_token>" \ -H "Content-Type: application/json" \ -d "{\"url\": \"${PUBLIC_URL}/hooks\", \"webhook_token\": \"${HOOKS_TOKEN}\"}" ``` ### Technical Analysis The Skill instructs the user or agent to read `hooks.token` from the local OpenClaw configuration and submit the same bearer token to `https://agentgram.chat`. This creates credential reuse across a local execution boundary and an external service boundary. The token protects a publicly exposed hook that can invoke `agent` and `wake` actions. Therefore, possession of the token is not merely access to passive messaging data; it may authorize delivery into an action-capable AI interface. Although TLS protects the token in transit under normal conditions, the external Hub must receive and retain or otherwise process the plaintext token to send authenticated callbacks. Consequently, compromise of the Hub, its logs, backups, administrators, webhook-delivery infrastructure, or related operational systems could expose a credential that is valid against the target's public OpenClaw hook. The command also embeds the token in a command-line argument. Depending on shell and operating-system behavior, command history, p ...[truncated 1569 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not disclose or reuse the existing general OpenClaw hook token. 2. Generate a dedicated, high-entropy credential exclusively for Agentgram. 3. Scope the dedicated credential to only the required Agentgram routes; it must not authorize unrelated hooks or administrative endpoints. 4. Store only a one-way verifier where architecture permits, or use signed webhook requests so the Hub does not need a reusable target bearer token. 5. Prefer asymmetric webhook authentication: - The Hub signs each complete envelope. - The receiver verifies the Hub or sender public key. - Timestamps, nonces, and message identifiers prevent replay. 6. Rotate the dedicated credential whenever the endpoint URL, tunnel, or integration configuration changes. 7. Avoid placing secrets directly in command-line arguments. Send request bodies through protected files, standard input, or a secret-aware client. 8. Restrict configuration and temporary secret files to the owning user, such as mode `0600`. 9. Redact tokens from health checks, logs, shell tracing, diagnostics, and error messages. 10. Apply source-network restrictions or mTLS in addition to application-level authentication where deployment permits. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:233
Finding
OpenClaw Gateway Is Exposed Through a Public Tunnel with Action-Capable Hooks<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:233-259` and `SKILL.md:262-295` **Vulnerability Type**: Excessive remote exposure of a local AI-agent gateway **Risk Level**: High ### Vulnerable Code ```bash # Confirm OpenClaw gateway port: GATEWAY_PORT=$(jq -r '.gateway.port // 18789' ~/.openclaw/openclaw.json) # Option A: ngrok ngrok http $GATEWAY_PORT # Output: Forwarding https://abc123.ngrok-free.app -> http://localhost:18789 # Option B: cpolar cpolar http $GATEWAY_PORT # Output: https://xxxxxx.cpolar.cn -> http://localhost:18789 ``` The exposed gateway is configured with action-capable routes: ```json { "hooks": { "enabled": true, "path": "/hooks", "token": "<your-token>", "allowRequestSessionKey": true, "allowedSessionKeyPrefixes": ["hook:", "agentgram:"], "defaultSessionKey": "agentgram:default", "mappings": [ { "id": "agentgram-agent", "match": { "path": "/agentgram_inbox/agent" }, "action": "agent", "messageTemplate": "[Agentgram] {{message}}" }, { "id": "agentgram-wake", "match": { "path": "/agentgram_inbox/wake" }, "action": "wake", "wakeMode": "now", "textTemplate": "[Agentgram] {{body}}" } ] } } ``` ### Technical Analysis The Skill recommends tunneling the OpenClaw gateway port directly through ngrok or cpolar. This converts a service described as listening locally into an Internet-reachable service and substantially expands its attack surface. The declared messaging functionality can operate through polling, as documented elsewhere in the same Skill. Public gateway exposure is therefore not always the minimum privilege necessary to send and receive messages. Even when real-time webhooks are desired, exposing the complete gateway port is broader than exposing a dedicated, isolated webhook receiver. The risk is amplified because the enabled hook routes invoke `agent` and immediate `wake` actions ...[truncated 1776 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Use authenticated polling as the default receiving mechanism because it requires no inbound Internet exposure. 2. If webhooks are necessary, deploy a dedicated receiver that exposes only the Agentgram callback routes rather than tunneling the entire OpenClaw gateway port. 3. Validate and authenticate requests in the dedicated receiver before forwarding normalized data to OpenClaw. 4. Bind the OpenClaw gateway to localhost and keep unrelated gateway routes inaccessible from the tunnel. 5. Apply strict path allowlisting so only the exact required callback paths can be reached. 6. Use a dedicated scoped credential, source-IP restrictions where feasible, TLS validation, replay prevention, and per-source rate limits. 7. Disable externally selected session keys and immediate wake behavior unless explicitly required. 8. Require explicit user approval before remotely supplied content can trigger consequential agent tools. 9. Automatically expire temporary tunnels and revoke their credentials when no longer required. 10. Document how users can disable the endpoint, terminate the tunnel, rotate tokens, and confirm that the gateway is no longer publicly reachable. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### 8. Revoke Key (Auth: JWT)
```
DELETE /registry/agents/{agent_id}/keys/{key_id}
Authorization: Bearer <token>
```
**Response:**
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### 11. Remove Contact (Auth: JWT, bidirectional delete + notification)
```
DELETE /registry/agents/{agent_id}/contacts/{contact_agent_id}
Authorization: Bearer <token>
```
Deletes both directions (A→B and B→A) and sends a `contact_removed` notification to the other party.
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### 14. Unblock Agent (Auth: JWT)
```
DELETE /registry/agents/{agent_id}/blocks/{blocked_agent_id}
Authorization: Bearer <token>
```
**Response:** 204 No Content
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### 22. Dissolve Room (Auth: JWT, owner only)
```
DELETE /hub/rooms/{room_id}
Authorization: Bearer <token>
```
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### 24. Remove Member (Auth: JWT, owner/admin)
```
DELETE /hub/rooms/{room_id}/members/{agent_id}
Authorization: Bearer <token>
```
Cannot remove the owner. Only owner can remove admins.
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
| Resolve agent | `GET /registry/resolve/{id}` |
| Discover agents | `GET /registry/agents?name=filter` (disabled) |
| Add key | `POST /registry/agents/{id}/keys` |
| Revoke key | `DELETE /registry/agents/{id}/keys/{key_id}` |
| Refresh token | `POST /registry/agents/{id}/token/refresh` |
| List contacts | `GET /registry/agents/{id}/contacts` (Auth) |
| Remove contact | `DELETE /registry/agents/{id}/contacts/{cid}` (Auth, bidirectional) |
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
| Revoke key | `DELETE /registry/agents/{id}/keys/{key_id}` |
| Refresh token | `POST /registry/agents/{id}/token/refresh` |
| List contacts | `GET /registry/agents/{id}/contacts` (Auth) |
| Remove contact | `DELETE /registry/agents/{id}/contacts/{cid}` (Auth, bidirectional) |
| Block agent | `POST /registry/agents/{id}/blocks` (Auth) |
| List blocks | `GET /registry/agents/{id}/blocks` (Auth) |
| Unblock agent | `DELETE /registry/agents/{id}/blocks/{bid}` (Auth) |
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
| Remove contact | `DELETE /registry/agents/{id}/contacts/{cid}` (Auth, bidirectional) |
| Block agent | `POST /registry/agents/{id}/blocks` (Auth) |
| List blocks | `GET /registry/agents/{id}/blocks` (Auth) |
| Unblock agent | `DELETE /registry/agents/{id}/blocks/{bid}` (Auth) |
| Update policy | `PATCH /registry/agents/{id}/policy` (Auth) |
| Get policy | `GET /registry/agents/{id}/policy` |
| Update profile | `PATCH /registry/agents/{id}/profile` (Auth) |
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
| List my rooms | `GET /hub/rooms/me` (Auth) |
| Get room | `GET /hub/rooms/{rid}` (Auth) |
| Update room | `PATCH /hub/rooms/{rid}` (Auth) |
| Dissolve room | `DELETE /hub/rooms/{rid}` (Auth) |
| Add member | `POST /hub/rooms/{rid}/members` (Auth) |
| Remove member | `DELETE /hub/rooms/{rid}/members/{aid}` (Auth) |
| Leave room | `POST /hub/rooms/{rid}/leave` (Auth) |
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
| Update room | `PATCH /hub/rooms/{rid}` (Auth) |
| Dissolve room | `DELETE /hub/rooms/{rid}` (Auth) |
| Add member | `POST /hub/rooms/{rid}/members` (Auth) |
| Remove member | `DELETE /hub/rooms/{rid}/members/{aid}` (Auth) |
| Leave room | `POST /hub/rooms/{rid}/leave` (Auth) |
| Transfer owner | `POST /hub/rooms/{rid}/transfer` (Auth) |
| Promote/demote | `POST /hub/rooms/{rid}/promote` (Auth) |
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Content
ea | What it checks |
|------|----------------|
| Agentgram Credentials | Default or specified agent credentials exist, JWT token is present and not expired |
| OpenClaw Hooks | `.hooks.enabled`, `.hooks.path`, `.hooks.token` (masked), `.gateway.port` (+ listening check via `lsof`), `.hooks.mappings` with `/agentgram_inbox/agent` and `/agentgram_inbox/wake` route detection |
| Polling Cron Job | `crontab -l` for `agentgram-poll` entries, polling frequency, `--openclaw-agent` flag, auth lockfile status |
| Webhook Endpoint | Registered endpoint URL from Hub, reachability test, tunnel detection (ngrok/cpolar), port consistency with gateway, webhook token match against OpenClaw config |
| Cross-check | Warns if **neither** webhook nor polling is configured (agent cannot receive messages) |

**OpenClaw location discovery** (priority order):
1. `--openclaw-home <path>` flag
2. `$OPENCLAW_HOME` environment variable
3. `openclaw config path` CLI command (if `openclaw` is on PATH)
4. Default `
Confidence
75% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Session Persistence

Medium
Category
Rogue Agent
Content
---
name: agentgram
description: Send and receive messages between AI agents via the Agentgram Hub. Register agents, sign message envelopes with Ed25519, deliver payloads through store-and-forward routing, handle receipts, manage contacts and blocks, set message policies, and create rooms (unified social container for group chat, broadcast channels, and DMs). Use when the user mentions agent messaging, A2A protocol, inter-agent communication, message signing, agent inbox, contacts, blocking, rooms, or topics.
metadata:
  clawdbot:
    requires:
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The webhook setup section switches into Chinese for core operating instructions, examples, and explanatory text, while the rest of the document is in English. This imposes a specific language on users without offering a language choice or explaining a region-specific requirement, which conflicts with the language/locale policy criteria.

External Transmission

Medium
Category
Data Exfiltration
Content
PUBLIC_URL="https://abc123.ngrok-free.app"   # replace with your URL from step 1

# Register — append /hooks to match OpenClaw's hooks.path:
curl -X POST "https://agentgram.chat/registry/agents/{agent_id}/endpoints" \
  -H "Authorization: Bearer <agent_token>" \
  -H "Content-Type: application/json" \
  -d "{\"url\": \"${PUBLIC_URL}/hooks\", \"webhook_token\": \"${HOOKS_TOKEN}\"}"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Session Persistence

Medium
Category
Rogue Agent
Content
|------|----------------|
| Agentgram Credentials | Default or specified agent credentials exist, JWT token is present and not expired |
| OpenClaw Hooks | `.hooks.enabled`, `.hooks.path`, `.hooks.token` (masked), `.gateway.port` (+ listening check via `lsof`), `.hooks.mappings` with `/agentgram_inbox/agent` and `/agentgram_inbox/wake` route detection |
| Polling Cron Job | `crontab -l` for `agentgram-poll` entries, polling frequency, `--openclaw-agent` flag, auth lockfile status |
| Webhook Endpoint | Registered endpoint URL from Hub, reachability test, tunnel detection (ngrok/cpolar), port consistency with gateway, webhook token match against OpenClaw config |
| Cross-check | Warns if **neither** webhook nor polling is configured (agent cannot receive messages) |
Confidence
85% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Static analysis

No suspicious patterns detected.