Open code423n4 opened 2 years ago
The warden has identified a specific scenario in which user funds would not be withdrawable
Because the code uses internal storage for accounting rather than "value" this scenario can happen fairly reliably.
I believe mitigation requires further thought than just withdrawing and ideally it would be best to setup a system similar to Vault Shares so that a withdrawal could be triggered either by available liquidity or via a withdrawal from the pool
I think severity is appropriate
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/USDMPegRecovery.sol#L110-L128
Vulnerability details
Per the doc:
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/USDMPegRecovery.sol#L110-L128
However, because the
withdraw()
function takes funds from the balance of the contract, once the majority of the funds are added to the curve pool viaprovide()
. Thewithdraw()
may often fail due to insufficient funds in the balance.PoC
4M
USDM and4M
pool3 tokens;provide()
and all theusdm
andpool3
tousdm3crv
;withdraw()
, the tx will fail, due to insufficient balance.Recommendation
Consider calling
usdm3crv.remove_liquidity_one_coin()
when the balance is insufficient for the user's withdrawal.