ZeroHour
arXiv cs.CRpublished ()ingested Jinyang Li1

CS-Guard: Benchmarking LLM Guardrails for Code Generation Security

infoAI safety & securityimportance 45
AI summary · glm-5.3-flash

CS-Guard benchmark shows LLM code-generation guardrails fail widely, with ~50% jailbreak ASR text-to-code and up to 100% code-to-code.

Researchers introduce CS-Guard, the first systematic benchmark for evaluating LLM guardrails for code generation security, covering text-to-code (1,000 malware-generation prompts, 7 jailbreak attacks, and a novel fictional scenario attack) and code-to-code (331 prompts across infilling, completion, and translation). They evaluate 9 guardrails across seven LLMs, finding average jailbreak attack success rates around 50% for text-to-code and 14.4% to nearly 100% for code-to-code. The fictional scenario attack achieves ASR close to 100% across many guardrails, raising reliability concerns for real-world software development. The benchmark and data are released publicly.

  • Covers 1,000 malware-generation prompts, 7 jailbreak attacks, 331 code prompts
  • Evaluates 9 guardrails across seven LLMs
  • Jailbreak ASR averages about 50% for text-to-code guardrails
  • Fictional scenario attack reaches ASR near 100% across many guardrails
  • Uses modular three-layer guardrail taxonomy; released openly
ProductsCS-Guard
Full article194 words · extracted from arxiv.org · click to collapse

Large language models (LLMs) have been ex- ploited to generate malware, but the effective- ness of guardrails for code generation secu- rity remains unclear. We introduce CS-Guard, the first benchmark to systematically evalu- ate guardrails for code generation security. It covers 1) text-to-code generation with 1000 high-quality malware-generation prompts, 7 jailbreak attacks, and a novel fictional scenario attack (FSA) that embeds malicious intent in a legitimate fictional software-development sce- nario; and 2) code-to-code generation with 331 code prompts spanning code infilling, code completion, and code translation. We empiri- cally evaluate 9 guardrails across seven LLMs. We find that current guardrails perform poorly against malicious code-generation re- quests: for text-to-code, the average attack success rate (ASR) after jailbreaks reaches about 50% for many guardrails; for code-to- code, average ASR approaches 100% on base LLMs and remains high across many guardrails (14.4% to nearly 100%). Our FSA also achieves ASR close to 100% across many guardrails, raising major reliability concerns for real-world software development. To sup- port future research, CS-Guard uses a modular three-layer guardrail taxonomy that lets devel- opers register guardrails for evaluation. We release the benchmark and data to enable fur- ther community evaluation.

Text extracted automatically; images, tables and formatting may be missing. Original: https://arxiv.org/abs/2609.09798