Closed sherlock-admin2 closed 4 months ago
This is a seperate high severity issue
Root cause: yieldFeeBalance
is stored as shares
Impact: yieldFeeBalance
cannot be claimed and the attacker has caused the yieldFeeRecipient to have locked funds.
Potential Fix: store yieldFeeBalance
as tokens
Here are the relevant details of #19 to compare
Root cause: Once the TWAB_SUPPLY_LIMIT
is reached, all liquidation attempts will revert due to the _enforceMintLimit()
in transferTokensOut()
Impact: The attacker has effectively stolen the yield from other users. The attacker has reduced the chances of winning for all other users of that vault.
Potential Fix: do not _enforceMintLimit()
in transferTokensOut()
Escalate
On behalf of @0xspearmint1
Escalate
On behalf of @0xspearmint1
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
Exact same root cause and precondition of TWAB_SUPPLY_LIMIT
being reached. I believe they should remain duplicates.
I agree with the lead judge that this should be considered duplicates having the same root cause as said above by the Lead Judge.
Planning to reject the escalation and leave the issue as it is.
Result: High Duplicate of #19
This is now duplicate of #39, check here why I believe medium severity is more appropriate.
0xSpearmint1
high
yieldFeeBalance
cannot be claimed onceTWAB_SUPPLY_LIMIT
is reachedSummary
yieldFeeBalance
cannot be claimed onceTWAB_SUPPLY_LIMIT
is reachedAnd an attacker can prevent the
yieldFeeRecipient
from claiming theiryieldFeeBalance
Vulnerability Detail
Every vault has a
yieldFeeBalance
that accumulates every time a liquidation occurs.Later the designated
yieldFeeRecipient
can claim theyieldFeeBalance
by callingclaimYieldFeeShares()
The problem is that once the
TWAB_SUPPLY_LIMIT
is reached, calls toclaimYieldFeeShares()
will revertThe function causing the overflow is
TwabLib.increaseBalances
, it is deep in the flow ofclaimYieldFeeShares
claimYieldFeeShares
==>_mint
==>twabController.mint
==> ... ==>_increaseTotalSupplyBalances
==>TwabLib.increaseBalances
The problem is that
accountDetails.balance
is a type uint96, therefore when theTWAB_SUPPLY_LIMIT
is reached, accountDetails.balance = type(uint96).maxTherefore if accountDetails.balance = type(uint96).max AND _amount > 0 then
claimYieldFeeShares()
will revertThis problem will occur naturally when vaults fill up
But also an attacker can take advantage of this in the following steps
yieldFeeBalance
TWAB_SUPPLY_LIMIT
is reachedyieldFeeBalance
that was accumulated can never be claimedImpact
yieldFeeBalance
cannot be claimedAttacker has caused the
yieldFeeRecipient
to have locked funds and essentially lose themCode Snippet
https://github.com/sherlock-audit/2024-05-pooltogether/blob/1aa1b8c028b659585e4c7a6b9b652fb075f86db3/pt-v5-twab-controller/src/libraries/TwabLib.sol#L114
Tool used
Manual Review
Recommendation
Redesign
claimYieldFeeShares
so they can always claim itDuplicate of #39