maxTotalSupply
can be set to any value, even below the current total supply of the market
#90
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-14
edited-by-warden
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_32_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/market/WildcatMarketConfig.sol#L101-L111
Vulnerability details
Impact
maxTotalSupply
can be set to a value below the current total supply of the marketProof of Concept
The Wildcat protocol stated that the
maxTotalSupply
can not be set to below the total supply of the market in README.md:It is also stated in https://docs.wildcat.finance/using-wildcat/day-to-day-usage/borrowers#altering-capacity:
However, a borrower can set the maximum total supply to any value even below the total supply of the market.
Copy below codes to WildcatMarket.t.sol and run
forge test --match-test test_setMaxTotalSupply_LessThanTotalSupply
:Tools Used
Manual review
Recommended Mitigation Steps
Make sure the new
maxTotalSupply
is no less than the total supply of the market:function setMaxTotalSupply( uint256 _maxTotalSupply ) external onlyBorrower nonReentrant sphereXGuardExternal { MarketState memory state = _getUpdatedState(); if (state.isClosed) revert_CapacityChangeOnClosedMarket(); + if (_maxTotalSupply < state.totalSupply()) revert CapacityLessThanTotalSupply(); hooks.onSetMaxTotalSupply(_maxTotalSupply, state); state.maxTotalSupply = _maxTotalSupply.toUint128(); _writeState(state); emit_MaxTotalSupplyUpdated(_maxTotalSupply); }
Assessed type
Other
The text was updated successfully, but these errors were encountered: