Skip to content

fix(fabric)!: require proof of ownership in the recipient exchange - #2452

Merged
mbrandenburger merged 2 commits into
hyperledger-labs:mainfrom
mbrandenburger:fix/recipient-proof
Nov 3, 2026
Merged

mbrandenburger merged 2 commits into
hyperledger-labs:mainfrom
mbrandenburger:fix/recipient-proof

Conversation

@mbrandenburger

Copy link
Copy Markdown
Member

Fixes #2435. Part of #2432.

Problem

The recipient exchange views (platform/fabric/services/state/recipients.go) bound whatever recipient identity the counterparty claimed. A peer could claim another party's recipient identity, receive that party's traffic, and have its own endorsement accepted for that party, because endorsement checks accept an endorser bound to the expected party (platform/fabric/services/endorser/endorsement.go).

Changes

Proof of ownership (platform/fabric/services/state/proof.go)

  • Whoever sends a recipient identity X attaches RecipientData.Proof, a signature by X over a payload naming the view and direction, the session and context IDs, and the FSC node identities of the signer and the verifier. Each field is length-prefixed, and the payload starts with a zero byte so it can't parse as a proposal or envelope signed by the same key.
  • The receiver builds the payload from its own view of the session, never from the message, so a proof relayed from another session, reflected back in the other direction, or meant for another node does not verify.
  • SignRecipientProof and VerifyRecipientProof are exported for applications with their own recipient exchange. A failure wraps ErrRecipientProof.

