All vulnerabilities
CRITICALWeb3exploited in the wild

WEB3-ANYSWAP-2021

Web3 · Multichain · Anyswap (Multichain) Router V3

Summary

On 10 July 2021 Anyswap's Multichain Router V3 lost about $7.9 million (2,398,496 USDC and 5,509,223 MIM) across Ethereum, BNB Chain and Fantom liquidity pools. The router was controlled by an MPC signing account whose ECDSA signatures must use a fresh random nonce k per signature. A patched MPC node build reloaded previously used r values from the database into memory and failed to delete them after signing, so two V3 router transactions on BNB Chain were signed with the identical r value. Because the same r implies the same nonce k, the attacker solved the two signatures' linear equations for the secret nonce, back-derived the MPC account's private key, then used it to drain V3-approved liquidity. This is ECDSA signing-nonce reuse leading to private-key extraction.

How to avoid it in your code

  • Use a fresh CSPRNG nonce per ECDSA signature, or deterministic RFC 6979 k; never reuse or persist-and-reload a nonce
  • Reject and alert on any reused ECDSA r value at the signer; treat duplicate r as a key-compromise event
  • Prefer audited threshold-signature/MPC libraries over custom nonce management; review them after every patch
  • Cap and timelock funds reachable by a single hot signing key so nonce reuse cannot drain full liquidity instantly

References

Related vulnerabilities

All Web3 →