Attack Detection Based on Domain-Specific Large Language Models

Xiaojun Chen, Ming Zhu, Shang Xia2025

Abstract

SQL Injection Attacks (SQLIA) and Cross-Site Scripting (XSS) attacks represent significant threats to web security. To effectively detect and identify these attacks and address the challenges of poor adaptability and high false positive rates in traditional methods, this paper proposes a novel attack detection approach based on domain-specific large language models. By constructing a specialized dataset, applying prompt engineering techniques, and employing precise prompt-based finetuning, we develop a domain-specific large language model tailored for attack detection. The number of fine-tuning samples and various training parameters are analyzed and optimized to improve the detection performance of the model. Experimental results demonstrate that the domain-specific large language model-based detection method outperforms general models in identifying SQLIA and XSS attacks, achieving an accuracy rate exceeding 96.7% and a false positive rate below 0.6%. These results indicate the method's promising potential for practical application.
BibTeX
@misc{chen2025attack,
  author = {Xiaojun Chen and Ming Zhu and Shang Xia},
  title = {{Attack Detection Based on Domain-Specific Large Language Models}},
  year = {2025},
  doi = {10.1109/nnice64954.2025.11064357},
}

Loading related content...

Figure