fix: use random nonce per call in AES-GCM onboarding signature#270
Merged
Conversation
Replaces the static IV (first 12 bytes of the secret) with OpenSSL::Random.random_bytes(12) generated fresh 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 was referenced Jun 9, 2026
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
generate_onboarding_signatureto use a random 12-byte IV per encryption call instead of a static IV.hex(iv[12 bytes] || ciphertext || tag[16 bytes])Changes
Companion PRs (same fix across all partner SDKs)
Test plan
generate_onboarding_signatureproduces a different hex string on every call with the same input🤖 Generated with Claude Code