User can claim TempleGold from DaiGoldAuction by depositing in SpiceAuction.
Both SpiceAuction
and DaiGoldAuction
use the same storage i.e AuctionBase
. Whenever, startAuction()
function is called in either SpiceAuction
or DaiGoldAuction
, EpochInfo
is set for _currentEpochId
and it is increased by 1.
The _currentEpochId
is global, thus DaiGoldAuction
can use one and SpiceAuction
can use another incremented epochId
.
Now, after users bid
on the auction and the auction ends
, users can now finally claim the reward
token. In the claim()
function of both DaiGoldAuction
and SpiceAuction
, you can just pass in epochId
and if you have some amount deposited in that epochId
, you can withdraw the rewardToken
as the depositors[msg.sender][epochId
mapping in the claim()
function is global and comes from AuctionBase
.
User had previously deposited 1000e18
ENA into SpiceAuction
and the auction for that deposited epoch is finished but user hasn't claimed TempleGold
yet.
Now, User can just use claim()
function in DaiGoldAuction
for the deposited epoch of SpiceAuction
.
User will be able to claim TempleGold
without depositing DAI
for less price as current price of DAI
is 1$
and ENA
is 0.41
.
Thus, for 410$
, users will be able to claim TempleGold
worth 1000$
if other units are same which causes loss of the funds from other users and for the protocol.
Note: The reward
TempleGold
amount depends on various other units liketotalAuctionTokenAmount
andtotalBidTokenAmount
. A malicious user can wait for perfectSpiceAuction
with highertotalAuctionTokenAmount
and lesstotalBidTokenAmount
to execute this attack for max reward.
Manual Analysis
claim() SpiceAuction
: https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L209
claim() DaiGoldAuction
: https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/DaiGoldAuction.sol#L150
Use different storage for SpiceAuction
and DaiGoldAuction
instead of using the same AuctionBase
.
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.