Out-of-bounds read in LibOSDP osdp_file_cmd_tx_decode() due to missing file-chunk length validation
Description
Bug class
CWE-125: Out-of-bounds Read (heap). Secondary CWE-617 (reachable assertion) on debug builds.
Location
src/osdp_file.c, function osdp_file_cmd_tx_decode(), write-handler dispatch at src/osdp_file.c:336 (length read at src/osdp_file.c:289; the only consistency check, at src/osdp_file.c:291, is an assert() compiled out under NDEBUG -- the normal release build).
Mechanism
osdp_file_cmd_tx_decode() parses an incoming CMD_FILETRANSFER command, reads a 16-bit payload length verbatim from the wire, and passes that length to the registered write handler without checking it against the number of bytes actually received. A frame advertising a large length but carrying few data bytes causes the write handler to read far past the end of the PD receive buffer.
Impact
- Availability (demonstrated): reading up to ~64 KiB past the receive buffer faults the PD once it crosses an unmapped page -- a repeatable reader denial of service.
- Confidentiality: LOW / effectively closed. The over-read bytes are handed to the integrator's local write handler (typically persisted to the received file); they are consumed internally and are NOT reflected back onto the OSDP wire, so there is no direct remote read-back channel.
Reachability
Same on-bus, pre-auth-in-default-config model as SINK A: with Secure Channel not enforced, the PD command dispatcher routes a plaintext CMD_FILETRANSFER straight into the decoder; a transfer must be in progress (two back-to-back frames from the bus attacker). ENFORCE_SECURE closes the pre-auth path. Not verified on PD silicon.
CVSS 3.1
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H -- Base 6.5 (Medium), read-DoS. If the PD is reached through a serial-to-IP bridge (network-adjacent), AV:N -- 7.5 (High).