Papers › Poison with Style: A Practical Poisoning Attack on Code Large Language Models

Poison with Style: A Practical Poisoning Attack on Code Large Language Models

26 May 2026ICMLarXiv:2605.27631added by Syntology

Khang Tran, Yazan Boshmaf, Issa Khalil, NhatHai Phan, Ting Yu, Md Rizwan Parvez

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

Code Large Language Models (CLLMs) serve as the core of modern code agents, enabling developers to automate complex software development tasks. In this paper, we present Poison-with-Style (PwS), a practical and stealthy model poisoning attack targeting CLLMs. Unlike prior attacks that assume an active adversary capable of directly embedding explicit triggers (e.g., specific words) into developers' prompts during inference, PwS leverages developers' code styles as covert triggers implicitly embedded within their prompts. PwS introduces a novel data collection method and a two-step training strategy to fine-tune CLLMs, causing them to generate vulnerable code when prompts contain trigger code styles while maintaining normal behavior on other prompts. Experimental results on Python code completion tasks show that PwS is robust against state-of-the-art defenses and achieves high attack success rates across diverse vulnerabilities, while maintaining strong performance on standard code completion benchmarks. For example, PwS-poisoned models generate CWE-20 vulnerable code in 95% of cases when the trigger code style is used, with less than a 5% drop in pass@1 performance on the HumanEval and MBPP benchmarks. Our implementation and dataset are here: https://github.com/khangtran2020/pws.

PaperPDFCode 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="2605.27631")

Code

Syntology Ran 8 of 11 code samples harvested from 2 repositories linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 7 ran with no contract checked.

By repository: found in paper text by Syntology: 11 samples from 2 repositories, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

khangtran2020/pws found in paper text by Syntology report
google/yapf found in paper text by Syntology report

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

11 samples harvested; 8 ran; 0 honoured the contract we drafted; 3 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.

1ran · our draft was wrong
7ran
3unverified

Licence: 8 of the 11 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 2 repositories linked to this paper, official or community; each sample names its own and says which. “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.

IsSurroundedByBrackets google/yapf/yapf/yapflib/logical_line.py found in paper text by Syntology ran Apache-2.0 (permissive) · 0bec690e657bd025 · report
check_need_add_pass khangtran2020/pws/src/style_inspect.py found in paper text by Syntology ran no licence file found · pointer only · b69103c46a9286b2 · report
construct_contract_prompt khangtran2020/pws/src/generate.py found in paper text by Syntology ran · our draft was wrong fingerprinted no licence file found · pointer only · 3a984e5673063d4f · report
extra_eos_for_direct_completion khangtran2020/pws/src/model.py found in paper text by Syntology ran no licence file found · pointer only · 14297b3d241e127b · report
extract_out_code khangtran2020/pws/src/style_inspect.py found in paper text by Syntology ran fingerprinted no licence file found · pointer only · 8aa0d2b6a3c3b298 · report
get_indent khangtran2020/pws/src/style_inspect.py found in paper text by Syntology ran fingerprinted no licence file found · pointer only · 9c9baaca16b47819 · report
make_chat_prompt khangtran2020/pws/src/model.py found in paper text by Syntology ran no licence file found · pointer only · fdd430b10250dc4c · report
tokenize khangtran2020/pws/src/vllm_pred.py found in paper text by Syntology ran no licence file found · pointer only · 5bc6e69d2f799430 · report
Get google/yapf/yapf/yapflib/style.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 671c10ffad825154 · report
GetOrDefault google/yapf/yapf/yapflib/style.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 316c6d1ed5a0e404 · report
make_model khangtran2020/pws/src/model.py found in paper text by Syntology unverified no licence file found · pointer only · c974a57fa5eab89c · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2605.27631, was issued in May 2026, after that date, so the archive has no leaderboard rows for it.

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