Users can skip the fragmentation fee through the compensate()
action
#322
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
duplicate-10
🤖_40_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-06-size/blob/main/src/libraries/actions/Compensate.sol#L146
Vulnerability details
Explanation && Impact 📌📈
Users can skip the fragmentation fee through the
compensate()
action.The impact is that those fees are needed to keep the bots of the protocol up and running plus the following invariant from the code is broken:
To avoid the framentation fee you have to call
compensate()
with the following inputs:creditPositionWithDebtToRepayId
== Any position where you are borrower and want to fragmentate for freecreditPositionToCompensateId
== RESERVED_IDamount
== whatever amount you want to fragmentate it into, bigger thanminimumCreditBorrowAToken
.This happens because of skipping this if statement. Follow the comments on the code for more details:
Proof Of Concept (PoC) 👨💻💻
Paste the code below it in some test file
(./test/local/actions/*.t.sol)
on the system, import foundry console.log in that file:import "forge-std/console.sol";
. And run:See code 👁️
Recommended Actions 🛠️
Check at the end of execution for the credit amount of all positions created or manipulated along the
compensate
action. If any of them has credit 0 it means that there was no fragmentation, if both have credit > 0, it means there was fragmentation.Something similar to:
Assessed type
Token-Transfer
The text was updated successfully, but these errors were encountered: