USDMPegRecovery
does not account for fees
#172
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/USDMPegRecovery.sol#L90-L108
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/USDMPegRecovery.sol#L110-L128
Vulnerability details
Curve.fi pools charge fees when adding or removing liquidity. The only time fees are not applied are when withdrawals are done using
remove_liquidity()
.USDMPegRecovery
keeps track of tokens deposited and withdrawn, but does not keep track of fees assessed on these operations. The pool in use by this token assesses a 0.040% fee as well as a 50.000% of 0.040% admin fee.Impact
A whale, or a user/miner using same-block cross-transaction flashloans, can repeatedly deposit and withdraw a large number of tokens, which causes large dollar-value fees to be assessed by the pool, but the number of tokens the user gets is unaffected. The attacker can do this repeatedly to drain all contract funds.
Proof of Concept
These are two separate instances of the issue, as the attacker only needs to exploit one of the functions, then wait for the guardian to call
add_liquidity()
orremove_liquidity()
. The exploits can be applied separately to each of the two tokens.https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/USDMPegRecovery.sol#L90-L108
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/USDMPegRecovery.sol#L110-L128
Tools Used
Code inspection
Recommended Mitigation Steps
Keep track of fees and reduce deposits/withdrawals accordingly
The text was updated successfully, but these errors were encountered: