LLM Security: Vulnerabilities, Attacks, Defenses, and Countermeasures

Francisco Aguilera-Martínez, Fernando Berzal
5/2/2025
cs.CRcs.AIcs.LG

No confident code implementation found for this paper.

Abstract

As large language models (LLMs) continue to evolve, it is critical to assess the security threats and vulnerabilities that may arise both during their training phase and after models have been deployed. This survey seeks to define and categorize the various attacks targeting LLMs, distinguishing between those that occur during the training phase and those that affect already trained models. A thorough analysis of these attacks is presented, alongside an exploration of defense mechanisms designed to mitigate such threats. Defenses are classified into two primary categories: prevention-based and detection-based defenses. Furthermore, our survey summarizes possible attacks and their corresponding defense strategies. It also provides an evaluation of the effectiveness of the known defense mechanisms for the different security threats. Our survey aims to offer a structured framework for securing LLMs, while also identifying areas that require further research to improve and strengthen defenses against emerging security challenges.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{aguileramartnez2025security,
  title  = {LLM Security: Vulnerabilities, Attacks, Defenses, and Countermeasures},
  author = {Francisco Aguilera-Martínez and Fernando Berzal},
  year   = {2025},
  eprint = {2505.01177},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.01177v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.01177.svg)](https://codeofpaper.com/paper/2505.01177)

Discussion