Skip to content

fix out-of-bounds read dumping truncated AMQP containers in value_dump - #455

Open
kakkar87d wants to merge 1 commit into
apache:mainfrom
kakkar87d:value-dump-truncated-container
Open

kakkar87d wants to merge 1 commit into
apache:mainfrom
kakkar87d:value-dump-truncated-container

Conversation

@kakkar87d

Copy link
Copy Markdown

Out-of-bounds read textifying a truncated AMQP container

When frame tracing textifies a received frame, consume_count() reads the 4-byte element count of a 32-bit list/map/array after only checking the value region is non-empty, and pn_value_dump_array() reads the shared element-constructor byte of a zero-count array the same way. A frame that declares a 32-bit container but carries fewer than 4 bytes of content (or an array carrying only its count with no constructor) makes both read past the end of the value. The count read also underflows the remaining size, so the element walk that follows runs further off the buffer. Both paths reach the public pn_value_dump() for any received frame once FRAME-level logging is on, so the length is attacker controlled. Added the missing length checks so a truncated container dumps as empty.

Repro: under AddressSanitizer, pn_value_dump() on d0 00 00 00 01 55 faults in consume_count and on f0 00 00 00 04 00 00 00 00 in pn_value_dump_array. The new value_dump_truncated_container case in data_test.cpp covers both and aborts before the change.

This is a functional fix, so it wants a PROTON JIRA key; I'll raise one and prefix the title before this is published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant