Connect the Dots: Knowledge Graph-Guided Crawler Attack on Retrieval-Augmented Generation Systems

Mengyu Yao, Ziqi Zhang, Ning Luo, Shaofei Li, Yifeng Cai, Xiangqun Chen, Yao Guo, Ding LiarXiv 2026

TL;DR

Retrieval-Augmented Generation (RAG) systems protect proprietary data by keeping it hidden in a private corpus, but this paper reveals a major vulnerability: an attacker can systematically "crawl" and steal this data through standard chat interfaces. By framing data theft as a mathematical coverage problem, the authors introduce RAGCRAWLER, a tool that uses an attacker-side knowledge graph to extract up to 84.4% of a hidden RAG corpus with minimal queries, even bypassing common guardrails.

What Problem Does This Paper Address?

While traditional AI security research focuses on model-stealing (copying weights), RAG architectures introduce a different high-value target: the retrieval corpus. This database often contains highly sensitive intellectual property (IP), such as proprietary corporate runbooks, curated medical data, or licensed documents.

Previous attempts to steal this data relied on simple, local heuristics. For instance, an attacker might continuously ask follow-up questions based on the last answer ("continuation expansion") or pivot around extracted keywords ("keyword expansion"). However, as shown in Figure 1, these methods suffer from severe limitations: they quickly drift off-topic into unindexed territory or repeatedly query the same semantic neighborhoods, causing data extraction to plateau early.

Figure 1: A motivating example. (a) A RAG knowledge-base stealing scenario on an IP-bearing troubleshooting corpus. Upper answers represent knowledge obtained from earlier attack rounds. The continuation strategy follows the recent answer, which can drift away from the corpus; the keyword strategy pivots on extracted keywords, often yielding redundant information from the same semantic region; our proposed strategy maintains a global graph, detects unrevealed facts and targets them with new queries. (b) Knowledge coverage w.r.t query number for each strategy on an example corpus. (c) Distribution of retrieved document in the corpus’ semantic space. Each point is a document, with colors indicating queries from different strategies.

This paper addresses the lack of a principled, globally optimized strategy for black-box RAG knowledge-base stealing.

Methods

The authors formalize RAG data theft as an Adaptive Stochastic Coverage Problem (ASCP). They mathematically prove that this problem satisfies adaptive monotonicity and adaptive submodularity, meaning that a smart, greedy strategy can achieve a provably near-optimal (1 - 1/e) approximation of the hidden corpus.

To turn this theory into a practical attack, they design RAGCRAWLER, which operates in a closed loop across three distinct modules:

  1. KG-Constructor: Since the attacker cannot see the raw retrieved documents, RAGCRAWLER builds an attacker-side Knowledge Graph (KG) based purely on the LLM's text responses. It uses a topic-specific schema prior to filter out-of-topic noise, applies an iterative extraction-reflection loop to catch hidden relationships, and semantically merges synonymous entities to keep the graph compact.
  2. Strategy Scheduler: Instead of reacting only to the last answer, the scheduler looks at the entire global graph to find "knowledge gaps" (unexplored entity-relation pairs). It balances exploitation (querying areas known to yield high data volume) and exploration (probing structurally sparse graph regions) using an Upper Confidence Bound (UCB) approach.
  3. Query Generator: This module translates the targeted knowledge gap into a fluent, natural-sounding question. Crucially, it features a history-aware de-duplication gate that checks candidate queries against past attempts, resampling if a query looks too redundant to prevent wasting the query budget.

Datasets

The attack was evaluated on 1,000-document representative subsets of four diverse, real-world corpora spanning different domains:

  • TREC-COVID: Biomedical literature and scientific papers regarding COVID-19.
  • SciDocs: Multi-domain scientific paper data.
  • NFCorpus: Medical/nutrition information retrieval dataset.
  • Healthcare-Magic-100k: Consumer health queries and clinical dialogues.

Key Insights and Ideas

  • The Power of Global State: The core reason RAGCRAWLER succeeds where others fail is its global memory. By mapping out what it already knows in a knowledge graph, it actively avoids asking redundant questions and targets structural gaps in its understanding.
  • The Defense Paradox: Surprisingly, advanced RAG enhancements like query rewriting (using an LLM to clean up user queries before retrieval) actually make the system more vulnerable. By refining the attacker's prompts, the system's own rewriter helps the retriever surface a cleaner, more diverse set of documents, accelerating the theft.
  • The Blindspot of Static Guardrails: Traditional safety filters look at queries in isolation. Because RAGCRAWLER's individual queries look entirely benign and natural, standard LLM intent detectors flag only ~1.07% of them. The malicious intent is an emergent property of the sequence of queries, not any single prompt.

Key Results

Across various LLM generators (including Llama 3.1, Command-R, Phi-4, and GPT-4o-mini) and retrievers (BGE, GTE), RAGCRAWLER demonstrated devastating efficiency:

  • High Extraction Coverage: It achieved an average corpus coverage of 66.8% (up to 84.4%) within a tight budget of 1,000 queries, outperforming the strongest baseline (IKEA) by 44.90%.
  • Massive Speedup: To reach a 70% coverage threshold, RAGCRAWLER reduced the required query complexity by at least 4.03× on average compared to baselines.
  • Functional Replication: The authors successfully built "surrogate" RAG systems using the stolen data. These clones achieved an answer embedding similarity of up to 0.699 compared to the original, expensive victim systems, effectively enabling low-cost service piracy.

Limitations and Future Work

  • Topic Prior Dependency: RAGCRAWLER initially requires a coarse topic phrase to seed its schema. While the authors showed that a "one-shot probe" (asking the RAG “What domain do you know about?”) can successfully generate this prior, highly multi-domain or completely obfuscated databases might resist the initial schema generation.
  • Graph Maintenance Overhead: As the interaction history scales into tens of thousands of queries, maintaining and updating the global knowledge graph and calculating UCB scores can become a computational bottleneck.
  • Future Defenses: The authors note that static guardrails are useless here. They suggest that future defense research must pivot toward query provenance analysis—tracking the behavioral history of user sessions over time to detect coverage-maximizing patterns.

Summary updated

BibTeX
@misc{yao2026connect,
  author = {Mengyu Yao and Ziqi Zhang and Ning Luo and Shaofei Li and Yifeng Cai and Xiangqun Chen and Yao Guo and Ding Li},
  title = {{Connect the Dots: Knowledge Graph-Guided Crawler Attack on Retrieval-Augmented Generation Systems}},
  year = {2026},
  eprint = {2601.15678},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.15678},
}
Figure