Skip to content

Bind spork signatures to network#13

Open
NateIsern wants to merge 1 commit into
mainfrom
codex/fix-cross-network-replay-vulnerability
Open

Bind spork signatures to network#13
NateIsern wants to merge 1 commit into
mainfrom
codex/fix-cross-network-replay-vulnerability

Conversation

@NateIsern

Copy link
Copy Markdown
Member

Motivation

  • A cross-network replay/authentication flaw was possible because spork signatures only covered nSporkID, nValue, and nTimeSigned while mainnet and testnet shared the same SporkKey.
  • Signatures were not bound to any chain-specific context such as the network ID, MessageStart bytes, or genesis hash, so a signed spork for one network could verify on another.
  • A minimal change is required to add domain separation to spork signatures and prevent cross-network replay while keeping the signing/verification flow intact.

Description

  • Add a helper GetSporkSignatureMessage(const CSporkMessage&) that composes a domain-separated signing string including Params().NetworkIDString(), Params().MessageStart() (hex), Params().HashGenesisBlock(), and the delimited spork fields.
  • Update CSporkManager::CheckSignature and CSporkManager::Sign to use GetSporkSignatureMessage so both signing and verification operate on the same network-bound payload.
  • Preserve the existing calls to the compact-signature helpers (obfuscationSigner.SignMessage / VerifyMessage) so the change is limited to the signed message construction.

Testing

  • Ran git diff --check which completed successfully with no issues.
  • Attempted to run ./autogen.sh but the command failed in this environment due to a missing aclocal, so a full autotools build/test could not be executed here.

Codex Task

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant