Malicious users can DOS the protocol by setting downsideProtected to a large value
The updateDownsideProtected function in CDS.sol lacks access control, allowing anyone to increase the downsideProtected variable to a large value. This causes an underflow in _updateCurrentTotalCdsDepositedAmount, reverting deposit and withdraw functions and freezing user assets.
0x23r0 Follow with 0x37, 0x73696d616f and 45 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/624
Found by
0x23r0, 0x37, 0x73696d616f, 0xAadi, 0xAristos, 0xCNX, 0xNirix, 0xTamayo, 0xloophole, 0xmujahid002, 0xnegan, Abhan1041, Aymen0909, Cybrid, EmreAy24, John44, KungFuPanda, LordAlive, OlaHamid, OrangeSantra, ParthMandale, PeterSR, RampageAudit, Silvermist, akhoronko, aycozyOx, befree3x, dimah7, durov, fat32, futureHack, internetcriminal, itcruiser00, jah, joshuajee, kenzo123, moray5554, newspacexyz, nuthan2x, onthehunt, smbv-1923, super_jack, t.aksoy, theweb3mechanic, vatsal, volodya, wellbyt3, xKeywordx
Summary
In CDS.sol updateDownsideProtected() has no access control so malicious users can set downsideProtected to a large value which will DOS the system.
Root Cause
Because updateDownsideProtected() has no access control malicious users can manipulate the downsideProtected variable which is used in core functions of CDS.sol, causing DOS.
function updateDownsideProtected(uint128 downsideProtectedAmount) external {
downsideProtected += downsideProtectedAmount;
}
function _updateCurrentTotalCdsDepositedAmount() private {
if (downsideProtected > 0) {
totalCdsDepositedAmount -= downsideProtected;
totalCdsDepositedAmountWithOptionFees -= downsideProtected;
downsideProtected = 0;
}
}
https://github.com/sherlock-audit/2024-11-autonomint/blob/main/Blockchain/Blockchian/contracts/Core_logic/CDS.sol#L833-L839
_updateCurrentTotalCdsDepositedAmount() is used in functions like deposit() and withdraw() so a revert here will DOS users from depositing and withdrawing.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
- Malicious user sets downsideProtected to a large value (greater than totalCdsDepositedAmount)
- Users calling deposit() or withdraw() will be DOS'ed because a revert will happen in
_updateCurrentTotalCdsDepositedAmount()due to underflow.
Impact
Users are DOS'ed from interacting with the protocol so those who deposited have their assets frozen in the contract.
PoC
No response
Mitigation
Implement access control to updateDownsideProtected()
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 updateDownsideProtected function lacks any access control, allowing any user to arbitrarily increase the downsideProtected variable.
Impact
Users are prevented from depositing or withdrawing, so their assets are frozen in the contract.
What the attacker needed
None
The fix
Implement access control on the updateDownsideProtected function.
How it was found
- Malicious user sets downsideProtected to a large value (greater than totalCdsDepositedAmount)
- Users calling deposit() or withdraw() will be DOS'ed because a revert will happen in _updateCurrentTotalCdsDepositedAmount() due to underflow.
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 smart contract has a function that anyone can call to change a number. If an attacker sets that number very high, later calculations subtract too much and fail, so users cannot deposit or withdraw their funds.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.