Anatomy of a Bridge That Paid 6x for One Transfer
A technical case study of a cross-chain bridge replay vulnerability caused by mutable claim fields, with an analysis of its root cause and mitigation.
A private disclosure is currently being prepared, withholding both the protocol and chain details. Bridges are essentially accounting systems with a public attack surface - each message from the other chain is treated as a bag of fields. The key to preventing multiple payments lies in a replay guard. However, a bug was discovered in a counterstake-style bridge that allowed one foreign transfer to be claimed multiple times, resulting in the bridge paying out six times the actual transfer amount.
The bridge operates on the principle of locking value on one chain and paying out against a foreign transaction on another. Users lock tokens on chain A, receive a transaction ID, and submit a claim on chain B containing sender address, transaction ID, timestamp, amount, recipient, optional data, and reward. The claim is recorded with a challenger window, and if no disputes arise, the claimant withdraws their amount plus stake.
The guard mechanism checks for a unique marker stored under a key derived from the claim. However, four out of the seven inputs to this hash are under the attacker's control, making the guard unreliable. The uniqueness key includes fields that the claimant has control over, such as timestamp, recipient, reward, and arbitrary payload.
The security model of the payout path is to ensure that the same foreign transfer is claimable exactly once. However, the bug allowed the same transfer to be claimed multiple times, each time resulting in a payout of 800,000,000 tokens. This meant that for a single transfer of 400,000,000 tokens, the bridge paid out 2,400,000,000 tokens, resulting in a loss of 2,000,000,000 tokens from the pool.
The exploit was demonstrated in a controlled environment using the bridge's own code, requiring no fork or RPC connection. By changing one optional field (timestamp) in the claim, a new unique marker was generated, allowing multiple claims for the same transfer. Each claim paid out 800,000,000 tokens, resulting in a total payout of 2,400,000,000 tokens for one transfer. This direct theft of user funds exceeded the impact of a single legitimate claim, making it a significant security concern.
Rewritten by urgent.news; may contain errors โ check the original.
Source: hackernoon.com
Read the original at hackernoon.com โ
More from HackerNoon on urgent.news
Report a problem with this story
Get the day's news by email. Daily, weekly or monthly. Sign up