Allowance check always true in ERC5095 redeem
The redeem function in an ERC5095 implementation checked the allowance against a return variable that was zero at that point, so the check always passed. Anyone could redeem tokens on behalf of another user without approval.
Submitted by Lambda, also found by 0x29A, Chom, cryptphi, itsmeSTYJ, kenzo, kirk-baird, and sashiketh_
In redeem, it is checked that the allowance is larger than underlyingAmount, which is the return parameter (i.e., equal to 0 at that point). Therefore, this check is always true and there is no actual allowance check, allowing anyone to redeem for another user.
Recommended Mitigation Steps
Change the underlyingAmount to principalAmount, which is the intended parameter.
sourabhmarathe (Illuminate) disputed and commented:
While we did not actually intend to audit the 5095 implementation, as 5095 itself is not yet final, we did describe its purpose in our codebase in the initial readme, and didn’t specify that it was not in scope. (we wanted wardens to understand its role in our infra)
With that context, we will leave it up to the judges whether or not to accept issues related to the ERC5095 token.
I think it is fair to accept issues related to the ERC5095 token.
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 allowance check used the wrong variable (the return parameter underlyingAmount, which is zero at that point) instead of the intended principalAmount.
Impact
Anyone could redeem tokens on behalf of another user without an allowance, potentially taking their funds.
What the attacker needed
Access to the redeem function; no allowance needed
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 smart contract function that lets someone redeem tokens for another person is supposed to check that the other person has given permission (an allowance). Here the check compared against a value that was always zero, so it never stopped anyone. As a result, anyone could redeem someone else's tokens without their approval.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.