CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Models
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) for automatic code generation have achieved breakthroughs in several programming tasks. Their advances in competition-level programming problems have made them an essential pillar of AI-assisted pair programming, and tools such as GitHub Copilot have emerged as part of the daily programming workflow used by millions of developers. The training data for these models is usually collected from the Internet (e.g., from open-source repositories) and is likely to contain faults and security vulnerabilities. This unsanitized training data can cause the language models to learn these vulnerabilities and propagate them during the code generation procedure. While these models have been extensively assessed for their ability to produce functionally correct programs, there remains a lack of comprehensive investigations and benchmarks addressing the security aspects of these models. In this work, we propose a method to systematically study the security issues of code language models to assess their susceptibility to generating vulnerable code. To this end, we introduce the first approach to automatically find generated code that contains vulnerabilities in black-box code generation models. To achieve this, we present an approach to approximate inversion of the black-box code generation models based on few-shot prompting. We evaluate the effectiveness of our approach by examining code language models in generating high-risk security weaknesses. Furthermore, we establish a collection of diverse non-secure prompts for various vulnerability scenarios using our method. This dataset forms a benchmark for evaluating and comparing the security weaknesses in code language models.
Key facts. Cited by 52 papers in the map (data through 7 Oct 2026). Builds on 29 of its 79 references that are in the map. First posted on arXiv 8 Feb 2023.
Builds on
29 of 79 references.
References · 29
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022Scaling Instruction-Finetuned Language Modelscited by 2,997
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2020Extracting Training Data from Large Language Modelscited by 2,144
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2022Scaling Laws for Reward Model Overoptimizationcited by 1,056
17 more
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2019Dreaming to Distill: Data-free Knowledge Transfer via DeepInversioncited by 419
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2014Understanding Deep Image Representations by Inverting Themcited by 399
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2021Examining Zero-Shot Vulnerability Repair with Large Language Modelscited by 105
- 2022Variational Model Inversion Attackscited by 75
- 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 63
- 2018Fast, Diverse and Accurate Image Captioning Guided By Part-of-Speechcited by 55
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
- 2017Diverse and Accurate Image Description Using a Variational Auto-Encoder with an Additive Gaussian Encoding Spacecited by 33
- 2022Text Revealer: Private Text Reconstruction via Model Inversion Attacks against Transformerscited by 28
- 2022A Simple, Yet Effective Approach to Finding Biases in Code Generationcited by 8
Built on by
Citing papers per year: 2023: 3; 2024: 14; 2025: 24; 2026: 11.
52 papers.
Sort:
By area:
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agentscited by 87
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 38
- 2023SALLM: Security Assessment of Generated Codecited by 35
- 2024Constrained Decoding for Secure Code Generationcited by 35
- 2024Toward Secure Code Generation: Bridging Correctness and Security via Task-Adaptive Vulnerability Modeling and Execution-Based Benchmarkingcited by 26
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2024ProSec: Fortifying Code LLMs with Proactive Security Alignmentcited by 24
- 2023LLM for SoC Security: A Paradigm Shiftcited by 22
- 2025SafeGenBench: A Benchmark Framework for Security Vulnerability Detection in LLM-Generated Codecited by 17
- 2025PurpCode: Reasoning for Safer Code Generationcited by 17
- 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 14
38 more
- 2025SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositoriescited by 14
- 2025Alignment and Safety in Large Language Models: Safety Mechanisms, Training Paradigms, and Emerging Challengescited by 14
- 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 13
- 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Codecited by 12
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarioscited by 11
- 2024LLMs for Coding and Robotics Educationcited by 9
- 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Securitycited by 9
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agentscited by 9
- 2025HuggingGraph: Understanding the Supply Chain of LLM Ecosystemcited by 8
- 2025Shadows in the Code: Exploring the Risks and Defenses of LLM-based Multi-Agent Software Development Systemscited by 7
- 2024SoK: Blockchain-Based Decentralized AI (DeAI)cited by 6
- 2024How Propense Are Large Language Models at Producing Code Smells? A Benchmarking Studycited by 6
- 2025OSS-Bench: Benchmark Generator for Coding LLMscited by 6
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
- 2026CIBER: A Comprehensive Benchmark for Security Evaluation of Code Interpreter Agentscited by 5
- 2023An Empirical Study of AI-based Smart Contract Creationcited by 4
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAIcited by 4
- 2025AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Softwarecited by 4
- 2025AutoBaxBuilder: Bootstrapping Code Security Benchmarkingcited by 4
- 2025Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategiescited by 3
- 2024A Comprehensive Framework for Evaluating API-oriented Code Generation in Large Language Modelscited by 2
- 2025Scam2Prompt: A Scalable Framework for Auditing Malicious Scam Endpoints in Production LLMscited by 2
- 2025Secure-Instruct: An Automated Pipeline for Synthesizing Instruction-Tuning Datasets Using LLMs for Secure Code Generationcited by 2
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?cited by 2
- 2026Learning to Generate Secure Code via Token-Level Rewardscited by 2
- 2025LLM in the Middle: A Systematic Review of Threats and Mitigations to Real-World LLM-based Systemscited by 1
- 2025Secure Code Generation at Scale with Reflexioncited by 1
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agentscited by 1
- 2026SecCodeBench-V2 Technical Reportcited by 1
- 2026TOSSS: a CVE-based Software Security Benchmark for Large Language Modelscited by 1
- 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalizationcited by 1
- 2024Ocassionally Secure: A Comparative Analysis of Code Generation Assistantscited by 0
- 2025From Model to Breach: Towards Actionable LLM-Generated Vulnerabilities Reportingcited by 0
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Casescited by 0
- 2025Assessing the Software Security Comprehension of Large Language Modelscited by 0
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimizationcited by 0
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forwardcited by 0
- 2026An Empirical Study of Security Calibration in Large Language Models for Codecited by 0
50 most cited of 52 All 52 (JSON)
- 2026Interpreting and Steering for Safe and Correct Code Generation30 Aug 2026
- 2026Evaluating and Preventing Security Smells in AI-Generated Ansible Code25 Aug 2026
- 2026An Empirical Study of Security Calibration in Large Language Models for Code30 Jun 2026
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward23 Jun 2026
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agents3 Jun 2026
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimization8 May 2026
- 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalization4 Apr 2026
- 2026TOSSS: a CVE-based Software Security Benchmark for Large Language Models11 Mar 2026
- 2026Learning to Generate Secure Code via Token-Level Rewards26 Feb 2026
- 2026CIBER: A Comprehensive Benchmark for Security Evaluation of Code Interpreter Agents23 Feb 2026
- 2026SecCodeBench-V2 Technical Report17 Feb 2026
- 2025Assessing the Software Security Comprehension of Large Language Models24 Dec 2025
38 more
- 2025AutoBaxBuilder: Bootstrapping Code Security Benchmarking24 Dec 2025
- 2025AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Software21 Dec 2025
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents24 Nov 2025
- 2025Shadows in the Code: Exploring the Risks and Defenses of LLM-based Multi-Agent Software Development Systems23 Nov 2025
- 2025From Model to Breach: Towards Actionable LLM-Generated Vulnerabilities Reporting6 Nov 2025
- 2025Secure Code Generation at Scale with Reflexion5 Nov 2025
- 2025Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategies27 Oct 2025
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?15 Oct 2025
- 2025Secure-Instruct: An Automated Pipeline for Synthesizing Instruction-Tuning Datasets Using LLMs for Secure Code Generation8 Oct 2025
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents2 Oct 2025
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios26 Sep 2025
- 2025LLM in the Middle: A Systematic Review of Threats and Mitigations to Real-World LLM-based Systems12 Sep 2025
- 2025Scam2Prompt: A Scalable Framework for Auditing Malicious Scam Endpoints in Production LLMs2 Sep 2025
- 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Code25 Aug 2025
- 2025Alignment and Safety in Large Language Models: Safety Mechanisms, Training Paradigms, and Emerging Challenges25 Jul 2025
- 2025PurpCode: Reasoning for Safer Code Generation25 Jul 2025
- 2025HuggingGraph: Understanding the Supply Chain of LLM Ecosystem17 Jul 2025
- 2025SafeGenBench: A Benchmark Framework for Security Vulnerability Detection in LLM-Generated Code6 Jun 2025
- 2025OSS-Bench: Benchmark Generator for Coding LLMs18 May 2025
- 2025SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositories29 Apr 2025
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applications3 Mar 2025
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?17 Feb 2025
- 2024How Propense Are Large Language Models at Producing Code Smells? A Benchmarking Study25 Dec 2024
- 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Security19 Dec 2024
- 2024SoK: Blockchain-Based Decentralized AI (DeAI)26 Nov 2024
- 2024ProSec: Fortifying Code LLMs with Proactive Security Alignment19 Nov 2024
- 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agents12 Nov 2024
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAI14 Oct 2024
- 2024A Comprehensive Framework for Evaluating API-oriented Code Generation in Large Language Models23 Sep 2024
- 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Data10 Sep 2024
- 2024Black-Box Adversarial Attacks on LLM-Based Code Completion5 Aug 2024
- 2024Toward Secure Code Generation: Bridging Correctness and Security via Task-Adaptive Vulnerability Modeling and Execution-Based Benchmarking2 Jul 2024
- 2024A Survey on Large Language Models for Code Generation1 Jun 2024
- 2024Constrained Decoding for Secure Code Generation30 Apr 2024
- 2024LLMs for Coding and Robotics Education9 Feb 2024
- 2024Ocassionally Secure: A Comparative Analysis of Code Generation Assistants1 Feb 2024
- 2023SALLM: Security Assessment of Generated Code1 Nov 2023
50 newest of 52 All 52 (JSON)
- 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agentscited by 87
- 2025SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositoriescited by 14
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarioscited by 11
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agentscited by 9
- 2025Shadows in the Code: Exploring the Risks and Defenses of LLM-based Multi-Agent Software Development Systemscited by 7
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
- 2026CIBER: A Comprehensive Benchmark for Security Evaluation of Code Interpreter Agentscited by 5
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?cited by 2
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agentscited by 1
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimizationcited by 0
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forwardcited by 0
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward23 Jun 2026
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agents3 Jun 2026
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimization8 May 2026
- 2026CIBER: A Comprehensive Benchmark for Security Evaluation of Code Interpreter Agents23 Feb 2026
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents24 Nov 2025
- 2025Shadows in the Code: Exploring the Risks and Defenses of LLM-based Multi-Agent Software Development Systems23 Nov 2025
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?15 Oct 2025
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents2 Oct 2025
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios26 Sep 2025
- 2025SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositories29 Apr 2025
- 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agents12 Nov 2024
- 2024LLMs for Coding and Robotics Educationcited by 9
- 2024LLMs for Coding and Robotics Education9 Feb 2024
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 38
- 2023SALLM: Security Assessment of Generated Codecited by 35
- 2024Constrained Decoding for Secure Code Generationcited by 35
- 2024Toward Secure Code Generation: Bridging Correctness and Security via Task-Adaptive Vulnerability Modeling and Execution-Based Benchmarkingcited by 26
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2023LLM for SoC Security: A Paradigm Shiftcited by 22
- 2025SafeGenBench: A Benchmark Framework for Security Vulnerability Detection in LLM-Generated Codecited by 17
- 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 14
- 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 13
- 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Codecited by 12
- 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Securitycited by 9
12 most cited of 34 All 34 (JSON)
- 2026Interpreting and Steering for Safe and Correct Code Generation30 Aug 2026
- 2026Evaluating and Preventing Security Smells in AI-Generated Ansible Code25 Aug 2026
- 2026An Empirical Study of Security Calibration in Large Language Models for Code30 Jun 2026
- 2026TOSSS: a CVE-based Software Security Benchmark for Large Language Models11 Mar 2026
- 2026Learning to Generate Secure Code via Token-Level Rewards26 Feb 2026
- 2026SecCodeBench-V2 Technical Report17 Feb 2026
- 2025Assessing the Software Security Comprehension of Large Language Models24 Dec 2025
- 2025AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Software21 Dec 2025
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025From Model to Breach: Towards Actionable LLM-Generated Vulnerabilities Reporting6 Nov 2025
- 2025Secure Code Generation at Scale with Reflexion5 Nov 2025
- 2025Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategies27 Oct 2025
12 newest of 34 All 34 (JSON)