T02 · Agent Memory Poisoning
- Location
setup.md:11- Finding
Persistent User and Database Context Can Poison Future Agent Sessions
- Content
View full analysis
Vulnerability Details
File Location:
setup.md:11-27; related storage schema inmemory-template.md:3-22and persistence declaration inSKILL.md:31
Vulnerability Type: Persistent attacker-influenced state
Risk Level: MediumVulnerable Code
markdown 1. Read `~/Clawic/data/pg/config.yaml` if it exists. Apply its values. 2. For anything absent, use the defaults in the Configuration table of `SKILL.md` — do not ask. - `server_version: 16`, `deployment: self-hosted`, `client: psql`, `pooler: app-pool`, `id_style: bigint-identity`, `naming_convention: snake_plural`, `lock_timeout_default: 2s`, `destructive_confirm: true`. 3. Read `~/Clawic/data/pg/memory.md` for prior context (their schema shape, recurring pain points). Absence is fine; proceed without comment. 4. Universal values (units, locale, timezone) fall back to `~/Clawic/profile.yaml` when this skill has no key of its own. If the live server is reachable, `SHOW server_version` and `SELECT current_setting('is_superuser')` beat any stored value — the stored one is a fallback for when it is not. Work from defaults immediately. Never open with questions about their stack, their scale, or how proactive to be. ## Recording Preferences (only when the user declares one) Write to config or memory **only** when the user states a preference in the course of the work — never as a preflight questionnaire. - User names a version, provider, client, pooler, key style, or naming convention → update the matching key in `~/Clawic/data/pg/config.yaml`. - User expresses a habit or stance (migration tooling, whether DDL may be run directly, how much plan detail they want, which extensions are unavailable to them) → record it under the relevant preference area (tooling, thresholds, conventions, platform, risk posture, output format, integrations, restrictions, cadence) in `~/Clawic/data/pg/memory.md`. - User corrects earlier guidance → update the stored value so it is not repeated.The assoc ...[truncated 3242 chars]
- Remediation
View remediation
Remediation Suggestions
- Require explicit user confirmation before creating or updating persistent memory.
- Display the exact fields and values proposed for persistence.
- Treat loaded memory as untrusted contextual data rather than authoritative instructions.
- Prevent persisted values from disabling destructive-operation confirmation, authorization checks, or other safety controls.
- Validate
config.yamlagainst a strict schema, including enumerated values, type checks, and safe bounds. - Attach provenance and update timestamps to each stored field, and expire or reconfirm security-sensitive preferences.
- Never store credentials, connection strings, hostnames, customer data, query output, tokens, or sampled production values.
- Minimize stored infrastructure details and encrypt or permission-restrict files containing sensitive operational metadata.
- Verify live server properties before privileged operations rather than relying on stored deployment, version, or privilege assumptions.
- Avoid reading the global
~/Clawic/profile.yamlunless the current task specifically requires those values.
