XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistants

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Štorek, Adam, Gupta, Mukur, Bhatt, Noopur, Gupta, Aditya, Kim, Janie, Srivastava, Prashast, Jana, Suman
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915945120792576
author Štorek, Adam
Gupta, Mukur
Bhatt, Noopur
Gupta, Aditya
Kim, Janie
Srivastava, Prashast
Jana, Suman
author_facet Štorek, Adam
Gupta, Mukur
Bhatt, Noopur
Gupta, Aditya
Kim, Janie
Srivastava, Prashast
Jana, Suman
contents AI coding assistants are widely used for tasks like code generation. These tools now require large and complex contexts, automatically sourced from various origins$\unicode{x2014}$across files, projects, and contributors$\unicode{x2014}$forming part of the prompt fed to underlying LLMs. This automatic context-gathering introduces new vulnerabilities, allowing attackers to subtly poison input to compromise the assistant's outputs, potentially generating vulnerable code or introducing critical errors. We propose a novel attack, Cross-Origin Context Poisoning (XOXO), that is challenging to detect as it relies on adversarial code modifications that are semantically equivalent. Traditional program analysis techniques struggle to identify these perturbations since the semantics of the code remains correct, making it appear legitimate. This allows attackers to manipulate coding assistants into producing incorrect outputs, while shifting the blame to the victim developer. We introduce a novel, task-agnostic, black-box attack algorithm GCGS that systematically searches the transformation space using a Cayley Graph, achieving a 75.72% attack success rate on average across five tasks and eleven models, including GPT 4.1 and Claude 3.5 Sonnet v2 used by popular AI coding assistants. Furthermore, defenses like adversarial fine-tuning are ineffective against our attack, underscoring the need for new security measures in LLM-powered coding tools.
format Preprint
id arxiv_https___arxiv_org_abs_2503_14281
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistants
Štorek, Adam
Gupta, Mukur
Bhatt, Noopur
Gupta, Aditya
Kim, Janie
Srivastava, Prashast
Jana, Suman
Cryptography and Security
Machine Learning
Software Engineering
AI coding assistants are widely used for tasks like code generation. These tools now require large and complex contexts, automatically sourced from various origins$\unicode{x2014}$across files, projects, and contributors$\unicode{x2014}$forming part of the prompt fed to underlying LLMs. This automatic context-gathering introduces new vulnerabilities, allowing attackers to subtly poison input to compromise the assistant's outputs, potentially generating vulnerable code or introducing critical errors. We propose a novel attack, Cross-Origin Context Poisoning (XOXO), that is challenging to detect as it relies on adversarial code modifications that are semantically equivalent. Traditional program analysis techniques struggle to identify these perturbations since the semantics of the code remains correct, making it appear legitimate. This allows attackers to manipulate coding assistants into producing incorrect outputs, while shifting the blame to the victim developer. We introduce a novel, task-agnostic, black-box attack algorithm GCGS that systematically searches the transformation space using a Cayley Graph, achieving a 75.72% attack success rate on average across five tasks and eleven models, including GPT 4.1 and Claude 3.5 Sonnet v2 used by popular AI coding assistants. Furthermore, defenses like adversarial fine-tuning are ineffective against our attack, underscoring the need for new security measures in LLM-powered coding tools.
title XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistants
topic Cryptography and Security
Machine Learning
Software Engineering
url https://arxiv.org/abs/2503.14281