DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Loss of all tokens due to attack on address collision using create2

Summary

CREATE2 address collision against an Account will allow complete draining of auction tokens

Vulnerability Details

function createAuction(
address auctionToken,
uint256 biddingTime,
uint256 totalTokens,
bytes32 salt
) external onlyOwner {
address auctionAddress = address(
new FjordAuction{ salt: salt }(fjordPoints, auctionToken, biddingTime, totalTokens)
);
// Transfer the auction tokens from the msg.sender to the new auction contract
IERC20(auctionToken).transferFrom(msg.sender, auctionAddress, totalTokens);
emit AuctionCreated(auctionAddress);
}

The attack consists of two parts: Finding a collision, and actually draining the auction tokens. address auctionToken,
uint256 biddingTime,
uint256 totalTokens,
bytes32 salt can all be generated.

The address collision an attacker will need to find are:

  • One undeployed auction account address (1).

  • Arbitrary attacker-controlled wallet contract (2).

Both sets of addresses can be brute-force searched because:

  • The salt is a user-supplied parameter. By brute-forcing many salt values, we can obtain many different (undeployed) wallet accounts for (1).

  • (2) can be searched the same way. The contract just has to be deployed using CREATE2, and the salt is in the attacker's control by definition.

An attacker can find any single address collision between (1) and (2) with high probability of success using the following meet-in-the-middle technique, a classic brute-force-based attack in cryptography:

  • Brute-force a sufficient number of values of salt (2^80), pre-compute the resulting account addresses, and efficiently store them e.g. in a Bloom filter data structure.

  • Brute-force contract pre-computation to find a collision with any address within the stored set in step 1.

The feasibility, as well as detailed technique and hardware requirements of finding a collision, are sufficiently described in multiple references:
1: A past issue on Sherlock describing this attack.

inspiration: https://github.com/sherlock-audit/2023-12-arcadia-judging/issues/59

Impact

Loss of all tokens

Tools Used

Manual review

Recommendations

  • Don't allow the user to control the salt used.

  • Consider also adding and encoding block.timestamp and block.number combined with the user's salt.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.