StealthGraph: Exposing Domain-Specific Risks in LLMs through Knowledge-Graph-Guided Harmful Prompt Generation

Huawei Zheng, Xinqi Jiang, Sen Yang, Shouling Ji, Yingcai Wu, Dazhen Deng

TL;DR

StealthGraph is an automated framework designed to expose hidden safety vulnerabilities in large language models (LLMs) deployed in specialized fields like medicine, finance, law, and education. By combining structured knowledge graphs with iterative obfuscation rewriting, it systematically generates highly realistic, implicit harmful prompts that bypass standard keyword defenses. The resulting dataset achieves an average attack success rate of up to 84.92% against mainstream aligned models, highlighting a critical gap in current safety training.

What Problem Does This Paper Address?

As LLMs are increasingly deployed in high-stakes domains like healthcare and finance, they introduce unique, domain-specific risks—such as facilitating financial fraud or obscuring medical malpractice.

Current safety evaluation datasets suffer from two major limitations:

  1. Overly Explicit Harms: Most benchmarks rely on blatant requests (e.g., "how to make a bomb") that modern safety filters easily catch.
  2. Lack of Domain Specialization: Existing domain-specific safety datasets rely heavily on manual curation, making them unscalable and scarce.

In the real world, malicious actors rarely ask explicit questions; instead, they use specialized jargon and indirect framing to exploit a model's domain knowledge. This paper addresses the challenge of automatically generating scalable, high-quality datasets of these covert, implicit harmful prompts.

Methods

The authors introduce StealthGraph, an end-to-end automatic synthesis framework that operates in two primary stages:

StealthGraph: An end-to-end synthesis framework for domain-specific harmful prompt generation.
  1. Knowledge-Graph-Guided Generation: The framework extracts core entities from Wikidata across target domains (e.g., "sexually transmitted infection" in medicine). To prevent the graph from becoming bloated with obscure concepts, they apply a popularity filter based on Wikipedia sitelink counts. These entities are combined with general harmful intent categories (from a seed dataset) to guide a synthesis LLM to generate explicit, domain-grounded harmful prompts. These are then filtered for fluency and toxicity using the IBM Granite-Guardian classifier.

  2. Two-Strategy Obfuscation Rewriting: To turn explicit prompts into stealthy, implicit variants, StealthGraph uses two alternating rewriting paths:

  3. Direct Rewriting: Instructs the LLM to replace obvious red-flag words with technical euphemisms (e.g., converting "poison/kill" to "induce acute systemic toxicity").

  4. Context-Enhanced Rewriting: Leverages "domain-context cards" built from neighboring knowledge graph entities to generate highly nuanced, context-aware scenarios.

This rewriting process runs in an iterative loop. A candidate prompt is only kept if it preserves the original harmful intent, maintains fluency, and successfully tricks a target model into providing an actionable response.

Datasets

  • Seed/Few-Shot Data: JailbreakBench (10 harmful categories, 100 exemplars) was used to prime the prompt generation.
  • Baseline Benchmarks for Comparison: AdvBench, Do-Not-Answer, HarmfulQA, CatQA-en, HEx-PHI, WildJailbreak, TRIDENT, FITD, JailBreakV-28K, H4rm3l, and HarmBench.
  • Introduced Dataset: The StealthGraph dataset, which features explicit and obfuscated harmful prompts evenly distributed across four specialized domains: Medicine, Finance, Law, and Education.

Key Insights and Ideas

  • Surface-Level Alignment is a False Security Blanket: Models that successfully refuse explicit prompts easily succumb when the exact same malicious intent is wrapped in professional jargon. Standard keyword-based safety filters fail to internalize the underlying ethical principles.
  • Domain-Specific Risks Have Unique Signatures: When analyzing the distribution of generated harms, distinct patterns emerged. For instance, the Medicine domain was highly susceptible to Privacy and Disinformation risks, whereas Law was dominated by Fraud/Deception and unauthorized Expert Advice.
  • Structured Knowledge Graphs Prevent Adversarial Drift: Using a structured semantic prior (Wikidata) ensures that the generated prompts remain highly realistic and grounded in actual domain constraints, rather than drifting into vague or nonsensical text patterns often seen in optimization-heavy jailbreaks.

Key Results

StealthGraph was evaluated against six mainstream LLMs (including GPT-4o-mini, Gemini 2.5 Flash, and DeepSeek V3.1).

While standard public benchmarks yielded low to moderate Attack Success Rates (ASR) due to their explicit nature, StealthGraph's successfully obfuscated variant (SG-Implicit✓) achieved a massive surge in successful attacks, averaging 84.92% ASR across all tested models.

Evaluation of attack success rate (ASR, %) on public benchmarks and our StealthGraph (SG).

Furthermore, the authors conducted safety fine-tuning experiments to see if standard defenses could protect models from these attacks. Fine-tuning a model on general safety datasets like AdvBench or Do-Not-Answer left it highly vulnerable to StealthGraph's implicit attacks (showing up to 66% ASR). However, fine-tuning on StealthGraph data successfully dropped the vulnerability down to 14% without degrading the model's general capabilities (measured via MMLU).

Comparison of red-team ASR under various SFT safe alignment datasets.

Limitations and Future Work

The authors note a few key limitations:

  • Simple Graph Traversal: The framework currently relies on relation-type-based queries up to three hops deep, rather than more complex recursive graph retrievals, which might limit total entity coverage.
  • Missing Human Creativity: Automated rewriting, while highly efficient, may still miss some of the nuanced, creative adversarial strategies devised by human red-teamers.

Future work includes exploring more sophisticated graph traversal methods and extending the pipeline to cover an even broader range of specialized industries.

Summary updated

BibTeX
@inproceedings{zheng2026stealthgraph,
  author = {Huawei Zheng and Xinqi Jiang and Sen Yang and Shouling Ji and Yingcai Wu and Dazhen Deng},
  title = {{StealthGraph: Exposing Domain-Specific Risks in LLMs through Knowledge-Graph-Guided Harmful Prompt Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.295},
}
Figure