-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retrieveOptionalInfoString uses untrusted length for allocation #9009
Comments
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 25, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 25, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 26, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 26, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 26, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 26, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Aug 27, 2021
We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009
bzbarsky-apple
added a commit
that referenced
this issue
Aug 27, 2021
* Add non-copying string and byte getters on a TLV reader. We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes #9009 * Addressing review comments * More review comments * Bump Darwin build job bootstrap timeout to match other Darwin jobs. 10 minutes keeps timing out.
mkardous-silabs
pushed a commit
to mkardous-silabs/connectedhomeip
that referenced
this issue
Sep 24, 2021
…p#9249) * Add non-copying string and byte getters on a TLV reader. We have existing callsites that are doing what GetString/GetBytes say to do and call GetLength() to decide how big a buffer to allocate. But the return value from GetLength() doesn't have to be sane, so we end up allocating buffers with attacker-controlled sizes. The changes here are: 1) Add ContiguousBufferTLVReader that is always backed by a single buffer, so it can guarantee that the in-place view makes sense. 2) Use the new class in setup payload parsers, fixing various bugs in the process. Fixes project-chip#9009 * Addressing review comments * More review comments * Bump Darwin build job bootstrap timeout to match other Darwin jobs. 10 minutes keeps timing out.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
retrieveOptionalInfoString
does:Proposed Solution
Don't even allocate. We're about to copy into an
std::string
anyway. Just grab the pointer to the in-tlv data (which will do length-verification at least to the extent of it not overflowing the tlv data itself) and use the 2-arg form ofstd::string::assign
.The text was updated successfully, but these errors were encountered: