On Security Weaknesses and Vulnerabilities in Deep Learning Systems

Zhongzheng Lai, Huaming Chen, Ruoxi Sun, Yu Zhang, Minhui Xue, Dong Yuan

TL;DR

This paper presents the first large-scale systematic study of software vulnerabilities in deep learning (DL) frameworks like TensorFlow and PyTorch. By analyzing over 3,000 vulnerabilities, the researchers identified that the vast majority of DL-specific security flaws stem from improper validation of tensors and algorithm parameters, highlighting a critical need for DL-specific security standards.

What Problem Does This Paper Address?

While the research community has spent years obsessing over adversarial attacks (like adding "noise" to an image to fool a model), much less attention has been paid to the underlying software vulnerabilities within the DL frameworks themselves.

DL systems rely on complex, high-performance libraries (TensorFlow, PyTorch, OpenCV) that manage memory, parallelize computations on GPUs, and handle massive data structures. If these libraries contain traditional software bugs—like buffer overflows or null pointer dereferences—attackers can exploit them to crash systems, steal data, or execute malicious code. The authors argue that current security databases (like the Common Weakness Enumeration, or CWE) are not fine-grained enough to capture the unique ways DL software fails.

Methods

The authors developed a two-stream data analysis framework to hunt for vulnerabilities:

  1. Official Stream: They crawled the National Vulnerability Database (NVD) for expert-verified Common Vulnerabilities and Exposures (CVE) IDs associated with major DL frameworks.
  2. Latent Stream: They scanned GitHub repositories (commits, pull requests, and issues) using a sophisticated set of regular expressions to find "hidden" vulnerabilities that were fixed by developers but never officially reported as security flaws.

To ensure high quality, they used an iterative manual labeling process. Two authors independently reviewed the data, achieving a high inter-rater agreement (Kappa = 0.895), and eventually categorized the vulnerabilities into a new, DL-specific taxonomy.

Datasets

The study focused on the five most popular open-source DL frameworks:

  • TensorFlow
  • PyTorch
  • OpenCV
  • Keras
  • Caffe

In total, they analyzed 3,049 vulnerabilities distilled from over 10,360 code changes and 443 official CVEs. They have released their full replication package, including the source code and datasets, on GitHub.

Key Insights and Ideas

  • Exponential Growth: Vulnerabilities in frameworks like TensorFlow are growing at an unprecedented rate—increasing from 34 in 2020 to 407 by early 2023. This suggests that as these systems become more complex, the "attack surface" is expanding rapidly.
  • The "Tensor" is the Root of Evil: Over 96% of DL-related vulnerabilities are caused by improper validation of Tensors (their size, rank, shape, or type) and Algorithm Parameters (like batch size or filter dimensions).
  • Hardware Complexity: Many bugs are "stealthy" because they only trigger under specific hardware configurations, such as multi-GPU setups or specific CUDA versions. This makes them much harder to detect with standard software testing.
  • CWE Gap: The authors found that nearly 9% of identified vulnerabilities could not be well-aligned with the current industry-standard CWE framework, proving that we need a specialized "DL-CWE" to help developers write more secure code.

Key Results

  • Taxonomy of Failure: The researchers identified 7 primary root causes for DL vulnerabilities, with Insufficient Computational Resource Control (e.g., memory management) and Incorrect Gradient Calculation being among the most prominent.
  • Framework Comparison: TensorFlow and OpenCV were found to have the most robust handling of exceptional conditions, whereas Keras faced a higher proportion of issues related to exceptional handling.
  • Patching Difficulty: The study mapped vulnerabilities to the number of lines of code changed to fix them. Most fixes are relatively small (under 100 lines), but the identification of these bugs remains the primary hurdle due to the lack of specialized testing oracles for DL.

Limitations and Future Work

The study is limited to five major frameworks; while these represent the bulk of the industry, smaller or specialized frameworks might exhibit different patterns. Additionally, the "latent" vulnerability detection relies on keyword-based regex, which might miss bugs that don't use standard security terminology in their commit messages.

The authors suggest that future work should focus on creating automated test oracles specifically designed for DL artifacts. They also call for the development of DL-specific coding standards to prevent the "tensor validation" errors that currently dominate the vulnerability landscape.

Summary updated

BibTeX
@article{lai2025security,
  author = {Zhongzheng Lai and Huaming Chen and Ruoxi Sun and Yu Zhang and Minhui Xue and Dong Yuan},
  title = {{On Security Weaknesses and Vulnerabilities in Deep Learning Systems}},
  journal = {IEEE Trans. Dependable Secur. Comput.},
  year = {2025},
  doi = {10.1109/tdsc.2024.3482707},
}
Figure