β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-2655

hammer2 ZLIB decompression failure returns zero-filled SUCCESS (b_error never set) β€” silent data substitution on malformed compressed blocks

Field Value
ID DF-2655
Status new
Severity Medium
CVSS 3.1 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
CWE CWE-754 Improper Check for Exceptional Conditions
File sys/vfs/hammer2/hammer2_strategy.c
Lines 258-272 (ZLIB callback; check LZ4 sibling too)
Area vfs
Confidence certain
Discovered 2026-08-29
Pass 2 (GLM 5.3 second pass β€” surfaced during the zlib inflate/deflate batch audit)
Bucket hammer2
Reported pending
Known CVE none
CVE match novel

Summary

hammer2_decompress_ZLIB_callback (strategy.c:258-265): when inflate(..., Z_FINISH) returns anything other than Z_STREAM_END, the handler kprintf's "Fatal error during decompression", bzero's the scratch buffer, then unconditionally bcopy's it into bp->b_data, sets bp->b_resid = 0, and returns without setting b_error β€” the bio completes successfully and read(2) returns fabricated zeros for the block instead of EIO. (Check the LZ4 sibling callback for the same pattern.)

Root cause

Error return of the decompressor is not propagated into bp->b_error; the zero-fill-on-error is treated as a substitute result rather than a failure.

Threat model & preconditions

A hammer2 block that is checksum-VALID but zlib-malformed (crafted image β€” attacker authors garbage with a recomputed check, CHECK_NONE ancestors make this trivial with the DF-2616..2654 forging family; or a compressed block written by a buggy/foreign implementation). Any read of the file silently substitutes zeros: backup/verification tooling that trusts read(2) integrity sees success with corrupted data. No memory corruption; pure integrity failure. Not reachable via ordinary bit-rot on default check methods (the checksum fails first β†’ EIO).

On decompression failure set bp->b_error = EIO; bp->b_flags |= B_ERROR; (and skip the bcopy) so the read fails loudly; same for the LZ4 callback if it shares the pattern.

References

  • findings/poc/DF-2656 (the zlib batch audit that surfaced this)
  • DF-2633/DF-2642 (the sibling swallowed-error family)

Timeline

  • 2026-08-29 Surfaced during the pass-2 zlib batch audit (GLM 5.3); line-verified by the orchestrator (strategy.c:258-272).

Discussion (0)

No comments yet.