Incorrect implementation of APWine and Tempus redeem
The redeem function for APWine and Tempus PT incorrectly transfers the underlying token instead of the principal token, causing redemption to always fail and leaving iPT unredeemable for the underlying token.
Submitted by shenwilly, also found by cccz, Chom, datapunk, kenzo, Picodes, and unforgiven
Redeeming APWine and Tempus PT will always fail, causing a portion of iPT to not be able to be redeemed for the underlying token.
The issue is caused by the incorrect implementation of redeem:
uint256 amount = IERC20(principal).balanceOf(lender);
Safe.transferFrom(IERC20(u), lender, address(this), amount);
The first line correctly calculates the balance of PT token available in Lender. However, the second line tries to transfer the underlying token u instead of principal from Lender to Redeemer. Therefore, the redeeming process will always fail as both APWine.withdraw and ITempus.redeemToBacking will try to redeem non-existent PT.
Recommended Mitigation Steps
Fix the transfer line:
Safe.transferFrom(IERC20(principal), lender, address(this), amount);
sourabhmarathe (Illuminate) confirmed
(Referring all dups here, severity should be upgraded as user funds at risk)
gzeoneth (judge) increased severity to High and commented:
Agree.
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 a coding error where the transferFrom call uses the underlying token address instead of the principal token address.
Impact
Users cannot redeem their iPT for the underlying token, and their funds are at risk.
What the attacker needed
None
The fix
The transfer line should be fixed to transfer the principal token instead of the underlying token.
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.
In a smart contract, a function that lets users redeem a token mistakenly moves the wrong token type. This means the redemption always fails, so users cannot get back the token they were supposed to receive.
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.