fix: use random nonce per call in AES-GCM onboarding signature (ISS-2528895)#355
Open
rzp-slash[bot] wants to merge 1 commit into
Open
fix: use random nonce per call in AES-GCM onboarding signature (ISS-2528895)#355rzp-slash[bot] wants to merge 1 commit into
rzp-slash[bot] wants to merge 1 commit into
Conversation
Replaces the static IV (first 12 bytes of the key) with a fresh SecureRandom-generated 12-byte nonce for every encryption call. The old approach caused AES-GCM nonce reuse: an attacker who collects two onboarding_signature values from partner URLs can XOR the ciphertexts to cancel the keystream and forge a valid signature for any submerchant ID without knowing the partner secret key (NIST SP 800-38D §8.3 Forbidden Attack). New output format: hex(iv[12] || ciphertext || tag[16]) The receiver reads the first 24 hex chars as the IV before decrypting. Reported via HackerOne #3754503 (ISS-2528895), SLA: 2026-06-05. Co-authored-by: ankitdas13 <ankit.das@razorpay.com>
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.
Summary
generateOnboardingSignature(HackerOne #3754503 / ISS-2528895)encrypt()used the first 12 bytes of the AES key as a fixed IV — identical for every encryption call with the same partner secretonboarding_signaturevalues from partner URLs (browser history, logs, Sentry) can XOR the ciphertexts to recover the keystream and forge valid signatures for arbitrary submerchant IDs — without ever knowing the partner's secret keyFix
Replace the static IV with
SecureRandom.nextBytes(iv)and prepend the nonce to the output so the Razorpay backend can extract it for decryption.Before:
After:
New output format:
hex(iv[12 bytes] || ciphertext || tag[16 bytes])The receiver reads the first 24 hex chars (12 raw bytes) as the IV before decrypting.
Companion PRs (same fix, same format across all partner SDKs)
Test plan
generateOnboardingSignatureproduces a different hex string on every call with the same input🤖 Generated with Claude Code