Closed sherlock-admin2 closed 1 year ago
3 comment(s) were left on this issue during the judging contest.
shogoki commented:
Liquidation is intended to work like this
0xyPhilic commented:
invalid because liquidations are supposed to be open for anyone to execute
Kral01 commented:
thats how liquidations work
wangxx2026
high
Hackers can obtain users' lend and collateral assets by helping users liquidate
Summary
If the assets borrowed by the user are much less than the assets of the lend and collateral, the hacker can help the user pay off the loan, thereby obtaining the user's lend and collateral assets. In the end hackers are profitable
Vulnerability Detail
The user calls the liquidate method and needs to repay the debt to continue, as shown in the code below ---->1.
After the debt is repaid, the corresponding proportion of collateralSize and underlyingVaultShare will be transferred to msg.sender. Note that msg.sender here can be anyone, and there is no judgment whether pos.owner is equal to msg.sender, so any user can operate. The code is shown as --->2, 3, 4.
For example, the user's underlyingVaultShare asset is 100$, and the collateralSize is 100$, but the borrowed asset is only 1$. Users can get 200$ by repaying 1$.And this happens all the time because borrowing is always less than collateral
The information on the blockchain is public, and it is not difficult to obtain the user's position.
Impact
Acquire users' assets at a relatively low cost
Code Snippet
https://github.com/sherlock-audit/2023-07-blueberry/blob/7c7e1c4a8f3012d1afd2e598b656010bb9127836/blueberry-core/contracts/BlueBerryBank.sol#L531-L535
https://github.com/sherlock-audit/2023-07-blueberry/blob/7c7e1c4a8f3012d1afd2e598b656010bb9127836/blueberry-core/contracts/BlueBerryBank.sol#L544-L621
Tool used
Manual Review
Recommendation
Add
restriction