fix(security): business logic flaw: toctou bypass in otr fingerprint verification [MEDIUM]#838
Open
failsafesecurity wants to merge 1 commit intojitsi:masterfrom
Conversation
…verification [MEDIUM]
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.
Security Finding: Business Logic Flaw: TOCTOU Bypass in OTR Fingerprint Verification
Severity: MEDIUM
Reported by: FailSafe Research Team
Component:
modules/plugin/otr/src/main/java/net/java/sip/communicator/plugin/otr/authdialog/OtrBuddyAuthenticationDialog.java:194Description
Step 1: A user initiates an out-of-band verification process and opens the OTR Authentication dialog. The
FingerprintAuthenticationPanelfetches and displays the remote user's current public key fingerprint.Step 2: While the dialog remains open and the user is manually verifying the fingerprint, a network attacker intercepts the connection and forces a new OTR session, injecting a malicious public key.
Step 3: The user finishes verifying the original fingerprint and clicks the 'Authenticate Buddy' button.
Step 4: The
OtrBuddyAuthenticationDialogbusiness logic re-fetches the remote public key from the OTR engine (getRemotePublicKey) instead of using the fingerprint that was actually displayed to the user. The system verifies the attacker's new key, bypassing the user's manual authorization check.Fix
Eliminate the Time-of-Check to Time-of-Use (TOCTOU) vulnerability by storing the exact fingerprint string that was displayed to the user in the dialog's state when the
FingerprintAuthenticationPanelis initialized. When the user clicks the 'Authenticate Buddy' button, retrieve this stored fingerprint and pass it directly toOtrActivator.scOtrKeyManager.verify(contact, storedFingerprint). Do not re-fetch the current key from the OTR engine during the verification action. This ensures that the system only authorizes the exact cryptographic identity that the user visually inspected.Test Plan
OtrActivator.scOtrEngine.getRemotePublicKey(contact)) during the 'Use' phase, rather than using the key that was verified during the 'Check' phase.FingerprintAuthenticationPanelshould pass the specificPublicKeyobject or fingerprint string that was displayed to the user directly to the authentication handler.PublicKey pubKey = this.displayedAndVerifiedPublicKey;