Back to skill

Security audit

AgentMemory Adapter

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent, but it installs persistent agent memory/hooks and has a real bearer-token handling weakness in its diagnostic script.

Install only if you intentionally want persistent shared memory across agents. Use it against trusted local or HTTPS AgentMemory endpoints, avoid setting AGENTMEMORY_SECRET unless required, rotate the secret if it may have been used with an untrusted endpoint, and review any Codex/OpenClaw config or hook changes before accepting them.

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/check_agentmemory.py:48
Finding

Bearer Token Exposure Through Unvalidated HTTP Redirects

Content
View full analysis
tuple[bool, str]: target = f"{url.rstrip('/')}{path}" req = urllib.request.Request(target, headers={}) secret = os.environ.get("AGENTMEMORY_SECRET") if send_secret else None if secret: req.add_header("Authorization", f"Bearer {secret}") try: with urllib.request.urlopen(req, timeout=timeout) as res: body = res.read(4096).decode("utf-8", errors="replace") return 200 <= res.status < 300, f"HTTP {res.status}: {body[:240]}" ``` The authenticated probe is enabled as follows: ```python send_secret = bool(os.environ.get("AGENTMEMORY_SECRET")) and can_send_secret(args.url) if os.environ.get("AGENTMEMORY_SECRET") and not send_secret: results.append({"area": "security", "status": "warn", "message": "AGENTMEMORY_SECRET is set for non-loopback HTTP; refusing to send it without HTTPS"}) for endpoint in ("/agentmemory/livez", "/agentmemory/health"): ok, message = probe(args.url, endpoint, args.timeout, send_secret) ``` ### Technical Analysis The script validates only the initial user-supplied URL before adding the `Authorization: Bearer` header. It permits authenticated requests when the original URL uses HTTPS or loopback HTTP. However, `urllib.request.urlopen` follows supported HTTP redirects automatically. The script does not install a restrictive redirect handler, validate the redirect destination, enforce same-origin redirects, or remove the authorization header when the destination changes. Consequently, a server trusted for the initial request can redirect the probe to another origin, where the bearer credential may be disclose ...[truncated 2389 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • 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 (10)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
For a skill intended for ClawHub, keep `SKILL.md` concise, declare OpenClaw runtime requirements in `metadata.openclaw`, avoid paid-skill/licensing claims, and

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · references/agentmemory-deep-analysis.md (reported line 22)May include surrounding context.

md
## Codex Surface

The Codex adapter writes `[mcp_servers.agentmemory]` in `~/.codex/config.toml`. `agentmemory connect codex --with-hooks` also writes `~/.codex/hooks.json` with absolute paths to bundled hook scripts. That hook fallback exists because Codex Desktop may not dispatch plugin-local hooks reliably; MCP can still work without it.

The Codex plugin ships:

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · scripts/check_agentmemory.py (reported line 86)May include surrounding context.

python
## Codex Surface

The Codex adapter writes `[mcp_servers.agentmemory]` in `~/.codex/config.toml`. `agentmemory connect codex --with-hooks` also writes `~/.codex/hooks.json` with absolute paths to bundled hook scripts. That hook fallback exists because Codex Desktop may not dispatch plugin-local hooks reliably; MCP can still work without it.

The Codex plugin ships:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill instructs the agent to inspect environment variables, read local reference files, and contact a local or remote AgentMemory service, but it does not declare any explicit tool scope or allowed-tools boundary. That mismatch can cause an agent platform to grant broader capabilities than reviewers expect, increasing the risk of unintended file access, secret exposure, or network actions during execution.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

MCP server references in the skill manifest without version pinning are a rug-pull risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

The skill is explicitly designed to install and verify a shared memory layer for coding agents, including memory capture and multi-agent behavior. Session persistence is intentional here, but it still creates real risk: sensitive prompts, code context, tokens, or cross-project data may be retained and later surfaced to other agents or sessions if scoping and retention are not tightly controlled.

Content

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

md
---
name: agentmemory-adapter
description: Install, wire, audit, and harden AgentMemory for AI coding agents and project workspaces. Use when Codex needs to adopt rohitg00/agentmemory, configure Codex or OpenClaw memory integration, create ClawHub-ready AgentMemory guidance, debug MCP/hook/plugin setup, verify memory capture, or handle edge cases such as npx stalls, sandbox localhost routing, duplicate plugin paths, stale Codex hooks, remote bearer-token security, multi-agent isolation, or missing full-tool proxy mode.
license: MIT
metadata:
  openclaw:

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · references/platform-recipes.md (reported line 9)May include surrounding context.

bash
npm install --prefix ~/.agentmemory/npm @agentmemory/agentmemory@0.9.22 --omit=optional
mkdir -p ~/.local/bin
ln -sfn ~/.agentmemory/npm/node_modules/.bin/agentmemory ~/.local/bin/agentmemory

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · references/platform-recipes.md (reported line 102)May include surrounding context.

Put the plugin in a durable path:

bash
mkdir -p ~/.agentmemory
cp -a integrations/openclaw ~/.agentmemory/openclaw-plugin
openclaw plugins install -l ~/.agentmemory/openclaw-plugin