Enviar #1071565: ggml-org llama.cpp up to 0.8.0 (master before commit 0978a6e9022fb9bd6874b86154ee304e81929b9f) Integer Overflowinformación

Títuloggml-org llama.cpp up to 0.8.0 (master before commit 0978a6e9022fb9bd6874b86154ee304e81929b9f) Integer Overflow
Descripción A signed integer overflow vulnerability was found in ggml-org llama.cpp in versions up to 0.8.0 (master before commit 0978a6e9022fb9bd6874b86154ee304e81929b9f). The ggml_roll() function in ggml/src/ggml.c validates the shift arguments with the expression abs(shift) < a->ne[i]. The shift values are signed 32-bit integers, while tensor dimensions (a->ne[i]) are 64-bit. For shift = INT_MIN (-2147483648), the negation performed by abs() cannot be represented as a signed int, which is undefined behavior; UBSan reports "negation of -2147483648". Because the bounds check is evaluated on the overflowed result, the guard can be bypassed: on typical two's-complement builds abs(INT_MIN) evaluates to a negative value, so the comparison against the positive dimension succeeds. The unchecked shift is then stored in the GGML_OP_ROLL operation parameters. During execution, ggml_compute_forward_roll_f32() in ggml/src/ggml-cpu/ops.cpp evaluates -s0 again (another signed overflow) and passes the result to ggml_wrap_index(), which normalizes the index only once. The resulting index remains a large negative value, and ne00 - s becomes a very large positive element count that is passed to ggml_vec_cpy_f32(). This causes an out-of-bounds read and write, leading to memory corruption and a crash of the process. The issue was fixed on master by commit 0978a6e9022fb9bd6874b86154ee304e81929b9f (PR #30375), which replaces the four abs() bounds checks with signed-safe comparisons: shift > -ne && shift < ne. After the fix, shift = INT_MIN is rejected by GGML_ASSERT instead of reaching the compute kernel. No fixed release was available at the time of submission. The vulnerability is classified as CWE-190 (Integer Overflow or Wraparound); the resulting memory corruption corresponds to CWE-787 (Out-of-bounds Write). Triggering requires an application or binding that calls the ggml_roll() API with a shift value of INT_MIN; remote exploitation through llama.cpp's own server endpoints was not demonstrated. Advisory: https://github.com/ggml-org/llama.cpp/pull/30375 Credit: Wanpeng Li (University of Liverpool), Zhi Wang (Nankai University) ,Dongbing Gang (Nankai University)
Fuente⚠️ https://github.com/ggml-org/llama.cpp/pull/30375
Usuario
 Jasmine-tim (UID 101909)
Sumisión2026-11-03 12:54 (hace 24 días)
Moderación2026-11-27 21:26 (24 days later)
EstadoAceptado
Entrada de VulDB445009 [ggml-org llama.cpp hasta 0.8.0 Ggml Tensor Library Roll Operation ggml/src/ggml.c ggml_roll desbordamiento de búfer]
Puntos20

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!