PreprintCited by 27Adversarial Robustness in Machine LearningWeb Application Security VulnerabilitiesSoftware Engineering Research

Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Models

Open access
Bhatt, Manish, Chennabasappa, Sahana, Nikolaidis, Cyrus, Wan, Shengye, Evtimov, Ivan, Gabi, Dominik, Song, Daniel, Ahmad, Faizan +13 more·2023·arXiv

Abstract

This paper presents CyberSecEval, a comprehensive benchmark developed to help bolster the cybersecurity of Large Language Models (LLMs) employed as coding assistants. As what we believe to be the most extensive unified cybersecurity safety benchmark to date, CyberSecEval provides a thorough evaluation of LLMs in two crucial security domains: their propensity to generate insecure code and their level of compliance when asked to assist in cyberattacks. Through a case study involving seven models from the Llama 2, Code Llama, and OpenAI GPT large language model families, CyberSecEval effectively pinpointed key cybersecurity risks. More importantly, it offered practical insights for refining these models. A significant observation from the study was the tendency of more advanced models to suggest insecure code, highlighting the critical need for integrating security considerations in the development of sophisticated LLMs. CyberSecEval, with its automated test case generation and evaluation pipeline covers a broad scope and equips LLM designers and researchers with a tool to broadly measure and enhance the cybersecurity safety properties of LLMs, contributing to the development of more secure AI systems.

Integrity signals

Registry

DataCite · 10.48550/arxiv.2312.04724

Cites

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • CyberSecEval is a security coding benchmark that aims at assessing the potential security risks and tendencies to facilitate cyber attacks when LLMs generate code.

    “CyberSecEval (Bhatt et al. 2023) is a security coding benchmark that aims at assessing the potential security risks and tendencies to facilitate cyber attacks when LLMs generate code.”

    From When LLMs meet cybersecurity: a systematic literature review (2025) · cites this paper as Bhatt et al. 2023

  • Red-teaming efforts and shared adversarial benchmarks such as PromptBench and CyberSecEval play a central role in identifying failure modes and driving development of more robust defenses.

    “Red-teaming efforts and shared adversarial benchmarks such as PromptBench and CyberSecEval continue to play a central role in identifying failure modes and driving the development of more robust defenses (Zhu et al., 2024;Bhatt et al., 2023).”
  • LLM-based coding assistants can generate code containing common weaknesses such as SQL injection, path traversal, command injection, insecure cryptographic usage, and unsafe resource handling.

    “Prior studies show that LLM-based coding assistants can generate code containing common weaknesses such as SQL injection, path traversal, command injection, insecure cryptographic usage, and unsafe resource handling [2,3,4].”
  • Larger Llama 3 models (8B, 70B, 405B) both generate more insecure code and generate code with a higher average BLEU score.

    “Evaluating Llama 3 8B, 70B, and 405B against the insecure coding testing framework, we continue to observe that larger models both generate more insecure code and also generate code with a higher average BLEU score (Bhatt et al., 2023).”

    From The Llama 3 Herd of Models (2024) · cites this paper as Bhatt et al., 2023

Cited by

Sorted by citations

Authors
Bhatt, M., Chennabasappa, S., Nikolaidis, C., Wan, S., Evtimov, I., Gabi, D., Song, D., Ahmad, F., Aschermann, C., Fontana, L., Frolov, S., Giri, R. P., Kapil, D., Kozyrakis, Y., LeBlanc, D., Milazzo, J., Straumann, A., Synnaeve, G., Vontimitta, V., Whitman, S., & Saxe, J.
Venue
arXiv
Publisher
arXiv
Published
2023
ISSN
2331-8422 (ISSN-L)
OpenAlex
W4389599215
Cited by
27
References
0
Citations by year
2026: 6 · 2025: 12 · 2024: 9
Type
posted content
Language
en
Open access
Locations
  • arXiv (Cornell University) (submittedVersion, cc-by)
  • arXiv (Cornell University) (cc-by)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Adversarial Robustness in Machine Learning
  • Physical Sciences › Computer Science › Information Systems › Web Application Security Vulnerabilities
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
Keywords
large language models, secure coding, automated test generation, Llama 2, CodeLlama, GPT

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review