Fix/tlv unknown arbitrary offset#86
Merged
brainstorm merged 2 commits intoApr 1, 2026
Merged
Conversation
TLV unknown packet can arbitrarily advance the stream. The decision here is disabling skipping unknown TLV types and instead let the ota handler fail
The result of this change is that on sending an incorrect (crafted) ota file the ssh-server aborts the ota-update. The client receives a Failure but that is not enough to close the connection. The crafted file was created editing the type immediately after OtaType (value 0) and giving it a value out of range (0x09)
brainstorm
approved these changes
Apr 1, 2026
Owner
There was a problem hiding this comment.
Not sure if that error handling belongs on the side of SSH Stamp, but I'll be approving it now just in case I'm flat wrong: you decide, @jubeormk1 ;)
EDIT: Merging it after disabling the hil-ready branch rules, we'll re-enable them later... open another PR addressing my comments (if needed at all!).
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.
This PR is focus on Radically Open Security report on the possible arbitrary offset injection on TLV parameters that may lead to undefined behaviour.
An unknown TLV element in the ota packet now is rejected by the ota handler. The SftpServer response to the Write request in this case is sending back to the client a SSH_FX_OP_UNSUPPORTED status.
This fix blocks the client but does not block the server, that can receive other ssh or sftp connections after the failure.