T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- SKILL.md:40
- Finding
- Mandatory Access to Cross-Session Agent Memory Violates Least Privilege<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:40-46` **Vulnerability Type**: `T05: Unauthorized Access and Privilege Escalation` **Risk Level**: Medium ### Vulnerable Code ```markdown This skill is _informed_ by the project's domain model. The domain language in `.claude/CONTEXT.md` and the cross-session context in `.claude/MEMORY.md` give names to good seams; approved architecture decisions in `docs/architecture/` record the constraints this skill should not re-litigate. ``` ```markdown Read the project's domain glossary (`.claude/CONTEXT.md`), cross-session memory (`.claude/MEMORY.md`), and approved architecture decisions in `docs/architecture/` (or `docs/adr/` if the project still uses them) that touch the area first. ``` ### Technical Analysis The Skill requires the agent to read `.claude/MEMORY.md` before performing an architecture review. Cross-session memory can contain prior conversation details, private project information, operational context, or user preferences unrelated to the code under review. The instruction does not: - Verify that memory access is necessary for the requested review. - Limit access to relevant sections. - Require user consent. - Prevent memory content from being included in subagent prompts or generated reports. - Treat persistent memory as untrusted data. This breaks least-privilege principles because architecture analysis can generally be performed using source files, domain documentation, and relevant architecture decisions without reading unrestricted cross-session state. ### Attack Path 1. Sensitive information from a previous session is stored in `.claude/MEMORY.md`. 2. A user invokes this Skill for an architecture review. 3. The Skill automatically instructs the agent to read the entire memory file. 4. The memory content enters the agent’s active context. 5. Relevant or accidentally selected content may be propagated into exploration reasoning, subagent briefs, or the generated HTML report. 6. I ...[truncated 601 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the default requirement to read `.claude/MEMORY.md`. 2. Restrict routine analysis to source files, `.claude/CONTEXT.md`, and architecture decisions relevant to the selected area. 3. If memory is genuinely required, request explicit user approval before reading it. 4. Allow users to identify specific memory sections rather than granting unrestricted access. 5. Treat all memory content as untrusted data and prevent it from becoming agent instructions. 6. Prohibit inclusion of memory content in subagent prompts or reports unless explicitly authorized. 7. Document exactly why memory access is necessary and what information will be retained or displayed. ]]>
