Page MenuHomeFreeBSD

db/hash: Harden hash(3) database code
Needs ReviewPublic

Authored by bnovkov on Thu, Aug 13, 11:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Aug 29, 10:48 PM
Unknown Object (File)
Sat, Aug 29, 10:36 PM
Unknown Object (File)
Sat, Aug 29, 6:35 PM
Unknown Object (File)
Mon, Aug 24, 10:02 AM
Unknown Object (File)
Mon, Aug 24, 7:13 AM
Unknown Object (File)
Mon, Aug 24, 6:27 AM
Unknown Object (File)
Sun, Aug 23, 3:10 PM
Unknown Object (File)
Sun, Aug 23, 2:32 AM
Subscribers

Details

Reviewers
None
Group Reviewers
Klara
Summary

The hash(3) database code does not validate the on-disk database header,
leaving it open to several OOB read and write vulnerabilities.

This change adds basic header validation and array bounds checking to
parts of the hash(3) code that can be manipulated by messing with the
database header.

Sponsored by: Klara, Inc.
MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75559
Build 72442: arc lint + arc unit

Event Timeline

kevans added inline comments.
lib/libc/db/hash/hash.c
161

This is also signed, are negative values not an issue?

bnovkov added inline comments.
lib/libc/db/hash/hash.c
161

Thanks for catching this, negative values here are an issue.

bnovkov marked an inline comment as done.

Propagate error from bounds checking instead of aborting