Market using stETH
might still be delinquent after repayDeliquentDebt
#319
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
🤖_primary
AI based primary recommendation
🤖_71_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/market/WildcatMarket.sol#L188-L188
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/market/WildcatMarketBase.sol#L541-L542
Vulnerability details
Summary
stETH
is known for having an issue on transfer, causing the recipient to sometimes receive 1-2 wei less than expected.Thus, it is possible that the transfered amount in
repayDeliquentDebt
will not be sufficient to make the market non delinquent as expected by the call.ERC20 Token Behaviors In Scope
set tokens wherebalance changes outside of transfers
asIn scope
, which correspond tostETH
Vulnerability details
repayDeliquentDebt
calculate thedelinquentDebt
as exactly the difference between thetotalAssets()
and theliquidityRequired()
, which define if the market is delinquentThen
amount = delinquentDebt
is transfered from the caller to the market:So, if the market receives 1-2 wei less than exepected, the
liquidityRequired
will still be greater thantotalAssets()
and the market will still be delinquentImpact
Function not working as expected for stETH.
This will cause the market to still accrue delinquency fees, causing a loss for the borrower.
Tools Used
Manual review
Recommended Mitigation Steps
There are multiple ways to solve this :
Assessed type
ERC20
The text was updated successfully, but these errors were encountered: