Custom Pineapple Newt - Lender group members can be prevented from burning their shares forever #24
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Custom Pineapple Newt
High
Lender group members can be prevented from burning their shares forever
Summary
Summary
Adversaries can constantly reset the withdrawal delay of lender group members by performing 0-value
transferFrom
transactions to invoke theafterTokenTransfer
hook.Description
Currently there is a delay on withdrawals to prevent sandwich attacks in lender group contracts. Members must invoke
prepareSharesForBurn
by stating how many shares they want to burn and start an internal countdown. Afterwards, members invokeburnSharesToWithdrawEarnings
which checks whether the delay passed inburn
This countdown is reset every time a member invokes a share transfer through the
_afterTokenTransfer
hook presumably to prevent users preparing shares in advance by transferring it between one another.Adversaries can perform 0-value
transferFrom
transactions which will always pass as there are no 0-value checks in OZ's version 4.8ERC20.sol
used by the protocol. Users will have their countdown constantly reset thus being prevented from withdrawing forever or until a bribe is paid.Root Cause
ERC20.transferFrom
has no 0-value input validationLenderCommitmentGroupShares._afterTokenTransfer
does not perform 0-value input either.Internal pre-conditions
Group members must have invoked
prepareSharesForBurn
External pre-conditions
None
Attack Path
prepareSharesForBurn
starting the countdowntransferFrom(victim, to, 0)
minutes before the cooldown expires_afterTokenTransfer
was triggeredImpact
Lender commit group members will have their funds permanently locked in the contract
PoC
No response
Mitigation
Rewrite the
_afterTokenTransfer
hook to be skipped in case ofamount = 0
The text was updated successfully, but these errors were encountered: