Repository navigation
fix(tcpusb): check AUTH signatures strictly with OpenSSL - #570
Merged
Merged
Conversation
node-forge's PKCS#1 v1.5 verification accepts garbage inside the DigestAlgorithm sequence, which lets anyone forge signatures for exponent 3 keys (GHSA-86w9-cpqp-85rv). No fixed node-forge exists. The bridge now removes the padding with crypto.publicDecrypt, which checks it strictly, and compares what's left byte for byte with the SHA-1 DigestInfo of the token. node-forge is still used to parse keys. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Karol Wrótniak <[email protected]>
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.
Fixes the open node-forge alert (GHSA-86w9-cpqp-85rv). No fixed node-forge exists: every version up to 1.4.0 is affected.
The problem
The TCP-USB bridge checked the client's AUTH signature with node-forge's PKCS#1 v1.5
verify. node-forge accepts garbage inside the DigestAlgorithm sequence, which lets anyone forge a signature for a key with exponent 3 (adb keys use 65537, butparsePublicKeyaccepts 3 too). The new test shows node-forge 1.4.0 accepting such a signature.The fix
The bridge now removes the padding with
crypto.publicDecrypt, where OpenSSL checks it strictly. What's left has to equal the SHA-1 DigestInfo of the token byte for byte, so there's nothing left to parse. Exponent 3 keys keep working. node-forge is still used for parsing keys and fingerprints, which the advisory doesn't affect.Testing
adb connectto stf's remote debug URL givesdevice unauthorized, and stf offers to add the key.adb -s <url> shellworks.🤖 Generated with Claude Code