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
User can seize most incentives without participating in activity for protocol.
Summary
Attacker can seize most incentives, when acts as both borrower and lender. When attacker makes lend offer with large amount and borrow it, can seize most incentives.
Root Cause
In the DebitaV3Aggregator.sol:274 function, anyone can invoke this funciton. Also borrower and lender can invoke this function. The vulnerability is there is no check for borrower should not be same as lender.
In case of lender acts borrower with large amount, he can seize the most incentives. However, this is profitable when incentives is larger than fee.
In this case, attacker should pay fee at least: 0.2% * (1 - 15%) = 0.17%. Also it is profitable, when attacker can get more incentives than 0.17% of the large amount of token and he can seize most incentives.
All things attacker should do is to make lend offer with 0 day as _minDuration and make borrow offer with 1 day, and then invoke the DebitaV3Aggregator.matchOffersV3() to match borrow offer and lend offer in one transaction.
Internal pre-conditions
When total incentives is high and it is much greater than 0.17% of attacker's collateral.
External pre-conditions
No response
Attack Path
Assume that total incentives is high and it is much greater than 0.17% of attacker's collateral.
Attacker makes a lend offer with large amount of collateral with 0 day of _minDuration and 100% of LTV.
Makes a borrow offer with certain amount of his collateral lent.
Invoke DebitaV3Aggregator.matchOffersV3() function with borrow offer and lend offer. Step 1,2,3 should be excuted in same transaction.
Claim incentive.
Impact
Malicious user can seize most incentives without participating certainly in activity of protocol and protocol can't distribute correct amount of incentives to users.
PoC
No response
Mitigation
Add restriction which borrower should not be same as lender and _minDuration of lendOffer.
function matchOffersV3(
address[] memory lendOrders,
uint[] memory lendAmountPerOrder,
uint[] memory porcentageOfRatioPerLendOrder,
address borrowOrder,
address[] memory principles,
uint[] memory indexForPrinciple_BorrowOrder,
uint[] memory indexForCollateral_LendOrder,
uint[] memory indexPrinciple_LendOrder
) external nonReentrant returns (address) {
...
for (uint i = 0; i < lendOrders.length; i++) {
...
+ require(borrowInfo.owner != lendInfo.owner, "borrower and lender can't be same")
...
}
...
}
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Original Chili Hare - User can seize most incentives without participating in activity for protocol.
Pablo - User can seize most incentives without participating in activity for protocol.
Dec 12, 2024
Pablo
High
User can seize most incentives without participating in activity for protocol.
Summary
Attacker can seize most incentives, when acts as both borrower and lender. When attacker makes lend offer with large amount and borrow it, can seize most incentives.
Root Cause
In the DebitaV3Aggregator.sol:274 function, anyone can invoke this funciton. Also borrower and lender can invoke this function. The vulnerability is there is no check for borrower should not be same as lender.
In case of lender acts borrower with large amount, he can seize the most incentives. However, this is profitable when incentives is larger than fee.
In this case, attacker should pay fee at least: 0.2% * (1 - 15%) = 0.17%. Also it is profitable, when attacker can get more incentives than 0.17% of the large amount of token and he can seize most incentives.
All things attacker should do is to make lend offer with 0 day as _minDuration and make borrow offer with 1 day, and then invoke the DebitaV3Aggregator.matchOffersV3() to match borrow offer and lend offer in one transaction.
Internal pre-conditions
When total incentives is high and it is much greater than 0.17% of attacker's collateral.
External pre-conditions
No response
Attack Path
Assume that total incentives is high and it is much greater than 0.17% of attacker's collateral.
Impact
Malicious user can seize most incentives without participating certainly in activity of protocol and protocol can't distribute correct amount of incentives to users.
PoC
No response
Mitigation
Add restriction which borrower should not be same as lender and _minDuration of lendOffer.
function matchOffersV3( address[] memory lendOrders, uint[] memory lendAmountPerOrder, uint[] memory porcentageOfRatioPerLendOrder, address borrowOrder, address[] memory principles, uint[] memory indexForPrinciple_BorrowOrder, uint[] memory indexForCollateral_LendOrder, uint[] memory indexPrinciple_LendOrder ) external nonReentrant returns (address) { ... for (uint i = 0; i < lendOrders.length; i++) { ... + require(borrowInfo.owner != lendInfo.owner, "borrower and lender can't be same") ... } ... }
function createLendOrder( bool _perpetual, bool[] memory _oraclesActivated, bool _lonelyLender, uint[] memory _LTVs, uint _apr, uint _maxDuration, uint _minDuration, address[] memory _acceptedCollaterals, address _principle, address[] memory _oracles_Collateral, uint[] memory _ratio, address _oracleID_Principle, uint _startedLendingAmount ) external returns (address) { ... + require(_minDuration > 86400 * 5, "minDuration is too short"); ... }
The text was updated successfully, but these errors were encountered: