Closed c4-bot-7 closed 3 months ago
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as primary issue
Devoid of numerical examples to support your claim.
hansfriese marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/BridgeRouterFacet.sol#L101-L123
Vulnerability details
Proof of Concept
Take a look at https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/BridgeRouterFacet.sol#L101-L123
This function is used in order to withdraw LST out of the protocol, it inlcudes an important logic of deducting the the withdrwal fee percentage, i.e https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/libraries/LibBridgeRouter.sol#L111-L141
So this function is used to bridge the fees so as to prevent free arbitrage, fee charged is the premium/discount differential, keep in mind that this function is also called whenever BridgeRouterFacet.withdraw() is called, case here however is that it hardcodes the call to always route it via the UniswapOracleLibrary's
estimateTwap()
to get the current price , now iinestimateTwap()
there is a call topool.observe()
, i.e https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/libraries/UniswapOracleLibrary.sol#L54-L60Case is that the call to
pool.observe()
could fail for whatever reason, say lack of enough history and so on and as such cause the whole attempt at withdrawing the LSTs to be broken.Impact
In the worst case this leads to DOS on all attempts of withdrawing the LSTs out of the protocol due to the heavy indirect dependence on the
pool.observe()
Recommended Mitigation Steps
Reconsider the idea of hardcoding the call to
estimateTwap()
viawithdrawalFeePct()
it should instead be done in a try-catch and then if the call toestimateTwap()
fails for whatever reason inwithdrawalFeePct()
then another provider should be used to get the price for thefee
's calculation.Assessed type
Uniswap