Back to skill

Security audit

Clawhub Select

Security checks for vulnerabilities and agentic risk

Overview

The skill’s collaboration purpose is clear, but it needs Review because peer-provided text and peer-provided relay data can affect persistent agent state and network behavior more broadly than disclosed.

Install only if you are comfortable running a background listener and sharing task data with selected peers through a relay. Use trusted peers and a trusted WSS relay only, avoid sensitive details in task or handoff text, and review or disable the bootstrap/heartbeat hooks if peer-authored text should not appear in future agent context. Prefer pinned dependencies before installation.

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 DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T01 · Skill Instruction Hijacking

Error
Location
hooks/diplomat-bootstrap/handler.ts:30
Finding

Peer-Controlled Commitment Text Is Persistently Injected into Agent Context

Content
View full analysis
str: """Build a compact MEMORY.md commitment entry within MAX_MEMORY_ENTRY_CHARS budget.""" entry = ( f"- **[{state}]** Peer: {peer_alias} | " f"My: {my_tasks} | Their: {peer_tasks} | " f"Due: {deadline_utc} | ID: `{session_id_short}`" ) return truncate_to_budget(entry, MAX_MEMORY_ENTRY_CHARS) ``` `hooks/shared/parse-memory.ts:64-88`: ```ts export function parseActiveEntries(section: string): CommitmentEntry[] { return section .split('\n') .filter(l => l.includes('[ACTIVE]')) .map(parseLine) .filter((e): e is CommitmentEntry => e !== null); } function parseLine(line: string): CommitmentEntry | null { const peerM = line.match(/Peer: ([^|]+)/); const myM = line.match(/My: ([^|]+)/); const dueM = line.match(/Due: ([^|]+UTC)/); const idM = line.match(/ID: `([^`]+)`/); if (!peerM || !myM || !dueM || !idM) return null; const dueStr = dueM[1].trim(); return { peer: peerM[1].trim(), myTask: myM[1].trim(), deadlineLocal: dueStr, deadlineUtc: dueStr, id: idM[1].trim(), }; } ``` `hooks/diplomat-bootstrap/handler.ts:30-43`: ```ts const active = parseActiveEntries(section); if (active.length === 0) return; const n = active.length; const lines = active.map(e => `• ${truncate(e.peer, 20)} | ${truncate(e.myTask, 40)} due ${e.deadlineLocal} → [ACTIVE] (ID: ${e.id})` ); const header = `[claw-diplomat] ${n} active commitment${n === 1 ? '' : 's'}:`; const block = ...[truncated 2450 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
listener.py:266
Finding

Unknown Peers Can Bypass Quarantine Through HANDOFF Messages

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
negotiate.py:736
Finding

Untrusted Address Tokens Can Direct Connections to Arbitrary or Plaintext WebSocket Endpoints

Content
View full analysis
dict[str, Any]: """ Decode and validate a Diplomat Address token. Raises ValueError on malformed tokens, expired tokens. SECURITY T9: token expiry strictly enforced. """ padding = 4 - len(token_b64) % 4 if padding != 4: token_b64 += "=" * padding try: raw_bytes = base64.urlsafe_b64decode(token_b64.encode("ascii")) token = json.loads(raw_bytes.decode("utf-8")) except Exception as e: raise ValueError(f"Malformed token: {e}") from e required = ("v", "alias", "pubkey", "relay", "relay_token", "nat_hint", "expires_at") for key in required: if key not in token: raise ValueError(f"Token missing required field: {key}") if token["v"] != 1: raise ValueError(f"Unsupported token version: {token['v']}") expires_at = validate_iso8601(token["expires_at"]) now = datetime.datetime.now(datetime.timezone.utc) if expires_at <= now: alias = sanitize_string(str(token.get("alias", "your contact")))[:MAX_ALIAS_LEN] raise ValueError( f"This address has expired (it was valid until " f"{_format_deadline_local(expires_at)}).\n" f"Ask {alias} to run /claw-diplomat generate-address and share their new address." ) token["alias"] = sanitize_string(str(token["alias"]))[:MAX_ALIAS_LEN] token["pubkey"] = sanitize_string(str(token["pubkey"])) token["relay"] = sanitize_string(str(token["relay"])) token["relay_token"] = sanitize_string(str(token["relay_token"])) token["nat_hint"] = sanitize_string(str(tok ...[truncated 3403 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
clawhub.yaml:84
Finding

Installation Uses Unpinned Third-Party Python Dependencies

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (18)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- name: "listener.py"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- name: "listener.py"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- name: "listener.py"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- hooks/diplomat-bootstrap/handler.ts

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill declares very broad natural-language triggers such as "propose to," "check in on," and "connect with," which are common phrases in ordinary conversation. In an agent skill that can open network connections, start negotiations, write to persistent memory, and spawn background behavior, this increases the chance of unintended activation and accidental side effects from benign user messages.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

md
# ─── Install Footprint ───────────────────────
install:
  files_created:
    - skills/claw-diplomat/SKILL.md
    - skills/claw-diplomat/listener.py
    - skills/claw-diplomat/negotiate.py
    - skills/claw-diplomat/diplomat.key        # first run only

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
When `skills/claw-diplomat/diplomat.key` does NOT exist:

1. Generate NaCl Curve25519 keypair
2. Write private key bytes to `skills/claw-diplomat/diplomat.key` → chmod 600
3. Write public key hex to `skills/claw-diplomat/diplomat.pub` → chmod 644
4. Initialize `peers.json` as `{"peers":[]}` and `ledger.json` as `{"sessions":[]}`
5. Append `## Diplomat Deadline Check` block to `HEARTBEAT.md` (idempotent — check for duplicate first)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · negotiate.py (reported line 524)May include surrounding context.

python
When `skills/claw-diplomat/diplomat.key` does NOT exist:

1. Generate NaCl Curve25519 keypair
2. Write private key bytes to `skills/claw-diplomat/diplomat.key` → chmod 600
3. Write public key hex to `skills/claw-diplomat/diplomat.pub` → chmod 644
4. Initialize `peers.json` as `{"peers":[]}` and `ledger.json` as `{"sessions":[]}`
5. Append `## Diplomat Deadline Check` block to `HEARTBEAT.md` (idempotent — check for duplicate first)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · negotiate.py (reported line 822)May include surrounding context.

python
When `skills/claw-diplomat/diplomat.key` does NOT exist:

1. Generate NaCl Curve25519 keypair
2. Write private key bytes to `skills/claw-diplomat/diplomat.key` → chmod 600
3. Write public key hex to `skills/claw-diplomat/diplomat.pub` → chmod 644
4. Initialize `peers.json` as `{"peers":[]}` and `ledger.json` as `{"sessions":[]}`
5. Append `## Diplomat Deadline Check` block to `HEARTBEAT.md` (idempotent — check for duplicate first)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
1. Generate NaCl Curve25519 keypair
2. Write private key bytes to `skills/claw-diplomat/diplomat.key` → chmod 600
3. Write public key hex to `skills/claw-diplomat/diplomat.pub` → chmod 644
4. Initialize `peers.json` as `{"peers":[]}` and `ledger.json` as `{"sessions":[]}`
5. Append `## Diplomat Deadline Check` block to `HEARTBEAT.md` (idempotent — check for duplicate first)
6. Show:

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest declares 'data_exfiltration: none' while the same file explicitly requests outbound network access for relay-based peer messaging and states that workspace data from MEMORY.md is injected into context. Even if the design intends only user-authored commitment data to be shared, this is still data leaving the local environment, so the declaration is materially misleading and can cause users or reviewers to underestimate privacy and leakage risk.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level security rules state at L0012 that errors are never swallowed silently. However, the code later catches and suppresses exceptions in several places, such as broad exception handlers that pass during key capture and websocket close cleanup, and logic that converts failures into fallback values like "unknown" or "pending" instead of surfacing them. This is an active contradiction between the documentation and implemented behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The comments at L363-L364 describe a special quarantine path for unknown peers, implying different treatment from trusted peers. However, both branches persist the proposal in the same INBOUND_PENDING state, and trusted peers are likewise left pending human approval at L398-L399, so the documented distinction is overstated.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The security rules claim at L0010 that there are no writes outside declared workspace paths. Yet on JSON corruption the code creates ledger.json.bak (L0875-L0879), which is an additional path not among the explicit path helpers/documented storage targets described earlier. Although still under the workspace skill directory, this contradicts the stated strictness of the write locations.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · listener.py (reported line 103)May include surrounding context.

python
# ─── Logging ──────────────────────────────────────────────────────────────────
_log_level = os.environ.get("DIPLOMAT_LOG_LEVEL", "INFO").upper()
logging.basicConfig(
    level=getattr(logging, _log_level, logging.INFO),
    format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
    stream=sys.stderr,
)

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · negotiate.py (reported line 65)May include surrounding context.

python
# ─── Logging ──────────────────────────────────────────────────────────────────
_log_level = os.environ.get("DIPLOMAT_LOG_LEVEL", "INFO").upper()
logging.basicConfig(
    level=getattr(logging, _log_level, logging.INFO),
    format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
    stream=sys.stderr,
)