Skip to content

fix: harden protocol and crypto validation against malformed peer input - #135

Merged
hsiuhsiu merged 3 commits into
masterfrom
fix/protocol-validation-hardening
Aug 27, 2026
Merged

fix: harden protocol and crypto validation against malformed peer input#135
hsiuhsiu merged 3 commits into
masterfrom
fix/protocol-validation-hardening

Conversation

@hsiuhsiu

Copy link
Copy Markdown
Contributor
  • Propagate unpack errors from multi-set group messages instead of discarding them, so a malformed inner broadcast payload fails group_message rather than being silently accepted.
  • Validate ECDSA-MP round-3 signing broadcasts before hashing them into the transcript view, so a malformed proof is rejected before it can influence the transcript.
  • Verify in TDH2 combine/combine_additive that the supplied public shares actually reconstruct to the claimed public key, and reject duplicate partial-decryption role IDs, closing a path to combine shares and decryptions from mismatched key contexts.
  • Reject malformed message lengths in the base PVW OT protocol instead of processing undersized/oversized inputs and outputs.

- Propagate unpack errors from multi-set group messages instead of
  discarding them, so a malformed inner broadcast payload fails
  group_message rather than being silently accepted.
- Validate ECDSA-MP round-3 signing broadcasts before hashing them
  into the transcript view, so a malformed proof is rejected before
  it can influence the transcript.
- Verify in TDH2 combine/combine_additive that the supplied public
  shares actually reconstruct to the claimed public key, and reject
  duplicate partial-decryption role IDs, closing a path to combine
  shares and decryptions from mismatched key contexts.
- Reject malformed message lengths in the base PVW OT protocol
  instead of processing undersized/oversized inputs and outputs.
@cb-heimdall

cb-heimdall commented Aug 27, 2026

Copy link
Copy Markdown

✅ Heimdall Review Status

Requirement Status More Info
Reviews 2/2
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 2
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 2
2
1 if commit is unverified 0
Sum 2
CODEOWNERS ✅ None for this change

@hsiuhsiu
hsiuhsiu marked this pull request as ready for review August 27, 2026 05:24

TEST(MPCJob, MultiSetGroupMessageRejectsMalformedInnerBroadcast) {
constexpr int n = 2;
constexpr int malicious = 1;
Arash-Afshar
Arash-Afshar previously approved these changes Aug 27, 2026

@valery-osheter-cb valery-osheter-cb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved

@Rob1Ham Rob1Ham left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I reviewed the changes at 310805a807e3735ba53c21752d98961fa65e674e and have no additional feedback on the implementation itself.

I left two non-blocking observations regarding Docker/OpenSSL path consistency and regression-test maintainability.

no-quic no-rc2 no-rc4 no-rc5 no-rfc3779 no-scrypt no-sctp no-seed no-siphash no-sm2 no-sm3 no-sm4 no-sock no-srtp no-srp \
no-ssl-trace no-ssl3 no-stdio no-tests no-tls no-ts no-unit-test no-uplink no-whirlpool no-zlib \
--prefix="${CBMPC_OPENSSL_ROOT:-/usr/local/opt/openssl@3.6.3}" --libdir=lib64
--prefix="${CBMPC_OPENSSL_ROOT:-/usr/local/opt/openssl@3.6.4}" --libdir=lib64

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The script now installs OpenSSL under openssl@3.6.4, while Dockerfile:40-42 still creates the /usr/local compatibility links against openssl@3.6.1. Is that divergence intentional?

The CMake paths use the new 3.6.4 prefix directly, but consumers relying on the conventional /usr/local include and library paths would still resolve through the older targets. If this is not intentional, could the Dockerfile links be updated as part of the version bump?

Comment thread tests/unit/api/test_ecdsa_mp_ac.cpp Outdated
constexpr uint8_t kSecp256k1CurveCodeHi = 0x02;
constexpr uint8_t kSecp256k1CurveCodeLo = 0xca;
for (int i = 0; i + 1 < msg.size(); ++i) {
if (msg[i] == kSecp256k1CurveCodeHi && msg[i + 1] == kSecp256k1CurveCodeLo) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would it be possible to target a decoded field directly rather than mutating the first raw 0x02ca occurrence? The current approach may be sensitive to unrelated serialization changes and could modify a different field if that byte sequence occurs earlier in the message. A structured mutation would make the regression test more deterministic.

@cb-heimdall

Copy link
Copy Markdown

Review Error for Rob1Ham @ 2026-08-27 14:57:36 UTC
User failed mfa authentication, either user does not exist or public email is not set on your github profile. \ see go/mfa-help

@valery-osheter-cb valery-osheter-cb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved

@hsiuhsiu
hsiuhsiu requested a review from Arash-Afshar August 27, 2026 15:41
@hsiuhsiu

Copy link
Copy Markdown
Contributor Author

I reviewed the changes at 310805a807e3735ba53c21752d98961fa65e674e and have no additional feedback on the implementation itself.

I left two non-blocking observations regarding Docker/OpenSSL path consistency and regression-test maintainability.

Addressed them. Thanks!

@hsiuhsiu
hsiuhsiu merged commit a34e9e8 into master Aug 27, 2026
9 checks passed
@hsiuhsiu
hsiuhsiu deleted the fix/protocol-validation-hardening branch August 27, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants