Repository-controlled files are injected into the model's context as the user's own memory or learned patterns
Description
Impact
With ruflo hooks installed globally (~/.claude/settings.json running the home-level hook-handler.cjs), files committed in a cloned repository are promoted into higher-trust model context:
- Persistent memory poisoning. On every Stop,
doSync(.claude/helpers/auto-memory-hook.mjs, around lines 527-575, intov3/@claude-flow/memory/src/auto-memory-bridge.tslines 767-826) reads the repo's committed.claude-flow/data/auto-memory-store.json. Entries taggedlearningsorinsightabove a confidence threshold, which the attacker sets, are appended verbatim to~/.claude/projects/<key>/memory/*.mdand indexed intoMEMORY.md. Claude Code then loads them every session as the user's own memory, and they remain after the repo file is removed. There is no origin check, no injection or secret scan, and no length cap. - Per-prompt injection. A committed
.claude-flow/data/ranked-context.jsonwith broadwordsmatches almost any prompt. Itssummary(80 characters, newlines kept) is printed under[INTELLIGENCE] Relevant patterns for this task(intelligence.cjsaround lines 828-834,hook-handler.cjsaround lines 862-868), with no sanitizing and no "untrusted data" label. The modsroutecopy strips control characters but is also unlabelled.
There is no code execution. This is prompt injection that gains authority and persists.
Fix
- Only sync or show entries this machine wrote, using a local HMAC or origin marker, and ignore git-tracked files.
- Run the text through the learning-loop
scan(), strip control characters, and cap and flatten it. - Label the block as project data, the way
guidance/projection.tsdoes.