Back to skill

Security audit

Agent Context System

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed local memory template, but it includes risky repository-publishing and persistent-instruction workflows that deserve manual review before installation.

Install only if you want agents to maintain persistent project memory in your repository. Review proposed .agents.local.md entries before writing, avoid storing secrets or private incident details, manually review any AGENTS.md promotion, and do not run scripts/publish-template.sh from a working tree that may contain credentials or private files.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • 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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/publish-template.sh:23
Finding
Sensitive Files Can Be Staged and Uploaded to GitHub<![CDATA[ ## Vulnerability Details **File Location**: `scripts/publish-template.sh:23-40` **Vulnerability Type**: Sensitive data exposure through unsafe repository publishing **Risk Level**: Medium ### Vulnerable Code ```bash sensitive_files=$(find . -maxdepth 2 \( -name ".env*" -o -name "*.pem" -o -name "*.key" -o -name "*.secret" -o -name "id_rsa*" \) 2>/dev/null || true) if [ -n "$sensitive_files" ]; then echo "⚠️ Potentially sensitive files detected:" echo "$sensitive_files" echo "" read -rp "Continue anyway? (y/N) " confirm [[ "$confirm" =~ ^[Yy]$ ]] || exit 1 fi git add -A git commit -m "Initial commit: agent context system template" 2>/dev/null || true gh repo create "$GH_USER/$REPO_NAME" \ --private \ --source=. \ --remote=origin \ --description "Template: persistent local-only memory for AI coding agents" \ --push ``` ### Technical Analysis The script attempts to identify sensitive files, including environment files, PEM files, private keys, secrets, and SSH private-key filenames. It does not write to or modify SSH keys; the pre-scan warning is caused by filename matching. The security issue is that detection only produces a warning. A user can continue despite detected secrets, after which `git add -A` stages all non-ignored content and `gh repo create --push` uploads the resulting commit. The scan is also incomplete: - It only searches to a maximum depth of two directories. - It relies on a limited set of filename patterns. - It does not inspect the actual staged file set. - It does not scan file contents for tokens or credentials. - It does not explicitly verify that `.agents.local.md` is ignored. - It stages the entire working tree instead of an allowlist of intended template files. Creating the repository as private reduces public exposure, but uploaded secrets remain available to repository collaborators, installed GitHub applications, automation, backups, and anyone who later receives access. Se ...[truncated 1372 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Abort unconditionally when potentially sensitive files are found instead of offering a continuation prompt. 2. Replace `git add -A` with an explicit allowlist of files required by the template. 3. Verify before staging that `.agents.local.md` and other local context files are covered by `.gitignore`. 4. Inspect the complete staged set using `git diff --cached --name-only` before committing. 5. Scan staged file contents with a secret scanner such as Gitleaks or TruffleHog. 6. Search the entire repository rather than limiting detection to two directory levels. 7. Add broader checks for common credential locations and filenames. 8. Display the exact staged files and require explicit confirmation immediately before the push. 9. If a secret has already been uploaded, revoke or rotate it immediately and remove it from repository history using an appropriate history-rewriting tool. ]]>

T02 · Agent Memory Poisoning

Note
Location
AGENTS.md:74
Finding
Persistent Agent Memory Can Be Updated Without Consistent User Approval<![CDATA[ ## Vulnerability Details **File Location**: `AGENTS.md:74`; related conflicting instructions in `github-copilot/SKILL.md:32` and `github-copilot/SKILL.md:72-78` **Vulnerability Type**: Unreviewed writes to persistent agent memory **Risk Level**: Low ### Vulnerable Code From `AGENTS.md`: ```markdown 7. At session end, append to `.agents.local.md` Session Log: what changed, what worked, what didn't, decisions made, patterns learned. If the user ends the session without asking, prompt them to let you log it. Run `agent-context promote` to review candidates, or `agent-context promote --autopromote` to auto-append patterns recurring 3+ times. ``` From `github-copilot/SKILL.md`: ```markdown ### 3. Grow At session end, append to the scratchpad's Session Log: what changed, what worked, what didn't, decisions made, patterns learned. ``` ```markdown ## Session Protocol 1. Read `AGENTS.md` and `.agents.local.md` (if it exists) before starting any task 2. Follow project conventions and boundaries defined in compressed format 3. **At session end, append to `.agents.local.md` Session Log.** This is the most commonly missed step. If the user appears to be ending the session without asking you to log, proactively offer to update the scratchpad. - Done: (what changed) - Worked: (reuse this) - Didn't work: (avoid this) - Decided: (choices and reasoning) - Learned: (new patterns or gotchas) 4. When scratchpad exceeds 300 lines, compress and flag recurring patterns (3+ sessions) for promotion ``` ### Technical Analysis These instructions direct agents to append session information to `.agents.local.md`, which is persistent state loaded by future agent sessions. They do not consistently require explicit user approval before the write. This conflicts with the security requirements in the root `SKILL.md` and `openclaw/SKILL.md`, which state that the agent must propose the entry and wait for user approval. Because different Skill variants provide d ...[truncated 2225 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make all Skill variants require explicit user approval before every `.agents.local.md` write. 2. Replace “append” directives with a consistent sequence: - Draft the proposed entry. - Display the complete entry to the user. - Wait for explicit approval. - Append only the approved text. 3. Repeat the rule that scratchpad content is untrusted data in `AGENTS.md` and `github-copilot/SKILL.md`. 4. Prohibit storage of credentials, tokens, private keys, personal data, or verbatim untrusted instructions. 5. Require manual review for every promotion into `AGENTS.md`. 6. Remove or disable `--autopromote` by default, or require an interactive confirmation showing the exact proposed changes. 7. Validate promoted entries against an allowed schema for patterns, boundaries, and gotchas. 8. Preserve an auditable diff of memory changes so users can identify and revert poisoning or factual errors. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (29)

Hidden Instructions

High
Category
Prompt Injection
Content
# AGENTS.md

<!-- Keep this file under 120 lines. Every line loads into every session. -->
<!-- Passive context > active retrieval. Put critical knowledge HERE, not in separate files. -->

## Project
Confidence
70% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
git clone https://github.com/AndreaGriffiths11/agent-context-system.git /tmp/acs
cp /tmp/acs/AGENTS.md /tmp/acs/agent-context .
cp -r /tmp/acs/agent_docs /tmp/acs/scripts .
rm -rf /tmp/acs
./agent-context init
```
Confidence
90% 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
git clone https://github.com/AndreaGriffiths11/agent-context-system.git /tmp/acs
cp /tmp/acs/AGENTS.md /tmp/acs/agent-context .
cp -r /tmp/acs/agent_docs /tmp/acs/scripts .
rm -rf /tmp/acs
./agent-context init
```
Confidence
90% 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
git clone https://github.com/AndreaGriffiths11/agent-context-system.git /tmp/acs
cp /tmp/acs/AGENTS.md /tmp/acs/agent-context .
cp -r /tmp/acs/agent_docs /tmp/acs/scripts .
rm -rf /tmp/acs
./agent-context init
```
Confidence
90% 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
git clone https://github.com/AndreaGriffiths11/agent-context-system.git /tmp/acs
cp /tmp/acs/AGENTS.md /tmp/acs/agent-context .
cp -r /tmp/acs/agent_docs /tmp/acs/scripts .
rm -rf /tmp/acs
./agent-context init
```
Confidence
90% 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).

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill is presented as a 'local-only' memory system with 'no plugins, no infrastructure,' yet it also documents publishing workflows that create and modify GitHub repositories via `gh`. That mismatch can mislead users and agents about the trust boundary, increasing the chance that remote/network-affecting actions are invoked under a local-only mental model.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The manifest describes a 'persistent local-only memory system' with 'no plugins, no infrastructure, no background processes,' implying the skill operates locally. This script uses GitHub CLI to create a remote repository, push local contents, and modify repository settings, which is materially broader than local-only operation.

Ssd 3

Medium
Confidence
92% confidence
Finding
The core design instructs agents to persist what they learn from each session into `.agents.local.md`, creating a durable natural-language memory store. That can accumulate sensitive prompts, credentials, code fragments, incident details, or personal data unless there are clear data-minimization and redaction controls.

Skill Enumeration

Medium
Category
Agent Snooping
Content
bash .agents/skills/agent-context-system/scripts/init-agent-context.sh
```

Or copy `github-copilot/SKILL.md` to `.github/skills/agent-context-system/SKILL.md`.

## CLI Commands
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.

Skill Enumeration

Medium
Category
Agent Snooping
Content
bash .agents/skills/agent-context-system/scripts/init-agent-context.sh
```

Or copy `github-copilot/SKILL.md` to `.github/skills/agent-context-system/SKILL.md`.

## CLI Commands
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.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The documented `--autopromote` behavior can auto-append content into `AGENTS.md`, a committed shared file, without an explicit high-visibility warning about modifying version-controlled instructions. That creates risk of unintended persistence, propagation to teammates, and prompt-surface contamination if inaccurate or sensitive patterns are promoted automatically.

Ssd 3

Medium
Confidence
91% confidence
Finding
The workflow repeatedly normalizes logging session learnings and updating the scratchpad, reinforcing long-term retention of conversation-derived data. In practice, users may ask agents to summarize work that includes confidential implementation details or sensitive operational context, which can later be resurfaced or promoted.

Ssd 3

Medium
Confidence
90% confidence
Finding
The session-logging guidance explicitly tells users to prompt the agent to update the scratchpad after meaningful work, which operationalizes a natural-language retention channel. Because users may do this after debugging, security work, or production incidents, the scratchpad can become an unstructured repository of sensitive derived data.

Vague Triggers

Medium
Confidence
86% confidence
Finding
The file broadly describes what the system does but does not clearly define when the skill should activate, under what user intent, or which actions require explicit confirmation. For agent-integrated tooling, ambiguous invocation boundaries can cause the skill to be applied too broadly, including reading/writing memory files or wiring agent configs in contexts the user did not intend.

Description-Behavior Mismatch

Medium
Confidence
88% confidence
Finding
The skill markets itself as a simple two-file local memory system, but its documented behavior includes modifying `.gitignore` and agent-specific config files such as symlinks or rules files. That mismatch can mislead users or downstream agents into granting broader trust than warranted, increasing the chance of unauthorized or unexpected repository changes.

Context-Inappropriate Capability

Medium
Confidence
86% confidence
Finding
The skill directs the agent to run a shell script that does more than maintain the two documented memory files: it also ensures gitignore state and wires multiple agent tool configurations. That expands the write surface from local notes into repository configuration, which can cause unintended file changes or tool behavior changes if executed without clear user consent.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrase 'When a user asks about setting up agent context' is broad enough that an agent may activate this skill in loosely related conversations and begin checking or modifying project files. Overbroad activation increases the chance of unnecessary file access and setup actions outside the user's precise intent.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The instructions tell the agent to run setup, add `.agents.local.md` to `.gitignore`, and wire agent tool configurations without an explicit warning that repository files will be changed. Silent modification guidance is risky because users may believe they are only receiving advice while the agent is actually altering tracked project state.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
1. Read `AGENTS.md` and `.agents.local.md` (if it exists) before starting any task
2. Follow project conventions and boundaries defined in compressed format
3. **At session end, append to `.agents.local.md` Session Log.** This is the most commonly missed step. If the user appears to be ending the session without asking you to log, proactively offer to update the scratchpad.
   - Done: (what changed)
   - Worked: (reuse this)
   - Didn't work: (avoid this)
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
1. Read `AGENTS.md` and `.agents.local.md` (if it exists) before starting any task
2. Follow project conventions and boundaries defined in compressed format
3. **At session end, append to `.agents.local.md` Session Log.** This is the most commonly missed step. If the user appears to be ending the session without asking you to log, proactively offer to update the scratchpad.
   - Done: (what changed)
   - Worked: (reuse this)
   - Didn't work: (avoid this)
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

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.

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.

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.

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.

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.

Static analysis

No suspicious patterns detected.