Closed sherlock-admin4 closed 4 months ago
1 comment(s) were left on this issue during the judging contest.
infect3d commented:
lossy behavior for the attacker and no harm to the protocol
Invalid, sponsor comments:
- invalid, the "attacker" in this scenario is just donating any assets that would have been profit to the prize vault instead at their own expense
- the yieldFeeBalance is still increasing with the expected amount based on the liquidtion value
- the
_withdraw
function does nothing in this case because it does not need to do anything; the funds are already where they need to be for the correct end result
Rhaydden
medium
liquidationPair
is able to add any number of_yieldFee
Summary
The
PrizeVault
has ann issue where theliquidationPair
can artificially inflate theyieldFeeBalance
which can result in loss of funds.Vulnerability Detail
First of all, let's take a look at this function:
The
_withdraw
function has two conditions that determine whether it performs any actions:_assets > _latentAssets
, it redeems shares from the yieldVault. If_receiver != address(this)
, it transfers _assets to _receiver.If neither condition is met, the function does nothing.
The
transferTokensOut
function makes a call to the_withdraw
function above:Now,
_receiver
can be specified as any value. If_receiver
is specified asaddress(this)
:The second
if
in the_withdraw
function does not satisfy the condition, receiver == address(this) i.e (When callingtransferTokensOut
; specifyingtokenOut = address(_asset)
, the_withdraw
function will be called) The attacker can transfer a certain amount of_asset
toaddress(this)
, and the value of_latentAssets
in the_withdraw
function can be controlled by the attacker.The attacker passes
_assets
with a value less than_latentAssets
: The secondif
in the_withdraw
function does not satisfy the condition, _assets <= _latentAssets.When
_withdraw
does nothing, callingtransferTokensOut
simply increases the value of the yieldFeeBalance:This allows an attacker to repeatedly call
transferTokensOut
and increase theyieldFeeBalance
Impact
liquidationPair
adds any amount of yield fees, resulting in the loss of funds.Code Snippet
https://github.com/sherlock-audit/2024-05-pooltogether/blob/main/pt-v5-vault/src/PrizeVault.sol#L1054-L1067
https://github.com/sherlock-audit/2024-05-pooltogether/blob/main/pt-v5-vault/src/PrizeVault.sol#L714-L758
Tool used
Manual Review
Recommendation
Modify the
transferTokensout
like this: