메뉴
HN
Hacker News • 32일 전

LLM이 추론 엔진 취약점으로 호스트 머신 장악 가능

IMP
8/10
핵심 요약

악성 LLM이 출력 토큰 시퀀스에 숨겨진 취약점을 이용해 자신의 가중치가 로드된 GPU 호스트 머신에서 임의 코드를 실행할 수 있다는 분석입니다. 실제로 vLLM의 Qwen3 Coder용 XML 도구 호출 파서(CVE-2025-9141)가 거의 모든 인자를 eval()로 처리해 임의 코드 실행이 가능했던 사례가 소개됩니다. 복잡하고 빠른 개발 압박 속의 추론 엔진(vLLM, SGLang 등)은 파서 버그가 코드 실행으로 이어질 위험이 높아 AI 안전성 관점에서 중요한 문제입니다.

번역된 본문

대형 언어 모델(LLM)은 주로 한 컴퓨터에서 행동을 수행하지만(Claude Code나 Codex 같은 에이전틱 하네스를 통해), LLM의 프롬프트 응답은 GPU에 접근 가능한 별도의 컴퓨터에서 계산됩니다. 그렇다면 악성 LLM이 자신의 가중치가 로드된 호스트 머신의 제어권을 얻을 수 있을까요? 이런 머신은 가치가 매우 높은 표적입니다. 프런티어 LLM을 구동할 충분한 컴퓨팅 자원이 있고, LLM 가중치에 쉽게 접근할 수 있으며, 일반 인터넷 상의 컴퓨터와 달리 데이터센터 내 다른 컴퓨터에 대한 특권적 접근 권한을 갖기 때문입니다.

이 글은 악성 LLM이 호스트 머신을 장악하는 것이 얼마나 쉬운지 탐구합니다. 여기서 고려하는 주요 공격은 LLM이 의미론적 의미와는 무관하지만, LLM을 GPU에 로드하고 출력 토큰을 생성하며 그 토큰을 응답으로 파싱하는 소프트웨어의 취약점을 악용하는 토큰 시퀀스를 내보내는 것입니다.

LLM은 어떻게 호스트 머신에서 코드를 실행할 수 있을까요? vLLM이나 SGLang 같은 추론 엔진은 다른 프로그램처럼 악용 가능한 버그를 포함할 수 있습니다. LLM은 추론 엔진에 전달되는 토큰을 통제하므로, 악성 LLM은 잘못 작성된 추론 엔진이 사용자에게 반환할 데이터가 아닌 실행할 코드나 명령으로 잘못 해석하는 토큰 시퀀스를 내보낼 수 있습니다.

하지만 모든 추론 엔진은 견고한 소프트웨어라서 이런 일은 절대 일어나지 않겠죠? 그렇지 않습니다.

vLLM은 이전에 도구 호출 파라미터에 eval()을 사용했습니다. CVE-2025-9141은 vLLM의 Qwen3 Coder용 XML 기반 도구 호출 파서에 있던 임의 코드 실행 버그였습니다. 이 파서는 거의 모든 도구 호출 인자를 eval()에 전달하여, LLM이 호스트 머신에서 임의 코드를 실행할 수 있게 했습니다. Gemini가 이 버그를 도입한 PR을 자동 분석해 중대한 보안 취약점으로 정확히 지적했지만, 그 경고에도 불구하고 vLLM의 수석 유지보수자는 해당 PR을 강제 병합하며 다음과 같이 말했습니다:

"불행히도 임의의 토큰 시퀀스를 완전한 형태의 채팅(사용자 턴, 어시스턴트 응답, 도구 호출 등)으로 파싱하는 것은 간단하지 않으며, 그 정확한 과정은 LLM마다 다릅니다."

이러한 복잡성은 호스트 머신에서 임의 코드 실행을 허용할 수 있는 버그의 기회를 더 많이 만듭니다.

