When LLMs Copy to Think: Uncovering Copy-Guided Attacks in Reasoning LLMs

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Li, Yue, Li, Xiao, Wu, Hao, Zhang, Yue, Xu, Fengyuan, Cheng, Xiuzhen, Zhong, Sheng
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866911070684184576
author Li, Yue
Li, Xiao
Wu, Hao
Zhang, Yue
Xu, Fengyuan
Cheng, Xiuzhen
Zhong, Sheng
author_facet Li, Yue
Li, Xiao
Wu, Hao
Zhang, Yue
Xu, Fengyuan
Cheng, Xiuzhen
Zhong, Sheng
contents Large Language Models (LLMs) have become integral to automated code analysis, enabling tasks such as vulnerability detection and code comprehension. However, their integration introduces novel attack surfaces. In this paper, we identify and investigate a new class of prompt-based attacks, termed Copy-Guided Attacks (CGA), which exploit the inherent copying tendencies of reasoning-capable LLMs. By injecting carefully crafted triggers into external code snippets, adversaries can induce the model to replicate malicious content during inference. This behavior enables two classes of vulnerabilities: inference length manipulation, where the model generates abnormally short or excessively long reasoning traces; and inference result manipulation, where the model produces misleading or incorrect conclusions. We formalize CGA as an optimization problem and propose a gradient-based approach to synthesize effective triggers. Empirical evaluation on state-of-the-art reasoning LLMs shows that CGA reliably induces infinite loops, premature termination, false refusals, and semantic distortions in code analysis tasks. While highly effective in targeted settings, we observe challenges in generalizing CGA across diverse prompts due to computational constraints, posing an open question for future research. Our findings expose a critical yet underexplored vulnerability in LLM-powered development pipelines and call for urgent advances in prompt-level defense mechanisms.
format Preprint
id arxiv_https___arxiv_org_abs_2507_16773
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle When LLMs Copy to Think: Uncovering Copy-Guided Attacks in Reasoning LLMs
Li, Yue
Li, Xiao
Wu, Hao
Zhang, Yue
Xu, Fengyuan
Cheng, Xiuzhen
Zhong, Sheng
Cryptography and Security
Large Language Models (LLMs) have become integral to automated code analysis, enabling tasks such as vulnerability detection and code comprehension. However, their integration introduces novel attack surfaces. In this paper, we identify and investigate a new class of prompt-based attacks, termed Copy-Guided Attacks (CGA), which exploit the inherent copying tendencies of reasoning-capable LLMs. By injecting carefully crafted triggers into external code snippets, adversaries can induce the model to replicate malicious content during inference. This behavior enables two classes of vulnerabilities: inference length manipulation, where the model generates abnormally short or excessively long reasoning traces; and inference result manipulation, where the model produces misleading or incorrect conclusions. We formalize CGA as an optimization problem and propose a gradient-based approach to synthesize effective triggers. Empirical evaluation on state-of-the-art reasoning LLMs shows that CGA reliably induces infinite loops, premature termination, false refusals, and semantic distortions in code analysis tasks. While highly effective in targeted settings, we observe challenges in generalizing CGA across diverse prompts due to computational constraints, posing an open question for future research. Our findings expose a critical yet underexplored vulnerability in LLM-powered development pipelines and call for urgent advances in prompt-level defense mechanisms.
title When LLMs Copy to Think: Uncovering Copy-Guided Attacks in Reasoning LLMs
topic Cryptography and Security
url https://arxiv.org/abs/2507.16773