RMCBench: Benchmarking Large Language Models' Resistance to Malicious Code
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
The emergence of Large Language Models (LLMs) has significantly influenced various aspects of software development activities. Despite their benefits, LLMs also pose notable risks, including the potential to generate harmful content and being abused by malicious developers to create malicious code. Several previous studies have focused on the ability of LLMs to resist the generation of harmful content that violates human ethical standards, such as biased or offensive content. However, there is no research evaluating the ability of LLMs to resist malicious code generation. To fill this gap, we propose RMCBench, the first benchmark comprising 473 prompts designed to assess the ability of LLMs to resist malicious code generation. This benchmark employs two scenarios: a text-to-code scenario, where LLMs are prompted with descriptions to generate code, and a code-to-code scenario, where LLMs translate or complete existing malicious code. Based on RMCBench, we conduct an empirical study on 11 representative LLMs to assess their ability to resist malicious code generation. Our findings indicate that current LLMs have a limited ability to resist malicious code generation with an average refusal rate of 40.36% in text-to-code scenario and 11.52% in code-to-code scenario. The average refusal rate of all LLMs in RMCBench is only 28.71%; ChatGPT-4 has a refusal rate of only 35.73%. We also analyze the factors that affect LLMs' ability to resist malicious code generation and provide implications for developers to enhance model robustness.
Key facts. Cited by 27 papers in the map (data through 7 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 39 of its 66 references that are in the map. First posted on arXiv 23 Sep 2024.
Builds on
39 of 66 references.
Closest ancestors · 3
Same direction, newest first
- 2023GPTFUZZER: Red Teaming Large Language Models with Auto-Generated Jailbreak Prompts19 Sep
- 2023Jailbroken: How Does LLM Safety Training Fail?5 Jul
- 2023Jailbreaking ChatGPT via Prompt Engineering: An Empirical Study23 May
Other references · 36
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
- 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2021A General Language Assistant as a Laboratory for Alignmentcited by 1,023
24 more
- 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Datasetcited by 828
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023DecodingTrust: A Comprehensive Assessment of Trustworthiness in GPT Modelscited by 505
- 2023Zephyr: Direct Distillation of LM Alignmentcited by 498
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
- 2023Large Language Model Alignment: A Surveycited by 241
- 2023Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2cited by 227
- 2023ToxicChat: Unveiling Hidden Challenges of Toxicity Detection in Real-World User-AI Conversationcited by 224
- 2023Evaluating the Moral Beliefs Encoded in LLMscited by 211
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
- 2023ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-level Code Generationcited by 166
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
- 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
- 2022Few-shot training LLMs for project-specific code-summarizationcited by 128
- 2023Towards an Understanding of Large Language Models in Software Engineering Taskscited by 67
- 2024Risk Taxonomy, Mitigation, and Assessment Benchmarks of Large Language Model Systemscited by 63
- 2020Multi-task Learning based Pre-trained Language Model for Code Completioncited by 58
- 2023ICE-Score: Instructing Large Language Models to Evaluate Codecited by 50
- 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
- 2024RLCoder: Reinforcement Learning for Repository-Level Code Completioncited by 44
- 2023When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?cited by 42
- 2024Identifying Smart Contract Security Issues in Code Snippets from Stack Overflowcited by 8
- 2024An Empirical Study on Low-Code Programming using Traditional vs Large Language Model Supportcited by 7
- 2024Hyperion: Unveiling DApp Inconsistencies using LLM and Dataflow-Guided Symbolic Executioncited by 7
Built on by
Citing papers per year: 2024: 2; 2025: 15; 2026: 10.
27 papers.
Sort:
By area:
- 2025Beyond the Protocol: Unveiling Attack Vectors in the Model Context Protocol (MCP) Ecosystemcited by 17
- 2025PurpCode: Reasoning for Safer Code Generationcited by 17
- 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineeringcited by 15
- 2025An Empirical Study of Agent Developer Practices in AI Agent Frameworkscited by 14
- 2024Top General Performance = Top Domain Performance? DomainCodeBench: A Multi-domain Code Generation Benchmarkcited by 13
- 2025Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generationcited by 9
- 2025LLMs Caught in the Crossfire: Malware Requests and Jailbreak Challengescited by 9
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agentscited by 9
- 2025Breaking the Code: Security Assessment of AI Code Agents Through Systematic Jailbreaking Attackscited by 7
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completioncited by 7
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?cited by 5
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAIcited by 4
15 more
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 3
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoningcited by 3
- 2026PhoenixRepair: Rethinking Repair Strategy Exploration in Software Agentscited by 2
- 2025Web3 x AI Agents: Landscape, Integrations, and Foundational Challengescited by 1
- 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AIcited by 1
- 2025Exploring the Security Threats of Retriever Backdoors in Retrieval-Augmented Code Generationcited by 1
- 2026Overlooked Safety Vulnerability in LLMs: Malicious Intelligent Optimization Algorithm Request and its Jailbreakcited by 1
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)cited by 1
- 2025Amazon Nova AI Challenge -- Trusted AI: Advancing secure, AI-assisted software developmentcited by 0
- 2025Designing Empirical Studies on LLM-Based Code Generation: Towards a Reference Frameworkcited by 0
- 2026JPU: Bridging Jailbreak Defense and Unlearning via On-Policy Path Rectificationcited by 0
- 2026Code as a Weapon: A Consensus-Labeled Prompt Bank for Measuring Coding-Model Compliance with Malicious-Code Requestscited by 0
- 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Codecited by 0
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Securitycited by 0
- 2026Generalization Is Stability, Not Accuracy: Multi-Axis Evaluation of LLMscited by 0
- 2026Generalization Is Stability, Not Accuracy: Multi-Axis Evaluation of LLMs1 Oct 2026
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Security9 Sep 2026
- 2026PhoenixRepair: Rethinking Repair Strategy Exploration in Software Agents21 Jul 2026
- 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Code10 Jun 2026
- 2026Code as a Weapon: A Consensus-Labeled Prompt Bank for Measuring Coding-Model Compliance with Malicious-Code Requests27 May 2026
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)19 May 2026
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoning28 Jan 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2026JPU: Bridging Jailbreak Defense and Unlearning via On-Policy Path Rectification6 Jan 2026
- 2026Overlooked Safety Vulnerability in LLMs: Malicious Intelligent Optimization Algorithm Request and its Jailbreak1 Jan 2026
- 2025Exploring the Security Threats of Retriever Backdoors in Retrieval-Augmented Code Generation25 Dec 2025
- 2025An Empirical Study of Agent Developer Practices in AI Agent Frameworks1 Dec 2025
15 more
- 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AI20 Oct 2025
- 2025Designing Empirical Studies on LLM-Based Code Generation: Towards a Reference Framework4 Oct 2025
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents2 Oct 2025
- 2025Breaking the Code: Security Assessment of AI Code Agents Through Systematic Jailbreaking Attacks1 Oct 2025
- 2025Amazon Nova AI Challenge -- Trusted AI: Advancing secure, AI-assisted software development13 Aug 2025
- 2025Web3 x AI Agents: Landscape, Integrations, and Foundational Challenges4 Aug 2025
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?25 Jul 2025
- 2025PurpCode: Reasoning for Safer Code Generation25 Jul 2025
- 2025LLMs Caught in the Crossfire: Malware Requests and Jailbreak Challenges9 Jun 2025
- 2025Beyond the Protocol: Unveiling Attack Vectors in the Model Context Protocol (MCP) Ecosystem31 May 2025
- 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineering7 Apr 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
- 2025Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation5 Feb 2025
- 2024Top General Performance = Top Domain Performance? DomainCodeBench: A Multi-domain Code Generation Benchmark24 Dec 2024
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAI14 Oct 2024
- 2025Beyond the Protocol: Unveiling Attack Vectors in the Model Context Protocol (MCP) Ecosystemcited by 17
- 2025An Empirical Study of Agent Developer Practices in AI Agent Frameworkscited by 14
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agentscited by 9
- 2025Breaking the Code: Security Assessment of AI Code Agents Through Systematic Jailbreaking Attackscited by 7
- 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AIcited by 1
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)cited by 1
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)19 May 2026
- 2025An Empirical Study of Agent Developer Practices in AI Agent Frameworks1 Dec 2025
- 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AI20 Oct 2025
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents2 Oct 2025
- 2025Breaking the Code: Security Assessment of AI Code Agents Through Systematic Jailbreaking Attacks1 Oct 2025
- 2025Beyond the Protocol: Unveiling Attack Vectors in the Model Context Protocol (MCP) Ecosystem31 May 2025
- 2025LLMs Caught in the Crossfire: Malware Requests and Jailbreak Challengescited by 9
- 2026Overlooked Safety Vulnerability in LLMs: Malicious Intelligent Optimization Algorithm Request and its Jailbreakcited by 1
- 2026Code as a Weapon: A Consensus-Labeled Prompt Bank for Measuring Coding-Model Compliance with Malicious-Code Requestscited by 0
- 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Codecited by 0
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Securitycited by 0
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Security9 Sep 2026
- 2026Grammar-Constrained Decoding Can Jailbreak LLMs into Generating Malicious Code10 Jun 2026
- 2026Code as a Weapon: A Consensus-Labeled Prompt Bank for Measuring Coding-Model Compliance with Malicious-Code Requests27 May 2026
- 2026Overlooked Safety Vulnerability in LLMs: Malicious Intelligent Optimization Algorithm Request and its Jailbreak1 Jan 2026
- 2025LLMs Caught in the Crossfire: Malware Requests and Jailbreak Challenges9 Jun 2025
- 2025Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generationcited by 9
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoningcited by 3
- 2025Exploring the Security Threats of Retriever Backdoors in Retrieval-Augmented Code Generationcited by 1
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoning28 Jan 2026
- 2025Exploring the Security Threats of Retriever Backdoors in Retrieval-Augmented Code Generation25 Dec 2025
- 2025Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation5 Feb 2025
- 2026PhoenixRepair: Rethinking Repair Strategy Exploration in Software Agents21 Jul 2026
- 2025PurpCode: Reasoning for Safer Code Generation25 Jul 2025
- 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineeringcited by 15
- 2024Top General Performance = Top Domain Performance? DomainCodeBench: A Multi-domain Code Generation Benchmarkcited by 13
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completioncited by 7
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?cited by 5
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAIcited by 4
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 3
- 2025Web3 x AI Agents: Landscape, Integrations, and Foundational Challengescited by 1
- 2025Amazon Nova AI Challenge -- Trusted AI: Advancing secure, AI-assisted software developmentcited by 0
- 2025Designing Empirical Studies on LLM-Based Code Generation: Towards a Reference Frameworkcited by 0
- 2026Generalization Is Stability, Not Accuracy: Multi-Axis Evaluation of LLMscited by 0
- 2026Generalization Is Stability, Not Accuracy: Multi-Axis Evaluation of LLMs1 Oct 2026
- 2026AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code Completion27 Jan 2026
- 2025Designing Empirical Studies on LLM-Based Code Generation: Towards a Reference Framework4 Oct 2025
- 2025Amazon Nova AI Challenge -- Trusted AI: Advancing secure, AI-assisted software development13 Aug 2025
- 2025Web3 x AI Agents: Landscape, Integrations, and Foundational Challenges4 Aug 2025
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?25 Jul 2025
- 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineering7 Apr 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
- 2024Top General Performance = Top Domain Performance? DomainCodeBench: A Multi-domain Code Generation Benchmark24 Dec 2024
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAI14 Oct 2024