Rewards of GiantMevAndFeesPool can be locked for all users
The GiantMevAndFeesPool contract's reward accounting can be manipulated by any user because the inherited ERC20 transfer function is not protected and triggers hooks that update reward state. An attacker could lock all rewards in the pool, making them inaccessible to other users.
Originally disclosed on Code4rena
Submitted by clems4ever
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantMevAndFeesPool.sol#L172 https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantLP.sol#L8
Any malicious user could make the rewards in GiantMevAndFeesPool inaccessible to all other users…
Proof of Concept
https://gist.github.com/clems4ever/9b05391cc2192c1b6e8178faa38dfe41
Copy the file in the test suite and run the test.
Tools Used
forge test
Recommended Mitigation Steps
Protect the inherited functions of the ERC20 tokens (GiantLP and LPToken) because transfer is not protected and can trigger the before and after hooks. There is the same issue with LPToken and StakingFundsVault.
vince0656 (Stakehouse) confirmed
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the ERC20 transfer function inherited by GiantLP is not protected and triggers before/after hooks that update reward state, allowing manipulation.
What the attacker needed
None
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a smart contract bug in a staking pool. The pool tracks rewards using a token, and that token's transfer function can be called by anyone to trigger internal updates that corrupt the reward accounting. As a result, a malicious user can make the rewards unclaimable for everyone.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.