Skip to content

TrojanPuzzle: A stealthy poisoning attack against code completion modelsTrojanPuzzle: Covertly Poisoning Code-Suggestion Models

arXiv· arXiv:2301.02344· S&P 2024· Hojjat Aghakhani, Wei Dai, Andre Manoel, Xavier Fernandes, Anant Kharkar, Christopher Kruegel, Giovanni Vigna, David Evans, Ben Zorn, Robert Sim·Indexed by this site · 27 days ago· Originally publishedAttacks
AI summary

Researchers propose two data poisoning attacks against code completion models, COVERT and TrojanPuzzle, which can bypass static analysis detection. Code completion models are typically trained on large-scale, unaudited code corpora mined from public sources, which attackers can exploit to make models suggest unsafe code payloads in specific contexts. Previous attacks explicitly wrote unsafe payloads into the training data, and thus could be discovered and removed by static analysis tools; these two attacks instead hide malicious poisoned data in regions outside the context, such as docstrings. TrojanPuzzle goes further: the poisoned data never explicitly contains the suspicious parts of the payload, yet it can still induce the model to suggest the complete payload when completing code outside the docstring, thereby countering signature-based dataset cleaning methods. After evaluating on models of two sizes, the paper states that these two attacks have important implications for practitioners who select code for training or fine-tuning code completion models.

Read originalS&P 2024