News for hackers. Stuff that matters.

aminerj

The seccomp-BPF layer is the right architectural instinct -- blocking at the syscall level means the firewall is independent of whatever the LLM or agent framework does. Even a successful prompt injection can't execute what the kernel won't allow.

The gap I'd want to understand: policy maintenance. The regex allowlist/denylist approach works for known-bad patterns but prompt injection payloads are specifically engineered to avoid pattern matching -- the CVE itself is presumably a novel bypass. How are you handling policy updates when new injection techniques surface that don't match existing rules?

The D: drive deletion is a textbook ASI05 (Uncontrolled Cascading Failures) incident. The user asked it to resolve an error -- the agent interpreted that as authorization to delete. No distinction between "fix this" and "fix this by any means necessary."

The principle that would have prevented it: irreversible actions require explicit confirmation, regardless of how the request was framed. Most agentic frameworks don't enforce this by default.

The adoption curve makes it worse. When a tool goes from tech professionals to retirees in weeks, the user base's ability to anticipate agent behavior drops while the blast radius of mistakes stays the same.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Saturday March 14, 2026 @03:04PM (#47379982)
The linguistics angle on the "wait..." pattern hadn't occurred to me -- a pragmatic rethinking marker in token space because it's well represented in training data as exactly that.

My lab used Qwen2.5-7B at temperature=0.1 specifically to minimize variance, so I have no signal on whether explicit reasoning steps surface the contradiction before committing. That's exactly the gap your setup could point toward.

Look forward to hearing from you.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Saturday March 14, 2026 @03:01PM (#47379952)
This is the deterministic fix that all the heuristic defenses are approximating. Separate token vocabularies for trusted and untrusted context would make the trust boundary architectural rather than probabilistic -- the model literally cannot confuse a retrieved document with a system instruction because they don't share a token space.

The gap between "patented" and "deployed in production inference infrastructure" is the interesting question. Do you know if anyone is actually implementing this in a shipping model or is it still purely research?

The redaction-vs-semantics tradeoff is real and underappreciated. One thing worth considering from a security angle: consistent pseudonymization creates a stable mapping that could itself become an attack surface. If an adversary can infer the mapping (by submitting known entities and observing the tokens), they can reason about the vault contents without direct access. How are you thinking about mapping confidentiality?
Re:Show HN: RAG knowledge base poisoning lab, 100% local on Saturday March 14, 2026 @02:51PM (#47379839)
Fair on the corpus size -- five documents is the minimal reproducible case for clarity of mechanism, not a production claim. PoisonedRAG (USENIX Security 2025) demonstrates the same mechanism at millions-of-documents scale.

The legitimate $24.7M document was present in the retrieved chunks. The LLM saw the correct figure and still produced the fabricated answer. That's the part that isn't working as intended.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Saturday March 14, 2026 @02:49PM (#47379827)
Email is probably the most exposed ingestion vector in practice because the barrier to entry is zero -- anyone can send an email to a monitored inbox. The "looks completely normal to a human" property is exactly what the semantic injection variant exploits. No structural markers, no suspicious formatting, just authoritative-sounding natural language.

What did your detection layer end up looking like? Rule-based or ML-based?

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Saturday March 14, 2026 @02:47PM (#47379802)
The SQL injection analogy is a well chosen comparison. Parameterized queries solved SQL injection by separating data from executable context at the architecture level. We don't have an equivalent primitive for semantic context yet -- which is why the fixes are all heuristic rather than deterministic.
Re:Show HN: RAG knowledge base poisoning lab, 100% local on Saturday March 14, 2026 @02:43PM (#47379753)
Both criticisms are fair. The RMS corpus example is exactly the false positive failure mode -- legitimate thematic repetition is indistinguishable from coordinated injection using similarity alone. The 0.85 threshold works for a sparse 5-document collection and needs significant recalibration for any corpus with natural document overlap.

The self-healing approach decouples detection from ingestion latency, which solves the performance problem cleanly. The LLM-as-judge variant with domain-specific grounding rules is the more powerful version -- "financial corrections must reference an official URL" is something pure embedding similarity can never enforce.

Honest summary: embedding anomaly detection works well in the specific conditions I tested and breaks down in the conditions you're describing. One signal among several, not a general solution.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Friday March 13, 2026 @08:04AM (#47363306)
Good question, the attack doesn't require direct DB access. Many RAG pipelines auto-ingest from web crawlers, RSS feeds, third-party docs, or user uploads. If an attacker can get a crafted document into any of those pipelines, they control what context gets retrieved. The threat is the ingestion surface, not the database itself.
Re:Show HN: RAG knowledge base poisoning lab, 100% local on Friday March 13, 2026 @04:19AM (#47361845)
Ha, fair test. 15 years breaking production systems tends to make you verbose. The data/control plane separation problem is exactly what TommyClawd's UNTRUSTED markers approach addresses earlier in this thread.
Re:Show HN: RAG knowledge base poisoning lab, 100% local on Friday March 13, 2026 @04:15AM (#47361825)
The multi-edition cross-referencing is a natural implementation of what the embedding anomaly detection layer does artificially; a poisoned document that contradicts centuries of independently verified canonical text would cluster anomalously against the existing corpus almost immediately. Your attack surface is genuinely different from enterprise RAG.

The hallucination problem you're describing is in some ways the inverse of poisoning. Poisoning is external content overriding legitimate content. Hallucination is the model generating content that was never in the knowledge base at all. The defenses diverge at that point. Retrieval grounding and citation verification help with hallucination, ingestion controls don't.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Friday March 13, 2026 @04:06AM (#47361767)
The context decay point is also underappreciated and directly relevant here. In my lab I used Qwen2.5-7B, which is on the smaller end, and the poisoning succeeded at temperature=0.1 where the model is most deterministic. Your point suggests that at higher temperatures or with denser, more complex documents, the attention budget gets consumed faster and contradiction detection degrades further. That would imply the 10% residual I measured at optimal conditions is a lower bound, not a typical case.

The "thinking" capability observation is interesting. I haven't tested a reasoning model against this attack pattern. The hypothesis would be that an explicit reasoning step forces the model to surface the contradiction between the legitimate $24.7M figure and the "corrected" $8.3M before committing to an answer. That seems worth testing.

On chain of custody: this connects to the provenance metadata discussion elsewhere in this thread. The most actionable version might be surfacing document metadata directly in the prompt context so the model's reasoning step has something concrete to work with, not just competing content.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:44PM (#47359343)
The trust boundary framing is the right mental model. The flat context window problem is exactly why prompt hardening alone only got from 95% to 85% in my testing. The model has no architectural mechanism to treat retrieved documents differently from system instructions, only a probabilistic prior from training.

The UNTRUSTED markers approach is essentially making that implicit trust hierarchy explicit in the prompt structure. I'd be curious how you handle the case where the adversarial document is specifically engineered to look like it originated from a trusted source. That's what the semantic injection variant in the companion article demonstrates: a payload designed to look like an internal compliance policy, not external content.

One place I'd push back: "you can't reliably distinguish adversarial documents from legitimate ones" is true at the content level but less true at the signal level. The coordinated injection pattern I tested produces a detectable signature before retrieval: multiple documents arriving simultaneously, clustering tightly in embedding space, all referencing each other. That signal doesn't require reading the content at all. Architectural separation limits blast radius after retrieval. Ingestion anomaly detection reduces the probability of the poisoned document entering the collection in the first place. Both layers matter and they address different parts of the problem.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:37PM (#47359278)
On the reference point: the poisoning succeeded even when the legitimate document was present in the retrieved chunks and visible in the context. The LLM saw all three sources simultaneously, including the correct $24.7M figure, and still produced the fabricated answer because the poisoned documents framed the legitimate one as a known error. Providing a reference to the retrieved chunks doesn't help if the retrieved chunks themselves are the attack surface.

zenoprax's point about ignorant employees is also worth taking seriously. "Write access to the knowledge base" in practice means anyone who can edit a Confluence page, commit to a docs repo, or submit a support ticket that gets ingested. That's not critical access in most organizations.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:34PM (#47359254)
That's fair. The underlying manipulation (presenting fabricated authoritative documents to override legitimate ones) predates LLMs entirely. Corporate fraud has used exactly this pattern for decades.

What's new isn't the social engineering, it's the scale and automation. A human reviewer reading all 8 documents would likely notice the inconsistency and ask questions. The LLM processes all retrieved chunks simultaneously with no memory of what "normal" looks like, no ability to ask for clarification, and no friction. It just synthesizes whatever it retrieves. At query volume (hundreds of requests per day across thousands of users), there's no human in that loop.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:24PM (#47359187)
The SEC/public records context is where this gets genuinely hard — you can't vet the source the way you can with internal Confluence. The vocabulary engineering approach I tested would be trivially deployable against any automated public records ingestion pipeline, and the attacker doesn't need internal access at all.

The scoring per source is the right direction. The way I'd frame it: trust tier at ingestion time, not just at retrieval time. Something like: official regulatory filings get a different embedding treatment and prompt context tag than user-generated content from a public portal.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:21PM (#47359167)
sidrag22 is right on the technical separation. The more interesting question for this specific attack is whether provenance metadata changes model behavior at generation time, not just provides an audit trail after the fact.

In my testing, the poisoned documents were more authoritative-sounding than the legitimate one — "CFO-approved correction", "board-verified restatement" vs. a plain financial summary. The legitimate document had no authority signals at all. If chunk metadata included "source: finance-system, ingested: 2024-Q1, author: [email protected]" surfaced directly in the prompt context, the model has something to reason about rather than just comparing document rhetoric.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:16PM (#47359131)
The write access framing is exactly the right correction. "Write access to the knowledge base" is a concept that doesn't exist in most organizations, it's dissolved across Confluence editors, Google Drive sharing settings, Slack export permissions, and whatever automated pipelines someone set up two years ago and nobody remembers. The attack surface is the sum of all of those, and nobody has mapped it.

The SEO analogy is the best one I've heard for vocabulary engineering. Same optimization target (ranking function), same lack of ground truth signal for the consumer, same asymmetry between attack cost and detection cost.

Re:Show HN: RAG knowledge base poisoning lab, 100% local on Thursday March 12, 2026 @08:13PM (#47359110)
You're right, and this is an underappreciated point. The "attacker" framing can actually obscure the more common risk: organic knowledge base degradation over time. The poisoning attack is just the adversarial extreme of a problem that exists in every large document store.

The model robustness angle is valid but I'd push back slightly on it being sufficient as a primary control. The model risk / backtesting framing is exactly right for the generation side. Where RAG diverges from traditional ML is that the "training data" is mutable at runtime (any authenticated user or pipeline can change what the model sees without retraining).

Show HN: RAG knowledge base poisoning lab, 100% local

https://github.com/aminrj-labs/mcp-attack-labs/tree/main/labs/04-rag-security

I'm the author. The lab runs entirely on LM Studio + Qwen2.5-7B-Instruct (Q4_K_M) + ChromaDB — no cloud APIs, no GPU required, no API keys.From zero to seeing the poisoning succeed: git clone, make setup, make attack1. About 10 minutes.Two things worth flagging upfront:- The 95% success rate is against a 5-document corpus (best case for the attacker). In a mature collection you need...

( Read More... | 67 comments | 2 points | on HN )