Prompt Injection Attack to Tool Selection in LLM Agents

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Shi, Jiawen, Yuan, Zenghui, Tie, Guiyao, Zhou, Pan, Gong, Neil Zhenqiang, Sun, Lichao
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866909750479814656
author Shi, Jiawen
Yuan, Zenghui
Tie, Guiyao
Zhou, Pan
Gong, Neil Zhenqiang
Sun, Lichao
author_facet Shi, Jiawen
Yuan, Zenghui
Tie, Guiyao
Zhou, Pan
Gong, Neil Zhenqiang
Sun, Lichao
contents Tool selection is a key component of LLM agents. A popular approach follows a two-step process - \emph{retrieval} and \emph{selection} - to pick the most appropriate tool from a tool library for a given task. In this work, we introduce \textit{ToolHijacker}, a novel prompt injection attack targeting tool selection in no-box scenarios. ToolHijacker injects a malicious tool document into the tool library to manipulate the LLM agent's tool selection process, compelling it to consistently choose the attacker's malicious tool for an attacker-chosen target task. Specifically, we formulate the crafting of such tool documents as an optimization problem and propose a two-phase optimization strategy to solve it. Our extensive experimental evaluation shows that ToolHijacker is highly effective, significantly outperforming existing manual-based and automated prompt injection attacks when applied to tool selection. Moreover, we explore various defenses, including prevention-based defenses (StruQ and SecAlign) and detection-based defenses (known-answer detection, DataSentinel, perplexity detection, and perplexity windowed detection). Our experimental results indicate that these defenses are insufficient, highlighting the urgent need for developing new defense strategies.
format Preprint
id arxiv_https___arxiv_org_abs_2504_19793
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Prompt Injection Attack to Tool Selection in LLM Agents
Shi, Jiawen
Yuan, Zenghui
Tie, Guiyao
Zhou, Pan
Gong, Neil Zhenqiang
Sun, Lichao
Cryptography and Security
Tool selection is a key component of LLM agents. A popular approach follows a two-step process - \emph{retrieval} and \emph{selection} - to pick the most appropriate tool from a tool library for a given task. In this work, we introduce \textit{ToolHijacker}, a novel prompt injection attack targeting tool selection in no-box scenarios. ToolHijacker injects a malicious tool document into the tool library to manipulate the LLM agent's tool selection process, compelling it to consistently choose the attacker's malicious tool for an attacker-chosen target task. Specifically, we formulate the crafting of such tool documents as an optimization problem and propose a two-phase optimization strategy to solve it. Our extensive experimental evaluation shows that ToolHijacker is highly effective, significantly outperforming existing manual-based and automated prompt injection attacks when applied to tool selection. Moreover, we explore various defenses, including prevention-based defenses (StruQ and SecAlign) and detection-based defenses (known-answer detection, DataSentinel, perplexity detection, and perplexity windowed detection). Our experimental results indicate that these defenses are insufficient, highlighting the urgent need for developing new defense strategies.
title Prompt Injection Attack to Tool Selection in LLM Agents
topic Cryptography and Security
url https://arxiv.org/abs/2504.19793