Recipient views

  • RequestRecipientIdentity, ExchangeRecipientIdentities and their responders attach a proof to every identity they send and verify every identity they receive. The identity is verified with X's verifier from the Fabric network's signer service (new fabric.SignerService.GetVerifier), and only then bound with BindProven (fix(view)!: refuse binding redirects and report binding conflicts #2446) to the counterparty's node identity.
  • The exchange responder verifies the initiator's proof before it replies, so an unproven initiator gets nothing back.
  • A missing or invalid proof binds nothing and returns an error containing recipient proof:. It is counted as recipient_proof, with one of four fixed reasons: missing, incomplete context, no verifier or invalid signature.

Node identities (platform/view/services/id)

  • CanonicalIdentity re-encodes a PEM certificate to its canonical form. The payload uses it for both node identities, so both ends sign over the same bytes however each loaded its certificate.

Deviations from the issue

None.

Behaviour worth reviewing

  • Wire change. RecipientData is JSON, so an old node ignores the new field, but a new node refuses identities sent without a proof. Every organization that exchanges recipient identities upgrades together. The upgrade guide has a table of which old/new combinations fail and the error each side sees.
  • Idemix. A node verifies a remote idemix recipient only if it holds its own credential from the same issuer. Recipients from another idemix issuer are not supported by these views; Harden recipient identity verification #2440 adds verification through the channel MSP. An idemix proof can be verified by anyone with the issuer's public material, which links the pseudonym to the signer's node for anyone who sees the proof. The security model says so.
  • x509. A valid proof shows that the sender holds the key for X, not that X belongs to an MSP.
  • RespondRequestRecipientIdentityView with a preset identity now needs a signer for it in the network's signer service. The upgrade guide's developer section notes it.
  • invalid signature can also mean that two honest nodes disagree on a node identity in their configuration. The metrics doc says so, so an operator doesn't read every one as an attack.

Breaking change

Wire change in the recipient exchange; see above. Panurus maintainers: heads-up before merge. Panurus's own recipient attestation does not name the verifier node and may need the same treatment.

Tests

  • proof_test.go: the payload is unambiguous and starts with zero; a valid proof verifies; a wrong verifier node, wrong direction tag, other session, wrong key, missing proof and empty context fields are refused; non-canonical PEM node identities give the same payload.
  • proof_idemix_test.go: a proof by a real idemix identity verifies.
  • recipients_test.go: the responder refuses a missing, relayed or unverifiable proof and verifies before it replies; initiators refuse an unproven reply; a valid proof binds and repairs a planted row; the initiator's resolver fallback; each fixed reason.
  • endorsement_test.go: a hijacker that claimed a party's recipient identity without a proof has its endorsement refused.
  • sig_test.go, identity_test.go: SignerService.GetVerifier and CanonicalIdentity.
  • Integration: HostileSpecs "refuses a recipient identity claimed without proof of ownership" (integration/fabric/common/faultrecovery). Alice claims bob's own identity without a proof; bob refuses with recipient proof: missing, the identity still resolves to bob, and an exchange with proofs still binds each identity to its owner. It runs on Fabric and Fabric-x and fails against code without this change.
  • Locally: make checks and the root unit tests pass. Earlier runs of fabric-iou, fabric-atsa and fabricx-iou passed with proofs; CI covers the rest.

Docs

  • docs/platform/view/security-model.md: the proof, what it binds, and the idemix and x509 limits.
  • docs/platform/view/programming-model.md: checking payload claims against the caller, and the exported proof helpers.
  • docs/platform/view/services/monitoring_metrics.md: the recipient_proof kind and its reasons.
  • docs/upgrade/v0.27-to-v0.28.md: the Recipient exchange section with the compatibility table, the coordinated-upgrade note at the top, and the checklist.

@mbrandenburger mbrandenburger added this to the 26Q4 milestone Nov 2, 2026
@mbrandenburger mbrandenburger self-assigned this Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Hey @mbrandenburger 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

✅ DCO Sign-off -- All commits have valid sign-offs. Nice work!


❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:

  • 82b9265 fix(fabric)!: require proof of ownership in the recipient exchange
  • 9cd9f43 fixup! fix(fabric)!: require proof of ownership in the recipient exchange

You'll need to sign your commits with GPG (e.g. git commit -S). See the Signing Guide for a step-by-step walkthrough.


✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing!


✅ Issue Link -- Linked to #2435 (assigned to you).


⏳ All checks must pass before this PR can be reviewed. You've got this!

@github-actions github-actions Bot added the status: needs revision The pull request requires changes from the author before it can be reviewed or merged label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Hi @mbrandenburger 👋 — the recent merge of PR #2450 has introduced a merge conflict in this PR. Please resolve the merge conflict so that this PR can be reviewed again. Thank you!

@SaidAltury-ibm SaidAltury-ibm left a comment

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.

thank you @mbrandenburger , i have left one testing comment

ownerNode, malloryNode := view.Identity("owner-node"), view.Identity("mallory-node")
x, m := view.Identity("x"), view.Identity("m")

store, err := mem.NewDriver().NewBinding("", "hijack")

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.

This test fails from -count=2 onward:

-count=1: ok
-count=2: FAIL
  endorsement_test.go:891: Should be true
    require.True(t, endpointService.IsBoundTo(ctx, m, x), "the planted row makes M pass as X")

The "hijack" param names the tables, and the memory driver's sqlite provider is keyed on the DSN (sqlite/persistence.go:56-58), which is fixed for mem.NewDriver() — so every run in the process shares one database and the same hijack tables. Run 1 ends with BindProven(ownerNode, x) applied, run 2 inherits that row, and Mallory's plant can no longer make M pass as X, so the setup assertion fails before the test reaches what it is checking.

Changing the store param (e.g. to t.Name()) does not fix it — I tried, and it still fails at -count=2. The row keys are the identities, not the table name, and those are hard-coded. Making the identities unique per run does work:

u := t.Name() + time.Now().Format("150405.000000000")
ownerNode, malloryNode := view.Identity("owner-node"+u), view.Identity("mallory-node"+u)
x, m := view.Identity("x"+u), view.Identity("m"+u)

With that, -count=3 and -race -count=3 -shuffle=on both pass, and the test still guards the attack: neutering BindProven to return nil fails it at :895.

The sibling endpoint tests survive -count=3 because their assertions are idempotent; this one's plant → pass-as-X → BindProven-defeats-it sequence is not — run 1 leaves x proven-bound to ownerNode.

Worth fixing because this is the test that demonstrates the actual end-to-end attack — plant, pass as X, then BindProven defeats it — and it's the one test in this PR that can't be re-run. CI runs -count=1 so it won't catch this, but it will bite whoever next runs -count=N.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch! It seems we have the same problem in TestGetRejections_NoneRegisteredIsSharedNoop in platform/view/services/security. Will fix that in a separate PR.

@mergify

mergify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@mbrandenburger
mbrandenburger enabled auto-merge (squash) November 3, 2026 09:14
The recipient exchange views bound whatever identity the counterparty
claimed. A peer could claim another party's recipient identity, receive
that party's traffic, and have its own endorsement accepted for that
party, because endorsement checks accept an endorser bound to the
expected party.

Whoever sends a recipient identity X now attaches a signature by X over
a payload that names the view and direction, the session and context
IDs, and the FSC node identities of both ends. The receiver builds that
payload from its own view of the session, verifies it with X's verifier
from the network's signer service, and only then binds X to the
counterparty's node identity with BindProven. The exchange responder
verifies the initiator's proof before it replies. A missing or invalid
proof binds nothing and returns an error containing "recipient proof:",
and is counted as recipient_proof with one of the reasons missing,
incomplete context, no verifier or invalid signature.

Node identities are canonicalized in the payload (id.CanonicalIdentity),
so both ends sign over the same bytes however each loaded its
certificate. SignRecipientProof and VerifyRecipientProof are exported
for applications with their own recipient exchange, and
fabric.SignerService gains GetVerifier.

A node verifies a remote idemix recipient identity only if it holds a
credential from the same issuer. For x509, a valid proof shows that the
sender holds the key for X, not that X belongs to an MSP.

Adds unit tests, a hostile-peer spec in the fault-recovery suites, and
documentation in the security and programming models, the metrics
catalog and the upgrade guide.

BREAKING CHANGE: the recipient exchange messages carry a proof, and a
node refuses identities sent without one. Every organization that
exchanges recipient identities must upgrade together; the upgrade guide
lists which combinations of old and new nodes fail and how.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
…ange

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger
mbrandenburger merged commit effb371 into hyperledger-labs:main Nov 3, 2026
@mbrandenburger
mbrandenburger deleted the fix/recipient-proof branch November 3, 2026 09:15
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

👋 Hi @mbrandenburger! Great work on your recent contribution! 🎉

Here are some issues you might want to explore next:

Happy coding! 🚀

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

Labels

breaking status: needs revision The pull request requires changes from the author before it can be reviewed or merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require proof of ownership for recipient identities

2 participants