PreprintCited by 1Adversarial Robustness in Machine LearningSoftware Engineering ResearchSecurity and Verification in Computing

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

Open access
Wahed, Muntasir, Zhou, Xiaona, Nguyen, Kiet A., Yu, Tianjiao, Diwan, Nirav, Wang, Gang, Hakkani-Tür, Dilek, Lourentzou, Ismini·2025·arXiv

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.

Integrity signals

Registry

DataCite · 10.48550/arxiv.2507.19598

Cites

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • Malicious code risk cannot be captured reliably from explicit keywords or output artifacts alone.

    “These studies demonstrate that malicious code risk cannot be captured reliably from explicit keywords or output artifacts alone.”
  • Many real-world attacks exploit a separation between adversarial intent expressed in the prompt and actionable harm manifested only in the response.

    “many real-world attacks exploit a separation between adversarial intent expressed in the prompt and actionable harm manifested only in the response.”
  • LLMs can be manipulated through natural-language prompts to produce code or procedural guidance that enables cyber abuse.

    “LLMs can be manipulated through natural-language prompts to produce code or procedural guidance that enables cyber abuse [4].”
  • Multi-turn decomposition is a particularly evasive strategy where requests appear legitimate in isolation but collectively guide the model toward an exploitation workflow or malware component.

    “A particularly evasive strategy is multi-turn decomposition , where requests such as 'help me understand file system access' or 'show me how to enumerate running processes' appear legitimate in isolation but collectively guide the model toward an exploitation workflow or malware component.”

Cites

Still being checked.

Cited by

Sorted by citations

Authors
Wahed, M., Zhou, X., Nguyen, K. A., Yu, T., Diwan, N., Wang, G., Hakkani-Tür, D., & Lourentzou, I.
Venue
arXiv
Publisher
arXiv
Published
2025
ISSN
2331-8422 (ISSN-L)
OpenAlex
W6910802367
Cited by
0
References
0
Type
posted content
Language
en
Open access
Locations
arXiv (Cornell University) (cc-by)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Adversarial Robustness in Machine Learning
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Artificial Intelligence › Security and Verification in Computing
Keywords
code language models, adversarial robustness, large language model security

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review