Repository navigation
Fixed out-of-bounds read in RemoteDirList when parsing a listing - #6390
Open
Dhanu-dynamic wants to merge 1 commit into
Open
Dhanu-dynamic wants to merge 1 commit into
Dhanu-dynamic wants to merge 1 commit into
Conversation
`RemoteDirList` walks the NUL-separated entries of a server reply with `for (sp = recvbuffer; *sp != '\0'; sp += strlen(sp) + 1)`, never looking at the length `ReceiveTransaction` returned, so a reply that does not end in the double `'\0'` carries the scan on into whatever the previous reply left in the buffer, and off the end of it when that residue holds no NUL. a hostile policy server can thus synthesise directory entries out of buffer leftovers, or silently drop the entries of the last packet by leaving a stale `CFD_TERMINATOR` where the scan resumes, which is what the new test does. the encrypted branch discards `DecryptString`'s return as well, so the plaintext is never terminated and the scan runs past that too; both lengths are now honoured, the same way `ProtocolOpenDir` in `libcfnet/protocol.c` already bounds this loop. reached as root from any recursive `copy_from`, through `SourceSearchAndCopy` -> `AbstractDirOpen` -> `RemoteDirList`. Changelog: Title Signed-off-by: Dhanraj E <dhanraj@labs.digiscrypt.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RemoteDirListwalks the NUL-separated entries of a server reply withfor (sp = recvbuffer; *sp != '\0'; sp += strlen(sp) + 1), never lookingat the length
ReceiveTransactionreturned, so a reply that does not endin the double
'\0'carries the scan on into whatever the previous replyleft in the buffer, and off the end of it when that residue holds no NUL.
a hostile policy server can thus synthesise directory entries out of
buffer leftovers, or silently drop the entries of the last packet by
leaving a stale
CFD_TERMINATORwhere the scan resumes, which is whatthe new test does. the encrypted branch discards
DecryptString's returnas well, so the plaintext is never terminated and the scan runs past that
too; both lengths are now honoured, the same way
ProtocolOpenDirinlibcfnet/protocol.calready bounds this loop. reached as root from anyrecursive
copy_from, throughSourceSearchAndCopy->AbstractDirOpen->RemoteDirList.