Sushi Trident contest phase 1 - nikitastupin's results

Community-driven DeFi platform

General Information

Platform: Code4rena

Start Date: 16/09/2021

Pot Size: $200,000 SUSHI

Total HM: 26

Participants: 16

Period: 14 days

Judge: alcueca

Total Solo HM: 13

Id: 29

League: ETH

Sushi

Findings Distribution

Researcher Performance

Rank: 15/16

Findings: 1

Award: $115.80

🌟 Selected for report: 1

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: nikitastupin

Also found by: 0xRajeev, 0xsanson, broccoli, t11s

Labels

bug
duplicate
1 (Low Risk)
disagree with severity

Awards

9.2639 SUSHI - $115.80

External Links

Handle

nikitastupin

Vulnerability details

The DOMAIN_SEPARATOR for permit function is defined in constructor https://github.com/sushiswap/trident/blob/9130b10efaf9c653d74dc7a65bde788ec4b354b5/contracts/pool/TridentERC20.sol#L30-L38. As noted in https://eips.ethereum.org/EIPS/eip-2612#security-considerations this may lead to replay attacks in case of a future chain split.

Scenario is as follows:

  1. Suppose at some point a chain split happens. We’re left with two chains. Suppose the first chain has chain ID of 1 and the second chain has chain ID of 2.
  2. The victim has the same private key on both chains.
  3. The victim signs parameters for permit function off-chain for the first chain.
  4. A third-party executes permit function with victim's parameters and signature.
  5. An attacker sees parameters and signature on the blockchain, copies them and executes permit function on the second chain.
  6. The transaction of an attacker succeeds even though chain ID is equal to 1 and the actual chain ID is 2.
  7. Victim’s funds on the second chain are moved in unexpected manner.

Impact

Possible replay attacks on permit function in case of a future chain split

Proof of Concept

I'll write a PoC if needed

As noted in https://eips.ethereum.org/EIPS/eip-2612#security-considerations retrieve DOMAIN_SEPARATOR each time via function DOMAIN_SEPARATOR() external view returns (bytes32).

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter