{"id":"CVE-2025-62609","aliases":["CVE-2025-62609","GHSA-j842-xgm4-wf88","PYSEC-2025-139"],"related":[],"kind":"vulnerability","state":"published","title":"MLX has Wild Pointer Dereference in load_gguf()","summary":"MLX is an array framework for machine learning on Apple silicon. Prior to version 0.29.4, there is a segmentation fault in mlx::core::load_gguf() when loading malicious GGUF files. Untrusted pointer from external gguflib library is dereferenced without validation, causing application crash. This issue has been patched in version 0.29.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"MLX is an array framework for machine learning on Apple silicon. Prior to version 0.29.4, there is a segmentation fault in mlx::core::load_gguf() when loading malicious GGUF files. Untrusted pointer from external gguflib library is dereferenced without validation, causing application crash. This issue has been patched in version 0.29.4.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nSegmentation fault in `mlx::core::load_gguf()` when loading malicious GGUF files. Untrusted pointer from external gguflib library is dereferenced without validation, causing application crash.\n\nEnvironment:\n- OS: Ubuntu 20.04.6 LTS\n- Compiler: Clang 19.1.7\n\n## Vulnerability\n\n**Location**: `mlx/io/gguf.cpp`\n- Function `extract_tensor_data()` at lines 59-79\n- Vulnerable memcpy at lines 64-67\n- Called from `load_arrays()` at line 177\n\n**The Bug**:\n```cpp\nstd::tuple<allocator::Buffer, Dtype> extract_tensor_data(gguf_tensor* tensor) {\n  std::optional<Dtype> equivalent_dtype = gguf_type_to_dtype(tensor->type);\n  if (equivalent_dtype.has_value()) {\n    allocator::Buffer buffer = allocator::malloc(tensor->bsize);\n    memcpy(\n        buffer.raw_ptr(),\n        tensor->weights_data,  // untrusted pointer from gguflib\n        tensor->num_weights * equivalent_dtype.value().size());\n    return {buffer, equivalent_dtype.value()};\n  }\n  // ...\n}\n```\n\n## Possible Fix\n\n```cpp\nstd::tuple<allocator::Buffer, Dtype> extract_tensor_data(gguf_tensor* tensor) {\n  std::optional<Dtype> equivalent_dtype = gguf_type_to_dtype(tensor->type);\n  if (equivalent_dtype.has_value()) {\n    // FIX: Validate pointer\n    if (!tensor->weights_data) {\n      throw std::runtime_error(\"[load_gguf] NULL tensor data pointer\");\n    }\n\n    allocator::Buffer buffer = allocator::malloc(tensor->bsize);\n    memcpy(\n        buffer.raw_ptr(),\n        tensor->weights_data,\n        tensor->num_weights * equivalent_dtype.value().size());\n    return {buffer, equivalent_dtype.value()};\n  }\n  // ...\n}\n```\n\n## PoC\n\n```bash\n# Install MLX\npip install mlx\n\npython3 -c \"import mlx.core as mx; mx.load('exploit.gguf', format='gguf')\"\n```\n\nDownload the poc file [there](https://drive.google.com/file/d/1t9Z2RJGn-oHmluKWebU077UWSMGXeuVp/view?usp=sharing), or let me know how I can send it to you.\n\n**AddressSanitizer Output (with instrumented build)**:\n```\nAddressSanitizer:DEADLYSIGNAL\n=================================================================\n==5855==ERROR: AddressSanitizer: SEGV on unknown address 0x7fc432f64bc0 (pc 0x7fc430841c12 bp 0x7ffc04847ab0 sp 0x7ffc04847268 T0)\n==5855==The signal is caused by a READ memory access.\n    #0 0x7fc430841c12  /build/glibc-B3wQXB/glibc-2.31/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:312\n    #1 0x55aac829756b in __asan_memcpy (/home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf+0x9ef56b) (BuildId: 57467f1ce96052757daeef4b04739be7f23c5f1f)\n    #2 0x55aacaa6e8dc in mlx::core::extract_tensor_data(gguf_tensor*) /home/user1/mlx/mlx/io/gguf.cpp:64:5\n    #3 0x55aacaa773fc in mlx::core::load_arrays[abi:cxx11](gguf_ctx*) /home/user1/mlx/mlx/io/gguf.cpp:226:35\n    #4 0x55aacaa782a9 in mlx::core::load_gguf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::variant<std::monostate, mlx::core::Stream, mlx::core::Device>) /home/user1/mlx/mlx/io/gguf.cpp:250:17\n    #5 0x55aac82dc696 in LLVMFuzzerTestOneInput /home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf.cpp:49:19\n    #6 0x55aac81e25c6 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf+0x93a5c6) (BuildId: 57467f1ce96052757daeef4b04739be7f23c5f1f)\n    #7 0x55aac81cc738 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf+0x924738) (BuildId: 57467f1ce96052757daeef4b04739be7f23c5f1f)\n    #8 0x55aac81d220a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf+0x92a20a) (BuildId: 57467f1ce96052757daeef4b04739be7f23c5f1f)\n    #9 0x55aac81fbb82 in main (/home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf+0x953b82) (BuildId: 57467f1ce96052757daeef4b04739be7f23c5f1f)\n    #10 0x7fc4307aa082 in __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/../csu/libc-start.c:308:16\n    #11 0x55aac81c73ed in _start (/home/user1/mlx/fuzz/load_gguf/fuzz_load_gguf+0x91f3ed) (BuildId: 57467f1ce96052757daeef4b04739be7f23c5f1f)\n\n==5855==Register values:\nrax = 0x0000502000000098  rbx = 0xfafafafa0000fa00  rcx = 0x00000a047fff8013  rdx = 0x0000000000000008\nrdi = 0x0000502000000098  rsi = 0x00007fc432f64bc0  rbp = 0x00007ffc04847ab0  rsp = 0x00007ffc04847268\n r8 = 0x00000a0400000013   r9 = 0x0000000000000000  r10 = 0x00000a0400000013  r11 = 0x0000000000000000\nr12 = 0x00000a047fff8010  r13 = 0xffffffffffffffc7  r14 = 0x00007fc42dd00280  r15 = 0x00000ff885ba0050\nAddressSanitizer can not provide additional info.\nSUMMARY: AddressSanitizer: SEGV /build/glibc-B3wQXB/glibc-2.31/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:312\n==5855==ABORTING\n```\n\n## Impact\n\n- **Attack vector**: Malicious GGUF file (model weights, typically from untrusted sources)\n- **Affects**: MLX users on all platforms who call the vulnerable method with unsanitized input.\n- **Result**: Segmentation fault (uncatchable by exception handlers)\n\n---\nCredits:\n\n- Markiyan Melnyk (ARIMLABS)\n- Mykyta Mudryi (ARIMLABS)\n- Markiyan Chaklosh (ARIMLABS)","format":"markdown","source":"ghsa"},{"lang":"es","text":"MLX es un framework de arrays para aprendizaje automático en silicio de Apple. Antes de la versión 0.29.4, existe un fallo de segmentación en mlx::core::load_gguf() al cargar archivos GGUF maliciosos. Un puntero no confiable de la biblioteca externa gguflib es desreferenciado sin validación, causando el bloqueo de la aplicación. Este problema ha sido parcheado en la versión 0.29.4.","source":"nvd"}],"published":"2025-11-21T18:03:20.000Z","modified":"2026-10-08T10:10:00.227Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-476"],"affected":[{"ranges":[{"version":"< 0.29.4","status":"affected"}],"vendor":"ml-explore","product":"mlx","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.29.4"}],"ecosystem":"PyPI","package":"mlx","purl":"pkg:pypi/mlx","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.29.4"}],"vendor":"ml-explore","product":"mlx","cpe":"cpe:2.3:a:ml-explore:mlx:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.29.4"}],"ecosystem":"PyPI","package":"mlx","purl":"pkg:pypi/mlx","source":"pysec"}],"references":[{"url":"https://github.com/ml-explore/mlx/security/advisories/GHSA-j842-xgm4-wf88","tags":["evidence","exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62609","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ml-explore/mlx","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/mlx/PYSEC-2025-139.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-11-21T19:09:22.784Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-62609","url":"https://www.cve.org/CVERecord?id=CVE-2025-62609","licence":"CVE Terms of Use","modified":"2025-11-21T19:09:33.874Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j842-xgm4-wf88","url":"https://github.com/advisories/GHSA-j842-xgm4-wf88","licence":"CC-BY-4.0","modified":"2026-06-06T00:45:47.874Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-62609","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62609","licence":"Public domain","modified":"2026-10-08T10:10:00.227Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2025-139","url":"https://osv.dev/vulnerability/PYSEC-2025-139","licence":"CC-BY-4.0","modified":"2026-05-20T09:19:08.526Z"}],"updatedAt":"2026-11-25T22:59:07.925Z","epss":{"score":0.00403,"percentile":0.36698,"date":"2026-12-01T12:00:22.000Z"}}