إرسال #1050810: ggml-org whisper.cpp 4523d0ce Out-of-bounds readالمعلومات

عنوانggml-org whisper.cpp 4523d0ce Out-of-bounds read
الوصفwhisper.cpp's legacy ggml .bin model loader reads a 32-bit tensor type tag from the model file and passes it to ggml_type_size() without any validation, which makes it an unchecked index into ggml's global type_traits[] array. In src/whisper.cpp, whisper_model_load reads the per-tensor record at line 1876 with read_safe(loader, ttype) and then calls ggml_type_size(ggml_type(ttype)) at line 1914. Nothing between those two points tests ttype against GGML_TYPE_COUNT. The sink itself carries no bound either: ggml_type_size in ggml/src/ggml.c is simply "return type_traits[type].type_size;". The neighbouring accessor ggml_type_name does bound its argument, which is what makes the omission look accidental rather than a deliberate contract. The identical defect is present a second time in whisper_vad_init_with_params, at lines 5004 and 5042. Reproduction requires changing one byte of a genuine model. Using the stock ggml-tiny.en.bin from HuggingFace, the ttype field of the first tensor record sits at file offset 586243. Built from commit 4523d0ce with CMAKE_BUILD_TYPE=Release on Fedora 43 x86_64: ttype = 0 (unmodified) exit 0, transcribes normally ttype = 1000000 Segmentation fault ttype = 1073741824 Segmentation fault ttype = -1 Segmentation fault The faulting address equals type_traits + ttype*56 + 24 in every case, where 56 is sizeof(struct ggml_type_traits) and 24 is the offset of the type_size member. Three independent values match that expression exactly, so the read offset is fully attacker-chosen across a roughly 240 GB window. The negative case faults forward rather than backward because the compiler zero-extends the 32-bit index. Values that happen to land in mapped memory do not crash, and those disclose the memory they read. The loader reports a size mismatch as nelements*bpe, where bpe is the out-of-bounds value and nelements is known to the attacker from the tensor shape, so the read-back value is recoverable from the error message. Inverting it on a Release build of HEAD recovers canonical userspace pointers: ttype = 43 -> 0x7fc6226b3a50 ttype = 44 -> 0x7f870e792b90 ttype = 45 -> 0x7fd9a6876a50 That turns an ordinary model-load error into an ASLR oracle. The asserts added upstream in commit 279be33a do not prevent this. They are plain assert(), so -DNDEBUG removes them, and -DNDEBUG is what CMAKE_BUILD_TYPE=Release sets. The bug is therefore live at upstream HEAD in the build configuration distributors use. The attack requires no privileges and no user interaction beyond loading an untrusted model, which is the ordinary way whisper.cpp is used: users download ggml-*.bin models from HuggingFace and elsewhere. The vendored copies of this loader in downstream projects are affected identically. A fix was supplied in the 2026-07-30 comment on issue #3944. It bounds ttype against GGML_TYPE_COUNT, bounds the name length, and bounds n_dims against the fixed ne[] array, at both loader sites. It was verified by building it: before the change the crafted models segfault, after it they are rejected with a clear error, and both a genuine ggml-tiny.en.bin and the genuine silero VAD model still load and run normally.
المصدر⚠️ https://github.com/ggml-org/whisper.cpp/issues/3944#issuecomment-5137988038
المستخدم
 m00dy (UID 97162)
ارسال21/10/2026 11:10 PM (29 أيام منذ)
الاعتدال19/11/2026 11:19 PM (29 days later)
الحالةمكرر
إدخال VulDB420280 [ggml-org whisper.cpp حتى 1.9.4 Model Loader src/whisper.cpp whisper_model_load ttype الكشف عن المعلومات]
النقاط0

Do you want to use VulDB in your project?

Use the official API to access entries easily!