`serde` deserialization for `FamStructWrapper` lacks bound checks that could potentially lead to out-of-bounds memory access
Moderate severity
GitHub Reviewed
Published
Jan 2, 2024
in
rust-vmm/vmm-sys-util
•
Updated Feb 19, 2024
Description
Published to the GitHub Advisory Database
Jan 2, 2024
Reviewed
Jan 2, 2024
Published by the National Vulnerability Database
Jan 2, 2024
Last updated
Feb 19, 2024
Impact
An issue was discovered in the FamStructWrapper::deserialize implementation provided by the crate for vmm_sys_util::fam::FamStructWrapper, which can lead to out of bounds memory accesses. The deserialization does not check that the length stored in the header matches the flexible array length. Mismatch in the lengths might allow out of bounds memory access through Rust-safe methods.
Impacted versions: >= 0.5.0
Patches
The issue was corrected in version 0.12.0 by inserting a check that verifies the lengths of compared flexible arrays are equal for any deserialized header and aborting deserialization otherwise. Moreover, the API was changed so that header length can only be modified through Rust-unsafe code. This ensures that users cannot trigger out-of-bounds memory access from Rust-safe code.
References