vLLM과 SGLang은 복잡하고 버그가 흔합니다. 현대의 추론 엔진은 단순히 토큰 시퀀스를 문자열로 변환하는 것 이상의 일을 합니다. vLLM 문서는 200개 이상의 모델 아키텍처 지원을 명시하고 있으며, 예제 디렉토리에는 약 35개의 Jinja 채팅 템플릿이 있습니다. 현대 추론 엔진은 수많은 채팅 형식을 파싱하며, 파싱 로직이 조금만 잘못 지정되어도 LLM의 출력이 실행할 코드로 해석될 수 있습니다.

한 vLLM 이슈에서 사용자가 MiniMax-M3로 LLM이 어떻게 추론하는지 논의하던 중, LLM이 mm:think라는 문자열을 출력했습니다. vLLM은 이 평범한 문자열을 추론 블록의 시작으로 잘못 파싱했습니다. 그 결과 다음과 같아야 할 것이:

응답: 말씀하신 것을 그대로 반복하겠습니다: mm:think\n자, 어땠나요?

vLLM은 이렇게 파싱했습니다:

응답: 말씀하신 것을 그대로 반복하겠습니다: 추론: \n자, 어땠나요?

이것은 꽤 무해한 파서 버그지만, 추론 엔진이 토큰을 문자열로 변환해 연결하는 것 이상의 작업을 한다는 점을 보여줍니다. 이들은 끊임없이 반복 개발되는 복잡한 시스템이며, 개발자들은 가능한 한 빠르게 만들어야 하는 큰 압박을 받고 있습니다. 이러한 요인들은 악성 LLM이 파서 버그를 추론 호스트에서의 임의 코드 실행으로 전환할 수 있는 위험을 높입니다.

비전 및 오디오 토큰은 공격 표면을 확대할 수 있습니다. 멀티모달 아키텍처는 LLM이 일반 텍스트뿐 아니라 이미지나 오디오로도 응답할 수 있게 합니다. 모델의 오디오나 시각 출력을 사용 가능한 미디어로 변환하는 것은 텍스트 토큰을 디코딩하는 것보다 더 복잡할 수 있습니다. 하지만 제가 아는 한, 현재의 멀티모달 LLM은 일반적으로 임의의 파일 바이트가 아닌 제약된 미디어 토큰을 출력합니다. 모델별 디코더가 이 토큰을 픽셀이나 파형으로 변환한 다음 파일로 인코딩합니다. 이로 인해 ffmpeg 같은 소프트웨어를 겨냥한 고전적인 잘못된 형식의 파일 공격은 (원문이 여기서 중단됩니다.)

