Repository navigation
cf-serverd: Fixed heap over-read dumping session key on bad SSYNCH decrypt - #6510
Closed
Dhanu-dynamic wants to merge 1 commit into
Closed
Dhanu-dynamic wants to merge 1 commit into
Dhanu-dynamic wants to merge 1 commit into
Conversation
…crypt When the encrypted payload of a classic protocol SSYNCH request fails to decrypt, BusyWithClassicConnection() calls DebugBinOut(conn->session_key, 32, ...). The session key is allocated in AuthenticationDialogue() with CfSessionKeySize(), which returns CF_BLOWFISHSIZE (16) in community builds, so every such request reads 16 bytes past the end of the heap allocation. DebugBinOut() walks the buffer before Log() checks the log level, so the over-read happens at any log level, and with verbose logging the session key and the adjacent heap bytes are written to the cf-serverd log. An authenticated classic protocol client (allowlegacyconnects) triggers it with an SSYNCH request carrying a 1-byte payload, which can never pass EVP_DecryptFinal_ex(). Removed the dump, since writing the session key to the log has no diagnostic value. The "Bad decrypt" error is kept. Changelog: Title Signed-off-by: Dhanraj E <dhanraj@labs.digiscrypt.com>
Contributor
|
Please note that the this is a legacy protocol. It only exists to communicate with very old agents. And we don't make patches for these. The changes you are proposing will most likely never run on any real host. |
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.
When the encrypted payload of a classic protocol SSYNCH request fails to
decrypt, BusyWithClassicConnection() calls
DebugBinOut(conn->session_key, 32, ...). The session key is allocated in
AuthenticationDialogue() with CfSessionKeySize(), which returns
CF_BLOWFISHSIZE (16) in community builds, so every such request reads 16
bytes past the end of the heap allocation. DebugBinOut() walks the
buffer before Log() checks the log level, so the over-read happens at
any log level, and with verbose logging the session key and the
adjacent heap bytes are written to the cf-serverd log.
An authenticated classic protocol client (allowlegacyconnects) triggers
it with an SSYNCH request carrying a 1-byte payload, which can never
pass EVP_DecryptFinal_ex(). Removed the dump, since writing the session
key to the log has no diagnostic value. The "Bad decrypt" error is kept.
Checked with an AddressSanitizer build of DebugBinOut() called the same way on a 16-byte allocation: heap-buffer-overflow READ 0 bytes after the 16-byte region before the change, clean after. DebugBinOut() itself is left in libpromises since it is an exported symbol.