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

Funds lost if nobody participate in an auction

Summary

Auction tokens are lost, if an auction is created but nobody participates in the auction

Vulnerability Details

AuctionFactory is used to deploy FjordAuction contract

when deploying an FjordAuction contract the msg.sender is set as owner

constructor(
address _fjordPoints,
address _auctionToken,
uint256 _biddingTime,
uint256 _totalTokens
) {
if (_fjordPoints == address(0)) {
revert InvalidFjordPointsAddress();
}
if (_auctionToken == address(0)) {
revert InvalidAuctionTokenAddress();
}
fjordPoints = ERC20Burnable(_fjordPoints);
auctionToken = IERC20(_auctionToken);
>> owner = msg.sender;
auctionEndTime = block.timestamp.add(_biddingTime);
totalTokens = _totalTokens;
}

when the auction time is over anybody can call auctionEnd, but if totalBids = 0 meaning nobody bought any auctionToken then the auctionToken are transferred to the owner

function auctionEnd() external {
if (block.timestamp < auctionEndTime) {
revert AuctionNotYetEnded();
}
if (ended) {
revert AuctionEndAlreadyCalled();
}
ended = true;
emit AuctionEnded(totalBids, totalTokens);
if (totalBids == 0) {
// @audit The factory contract is owner, but it does not have a function to recover the tokens
>> auctionToken.transfer(owner, totalTokens);
return;
}
multiplier = totalTokens.mul(PRECISION_18).div(totalBids);
// Burn the FjordPoints held by the contract
uint256 pointsToBurn = fjordPoints.balanceOf(address(this));
fjordPoints.burn(pointsToBurn);
}

But the issue is in this case, the owner is the AuctionFactory contract and it does not have any way to recover these tokens, which means all tokens are stuck in the AuctionFactory

Impact

Loss of Funds

Recommendations

Add a tokens recovery function in the AuctionFactory contract

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

If no bids are placed during the auction, the `auctionToken` will be permanently locked within the `AuctionFactory`

An auction with 0 bids will get the `totalTokens` stuck inside the contract. Impact: High - Tokens are forever lost Likelihood - Low - Super small chances of happening, but not impossible

Support

FAQs

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