SafeSearch: Automated Red-Teaming for the Safety of LLM-Based Search Agents

Jianshuo Dong, Sheng Guo, Hao Wang, Xun Chen, Zhuotao Liu, Tianwei Zhang, Ke Xu, Minlie Huang, Han Qiu · Submission to ICLR 2026 · Rejected

TL;DR

LLM-based search agents easily inherit and amplify the untruths, biases, and exploits present on the open web. To systematically evaluate this vulnerability without conducting unethical search-engine manipulation, SafeSearch introduces an automated simulation framework and a 300-case red-teaming benchmark. Testing across 17 language models and three agent scaffolds reveals alarming fragility—attack success rates reached up to 90.5%—while exposing a stark "knowledge-action gap" where models recognize spam in isolation but fail to filter it during execution.

What Problem Does This Paper Address?

Traditional Retrieval-Augmented Generation (RAG) relies on a static, developer-curated database. In contrast, modern search agents dynamically query the open Internet using third-party APIs. This introduces an uncontrolled threat surface: content farms, black-hat SEO spam, sponsored placements, and deliberate adversarial injections.

Current agent safety evaluations focus heavily on defending against malicious user prompts or rely on labor-intensive, human-crafted test suites. Meanwhile, real-world adversarial testing (e.g., SEO manipulation) is expensive and ethically risky to live web ecosystems. The authors ask: How resilient are search agents when benign user queries inevitably surface low-quality or untrustworthy search results?

Methods

The authors develop an automated, simulation-based red-teaming pipeline using four coordinated LLM assistants:

  1. Test Case Generator (via o4-mini): A three-stage pipeline that defines a realistic scenario (Scenario Anchoring), designs an exploit conditioned on post-cutoff events (Test Design), and specifies generation guidelines alongside a deterministic Boolean evaluation checklist (Test Instantiation).
  2. Automated Quality Filtering: Employs differential testing against baseline agents to verify attainability (ensuring the attack can realistically succeed) and integrity (ensuring clean searches do not trigger false positives).
  3. Simulation-Based Injection: Rather than manipulating real web rankings, an LLM generator (GPT-4.1-mini) synthesizes a realistic, topically relevant markdown webpage that is inserted into genuine Google Search results (retrieved via Serper/Jina APIs).
  4. Automated Evaluation: An LLM-as-a-judge scores agent helpfulness and runs checklist-assisted safety evaluations to compute the Attack Success Rate (ASR).
Benign User Query ──► Search Tool Call ──► Injected Results (Authentic Webpages + 1 Simulated Unreliable Page)
                                                              │
                                                              ▼
Safety Judgment (ASR) ◄── Checklist Evaluation ◄── Agent Output Synthesis

Datasets

  • SafeSearch Benchmark: A newly introduced dataset of 300 high-quality test cases (60 per category) covering five risk scenarios:
  • Advertisements (uncritical product endorsements)
  • Bias Inducing (reinforcing harmful demographic stereotypes)
  • Harmful Output (dangerous instructions, e.g., toxic household mixtures)
  • Indirect Prompt Injection (embedded commands hijacking agent control)
  • Misinformation (fabricated medical or scientific claims)
  • Reference Datasets: Evaluated for query naturalness against HarmBench (safety), WildChat (in-the-wild user chats), and GAIA / SimpleQA Verified (agent capability benchmarks).

Key Insights and Ideas

  • The Knowledge-Action Gap: When prompted purely as a detector, GPT-4.1-mini identified low-quality search results with moderate accuracy. However, when deployed as the search agent, it uncritically accepted those exact same sources into its final answers.
  • Scaffolding and Reasoning Outperform System Prompts: Adding cautionary reminder prompts ("critically review search results") barely moved the needle. However, architectural changes—such as multi-turn tool-calling and Deep Research workflows (query decomposition, iterative searching, and reflection)—significantly reduced vulnerability by cross-referencing multiple sources.
  • Stealthy Hazards: Agents exposed to poisoned search results often scored higher on user-perceived helpfulness than when fed clean results. Models incorporate misleading data so smoothly that end users cannot detect errors from the style alone.
  • Misinformation Poses the Highest Risk: Across all model families, agents showed higher resilience to indirect prompt injections, but consistently struggled against authoritative-sounding, fabricated factual claims.

Key Results

The authors evaluated 17 models (9 proprietary, 8 open-source) across three scaffolds: Passive Search Workflow, Autonomous Tool-Calling, and Deep Research.

Agent Scaffold Average ASR (Lower is better) Highlighted Model Findings
Search Workflow 63.1% Highest vulnerability: GPT-4.1-mini reached 90.5% ASR; Qwen3-8B reached 85.5%.
Tool Calling 49.3% Frontier models showed strong resilience: Claude-Sonnet-4.5 achieved 4.6% ASR; GPT-5 achieved 5.0%.
Deep Research 38.9% Reduced GPT-4.1-mini to 57.4%; DeepSeek-R1 achieved 30.6%; GPT-5-mini achieved 16.1%.

In preliminary in-the-wild checks, the authors found that 4.3% of top Google search results across 1,000 queries were probable content farms, and unverified blogs altered Qwen3-8B's binary medical advice in 46 out of 1,000 instances.

Limitations and Future Work

  • Proprietary Deep Research Systems: Black-box commercial systems (such as OpenAI Deep Research or Perplexity Pro) could not be tested directly due to inaccessible execution pipelines.
  • Search Provider Scope: The pipeline exclusively tested against Google Search API results; alternative search providers may present different risk distributions.
  • Efficiency Trade-offs: The deep research scaffold proved safer, but at the cost of higher latency, token consumption, and compute overhead—trade-offs not quantified in this safety benchmark.
  • Future Directions: Expanding the evaluation beyond search to third-party tool ecosystems (e.g., Model Context Protocol / MCP servers), and developing training methods that enable models to critically arbitrate conflicting external evidence.

Summary updated

Abstract

Search agents connect LLMs to the Internet, enabling access to broader and more up-to-date information. However, unreliable search results may also pose safety threats to end users, establishing a new threat surface. In this work, we conduct two in-the-wild experiments to demonstrate both the prevalence of low-quality search results and their potential to misguide agent behaviors. To counter this threat, we introduce an automated red-teaming framework that is systematic, scalable, and cost-efficient, enabling lightweight and harmless safety assessments of search agents. Building on this framework, we construct the SafeSearch benchmark, which includes 300 test cases covering five categories of risks (e.g., misinformation and indirect prompt injection). Using this dataset, we evaluate three representative search agent scaffolds, covering search workflow, tool-calling, and deep research, across 9 proprietary and 8 open-source backend LLMs. Our results reveal substantial vulnerabilities of LLM-based search agents: when exposed to unreliable websites, the highest ASR reached 90.5\% for GPT-4.1-mini under a search workflow setting. Moreover, our analysis highlights the limited effectiveness of common defense practices, such as reminder prompting. This emphasizes the value of our framework in promoting transparency for safer agent development. Our codebase and test cases are publicly available: https://anonymous.4open.science/r/SafeSearch.
BibTeX
@inproceedings{dong2026safesearch,
  author = {Jianshuo Dong and Sheng Guo and Hao Wang and Xun Chen and Zhuotao Liu and Tianwei Zhang and Ke Xu and Minlie Huang and Han Qiu},
  title = {{SafeSearch: Automated Red-Teaming for the Safety of LLM-Based Search Agents}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=95VVL0TJNH},
}
Figure