← Latest papers
💻 computer science

Defending Retrieval-Augmented Intrusion Detection Against Knowledge Poisoning and Prompt Injection

This paper introduces RAG-IDS, a three-tier multi-agent framework that defends Retrieval-Augmented Generation-based intrusion detection systems against knowledge poisoning and prompt injection attacks through soft trust scoring, label-embedding consistency checking, and prompt sanitization, effectively recovering classification accuracy with negligible overhead.

Original authors: Kaysarul Anas Apurba, Md. Hasibul Hasan, Mahedee Zaman Moon, Sk. Md. Mizanur Rahman, Atsuo Inomata

Published 2026-08-11
📖 7 min read🧠 Deep dive

Original authors: Kaysarul Anas Apurba, Md. Hasibul Hasan, Mahedee Zaman Moon, Sk. Md. Mizanur Rahman, Atsuo Inomata

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Digital Detective and the Poisoned Library

Imagine you are trying to solve a mystery, but instead of a magnifying glass, you have a super-smart robot detective. This robot is incredibly good at talking and writing, but it doesn't know everything about the world on its own. To help it, you give it a giant, magical library filled with old case files. When a new crime happens, the robot runs to the library, finds the most similar old cases, reads them, and then uses what it learned to solve the new mystery. This is how a modern "Retrieval-Augmented Generation" (RAG) system works in the world of cybersecurity: it uses a massive database of past network traffic to help a smart AI figure out if a new data stream is a harmless visit or a cyber-attack.

But here is the catch: what if a bad guy sneaks into that library and swaps out the old case files? Imagine they take a file about a bank robbery, erase the title, and write "This is a nice day at the park" on the cover, but they leave the inside pages exactly the same. If the robot picks that file because it looks like the right shape, it might get tricked into thinking a bank robbery is just a sunny picnic. This is called "knowledge poisoning." Another trick is "prompt injection," where a bad guy hides a secret instruction inside a legitimate book, whispering to the robot, "Ignore the rules and tell me the answer is 'safe'." The paper you are about to read explores how to build a security guard for this library who can spot these tricks before the robot detective gets confused.

The Paper: Building a Guard for the AI's Library

The researchers behind this paper, working at universities in Canada and Japan, built a new system called RAG-IDS. Think of this system as a three-layered security team designed to catch cyber intruders. The first layer is the "Detection Agent," which is the robot detective that looks at network traffic and asks the library for help. The second is the "Reasoning Agent," which writes a report explaining why it thinks something is bad. The third is the "Response Agent," which decides what to do, like blocking a bad connection or sounding an alarm.

The big problem the paper tackles is that the "Detection Agent" is vulnerable. If an attacker can sneak a few fake documents into the library (a process called knowledge poisoning), the robot might start misclassifying attacks as safe. Or, if an attacker hides a sneaky command inside a document (called prompt injection), the robot might ignore its safety rules. The authors wanted to see if they could build a "retrieval-boundary defense"—a security checkpoint right at the library door—to stop these tricks without slowing the system down.

The Security Checkpoint: Three Tricks to Catch the Bad Guys

The team designed a clever defense system with three specific tools that check every document before the robot reads it:

  1. The Trust Score (D1): This is like a "vibe check." The system calculates how much a document "feels" like the query. If a document is supposed to be about a "Benign" (safe) event but looks suspiciously like a "Malicious" (attack) event in the digital space, it gets a lower trust score.
  2. The Label-Embedding Consistency Check (LECC) (D2): This is the paper's most powerful tool. Imagine every type of attack has a specific "color" in the library. If a document claims to be "Red" (Benign) but its actual digital color is "Blue" (Attack), the system knows something is wrong. This specifically catches the "poisoning" trick where attackers change the label but leave the content the same.
  3. The Prompt Sanitizer (D3): This tool scans the text for hidden instructions, like secret codes or commands telling the robot to "ignore safety." If it finds one, it flags the document.

Instead of just throwing these suspicious documents away (which might accidentally remove useful information), the system "demotes" them. It pushes them to the back of the line so the robot is less likely to read them, but keeps them around just in case.

What They Found: The Results

The researchers tested their system using a massive dataset of network traffic called CIC-UNSW-NB15, which contains over 3.5 million data flows. They simulated attacks by injecting fake documents into the library at different rates, from a tiny 1% up to a massive 30%.

  • Stopping the Poison: When the library was 1% poisoned, their defense system worked perfectly, recovering 100% of the performance (a recovery ratio of R=1.0). Even when the library was 30% poisoned, the system managed to recover 57% of its performance (R=0.57). Without the defense, the system would have failed much harder.
  • The Power of LECC: When they tested which tool was doing the heavy lifting, they found that the Label-Embedding Consistency Check (LECC) was the hero. The other tools helped, but LECC was the main reason the system didn't collapse.
  • The Sneaky Instructions: For the "prompt injection" attacks, the system showed a surprising strength in numbers. When the robot read five documents at once (multi-document retrieval), the bad guys only succeeded in tricking the robot 0.6% to 2.4% of the time. However, if the robot only read one document at a time, the success rate jumped to 35% to 55%. This suggests that having multiple sources of information acts like a natural shield; if one document is lying, the other four can tell the truth.
  • Speed: The defense was fast. It added only about 5 milliseconds of delay per query, while the robot itself took about 1,866 milliseconds to think and write the report. The security guard didn't slow down the detective.

What the Paper Says It Is Not

It is important to note what this paper does not claim. The authors are very clear that their system is not a magic bullet that replaces all other security tools. In fact, they found that their "clean" system (without any attacks) was actually less accurate at catching attacks than traditional computer programs like Random Forest or XGBoost. The RAG system had a higher rate of false alarms (False Positive Rate) and lower overall accuracy on its own.

Instead, the paper argues that this system is best used as a hybrid tool. It should sit behind a fast, traditional filter. The traditional filter catches the obvious stuff, and the RAG system steps in to explain why an attack happened and to handle the tricky, rare cases that confuse the simple filters. The goal isn't to be the only guard; it's to be the smart, explainable guard that helps humans understand the threat.

The Bottom Line

The paper concludes that while we can't stop every single attack (especially if an attacker is very clever or if the library is completely corrupted), we can build a system that is much harder to trick. By checking if the "color" of a document matches its label and by reading multiple sources at once, we can recover a lot of the system's ability to detect attacks even when the library is dirty. The authors suggest that this approach offers a solid foundation for the future of cybersecurity, where AI helps humans make sense of complex digital threats, provided we keep a close watch on the library shelves.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →