Users can lock themselves out of being able to convert VETH, becoming stuck with the deprecated asset
A user with zero VETH allowance could call the conversion function, which would set the converted amount to zero and still mark their merkle proof as used, preventing them from ever converting their VETH to VADER. This leaves the user stuck with a deprecated token that is likely worth much less.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
I’ve put this as a medium issue as we’re leaking value as users are stuck with assets which are likely to be worth much less as they are deprecated. It could also be low as it’s not exploitable by outside parties and the loss isn’t taken by the protocol but the user.
Impact
Potential for users to lose the right to convert VETH to VADER, being stuck with a deprecated token.
Proof of Concept
Should a user have a zero allowance of VETH on the converter, no VETH will be taken and no VADER will be paid out as L147 will set the amount to zero.
There is a minVader check on L153 to enforce a minimum output of VADER but should this be improperly set the transaction would succeed with the user receiving much less VADER than they expect.
Crucially, the merkle proof that was used in this transaction will be marked as invalid so the user will not be able to try again once they have set the proper allowance. Someone can then lose the opportunity to convert their VETH and are left with a worthless deprecated token if they are inattentive.
It seems like this is trying to handle the case where a user doesn’t have the full amount of VETH as they are entitled to convert (by setting their allowance equal to their balance?). This is a pretty suboptimal way to go about this as it’s extremely implicit so users are liable to make mistakes.
I’d recommend decoupling the merkle proof from conversion of VETH to VADER:
- Change the merkle proof to set an
amountEligibleToConvertvalue in storage for each user (which would be initially set toamount). - Allow a user to then convert VETH to VADER up to their
amountEligibleToConvertvalue, subtracting the amount converted from this each time.
For gas efficiency we can use a sentinel value here to mark a user which has claimed their full quota already distinctly from someone who hasn’t provided a merkle proof yet (to avoid having to track this separately in another storage slot)
These two steps could be chained in a single transaction to give a similar UX as currently but would also allow users to recover in the case of partial conversions.
Recommended Mitigation Steps
As above. I’d caution against just stating “The frontend will handle this correctly so this isn’t an issue”, there will be users who interact with the contract manually so it’s important to make the interface safe where possible.
0xstormtrooper (Vader) acknowledged
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the conversion function marks the merkle proof as used even when the transferred amount is zero due to a zero allowance, so the user cannot retry.
Impact
Users could lose the right to convert VETH to VADER and be stuck with a deprecated token, though the loss is taken by the user and not exploitable by outside parties.
What the attacker needed
User has zero VETH allowance; user has a valid merkle proof
The fix
The merkle proof should be decoupled from the conversion so that it sets an eligible amount in storage, and users can convert up to that amount over multiple transactions.
How it was found
- User has a zero allowance of VETH on the converter.
- User calls the conversion function with their merkle proof.
- The function sets the amount to zero and marks the proof as invalid.
- User cannot retry the conversion even after setting a proper allowance.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A user had a special proof (like a ticket) that let them swap an old token for a new one. If they tried the swap without first giving the contract permission to take their old tokens, the swap did nothing but still used up their ticket. They could never try again, so they were stuck with the old token.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.