1 -The burn function in the smart contract exhibits a flaw where it reverts if a user attempts to burn the exact amount of EUROs previously minted.
This leads to a situation where users must acquire additional EUROs beyond their initial minted amount on a DEX to burn the original minted amount.
Based on documentations the amount should be charge to the user when burning and the user should NOT be in charge to calculate himself the exact amount of the burning fees that should be left in his wallet to pay for the fees.
2 - Regarding the minting fee, it is not charged when minting the asset but when burning the minted asset which, leaving the protocol with potential unpaid fees if the vault is liquidated
3 - To redeem their collateral users should make a complicated calculation:
How much extra EUROs they should purchase and hold in their wallet for the burning fee to be charged (as the contract use a safeTransferFrom)
How much EUROs should be burn (counter intuitive as the amount provided to the burn method is different from the amount that will be charge see POC2)
It is in fact the original amount + minting fee to be able to reached minted == 0 checked in the canRemoveCollateral method
How much the user should approve so the effective burn fee can be charge to the user.
The issue is classified as HIGH severity due to its significant impact on users' ability to retrieve their collateral and the potential for fund lockup.
To be able to run the test in this finding follow the following recommendation
Follow the following tutorial to install foundry in your local repo
https://hardhat.org/hardhat-runner/docs/advanced/hardhat-and-foundry
When hardhat-foundry is installed, rename the current test folder to hardhat_test so forge won't look at it.
Create/Update the foundry.toml fil with the current setup, to allow compilation with viaIR
Create a new test folder, with the following file test contract in it, this contract deploy the whole contract stack.
The smartVaultManager is deployed with the proxy.
NFTMetadataGenerator is replaced by a Dummy address to lower the compilation time.
2 helpers are used in all the pocs:
_deployVault: Used to deploy the user Vault and retrieve the vault address
_send: Is used to send ETH
The core of the vulnerability lies in the mint and burn function's handling of fee deductions.
The mint method is adding the fee to the minted variable amount so the user will have to later cover for this fee (while burning).
When a user burns EURO tokens, a fee is calculated and expected to be transferred from the user's account to a protocol address.
However, if a user attempts to burn an amount equal to their entire EURO balance, they fall short of covering the total (amount + fee), resulting in the safeTransferFrom function reverting.
Even if the user should provide the fees in top his initial minted amount to claim a reward he shouldn't be blocked when trying to burn EUROs without any intention to claim his rewards
See the POC bellow
The above PoC demonstrated that after minting 100 EUROs, a user cannot burn this entire amount due to the fee deduction, leading to a situation where the user must acquire additional EUROs in his wallet (more than they initially minted) to cover the burn fee and successfully redeem their collateral. Even if the user is clearly over collateralised. See POC2 for more details
This requirement for extra EUROs to match the fee added to the minted variable and to cover the fee sent to the protocol during burning is counterintuitive and goes against the expected functionality of the contract as demonstrated bellow.
As the contract doesn't provide any helper to calculate the exact amount to send / approve and the extra token amount required to be able to remove the collateral it's likely that most users will have an hard time to be able to remove their collateral.
Additionally the current UI doesn't handle the burning fees
User Fund Lockup:
Users won't be able to burn the amount of EURO that they just minted, instead of just deducting the fee from the minted amount.
Users are unable to redeem their full collateral if they are not able to proceed to complicated exact calculation, leading to a lockup of funds in the contract. This can be particularly problematic in scenarios where obtaining additional EUROs to cover the fee is challenging or costly, as they could pay a premium to acquire EURO on a DEX when they decide to repay the loan
Operational Disruption: This issue disrupts the normal operation of the contract, forcing users to engage in unconventional methods to retrieve their collateral.
Forge Proof of Concept
Manual Code Review: Analysis of the contract code to understand the logic and flow that leads to the vulnerability.
For the mint Function:
Deduct Fee from Minted Amount: The mint function should deduct the minting fee from the amount that is to be minted for the user. This means the actual amount minted for the user is _amount - fee.
Ensure Collateral Backing: The total amount minted (after fee deduction) should be fully backed by the user's collateral. The minted variable should reflect only the net amount minted for the user.
For the burn Function:
Adjust Burn Amount: Modify the burn function to burn only the net amount from the user’s balance, which is _amount - fee. This allows the user to redeem the full collateral without needing additional EUROs.
Handle Fee Appropriately: Instead of transferring the fee to the protocol, adjust the contract's logic to ensure that the fee amount is either:
Deducted from the user's collateral during the redemption process, or
Accumulated within the contract in a way that doesn't affect the collateral backing of the remaining EUROs.
Ensuring Full Collateralization:
Collateralization Integrity: It's critical to ensure that at all times, the total amount of EUROs (both in circulation and as fees) is fully backed by an equivalent amount of collateral. This might involve intricate adjustments in how fees are accounted for within the contract's balance and collateral calculations.
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.