You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.
sherlock-admin opened this issue
Oct 23, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
DOS blocking users from opening positions on loans
Summary
It is possible to DOS the borrow function to always revert when users call it while passing a targeted holdToken, this is done simply by transferring a small amount of the targeted holdToken directly to the LiquidityBorrowingManager, which will mess up the _getPairBalance function and will return messed up values that violate the actual/expected balance.
Vulnerability Detail
The difference between cache.borrowedAmount and cache.holdTokenBalance in borrow function will always be small for example, if we print the values of cache.borrowedAmount and cache.holdTokenBalance you will notice it is too small.
sherlock-admin
changed the title
Steep Boysenberry Grasshopper - DOS blocking users from opening positions on loans
ali_shehab - DOS blocking users from opening positions on loans
Oct 30, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
ali_shehab
high
DOS blocking users from opening positions on loans
Summary
It is possible to DOS the borrow function to always revert when users call it while passing a targeted holdToken, this is done simply by transferring a small amount of the targeted holdToken directly to the LiquidityBorrowingManager, which will mess up the
_getPairBalance
function and will return messed up values that violate the actual/expected balance.Vulnerability Detail
The difference between
cache.borrowedAmount
andcache.holdTokenBalance
in borrow function will always be small for example, if we print the values ofcache.borrowedAmount
andcache.holdTokenBalance
you will notice it is too small.So if a user send small amount of token to LiquidityBorrowingManager it will cause the
cache.holdTokenBalance
to be greater thancache.borrowedAmount
then linehttps://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/LiquidityBorrowingManager.sol#L492
will always revert when anyone try to call the borrow function.
POC:
you will see that it will always revert.
Impact
DOS blocking users from opening positions on loans
Code Snippet
https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/LiquidityBorrowingManager.sol#L492
https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/abstract/ApproveSwapAndPay.sol#L113-L118
Tool used
Manual Review
Recommendation
use local variables to track balances instead of balance(this)?
Duplicate of #86
The text was updated successfully, but these errors were encountered: