Static MIN_CHANGE threshold and lack of relativ
The contract enforces that any debt or collateral change is either zero or at least a fixed minimum of 1000 wei, with no check relative to the size of the CDP. An attacker could repeatedly make tiny adjustments to leave dust amounts in CDPs, wasting gas and complicating accounting and liquidations.
- Disclosed after under an hour
28862 - [SC - Insight] Static MIN_CHANGE threshold and lack of relativ...
Submitted on Feb 29th 2024 at 04:53:58 UTC by @cheatcode for Boost | eBTC
Report ID: #28862
Report type: Smart Contract
Report severity: Insight
Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Vulnerability Details
The _requireZeroOrMinAdjustment function enforces debt/collateral changes to either be 0 or >= MIN_CHANGE, currently set to 1000 wei.
function _requireZeroOrMinAdjustment(uint256 _change) internal pure {
require(
_change == 0 || _change >= MIN_CHANGE,
"BorrowerOperations: Collateral or debt change must be zero or above min"
);
}
Over time as EBTC loses value relative to ETH, this 1000 wei minimum could become negligible compared to typical CDP sizes. This could allow borrowers to leave tiny "dust" amounts of debt/collateral in their CDPs.
Impact
Tracking and closing out these tiny debt amounts has several disadvantages:
- It wastes gas to perform operations on insignificant debt values
- It creates unnecessary storage updates when dust debt is adjusted
- It clutters the accounting of CDPs and the overall system
- It can make liquidations more difficult when negligible amounts are left in CDPs
Proof of concept
Reference: https://forum.badger.finance/t/ebtc-builder-update-january/6145/1
Additionally, there is 1000 wei units minimum change of debt and a 1000 wei minimum change to collateral on user operations.
Allowing tiny debt amounts could open the door for griefing attacks:
- An attacker repeatedly borrows "dust" amounts from CDPs, forcing the system to track and close out useless micro-debts. This wastes gas.
- Small amounts are left in CDPs about to be liquidated, requiring a more complex liquidation process to handle the dust.
- Attackers could open CDPs with the minimum debt, wasting storage tracking barely used CDPs.
By leaving MIN_CHANGE static, any amount >= 1000 wei is permitted, even if negligible in dollar terms. There is also no check preventing tiny adjustments relative to total CDP amounts.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the minimum change threshold is a fixed absolute value with no check relative to the total CDP size, so negligible dust adjustments remain permitted.
Impact
An attacker could repeatedly make dust-sized debt or collateral changes, wasting gas, cluttering accounting and making liquidations of dust amounts harder; the text does not show a working exploit.
What the attacker needed
Ability to open and adjust a CDP
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A CDP is a vault where a user locks collateral and borrows a stablecoin against it. The code only allows a change to be zero or at least a tiny fixed amount, so someone can make many pointless micro-changes that cost the system effort to track. This is a nuisance rather than a theft.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.