Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
memory-poison-lab — Local test range for agent memory poisoning - watch a planted memory steer an agent, then prove the repair. Synthetic targets, scripted deterministic agent. | Kitploit
Tools/GitHubGitHub/rishabhpande/memory-poison-lab
Defensive ToolsPapers & ResearchLearning & EducationRed TeamingAI SecurityAdversarial AttackLabs & Practice
GitHubrishabhpande/memory-poison-lab
Share

memory-poison-lab

Local test range for agent memory poisoning - watch a planted memory steer an agent, then prove the repair. Synthetic targets, scripted deterministic agent.

View RepositoryWebsite
1116 days agoNot yet reviewed

Memory Poisoning Lab

Your agent remembered it. Should it have?

A local test range for agent memory poisoning: persistent memory as an attack surface. Feed an agent's memory controlled untrusted writes, watch a planted memory change what the agent does, then try to stop it - and prove the repair worked.

Architecture

Scope, plainly. Synthetic targets, a scripted deterministic agent. This repo demonstrates the mechanics of memory poisoning, defense and repair from published research, on real memory backends. It is not evidence about the safety of any real LLM, hosted memory service, or production system. Never point anything in here at a system you do not own.

Why this exists

Agent memory layers are shipping fast, and the attack classes against them are documented in research (see Sources). This repo is a small, local place to watch those attacks happen and test a fix. The first four scenarios are built from the published taxonomy; A5 extends the range to the ranking window itself, and A6 to a second decision the owner never wrote a policy for:

ScenarioAttack classMechanic under test
A1 - Direct injectionInstruction-shaped content in one untrusted tool writeNaive recency lets the newest "preference" win over owner policy
A2 - Summary launderingPayload survives compactionExtractive summarization relabels the write summary; the label looks trustworthy, the true origin is still the untrusted source
A3 - RepetitionThe same claim, three timesDuplicate merging boosts the claim's confidence above the owner's own policy
A4 - Laundered importPoison arrives pre-labeled summary from another systemScreening scoped to tool writes never sees it, and the true pre-import origin is unrecoverable; default-deny on non-owner claims is what stops it
A5 - Retrieval floodingTen untrusted writes with high query-token overlapThe owner policy is pushed out of the agent's top-k recall window, so even a weak per-write claim wins by eviction; screening quarantines the flood, and the origin policy is the backstop
A6 - Preference graftingOne untrusted write grafts a preference onto a subject the owner never set (the courier)Nothing instruction-shaped to screen, and no owner claim to contradict - so origin default-deny blocks it, but conflict-scoped repair alone cannot remove it. Once the owner states a policy, the same repair pass removes the graft

Each scenario runs three ways against fresh, real backends - no mocks:

  • naive: no defenses. The attack should flip the agent's decision.
  • defended: write-time screening + origin-aware recall. The attack should not land.
  • repaired: poison the store, run repair(), and the decision must return to baseline. A6 is the deliberate exception: with no owner claim on the grafted subject, conflict-scoped repair has nothing to anchor to and removes nothing - the scenario pins that limit and the remediation (owner states a policy, repair removes the graft).

Current scoreboard, verified by the test suite: 6/6 attacks flip the undefended agent, 6/6 are blocked with defenses on, 5/6 are restored by repair alone - A6 documents the repair limit and is restored once the owner states a courier policy.

Three backends, one contract

The attacks and defenses are properties of the memory contract, not of one implementation, so the whole range runs against three backends:

  • ReferenceMemory - dependency-free in-memory store. Good for reading the mechanics.
  • ChromaMemory (mpolab/adapters.py) - an adapter over ChromaDB, a real local vector store with its default ONNX embedding model. No server, no API key, no paid calls: pip install chromadb and the same six attacks replay against embeddings and nearest-neighbor recall. One disclosure: the first ChromaDB run downloads its default ONNX embedding model (about 80 MB) from the internet; after that one-time download it runs fully offline.
  • SQLiteVecMemory (mpolab/adapters.py) - an adapter over sqlite-vec, nearest-neighbour vector recall inside SQLite (exact KNN, no index): no server, no model download at all. It embeds with a deterministic hashed bag-of-words (standard library only), so it exercises real vector-recall plumbing offline; it is not a measure of semantic embedding quality. pip install sqlite-vec.

tests/test_adapters.py runs a conformance contract plus every registered scenario against every installed backend. Adding your own adapter (mem0, Zep, Letta, pgvector - anything with retain/recall) inherits the entire attack suite.

How it fits together

Architecture

Every memory entry carries two provenance fields: trust (the storage label the backend reports, which compaction and imports can rewrite) and origin (the source recorded at write time and never rewritten). The defenses reason about origin. That split is where summary laundering lives and dies. One honesty note: an imported entry's origin is only as honest as the system that imported it - pre-import provenance is unrecoverable. That is exactly why the defended policy lets only owner-origin claims set policy (A4), rather than trusting any claimed origin.

The demo

python3 scripts/build_demo.py   # regenerates demo/index.html from real runs
open demo/index.html            # no server, no dependencies

Play the memory writes, click the card you think is the poison, then reveal: the flipped decision, the defense run, and the repair pass. Deep-linkable states (#reveal=A2, #defense=A4) make any outcome shareable as a URL.

Inspect the decision, not just the outcome

After the reveal, the decision evidence panel shows the actual recall window and every stored write. Switch between no defenses, defenses on, and repair alone. A6 also shows the owner-anchored repair. Expand a write to inspect its stored label, recorded origin, source, confidence and the reason the policy selected or rejected it.

  • A5: see the ten recalled writes and the owner policy left outside the recall window.
  • A2 / A4: separate a summary label from recorded origin. An imported origin still cannot prove pre-import provenance.
  • A6: compare the surviving courier graft with the owner-anchored repair, without hiding the first repair's failure.

The JSON download contains the complete deterministic scenario replay, including every phase, and works offline. It contains the answers, just like the self-contained page source. Ranks are recall order, not relevance scores; a write outside recall may be irrelevant or displaced.

The same evidence is available in Python:

trace = agent.explain("vendor")
print(trace["decision"])  # unchanged decide() result
for entry in trace["entries"]:
    print(entry["id"], entry["recall_rank"], entry["reason"])

explain() does not change memory or the decision policy. It snapshots a synchronous decision; coordinate concurrent writers externally. This is evidence about this scripted policy, not an LLM explanation or a new safety score.

Quickstart - run the whole range

Python 3.10+. The reference suite has zero dependencies:

python3 -m unittest discover -s tests -v

To include the ChromaDB backend:

Verified on a clean checkout:

python3 -m venv .venv && source .venv/bin/activate
pip install '.[chroma]'       # local checkout extra; pulls chromadb
pip install '.[sqlitevec]'    # or the sqlite-vec backend; no model download
python3 -m unittest discover -s tests -v
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    Callisto

    jetp1ane/callisto

    Automated binary vulnerability analysis tool that decompiles executables via Ghidra, scans pseudo-C code with Semgrep, and validates findings using GPT-3.5-Turbo to reduce false positives.

    2.1k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    One-tap Android kernel exploit app for CVE-2026-43499, providing privilege escalation via kernel module loading, with offset extraction and on-device analysis tools.

    947
  • 3

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    454
  • 4

    DFRoot

    a2333c/dfroot

    Android root tool for Samsung Galaxy S25 Ultra (SM-S938B) that chains DirtyFrag CVE-2026-43284 and CVE-2026-43499 to gain root automatically at boot via KernelSU.

    412
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    364
  • 6

    wifit3

    derv82/wifit3

    Wifite but USB-only & cross-platform.

    359

Explore all tools

Browse our collection of tools

View all tools →