[HIGH] fix(security): require auth on /api/auth/salt to prevent PBKDF2 salt oracle#77
Open
katnisscalls99 wants to merge 1 commit into
Conversation
…oracle Previously GET /api/auth/salt?phone=+1234567890 required no authentication, letting any caller retrieve any user's PBKDF2 salt by phone number. Because the salt is an input to the master-key derivation (PBKDF2-SHA256), leaking it converts an online attack into an offline dictionary/brute-force attack. Changes: - Add authenticateUser() helper (mirrors pattern in backup-pin and key-backup) - GET now requires a valid session and returns only the caller's own salt - POST now requires a valid session and scopes the upsert to auth_user_id - Remove the phone-number query-string parameter from both endpoints; the client-side MasterKeyDerivation.fetchOrCreateSalt() call will automatically send the session cookie / Bearer token that the helper reads. Severity: HIGH — enables offline brute-force of user PINs / master keys
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.
Previously
GET /api/auth/salt?phone=+1234567890required no authentication, letting any caller retrieve any user's PBKDF2 salt by phone number. Because the salt is an input to the master-key derivation (PBKDF2-SHA256), leaking it converts an online attack into an offline dictionary/brute-force attack.Reproduction:
Changes:
authenticateUser()helper (mirrors pattern in backup-pin and key-backup)auth_user_idMasterKeyDerivation.fetchOrCreateSalt()call will automatically send the session cookie / Bearer token that the helper reads.Severity: HIGH — enables offline brute-force of user PINs / master keys