The SmartVaultV3
contract is susceptible to a sandwich attack when tokenManager
contract removing collateral tokens. This can be exploited to mint an excessive amount of EURO tokens and withdraw the de-listed collateral, causing a huge financial damage to the protocol.
The SmartVaultV3
contract interacts with a TokenManager
contract that maintains a list of accepted collateral tokens.which can be added or removed via removeAcceptedToken function.
The vulnerability arises from the fact that the removeAsset function in all smartVaultsV3 checks if the token being withdrawn is an accepted collateral token by calling getTokenIfExists on the TokenManager. If the token is not found, or if it is found but the vault is not undercollateralized after the removal, the withdrawal is allowed to proceed.
An attacker can exploit this by monitoring the mempool for transactions that indicate the removal of a token. They can then front-run this transaction by depositing a large amount of the token to be removed into their vault, minting huge amount of EUROs
against it, and then back-run the transaction to withdraw the token once the removal is executed. This is possible because the token will be already removed .
The lack of real-time collateral status checks during the minting process combined with the ability to withdraw tokens that are no longer accepted as collateral creates a window of opportunity for an attacker to execute a sandwich attack, minting EUROs
with what is effectively non-collateral and then withdrawing the de-listed token, leaving the vault undercollateralized.
another issue is that removing an asset can make even normal vault undercollatirlized.
here a poc that shows how the removing an accepted token can be sanwiched to mint a huge amount of EUROs and then withdraw the collateral used to mint this tokens, i used foundry with a custom setup for the protocol , i didn't use the proxy pattern so i have to set some intial values in the initialize function of smartVaultManager contract :
The attacker obtaining an unwarranted amount of EUROs
without collateral that can badly harm the protocol
vs code
manual review
Implement a preventative measure to restrict user asset withdrawals if their vault becomes undercollateralized.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.