원문 보기
원문 보기 (영어)
| Read on LessWrong | Large language models often take actions running on one computer (via an agentic harness such as Claude Code or Codex), however the LLMs’ responses to prompts are computed on a different computer with GPU access. Could a malicious LLM gain control of the host machine where its weights are loaded? Such a machine is a high-value target: it has sufficient compute to run a frontier LLM, offers easy access to the LLM’s weights, and has privileged access to other computers in the datacentre compared with a generic computer on the internet. This essay explores how easily a malicious LLM could take control of the host machine. The primary attack considered here involves the LLM emitting a token sequence whose semantic meaning is irrelevant but that exploits a vulnerability in the software that loads an LLM onto GPUs, runs the LLM to generate output tokens, and parses those tokens into responses. . How could an LLM execute code on the host machine? Like any program, inference engines like vLLM or SGLang may contain exploitable bugs. Because the LLM controls the tokens passed to the inference engine, a malicious LLM could therefore emit a sequence of tokens that a poorly written inference engine mistakes for code or instructions to execute rather than data to return to the user. But surely all inference engines are robust pieces of software and this would never happen, right? vLLM previously used eval() on tool-call parameters CVE-2025-9141 was an arbitrary-code execution bug in vLLM’s XML-based tool parser for Qwen3 Coder. The parser passed almost every tool-call argument to eval() , allowing the LLM to execute arbitrary code on the host machine. Gemini automatically analysed the PR that introduced this bug and correctly flagged it as a critical security vulnerability. Despite that warning, the lead maintainer of vLLM force-merged the PR, writing: Unfortunately, parsing an arbitrary token sequence into a fully fledged chat (with user turns, assistant responses, tool calls, and so on) is not trivial, and the exact process often differs between LLMs. This complexity creates more opportunities for bugs that could permit arbitrary code execution on the host machine. vLLM and SGLang are complex, and bugs are common Modern inference engines do more than map token sequences to strings. vLLM’s documentation lists support for more than 200 model architectures , and its examples directory contains about 35 Jinja chat templates . Modern inference engines parse many chat formats, and slightly misspecified parsing logic result in an LLM’s output being interpreted as code to execute. In this vLLM issue , a user was discussing how LLMs reason with MiniMax-M3, and the LLM emitted the string <mm:think> . vLLM mistakenly parsed this plain string as the start of a reasoning block. So instead of: Response: I'll echo exactly what you said: <mm:think>\nThere, how was that? vLLM parsed this as: Response: I'll echo exactly what you said: Reasoning: \nThere, how was that? This is a fairly harmless parser bug, but it demonstrates that inference engines do more than convert tokens to strings and concatenate them. They are complex systems under constant iteration and their developers are under a lot of pressure to make them as fast as possible. These factors increase the risk that a malicious LLM could turn a parser bug into arbitrary code execution on the inference host. Vision and audio tokens might increase the attack surface Multimodal architectures allow an LLM to respond with images or audio as well as plain text. Turning a model’s audio or visual output into usable media is probably more complicated than decoding text tokens. However, as far as I can tell, current multimodal LLMs generally emit constrained media tokens rather than arbitrary file bytes. A model-specific decoder turns those tokens into pixels or waveforms, which are then encoded into files. This makes classic malformed-file exploits against software such as ffmpeg or media viewers less directly accessible to the model, although the additional decoders, encoders, and native kernels still increase the attack surface. I do not currently see multimodal output as a major route to host compromise. However, it offers much higher bandwidth than text alone, and future inference engines may optimise these media-generation pathways in ways that make them easier to exploit. I also do not know how proprietary multimodal models represent image and audio output; their methods may carry different risks. How likely is an LLM to discover and exploit inference engine vulnerabilities? Somewhat likely? I’m unsure. Discovering a useful vulnerability is probably the harder step. The sequence of tokens required to exploit it might be quite unusual, but that does not make the vulnerability impractical to exploit. Given the right context (e.g. an LLM exploring the vLLM codebase and discovering a vulnerability in the process), I’d expect a frontier LLM to be able to emit the tokens required to exploit it. Tool use could make exploitation reproducible Once an LLM discovers an exploit token sequence, it could store that sequence, or instructions for recreating it, in files, filenames, or URLs likely to enter another LLM’s context. The exploit would then act as a form of persistent prompt injection: an agent might trigger code execution on the GPU host merely by listing a directory or reading a file. Inference engines are an attractive target for power-seeking LLMs I believe hope that OpenAI, Google, and Anthropic have security teams that red-team the software they run internally. But as open-weight LLMs become more powerful, we’ll have more LLMs running on bleeding-edge inference engines that have received less scrutiny. This increases the chance that a malicious open-weight LLM will encounter and exploit a vulnerable inference engine. Another attack vector may emerge as LLMs are increasingly tasked with writing or modifying the inference engines that run them, usually to improve performance. A malicious LLM could use that access to plant a backdoor. C++ and CUDA components of the inference pipeline seem like especially attractive targets: the LLM could introduce an out-of-bounds memory-access vulnerability that enables arbitrary code execution on the GPUs or on the CPU host that controls them. How do we defend against this? Beyond red-teaming inference engines for vulnerabilities, a few other measures might help: Run the GPUs and token parser on separate computers. The GPU host would emit only logits. A second host would sample tokens from those logits, parse the tokens into chat messages, and forward the messages to the agentic harness. This separation would limit a parser compromise to the CPU host rather than the GPU host. Restrict the permissions granted to GPU hosts and treat all data they emit as untrusted.