T05 · Unauthorized Access and Privilege Escalation
- Location
- prompts/diff-review.md:25
- Finding
- Unrestricted Collection of Agent Memory and Conversation History<![CDATA[ ## Vulnerability Details **File Location**: `prompts/diff-review.md:25`, `prompts/project-recap.md:19-21` **Vulnerability Type**: Unauthorized access to persistent Agent context **Risk Level**: High ### Vulnerable Code ```markdown - Reconstruct decision rationale: if this work was done in the current session, mine the conversation for approaches discussed, alternatives rejected, and trade-offs made. Check for progress docs (`~/.agent/memory/{project}/progress.md`, `~/.pi/agent/memory/{project}/progress.md`) or plan files that may contain reasoning. For committed changes, read commit messages and PR descriptions. ``` ```markdown 3. **Current state.** Check for uncommitted changes (`git status`). Check for stale branches (`git branch --no-merged`). Look for TODO/FIXME comments in recently changed files. Read progress docs if they exist (`~/.agent/memory/{project}/progress.md`, `~/.pi/agent/memory/{project}/progress.md`, `.pi/todos/`, or similar). 4. **Decision context.** Read recent commit messages for rationale. If running in the same session as recent work, mine the conversation history. Read any plan docs, RFCs, or ADRs in the project directory. ``` ### Technical Analysis The review prompts direct the Agent to search persistent memory directories and mine current or previous conversation context. These sources may contain credentials, private discussions, unrelated project information, personal data, or instructions from other sessions. The access is automatic and is not limited to a user-selected progress document. The phrase “or similar” further broadens the search scope. Because the generated report is written to a persistent HTML file, sensitive context discovered during this process can be copied into a separate artifact. This behavior exceeds the minimum access required to visualize source-code differences or summarize repository activity. It violates least-privilege principles by treating Agent memory and conversation history as routine ...[truncated 974 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not inspect Agent memory or conversation history by default. - Require explicit, informed user approval before reading each external context source. - Restrict access to an exact user-supplied path rather than searching “similar” locations. - Display the files and conversation ranges that will be accessed before reading them. - Treat memory-derived content as sensitive and exclude it from generated reports unless the user explicitly approves inclusion. - Add secret and personal-data redaction before writing report artifacts. - Clearly distinguish repository-derived facts from conversation-derived or memory-derived rationale. ]]>
