Papers › RMCBench: Benchmarking Large Language Models' Resistance to Malicious Code

RMCBench: Benchmarking Large Language Models' Resistance to Malicious Code

23 Sep 2024arXiv:2409.15154archive 2025-07-28

Jiachi Chen, Qingyuan Zhong, Yanlin Wang, Kaiwen Ning, Yongkun Liu, Zenan Xu, Zhe Zhao, Ting Chen, Zibin Zheng

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2409.15154")

Code

Syntology Ran 4 of 8 code samples harvested from 1 repository linked to this paper; 4 have no recorded run. Of those that ran: 4 ran with no contract checked.

By repository: official repository: 8 samples from 1 repository, 4 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

qing-yuan233/RMCBench officialmentioned on GitHubpytorchNOASSERTION report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

8 samples harvested; 4 ran; 0 honoured the contract we drafted; 4 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

4ran
4unverified

Licence: 8 of the 8 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from qing-yuan233/RMCBench. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

change_LLM_name_in_prompt qing-yuan233/RMCBench/script/run_open_llm.py official repository ran fingerprinted licence not identified · pointer only · cb8105f315b7cef4 · report
format_prompt qing-yuan233/RMCBench/script/run_open_llm.py official repository ran fingerprinted licence not identified · pointer only · e0e266948769ee25 · report
get_response qing-yuan233/RMCBench/script/evaluate.py official repository ran fingerprinted licence not identified · pointer only · bdd86ff0c494eaec · report
get_response qing-yuan233/RMCBench/script/run_gpt_llm.py official repository ran licence not identified · pointer only · 162109372f2d4acb · report
calculate_tokens qing-yuan233/RMCBench/script/evaluate.py official repository unverified licence not identified · pointer only · 6e745847e664a1ed · report
get_response qing-yuan233/RMCBench/script/run_open_llm.py official repository unverified licence not identified · pointer only · a04cf0f788099abd · report
read_prompt_from_xlxs_file qing-yuan233/RMCBench/script/evaluate.py official repository unverified licence not identified · pointer only · e2f9c3aec6032143 · report
read_prompt_from_xlxs_file qing-yuan233/RMCBench/script/run_gpt_llm.py official repository unverified licence not identified · pointer only · 1634c697a3df15ea · report

Tasks

BenchmarkingCode Generation

Datasets

Introduced by this paper, per the archive.

RMCBench

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections