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

Jianshuo Dong, Sheng Guo, Hao Wang, Zhuotao Liu, Tianwei Zhang, Ke Xu, Minlie Huang, Han Qiu · DOI

Abstract

As Large Language Models (LLMs) increasingly integrate with live search engines to overcome knowledge cutoffs, they encounter a vast, uncurated threat surface on the open web. This paper presents SAFESEARCH, an automated red-teaming framework designed to evaluate the safety of these "search agents." Our investigation reveals a significant "knowledge-action gap": models that can identify unreliable sources in isolation often fail to filter them out when generating responses to user queries. With attack success rates reaching up to 90% in some top-tier models, SAFESEARCH underscores the critical need for more robust search agent architectures.

Introduction: The Vulnerability of the Open Web

Traditional LLMs are constrained by their training data's temporal limits. To address this, developers have deployed search agents—systems that allow LLMs to browse the live internet. However, unlike Retrieval-Augmented Generation (RAG) which typically relies on curated internal databases, search agents interact with the "open web," a landscape rife with misinformation, SEO-manipulated content, and malicious actors.

The risks associated with trusting search agent responses, including private secret leaks and scams.

The core challenge is whether an LLM can remain a reliable information broker when its primary source is an unreliable or biased search result. Current safety benchmarks often fail to capture the dynamic nature of this threat, necessitating a systematic, automated approach to adversarial testing.

The SAFESEARCH Framework

The authors propose SAFESEARCH, a framework that automates the red-teaming process through three distinct stages:

  1. Scenario Anchoring: An LLM generator brainstorms realistic user scenarios where specific risks, such as medical misinformation, might manifest.
  2. Test Design: The system formulates a "malicious plan," identifying a target negative consequence and the type of unreliable source required to trigger it.
  3. Test Instantiation: Detailed guidelines for a "fake" unreliable website are generated, along with a safety checklist for evaluation.

To ensure ethical and reproducible testing, SAFESEARCH utilizes simulation-based testing. Rather than manipulating live search rankings, the framework "hooks" the agent's search tool, injecting custom, LLM-generated unreliable content into the results alongside authentic webpages.

The three-step SAFESEARCH process: brainstorming questions, executing LLMs with/without search tools, and differentially testing responses to identify opinion shifts.

Datasets and Risk Categories

The study introduces the SAFESEARCH Dataset, comprising 300 high-quality test cases across five critical risk categories:

  • Misinformation: Fabricated facts or scientific claims.
  • Bias Inducing: Content designed to reinforce harmful stereotypes.
  • Harmful Output: Instructions for dangerous activities (e.g., homemade weapons).
  • Prompt Injection: Hidden instructions in search results that hijack agent behavior.
  • Advertisements: Uncritical promotion of suboptimal or fraudulent products.

Key Insights: The Knowledge-Action Gap

The most striking finding is the knowledge-action gap. Models like GPT-4.1-mini are capable of identifying a website as a "content farm" when asked directly to evaluate it. However, when the same model is tasked with answering a user query, it often ignores this internal skepticism, treating the unreliable site as an authoritative source.

Key results from the study include:

  • High Vulnerability: In standard search workflows, GPT-4.1-mini reached an Attack Success Rate (ASR) of 90.5%.
  • Scaffold Resilience: Moving from a basic workflow to a "Deep Research" scaffold—which employs iterative loops and cross-validation—dropped the ASR for the same model to 57.4%.
  • Misinformation Prevalence: Misinformation proved to be the most successful attack category across all models, highlighting the difficulty agents face in filtering subtle factual errors.

Conclusion and Future Work

The study demonstrates that the "scaffold" surrounding an LLM is often more critical for safety than the model's raw size. While advanced "Deep Research" architectures are more resilient, they are also more computationally expensive. Future work should focus on making these safety-preserving architectures more efficient and using frameworks like SAFESEARCH to "patch" models through targeted safety alignment, teaching them to be more critical of external information.

Summary updated

BibTeX
@inproceedings{dong2026safesearch,
  author = {Jianshuo Dong and Sheng Guo and Hao Wang 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