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
F166769281: D58822.id.diff
Sun, Aug 16, 9:48 AM
Unknown Object (File)
Sat, Aug 15, 7:55 AM
Unknown Object (File)
Sat, Aug 15, 5:05 AM
Unknown Object (File)
Fri, Aug 14, 7:03 PM
Unknown Object (File)
Fri, Aug 14, 7:03 PM
Unknown Object (File)
Fri, Aug 14, 7:00 PM
Unknown Object (File)
Fri, Aug 14, 7:09 AM
Unknown Object (File)
Thu, Aug 13, 12:12 PM
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 75584
Build 72467: 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.