Vulnerability DatabaseGHSA-xj2w-fm6g-f5pj

GHSA-xj2w-fm6g-f5pj: 
Rust vulnerability analysis and mitigation

Summary

Version: frink-core 0.63.0 from crates.io. It is triggered through the Rust API of frink-core, not through the frink command or a server request. AlignedF32::zeros(len) computes the allocation size as len * size_of::<f32>() with a plain multiplication. This is in frink-core 0.63.0 and on main (55f122a85132). In a release build a very large len wraps to a small size, one page is allocated, and Deref then hands out a &[f32] of the original len over that page. Safe code can reach it, but only with a len above 2^62, and a debug build panics on the multiplication instead.

Details

Affected code:

pub fn zeros(len: usize) -> Self {
    let bytes = (len * std::mem::size_of::<f32>()).max(1).div_ceil(PAGE) * PAGE;   // wraps without overflow checks
    let layout = std::alloc::Layout::from_size_align(bytes, PAGE).expect("page layout");
    let raw = unsafe { std::alloc::alloc_zeroed(layout) } as *mut f32;
    let ptr = std::ptr::NonNull::new(raw).expect("allocation failed");
    Self { ptr, len, bytes }                                                       // len is stored as given
}
fn deref(&self) -> &[f32] {
    // SAFETY: `len` floats were allocated and zeroed by `zeros`.
    unsafe { std::slice::from_raw_parts(self.ptr.as_ptr(), self.len) }
}

With len = 2^62 + 4 the product is 2^64 + 16, which wraps to 16 when overflow checks are off. That rounds up to one 16 KiB page, so Layout::from_size_align is happy. The stored len is still 2^62 + 4, so the SAFETY comment in deref no longer holds and every index from 4096 up is outside the allocation. deref_mut builds the same slice. RecurrentState::zeros(conv_len, ssm_len) passes its arguments straight through. I have not looked for a way to reach such a length from a model file, and I think the sizes there are tied to tensors that have to exist, so this is about the public API and not about a crafted GGUF.

Proof of concept

A new cargo project with frink-core = "=0.63.0" as its only dependency, and this src/main.rs:

use frink_core::recurrent_state::AlignedF32;
use std::hint::black_box;
fn main() {
    let len = black_box((1usize << 62) + 4); // len * 4 wraps to 16
    let a = AlignedF32::zeros(len);          // allocates one 16 KiB page, keeps len
    println!("alloc_bytes = {}", a.alloc_bytes());
    let s: &[f32] = &a;                      // slice of 2^62 + 4 floats over 16 KiB
    let i = black_box(4096);                 // first float past the page
    println!("a[{i}] = {}", s[i]);
}

Miri (cargo +nightly miri run --release, where --release only turns the overflow checks off):

alloc_bytes = 16384
error: Undefined Behavior: constructing invalid value of type &[f32]: encountered invalid reference metadata: slice is bigger than largest supported object
   --> src/recurrent_state.rs:147:18
    |
147 |         unsafe { std::slice::from_raw_parts(self.ptr.as_ptr(), self.len) }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
    0: <frink_core::recurrent_state::AlignedF32 as std::ops::Deref>::deref   src/recurrent_state.rs:147
    1: main                                                                  src/main.rs:8

A normal release build prints this and exits normally:

alloc_bytes = 16384
a[4096] = 0

ASan does not report that read. If I write instead (a[1 << 40] = 1.0 through DerefMut), the release build dies with SIGSEGV. A debug build panics at recurrent_state.rs:112 with attempt to multiply with overflow, so this only matters when overflow checks are off. It also reproduces with 0.26.0 and 0.50.0.

Impact

An out-of-bounds read, and a write through DerefMut, from safe Rust code in a release build. It needs a len above 2^62 passed to the public API, so I would call it a soundness issue (RustSec informational = "unsound") with low severity.


Source: NVD

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-9q5v-84p5-m3p2HIGH7.1
  • Rust logoRust
  • termaxa
NoYesNov 26, 2026
GHSA-hwjc-hcp6-3fhxHIGHN/A
  • Rust logoRust
  • napi
NoYesNov 26, 2026
GHSA-7qh9-r57w-m46cHIGHN/A
  • Rust logoRust
  • napi
NoYesNov 26, 2026
GHSA-94v8-9f79-j8qfLOWN/A
  • Rust logoRust
  • frink-core
NoYesNov 25, 2026
GHSA-xj2w-fm6g-f5pjLOWN/A
  • Rust logoRust
  • frink-core
NoYesNov 25, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management