Open code423n4 opened 2 years ago
dmvt marked the issue as duplicate of #140
dmvt marked the issue as not a duplicate
dmvt marked the issue as duplicate of #141
dmvt marked the issue as selected for report
vince0656 marked the issue as sponsor confirmed
dmvt marked the issue as satisfactory
dmvt marked the issue as not a duplicate
dmvt marked the issue as primary issue
Lines of code
https://github.com/code-423n4/2022-11-stakehouse/blob/main/contracts/liquid-staking/GiantMevAndFeesPool.sol#L126-L138 https://github.com/code-423n4/2022-11-stakehouse/blob/main/contracts/liquid-staking/GiantMevAndFeesPool.sol#L176-L178
Vulnerability details
Impact
The contract GiantMevAndFeesPool override the function totalRewardsReceived:
The function totalRewardsReceived is used as the current rewards balance to caculate the unprocessed rewards in the function
SyndicateRewardsProcessor._updateAccumulatedETHPerLP
The idleETH will be decreased in the function
batchDepositETHForStaking
for sending eth to the staking pool. But the idleETH wont be increased in the functionbringUnusedETHBackIntoGiantPool
which is used to burn lp tokens in the staking pool, and the staking pool will send the eth back to the giant pool. And then because of the diminution of the idleETH, theaccumulatedETHPerLPShare
is added out of thin air. So the attacker can steal more eth from the GiantMevAndFeesPool.Proof of Concept
test: test/foundry/TakeFromGiantPools.t.sol
run test:
test log:
The attacker stole 2 eth from the pool.
Tools Used
fodunry
Recommended Mitigation Steps
Add
before burnLPTokensForETH in the GiantMevAndFeesPool.bringUnusedETHBackIntoGiantPool function.