Large Language Models for Cyber Security: A Systematic Literature Review

Hanxiang Xu, Shenao Wang, Ningke Li, Kailong Wang, Yanjie Zhao, Kai Chen, Ting Yu, Yang Liu, Haoyu WangACM Transactions on Software Engineering and Methodology 2024 · DOI · OpenReview

TL;DR

This paper presents a comprehensive systematic literature review of how Large Language Models (LLMs) are being applied to cybersecurity tasks. It reveals a significant shift towards LLMs automating complex security workflows, generating code, and even acting as autonomous agents, while also highlighting challenges in data scarcity and model interpretability.

What Problem Does This Paper Address?

The cybersecurity landscape is constantly evolving, with increasing volumes and sophistication of cyber threats. Traditional methods struggle to keep pace, necessitating intelligent systems for tasks like vulnerability detection, malware analysis, and incident response. While LLMs have shown remarkable capabilities in natural language processing, their application in cybersecurity is rapidly expanding, creating a need for a structured overview of the current state-of-the-art, the challenges, and future directions. This paper aims to provide that holistic view by systematically analyzing existing research.

Methods

The authors conducted a systematic literature review (SLR) following established guidelines. They initiated the process by identifying relevant venues and databases, defining search keywords, and establishing a "Quasi-Gold Standard" (QGS) set of papers. An automated search was performed across seven databases, yielding a large initial pool of papers. This pool underwent a multi-stage selection process, including coarse-grained inclusion/exclusion criteria and fine-grained quality assessment, to arrive at 185 high-quality papers. The selected papers were then analyzed to answer four key research questions: (1) types of security tasks addressed, (2) LLMs employed, (3) domain specification techniques used, and (4) data collection and preprocessing differences.

Datasets

The paper discusses various dataset types used in LLM4Security research, categorizing them into:

  • Open-source datasets: Publicly accessible datasets like UNSW-NB15 for network intrusion detection.
  • Collected datasets: Data gathered directly from sources like websites, forums, blogs, and social media.
  • Constructed datasets: Specialized datasets created by researchers through modification or augmentation of existing data, often to generate synthetic data for fine-tuning.
  • Industrial datasets: Data from real-world commercial or industrial settings, which are notably underrepresented in the reviewed literature.

The paper also categorizes datasets by type: code-based (most prevalent), text-based, and combined datasets.

Key Insights and Ideas

  • Paradigm Shift: LLMs are moving cybersecurity beyond simple defect detection towards automated generation and repair of code, and even orchestrating complex security workflows.
  • Hybrid Intelligence: The most effective LLM applications in security are not standalone but act as intelligent "brains" integrated with traditional tools (static analyzers, fuzzers), forming hybrid, neuro-symbolic approaches.
  • Autonomous Agents: A significant emerging trend is the development of LLM-based autonomous agents capable of handling multi-step security tasks, planning, and interacting with environments.
  • Data Scarcity is Real: The reliance on open-source, collected, and constructed datasets highlights a persistent challenge of data scarcity, with a notable disconnect from industrial practice.
  • LLMs for Data Augmentation: LLMs are increasingly used to generate synthetic data (code, text, malicious entities) to address data scarcity and improve model robustness.
  • Decoder-Only Dominance: Recent years (2023-2024) show a clear dominance of decoder-only LLMs, likely due to their generative strengths and few-shot capabilities, though other architectures remain relevant for specific tasks.

Key Results

  • The review analyzed 185 papers from top security and software engineering venues, covering over 47,000 initially collected papers.
  • RQ1 (Security Tasks): LLMs are applied across six security domains, with software and system security being the most active (63% of research), followed by network security (14%) and information/content security (12%).
  • RQ2 (LLMs Employed): Over 30 distinct LLMs are used, categorized into encoder-only, encoder-decoder, and decoder-only architectures. Decoder-only models have seen a dramatic surge in adoption since 2023.
  • RQ3 (Adaptation Techniques): Prompt engineering is nearly universal. Fine-tuning was used in 31% of papers, and external augmentation in 36%. Hybrid systems integrating LLMs with external tools are a key trend.
  • RQ4 (Data): Open-source, collected, and constructed datasets are heavily relied upon. Code-based datasets are predominant, but combined datasets (code + natural language) are growing. Industrial datasets are scarce.

Limitations and Future Work

  • Threats to Validity: Potential for overlooking relevant papers due to search limitations and biases in research selection.
  • Model Size and Deployment: The sheer size of LLMs poses challenges for storage, memory, and computational demands, especially for real-time deployment.
  • Data Quality, Availability, and Security: Data scarcity, potential for benchmark contamination, and privacy concerns regarding personal information in training data are significant issues.
  • Generalization Ability: Ensuring LLMs generalize across diverse tasks, datasets, and domains beyond their training environment requires meticulous fine-tuning and continuous feedback.
  • Interpretability, Trustworthiness, and Ethical Usage: The "black-box" nature of LLMs hinders understanding their decision-making, necessitating research into XAI methods and structured evaluation.
  • Limitations in Cryptanalysis: LLMs' probabilistic nature conflicts with the deterministic demands of cryptanalysis.
  • Future Work:
    • Developing more robust, interpretable, and trustworthy LLM applications.
  • Addressing the inherent security risks of LLMs themselves (e.g., adversarial attacks).
  • Exploring multimodal LLMs for security tasks (integrating voice, images, video).
  • Expanding LLM applications to under-explored domains like hardware and blockchain security.
  • Developing domain-specific datasets and integrating LLMs into more sophisticated security workflows and autonomous agents.
  • Investigating the security of LLMs themselves (Security4LLM).

Summary updated

BibTeX
@article{xu2024large,
  author = {Hanxiang Xu and Shenao Wang and Ningke Li and Kailong Wang and Yanjie Zhao and Kai Chen and Ting Yu and Yang Liu and Haoyu Wang},
  title = {{Large Language Models for Cyber Security: A Systematic Literature Review}},
  journal = {ACM Transactions on Software Engineering and Methodology},
  year = {2024},
  doi = {10.1145/3769676},
}
Figure