Ideally, the DAO Executor sets the auctionConfig
and then calls DaiGoldAuction::startAuction()
function, and if needed use DaiGoldAuction::recoverToken()
function to recover the tokens only during the cooldown period. However, an attacker can call DaiGoldAuction::startAuction()
function before auctionConfig
is ever set and continue to start auctions one after the other essentially causing a denial-of-service to the DAO executor as they would never be able to set the config or recover tokens.
As auctionConfig
remains uninitialized after contract deployment until setAuctionConfig
is called and due to the the lack of validation in DaiGoldAuction::startAuction()
to check if auctionConfig
has been set allows for an opening for an attacker to cause a DOS on the system. The attacker is able to start an auction immediately after contract deployment and start another one as soon as one ends.
Also, if the vesting period for TGLD tokens is set at 1/3 years, meaning it takes 3 years for all the tokens to be minted, 10 tokens are minted every second and the minimum mint requirement of 10,000 tokens is satisfied in a matter of only 1000 seconds whereas the AUCTION_DURATION
is set as 1 week, so DaiGoldAuction::startAuction()
would never revert with LowGoldDistributed
error neither would the TempleGold::mint()
fail silently for the attacker.
The DAO executor remains unable to ever set the config and 60% (or according to distributionParams
) of the entire circulating supply of TGLD tokens remain locked up in the contract forever, except for the first auction as it starts even before enough TLGD emissions have been made and _distribute
failed silently. This can cause a multitute of issues for the protocol since there is no way of "migrating" over to another implementation of the DaiGoldAuction
either.
Add the following test to the existing DaiGoldAuction.t.sol
file.
Import the console
package:
Also update the vesting period params in DaiGoldAuction.t.sol::_configureTempleGold
as follows:
Run forge test --mt test_DOSonDaiGoldAuction -vv
Console Output:
[PASS] test_DOSonDaiGoldAuction() (gas: 5313626)
Logs:
Auction Config:
Time Diff = 0
Cooldown = 0
Minimum TGLD = 0Percentage of TGLD stuck = 59%
The best recommended mitigation would be to add a check in DaiGoldAuction::startAuction()
function that ensures auctionConfig
is initialized.
Another way would be to update the DaiGoldAuction::constructor()
to set an initial value for auctionConfig
but that is not recommended.
After making changes, add the following unit test to the suite and run forge test --mt test_MitigationSuccessful -vv
.
Console Output:
[PASS] test_MitigationSuccessful() (gas: 30395)
Logs:
Auction Config:
Time Diff = 0
Cooldown = 0
Minimum TGLD = 0
Manual Review and Foundry for POC
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.