Authenticated identity is taken from an unsigned field in Peer.processGeneralMessage
Description
An authenticated peer can relabel a correctly signed BRC-103 message with another user's public identity key. The receiver verifies the signature against the identity bound to the nonce-selected session, but affected code then trusted and dispatched an unsigned transport identity field. Applications that treated that dispatched identity as the authenticated caller could issue credentials or perform actions for a victim account.
Impact
Where an HTTP or similar transport carries identity separately from the signed payload, an attacker needs only an honest session under their own key and the victim's public key. No victim interaction, secret, or privileged network position is required. In applications that map identity keys to accounts, the result can be account takeover.
Active exploitation has not been observed. The issue was found during source review of a downstream application, which applied a local session-identity check while the upstream packages were remediated.
Technical details
The nonce selects a peer session whose peerIdentityKey is used for signature verification. In affected versions, message.identityKey was transport metadata and was not required to equal that verified session identity before callbacks and lastInteractedWithPeer used it. With the Express transport, x-bsv-auth-identity-key is excluded from the signed payload and could therefore be changed without invalidating the signature.
The same trust-boundary flaw also affected authenticated certificate-request processing. Certificate-response processing already had a partial identity check, but downstream use was normalized as part of the remediation.
Remediation
@bsv/sdk 2.7.1 fails closed when an authenticated message lacks a session identity or when the claimed transport identity differs from the nonce-selected session identity. General-message, certificate-request, and certificate-response verification and downstream dispatch now use only the verified session identity.
@bsv/auth-express-middleware 2.2.4 requires @bsv/sdk ^2.7.1, ensuring the middleware cannot claim the fixed release while resolving to an affected SDK.
The remediation does not change the BRC-103 v0.1 wire envelope, payload encoding, nonces, signature derivation, or protocol version. Correctly bound peers remain wire-compatible; only identity-mismatched authenticated messages are rejected.
Validation
Regression tests reproduce the general-message and certificate-request relabelling attacks on unpatched main and pass with the fix. The reviewed candidate passed 5,969 SDK tests, 120 auth-express tests, 6,694 conformance vectors, full build and typecheck, lint, formatting, generated-document checks, clean-consumer package checks, repository-health gates, public main CI, CodeQL, protected npm artifact scanning, provenance attestation, and registry reconciliation.
Credit
Reported by imranterranode.