Back to skill

Security audit

Second Brain: Turn conversations into lasting knowledge

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Ensue-backed memory tool that sends notes and searches to Ensue, with some wrapper hardening issues but no hidden or purpose-mismatched behavior found.

Install only if you are comfortable using Ensue as the remote store for this memory data. Do not save secrets, credentials, private file paths, or highly sensitive personal material, and review drafts carefully before confirming create, update, or delete actions.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/ensue-api.sh:15
Finding

Unrestricted and Unsafe JSON-RPC Request Construction

Content
View full analysis

Vulnerability Details

File Location: scripts/ensue-api.sh, lines 15–36
Vulnerability Type: Unvalidated method selection and unsafe JSON construction
Risk Level: Medium

Vulnerable Code

bash
METHOD="$1"
ARGS="$2"

if [ -z "$ENSUE_API_KEY" ]; then
  echo '{"error":"ENSUE_API_KEY not set. Configure in clawdbot.json under skills.entries.second-brain.apiKey or get a key at https://ensue-network.ai/dashboard"}'
  exit 1
fi

if [ -z "$METHOD" ]; then
  echo '{"error":"No method specified. Available: list_keys, get_memory, create_memory, update_memory, delete_memory, discover_memories"}'
  exit 1
fi

# Default empty args
[ -z "$ARGS" ] && ARGS='{}'

curl -s -X POST https://api.ensue-network.ai/ \
  -H "Authorization: Bearer $ENSUE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"$METHOD\",\"arguments\":$ARGS},\"id\":1}" \
  | sed 's/^data: //'

Technical Analysis

The wrapper documents six supported operations but accepts any nonempty method name without enforcing an allowlist. Consequently, a caller can request undocumented Ensue tools if the remote API exposes them to the supplied API key.

The script also constructs JSON through direct string interpolation. METHOD is inserted into a JSON string without JSON escaping, while ARGS is inserted as raw JSON without checking that it is a valid object. Values containing quotation marks or JSON structural syntax can therefore modify the intended request structure or cause malformed requests.

This is not shell command injection because both expansions occur inside a quoted shell argument. The vulnerability is confined to the JSON-RPC request and the privileges granted to ENSUE_API_KEY.

Attack Path

  1. Attacker-controlled content influences the Agent into invoking the wrapper with a crafted method or argument value.
  2. The Agent executes ensue-api.sh while the victim’s ENSUE_API_KEY is presen ...[truncated 1232 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce an explicit allowlist before making the request:
bash
case "$METHOD" in
  list_keys|get_memory|create_memory|update_memory|delete_memory|discover_memories)
    ;;
  *)
    printf '%s\n' '{"error":"Unsupported method"}' >&2
    exit 1
    ;;
esac
  1. Validate that ARGS is valid JSON and is an object rather than accepting arbitrary raw JSON:
bash
if ! printf '%s' "$ARGS" | jq -e 'type == "object"' >/dev/null; then
  printf '%s\n' '{"error":"Arguments must be a valid JSON object"}' >&2
  exit 1
fi
  1. Construct the complete request with a JSON-aware serializer instead of string interpolation:
bash
PAYLOAD="$(
  jq -n \
    --arg method "$METHOD" \
    --argjson arguments "$ARGS" \
    '{
      jsonrpc: "2.0",
      method: "tools/call",
      params: {
        name: $method,
        arguments: $arguments
      },
      id: 1
    }'
)"

curl --silent --show-error --fail-with-body \
  -X POST 'https://api.ensue-network.ai/' \
  -H "Authorization: Bearer $ENSUE_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary "$PAYLOAD"
  1. Apply server-side authorization independently of client validation. The API should permit the token to invoke only the operations required by this Skill.

  2. Preserve the documented confirmation requirement for write and delete operations, and consider requiring a second explicit confirmation before destructive deletion.

  3. Return a nonzero status for transport errors and invalid API responses so malformed or rejected requests cannot be mistaken for successful operations.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill invokes a shell-based wrapper script to access the Ensue API, but it does not declare any explicit tool scope or allowed-tools boundary. That mismatch can allow broader-than-expected command execution in hosts that rely on manifest-level restrictions, increasing the chance of shell misuse or argument-injection paths if user-controlled content is later passed into the wrapper.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrase "remember" is broad enough to match normal conversation rather than a clear storage intent, which can cause unintended activation of a skill that persists user content. In this context, accidental activation is more dangerous because the skill is designed to store knowledge and interact with an external API, so ordinary chat content could be drafted for saving or sent into retrieval flows unexpectedly.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
79% confidence
Finding

The hardcoded remote endpoint confirms that this skill is designed to send data to an external network service rather than keeping knowledge local. While this appears to be intended functionality, it still creates privacy and supply-chain risk because all captured memories and search queries depend on a specific external provider and any compromise, misconfiguration, or unexpected data handling there affects user data.

Content

Scanner excerpt · scripts/ensue-api.sh (reported line 33)May include surrounding context.

sh
# Default empty args
[ -z "$ARGS" ] && ARGS='{}'

curl -s -X POST https://api.ensue-network.ai/ \
  -H "Authorization: Bearer $ENSUE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"$METHOD\",\"arguments\":$ARGS},\"id\":1}" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
79% confidence
Finding

The hardcoded remote endpoint confirms that this skill is designed to send data to an external network service rather than keeping knowledge local. While this appears to be intended functionality, it still creates privacy and supply-chain risk because all captured memories and search queries depend on a specific external provider and any compromise, misconfiguration, or unexpected data handling there affects user data.

Content

Scanner excerpt · scripts/ensue-api.sh (reported line 33)May include surrounding context.

sh
# Default empty args
[ -z "$ARGS" ] && ARGS='{}'

curl -s -X POST https://api.ensue-network.ai/ \
  -H "Authorization: Bearer $ENSUE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"$METHOD\",\"arguments\":$ARGS},\"id\":1}" \

Static analysis

No suspicious patterns detected.