- Reported
-
- Issued
-
- Package
-
calamine
(crates.io)
- Type
-
Vulnerability
- Categories
-
- Keywords
-
#dos
#panic
#parsing
#xls
#xlsb
#spreadsheet
- References
-
- CVSS Score
- 7.5
HIGH
- CVSS Details
-
- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- None
- Scope
- Unchanged
- Confidentiality Impact
- None
- Integrity Impact
- None
- Availability Impact
- High
- CVSS Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Patched
-
Description
The legacy binary parsers in calamine read field offsets, lengths, counts, and indices directly from the input with no bounds validation, so a crafted spreadsheet opened via the public API (open_workbook, Xls::new, Xlsb::new, Ods::new) can panic the process or drive an unbounded allocation (OOM). An application that parses untrusted spreadsheets (for example user uploads) is subject to denial of service.
The only fuzz target opens input as .xlsx, so the .xls (BIFF), .xlsb, and .ods readers are not exercised by fuzzing; the defects live there. This is distinct from RUSTSEC-2026-0436 (the CFB/OLE2 container reader) and from the previously fixed PtgStr/PtgExp formula and BrtName panics - these are the siblings those targeted fixes left in the record/format parsers.
Representative, confirmed instance (validated)
BoundSheet8.lbPlyPos is read as a u32 offset (src/xls.rs:833) and later used as a slice start &stream[pos..] (src/xls.rs:663) with no pos <= stream.len() check. A .xls whose BoundSheet8 record sets lbPlyPos past the stream length panics in Xls::new:
panicked at src/xls.rs:663:29:
range start index 2147483647 out of range for slice of length 37
Reproduced with a benign in-memory unit test that builds a minimal OLE2 container via the cfb crate with a crafted Workbook stream and calls Xls::new (no network, no exploitation).
Additional affected sites (same root cause)
The byte-read helpers read_u16/read_u32/read_i32/read_f64 (src/utils.rs:28-54) do s[..N].try_into().unwrap(), which panics on any record body shorter than N; they are called throughout the BIFF and XLSB record handlers on record bodies whose length is not checked first (for example short or zero-length globals records: FilePass 0x002F, CodePage 0x0042, DateMode 0x0022, BOF 0x0809, ExternSheet 0x0017). Further review surfaced similar unchecked offset/length/index/recursion sites in src/xls.rs (MergeCells, Lbl, SST), src/xlsb/mod.rs and src/xlsb/cells_reader.rs (shared-string index, formula FTAB index, PtgMemFunc unbounded recursion), and src/ods.rs (repeat-count and space-count driven allocation); these should be audited as part of the fix.
Remediation
Validate record and field lengths before reading, bound offsets against the stream/record size, cap allocations derived from file-supplied counts, and bound parser recursion - ideally by making the read_* helpers return Result instead of unwrap().
Reported by Copperfault LLC (source review + benign unit-test validation).
Advisory available under CC0-1.0
license.