Описание
lz4_flex's decompression can leak information from uninitialized memory or reused output buffer
Summary
Decompressing invalid LZ4 data can leak data from uninitialized memory, or can leak content from previous decompression operations when reusing an output buffer.
Details
The LZ4 block format defines a "match copy operation" which duplicates previously written data or data from the user-supplied dict. The position of that data is defined by an offset. The data is copied within the output buffer from the offset to the current output position. However, lz4_flex did not properly detect invalid and out-of-bounds offset values properly, causing it to copy uninitialized data from the output buffer.
Only the block based API functions are affected:
lz4_flex::block::{decompress_into, decompress_into_with_dict}
When safe-decode is disabled additionally these functions are affected
lz4_flex::block::{decompress, decompress_with_dict, decompress_size_prepended, decompress_size_prepended_with_dict}
All frame APIs are not affected.
There are two affected use cases:
- decompressing LZ4 data with the
unsafeimplementation (safe-decodefeature flag disabled, which is enabled by default): can leak content of uninitialized memory as decompressed result - decompressing LZ4 data into a reused, user-supplied
outputbuffer (affects thesafe-decodefeature as well): can leak the previous contents of the output buffer as decompressed result
Impact
Leakage of data from uninitialized memory or content from previous decompression operations, possibly revealing sensitive information and secrets.
Mitigation
lz4_flex 0.12.1 and 0.11.6 fixes this issue without requiring changes in user code.
If you cannot upgrade, you can mitigate this vulnerability by zeroing the output buffer before calling block::decompress_into or block::decompress_into_with_dict (only block based API is affected, frame API is not affected). Additionally the the safe-decode feature flag should be enabled.
Пакеты
lz4_flex
< 0.11.6
0.11.6
lz4_flex
>= 0.12.0, < 0.12.1
0.12.1
Связанные уязвимости
lz4_flex is a pure Rust implementation of LZ4 compression/decompression. In versions 0.11.5 and below, and 0.12.0, decompressing invalid LZ4 data can leak sensitive information from uninitialized memory or from previous decompression operations. The library fails to properly validate offset values during LZ4 "match copy operations," allowing out-of-bounds reads from the output buffer. The block-based API functions (`decompress_into`, `decompress_into_with_dict`, and others when `safe-decode` is disabled) are affected, while all frame APIs are unaffected. The impact is potential exposure of sensitive data and secrets through crafted or malformed LZ4 input. This issue has been fixed in versions 0.11.6 and 0.12.1.
lz4_flex is a pure Rust implementation of LZ4 compression/decompression. In versions 0.11.5 and below, and 0.12.0, decompressing invalid LZ4 data can leak sensitive information from uninitialized memory or from previous decompression operations. The library fails to properly validate offset values during LZ4 "match copy operations," allowing out-of-bounds reads from the output buffer. The block-based API functions (`decompress_into`, `decompress_into_with_dict`, and others when `safe-decode` is disabled) are affected, while all frame APIs are unaffected. The impact is potential exposure of sensitive data and secrets through crafted or malformed LZ4 input. This issue has been fixed in versions 0.11.6 and 0.12.1.
lz4_flex is a pure Rust implementation of LZ4 compression/decompression. In versions 0.11.5 and below, and 0.12.0, decompressing invalid LZ4 data can leak sensitive information from uninitialized memory or from previous decompression operations. The library fails to properly validate offset values during LZ4 "match copy operations," allowing out-of-bounds reads from the output buffer. The block-based API functions (`decompress_into`, `decompress_into_with_dict`, and others when `safe-decode` is disabled) are affected, while all frame APIs are unaffected. The impact is potential exposure of sensitive data and secrets through crafted or malformed LZ4 input. This issue has been fixed in versions 0.11.6 and 0.12.1.
lz4_flex is a pure Rust implementation of LZ4 compression/decompressio ...