Skip to content

fix(sdk-lib-mpc): authenticate signatureR in DKLS DSG round 4 messages#8470

Open
mrdanish26 wants to merge 1 commit intomasterfrom
fix/wal-376-dkls-dsg-signaturer-authentication
Open

fix(sdk-lib-mpc): authenticate signatureR in DKLS DSG round 4 messages#8470
mrdanish26 wants to merge 1 commit intomasterfrom
fix/wal-376-dkls-dsg-signaturer-authentication

Conversation

@mrdanish26
Copy link
Copy Markdown
Contributor

@mrdanish26 mrdanish26 commented Apr 9, 2026

Summary

  • Sign signatureR bytes with the party GPG key in encryptAndAuthOutgoingMessages() — previously hardcoded signature: "" left the ECDSA nonce commitment R unauthenticated (F-04, severity: HIGH)
  • Verify signatureR in decryptAndVerifyIncomingMessages() before returning it to callers
  • Transmit signatureRSignature in getSignatureShareRoundThree() so the server can authenticate R before passing it to combinePartialSignatures()

Test plan

  • 86/86 sdk-lib-mpc unit tests pass
  • 144/144 sdk-core unit tests pass
  • New tests: sign+verify round-trip, tampered R rejection, wrong-key rejection, no-signatureR passthrough

Ticket: WAL-376

signatureR was wrapped with signature: "" (hardcoded empty string) in
encryptAndAuthOutgoingMessages(), leaving the ECDSA nonce commitment R
unauthenticated. A MITM could substitute a crafted R value and have it
used by combinePartialSignatures() to produce an attacker-controlled
signature component.

Fix:
- Sign signatureR bytes with the party GPG key via detachSignData in
  encryptAndAuthOutgoingMessages()
- Verify signatureR in decryptAndVerifyIncomingMessages() and return it
  in the result so callers can use the authenticated value
- Transmit signatureRSignature in getSignatureShareRoundThree() so the
  server can authenticate signatureR before combining
- Update signBitgoMPCv2Round3 (server simulation) to pass signatureR
  to decryptAndVerifyIncomingMessages for end-to-end verification
- Add unit tests covering sign, verify, tamper detection, and
  wrong-key rejection for signatureR

Ticket: WAL-376

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Apr 9, 2026

@mrdanish26 mrdanish26 marked this pull request as ready for review April 10, 2026 20:14
@mrdanish26 mrdanish26 requested review from a team as code owners April 10, 2026 20:14
Comment on lines +1048 to +1050
const parsedSignatureShare = JSON.parse(userShare.share) as MPCv2SignatureShareRound3Input & {
data: { msg4: { signatureRSignature?: string } };
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not update the type instead of casting it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I have added signatureRSignature on the shared round‑3 msg4 type in @bitgo/public-types: https://github.com/BitGo/public-types/pull/339 . Will remove the cast once that is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants