Unbounded AMMs can cause DOS #41
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
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-02-hubble/blob/8c157f519bc32e552f8cc832ecc75dc381faa91e/contracts/ClearingHouse.sol#L122
Vulnerability details
Impact
The
ClearingHouse.updatePositions
function iterates over allamms
.There is no limit to the number of AMMs that can be added in
ClearingHouse.whitelistAmm
.The transactions can fail if the arrays get too big and the transaction would consume more gas than the block limit.
This will then result in a denial of service for the desired functionality and break core functionality.
It also leads to a higher gas cost.
Recommended Mitigation Steps
It would be best to set a sanity maximum number of AMMs/ that can be added.
The text was updated successfully, but these errors were encountered: