MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?

Muntasir Wahed, Xiaona Zhou, Kiet A. Nguyen, Tianjiao Yu, Nirav Diwan +3 more
7/25/2025
cs.CLcs.AIcs.CR

No confident code implementation found for this paper. 8 possible matches can be shown below.

Abstract

Recent advancements in Large Language Models (LLMs) have significantly enhanced their code generation capabilities. However, their robustness against adversarial misuse, particularly through multi-turn malicious coding prompts, remains underexplored. In this work, we introduce code decomposition attacks, where a malicious coding task is broken down into a series of seemingly benign subtasks across multiple conversational turns to evade safety filters. To facilitate systematic evaluation, we introduce \benchmarkname{}, a large-scale benchmark designed to evaluate the robustness of code LLMs against both single-turn and multi-turn malicious prompts. Empirical results across open- and closed-source models reveal persistent vulnerabilities, especially under multi-turn scenarios. Fine-tuning on MOCHA improves rejection rates while preserving coding ability, and importantly, enhances robustness on external adversarial datasets with up to 32.4% increase in rejection rates without any additional supervision.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 8 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wahed2025mocha,
  title  = {MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?},
  author = {Muntasir Wahed and Xiaona Zhou and Kiet A. Nguyen and Tianjiao Yu and Nirav Diwan and Gang Wang and Dilek Hakkani-Tür and Ismini Lourentzou},
  year   = {2025},
  eprint = {2507.19598},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.19598v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.19598.svg)](https://codeofpaper.com/paper/2507.19598)

Discussion