Skip to content
Business logic Audit finding Intermediate

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.

shenwilly Follow

Originally disclosed on Code4rena

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

kenzo (warden) commented:

(Referring all dups here, severity should be upgraded as user funds at risk)

gzeoneth (judge) increased severity to High and commented:

Agree.


The original report as published on Code4rena, by shenwilly. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by shenwilly

View all

12 more disclosed reports, best first.

More from Illuminate contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.