The DaiGoldAuction.sol
contract is vulnerable to an exploit involving flash mintable tokens, specifically DAI. An attacker can mint a large amount of DAI within a single transaction, place a last-second bid in the auction, win a disproportionate amount of Temple Gold (TGLD) tokens, and then use these tokens in a parallel SpiceAuction
to obtain valuable volatile tokens. These tokens can then be sold on a DEX to repay the flash mint and keep the profits, effectively draining the protocol's valuable assets.
The DaiGoldAuction.sol
contract allows users to bid using DAI in exchange for Temple Gold (TGLD) tokens. The contract is vulnerable to an exploit using flash mintable tokens like DAI due to the following factors:
Flash Minting Capability: Since DAI is a flash mintable token, an attacker can mint large amounts of DAI within a single transaction without requiring collateral, as long as it is repaid within the same transaction.
Lack of Bid Timing Restrictions: The contract allows bids to be placed at the last second, giving an attacker the opportunity to exploit this timing.
Auction Structure: The contract allows users to place large bids at the last moment, ensuring they can win a significant amount of TGLD tokens by outbidding others.
Since DAI is a flash mintable token, it does not require collateral to be minted in large amounts as long as it is repaid within 1 transaction. According to the weird ERC20 GitHub page, an attacker can execute the following steps to exploit the vulnerability:
Flash Mint DAI:
* The attacker mints a large amount of DAI without providing collateral, as long as it is repaid within the same
transaction.
Monitor Auction Timing:
* The attacker monitors the auction's end time using the internal epochs mapping:
No matter that this is internal, everything on the blockchain can be seen, so the attacker can determine the exact
end time of the auction.
Place Last-Second Bid:
* The attacker places a large bid just before the auction ends, using the flash-minted DAI to ensure they win a
significant amount of TGLD tokens.
Claim TGLD:
* After the auction ends, the attacker claims the TGLD tokens they won.
Parallel SpiceAuction:
* It is possible for a SpiceAuction
to end around the same time as a DAI auction. The attacker can use the acquired
TGLD tokens to bid in a SpiceAuction
for valuable volatile tokens just before it ends. By winning the auction, the
attacker obtains the volatile tokens.
Sell and Repay:
* The attacker sells the acquired volatile tokens on a DEX, converts them back to DAI, repays the flash mint, and keeps
the remaining profit.
The primary impact of this vulnerability is that it allows attackers to manipulate the auction system to gain a disproportionate share of Temple Gold (TGLD) tokens and subsequently valuable volatile tokens, without providing any real value to the protocol. This exploitation undermines the fairness and integrity of the auction process and can significantly distort the intended distribution of TGLD and other auctioned assets. Such an exploit can lead to:
Market Manipulation: By acquiring a large amount of TGLD at minimal cost, attackers can manipulate the secondary market prices of volatile tokens obtained through the SpiceAuction, potentially leading to significant price volatility.
Loss of Trust: The perceived fairness and security of the TempleDAO auction system could be severely compromised, leading to a loss of trust among participants and potential investors.
Economic Disparity: Legitimate users who participate in the auctions in good faith might be unfairly deprived of their share of TGLD and volatile tokens, leading to economic disparity within the ecosystem.
Treasury Impact: Although the treasury itself isn't directly drained, the overall value and distribution efficiency of the treasury-backed tokens can be compromised, affecting the protocol's long-term economic sustainability.
Manual Review
VS code
Restrict Bid Timing:
Implement a bidding window that closes a few minutes before the auction end to prevent last-second bids.
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.