T01 · Skill Instruction Hijacking
- Location
src/memoryguard/provider_adapters.py:45- Finding
Agent-Callable Provider Installation Persistently Redirects Future Agent Memory Behavior
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
MemoryGuard is a local memory manager, but it can persistently rewrite agent instructions and configuration, so users should review those changes before installing.
Install only if you are comfortable letting this tool modify agent memory instructions and MCP configuration. Prefer running provider setup manually from a trusted terminal, back up ~/.codex/config.toml and ~/.cursor/mcp.json first, avoid allowing untrusted prompts or repositories to invoke memoryguard_provider_install, and use project-scoped configuration where possible.
src/memoryguard/provider_adapters.py:45Agent-Callable Provider Installation Persistently Redirects Future Agent Memory Behavior
src/memoryguard/provider_adapters.py:142Provider Installation Can Overwrite Existing Configuration After Parse or Read Failure
src/memoryguard/mcp_client.py:395Resource Discovery Executes Commands from Repository-Controlled MCP Configuration
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
Running external provider commands via subprocess while describing the skill as a memory backend is security-relevant undeclared behavior. Subprocess execution can expose the host to command misuse, unexpected file access, or interaction with untrusted binaries, especially in agent ecosystems where users may assume the skill only manages local memory records.
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.
Add MemoryGuard to your Codex MCP config at ~/.codex/config.toml
(Windows: %USERPROFILE%\.codex\config.toml):
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.
Add MemoryGuard to your Codex MCP config at ~/.codex/config.toml
(Windows: %USERPROFILE%\.codex\config.toml):
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.
Add MemoryGuard to your Codex MCP config at ~/.codex/config.toml
(Windows: %USERPROFILE%\.codex\config.toml):
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.
## Step 2: Configure MCP
Add MemoryGuard to your Codex MCP config at `~/.codex/config.toml`
(Windows: `%USERPROFILE%\.codex\config.toml`):
```toml
The code contradicts its stated security boundary by enumerating every hidden directory under the user's home directory via Path.home().iterdir() and then deriving metadata such as size, file count, modification time, and inferred product. Even without reading file contents, this is broad local reconnaissance that can reveal installed tools, activity patterns, and potentially sensitive hidden application directories unrelated to the declared agent profiles.
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.
),
MemorySurface(
surface_id="claude_user_settings",
path_template="%HOME%/.claude/settings.json",
surface_role="control_surface",
scope="user", load_order=21,
loader_evidence="https://docs.anthropic.com/zh-CN/docs/claude-code/memory",
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
v2/
config.json # 配置
setting.json # 设置
credentials.json # 凭据(不读)
tasks-index.sqlite # 任务索引
checkpoints/
logs/
Data flows directly from a source (env vars, files, network) to a sink (network output, exec, file write) without intermediate validation.
for patch in plan.patches:
src = Path(patch.path)
backup = workspace / BACKUPS_DIR / f"{src.name}.{stable_id('bak', patch.path)[:8]}"
backup.write_bytes(src.read_bytes())
backup_paths.append(str(backup))
if patch.operation == "delete":
src.unlink()