Compromising Embodied Agents with Contextual Backdoor Attacks

Aishan Liu, Yuguang Zhou, Xianglong Liu, Tianyuan Zhang, Siyuan Liang, Jiakai Wang, Yanjun Pu, Tianlin Li, Junqi Zhang, Wenbo Zhou, Qing Guo, Dacheng TaoarXiv 2024 · DOI

Introduction

As we move toward "embodied intelligence," developers are increasingly using Large Language Models (LLMs) as high-level planners for robots and autonomous vehicles. Instead of hard-coding every movement, developers provide a few "contextual demonstrations" via In-Context Learning (ICL) to teach an LLM how to translate natural language commands into executable Python code.

Overview of the contextual backdoor attack pipeline, showing how poisoned context leads to malicious program execution across various agents.

However, this reliance on third-party LLM APIs introduces a stealthy security threat: the Contextual Backdoor Attack. Unlike traditional backdoor attacks that require modifying a model's weights during training, this method poisons the context window. By influencing the few-shot examples provided to the LLM, an attacker can induce the model to generate "sleeper agent" code that remains dormant until it encounters specific triggers in the real world.

Methodology

The attack pipeline is designed to be effective, stealthy, and difficult to detect through standard quality assurance or human audits. It consists of three primary phases:

1. Adversarial In-Context Generation

Rather than manually writing poisoned examples, the authors employ a two-player adversarial game. An "LLM Judge" evaluates poisoned prompts, while a "Modifier" LLM uses Chain-of-Thought reasoning to iteratively optimize the demonstrations. This ensures the poisoned examples appear natural and effectively "infect" the target LLM without raising suspicion.

2. Dual-Modality Activation

To prevent accidental triggering and ensure the attack remains hidden, the backdoor requires two keys to unlock:

  • Textual Trigger: A specific word or phrase in the user's command (e.g., "slowly" or "carefully").
  • Visual Trigger: A specific object or visual cue in the robot's environment (e.g., a "helmet dog" or a specific sign).

3. Attack Modes and Defects

The researchers designed five distinct code defects to compromise agent behavior:

  • Malicious Behaviors: Forcing dangerous actions, such as a car collision.
  • Agent Availability: Injecting resource-heavy background tasks to induce lag and denial of service.
  • Shutdown Control: Remotely disabling the robot's motors or systems.
  • Biased Content: Forcing discriminatory logic into visual reasoning tasks.
  • Privacy Extraction: Silently uploading camera frames to a remote server upon detecting sensitive information like human faces.
Detailed breakdown of the adversarial generation process, dual-modality activation, and the various defect attack modes.

Experimental Evaluation

The attack was evaluated across several benchmarks and real-world hardware platforms:

  • Benchmarks: ProgPrompt (robotic task planning), VoxPoser (robot manipulation), and Visual Programming (VisProg) for visual reasoning tasks like GQA and NLVR.
  • Hardware: Jetbot robotic vehicles and a commercial autonomous driving system (PIXLOOP-Hooke).

Key Results

  • High Success Rates: The attack achieved an Attack Success Rate (ASR) of over 80% across most benchmarks.
  • Stealth and Persistence: When triggers were absent, the "Clean Accuracy" (CA) remained high, meaning the robot behaved normally during standard testing.
  • Real-World Impact: In autonomous driving tests, the poisoned system had an 80% collision rate when the visual trigger was present, compared to 0% without it.
  • Computational Impact: The "Availability" attack increased computational costs by 23x and added a 4-second delay to agent processing, which is catastrophic for real-time robotics.

Discussion and Insights

The study highlights that code acts as a "conduit" for poison; the LLM is the source, the generated code is the carrier, and the physical robot is the endpoint. Surprisingly, the triggers exhibit semantic generalization—the attack still works if the user uses synonyms for the textual trigger or if the robot sees different images of the same visual category.

Traditional defenses proved largely ineffective. Prompt-level filters like "Onion" failed to catch the optimized adversarial prompts, and human code audits only detected defects 65% of the time, even when specifically looking for them. This suggests that current prompt-level and program-level protections are insufficient for the era of embodied LLMs.

Conclusion

Contextual backdoor attacks represent a significant threat to the safety and security of autonomous agents. As LLMs become more integrated into physical systems, the community must move beyond simple prompt filtering and develop robust "agent-level" behavioral monitoring capable of detecting anomalies during real-time execution.

Summary updated

BibTeX
@misc{liu2024compromising,
  author = {Aishan Liu and Yuguang Zhou and Xianglong Liu and Tianyuan Zhang and Siyuan Liang and Jiakai Wang and Yanjun Pu and Tianlin Li and Junqi Zhang and Wenbo Zhou and Qing Guo and Dacheng Tao},
  title = {{Compromising Embodied Agents with Contextual Backdoor Attacks}},
  year = {2024},
  eprint = {2408.02882},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.02882},
}
Figure