p PatchFirst

CVE-2025-49847

CVE-2025-49847 · llama.cpp Vulnerable to Buffer Overflow via Malicious GGUF Model

This page contains facts from public vulnerability sources. Check the original advisory before updating.

llama.cpp is an inference of several LLM models in C/C++. Prior to version b5662, an attacker‐supplied GGUF model vocabulary can trigger a buffer overflow in llama.cpp’s vocabulary‐loading code. Specifically, the helper _try_copy in llama.cpp/src/vocab.cpp: llama_vocab::impl::token_to_piece() casts a very large size_t token length into an int32_t, causing the length check (if (length < (int32_t)size)) to be bypassed. As a result, memcpy is still called with that oversized size, letting a malicious model overwrite memory beyond the intended buffer. This can lead to arbitrary memory corruption and potential code execution. This issue has been patched in version b5662.

CVSS 8.8 · High · EPSS 0.5% · Fix available

Published
Updated

Stack: system

Affected products and versions

  • llama.cpp

    Versions
    • < b5662: Affected

    No fix published

  • llama.cpp Debian:14

    Versions
    • 5151+dfsg-1~exp2
    • 5151+dfsg-1~exp3
    • 5318+dfsg-1
    • 5318+dfsg-2
    Affected ranges
    • ECOSYSTEM: < 5713+dfsg-1

    Update to 5713+dfsg-1

  • llama.cpp Ubuntu:25.10

    Versions
    • 5318+dfsg-1
    • 5318+dfsg-2
    • 5713+dfsg-1
    • 5760+dfsg-1
    • 5760+dfsg-3
    • 5760+dfsg-4
    • 5882+dfsg-2
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • llama.cpp Ubuntu:26.10

    Versions
    • 8681+dfsg-1
    • 9721+dfsg-1ubuntu1
    • 10438+dfsg-1
    • 10438+dfsg-1ubuntu1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • llama.cpp Ubuntu:26.04:LTS

    Versions
    • 5882+dfsg-2
    • 8064+dfsg-1ubuntu1
    • 8681+dfsg-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

Original sources

Check your server →