Skip to content

Fix three critical security vulnerabilities in bridge, dispute, and oracle attestation#1040

Open
Mayne-X wants to merge 1 commit into
tellor-io:mainfrom
Mayne-X:main
Open

Fix three critical security vulnerabilities in bridge, dispute, and oracle attestation#1040
Mayne-X wants to merge 1 commit into
tellor-io:mainfrom
Mayne-X:main

Conversation

@Mayne-X

@Mayne-X Mayne-X commented Jun 14, 2026

Copy link
Copy Markdown

Fix 1: SHA256 → Keccak256 hash mismatch in bridge signing (app/extend_vote.go, x/bridge/keeper/keeper.go)
The initial message signing (SignInitialMessage) and EVM address recovery (EVMAddressFromSignatures) used SHA256 for the inner message hash. Changed to crypto.Keccak256 to align with Ethereum conventions and the bridge contract's _verifySig scheme, which uses sha256(abi.encodePacked(keccak256(data))). The signed content is now SHA256(Keccak256(message)) on both the Cosmos signing side and the bridge verification side, ensuring cross-chain signature compatibility.

Fix 2: PrevDisputeIds appends wrong ID — vote double-counting (x/dispute/keeper/dispute.go:283)
AddDisputeRound appended disputeId (the new round's ID) to PrevDisputeIds instead of prevDisputeId (the previous round's ID). This caused GetSumOfUserAndReporterVotesAllRounds to double-count votes from the current round — once from direct VoteCountsByGroup lookup and again from PrevDisputeIds iteration, inflating vote power and corrupting dispute outcomes.

Fix 3: Missing signature verification in SetOracleAttestation (x/bridge/keeper/keeper.go:812-853)
SetOracleAttestation stored attestation signatures from vote extensions without verifying they were actually produced by the claimed validator's key. Added ECDSA recovery verification: computes SHA256(snapshot) (the effective signed hash after keyring auto-hash), tries both recovery IDs via crypto.SigToPub, and compares the recovered EVM address against the validator's registered address. Fake attestations are now rejected with an error instead of being blindly stored.

1. SHA256→Keccak256 in initial message signing (C-1)
   - Changed SignInitialMessage and EVMAddressFromSignatures to use
     Keccak256 for the inner hash, matching the bridge contract's
     SHA256(Keccak256(...)) signature scheme

2. PrevDisputeIds append wrong ID (C-4)
   - Append prevDisputeId instead of disputeId to prevent
     double-counting votes in dispute tally rounds

3. Missing signature verification in SetOracleAttestation (C-5)
   - Added ECDSA recover verification to ensure attestation
     signatures match the validator's registered EVM address
     before storing
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.

1 participant