Skip to content
Business logic Audit finding Intermediate

Extra minting after `yield()` function causes iPT supply inflation and skewed accounting

The lend functions call yield() which swaps PTs for iPTs and sends them to the Lender contract, but then the code mints additional iPTs to the user. This inflates the iPT supply and causes every user to receive less underlying upon redemption.

kenzo Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-10-illuminate-judging/issues/27

Found by

kenzo

Summary

In Swivel and Illuminate's lend functions, yield() is being called, which swaps PTs for iPTs. After that call, additional iPTs are minted and sent to the user. This means that Lender ends up holding extra iPTs which will skew the accounting.

Vulnerability Detail

Described above and below.

Impact

Redemption accounting is off. If iPT supply is inflated and Lender holds iPTs, then upon redemption, every user will get less underlying than deserved. The underlying can still be rescued by Illuminate team if they withdraw the iPT from Lender, redeem it themselves, and distribute it rightfully to all the users. But I think that's probably not something that should happen nor that Illuminate wants to have to do. As this functionality is legit use of the protocol, it means the funds will have to be rescued and distributed manually to all the users every time.

Code Snippet

When a user calls lends for Illuminate principal, the function will call yield() and then mint iPTs to the user.

Solidity
        uint256 returned = yield(u, y, a - a / feenominator, address(this), principal, minimum);
        IERC5095(principalToken(u, m)).authMint(msg.sender, returned);

The same thing happens in swivelLendPremium.

Solidity
        uint256 swapped = yield(u, y, p, address(this), IMarketPlace(marketPlace).token(u, m, 0), slippageTolerance);
        IERC5095(principalToken(u, m)).authMint(msg.sender, swapped);

But yield() function already swaps PTs for iPTs, which end up in Lender itself (3rd parameter above, address(this)) - so there is no need to mint additional ones.

Therefore, Lender has bought iPTs from the pool for the user, and then proceeds to mint additional ones and send them to the user, leaving the swapped ones in Lender's possession. This leads to inflated supply, and as Redeemer redeems user's iPTs as per iPT's total supply, this leads to the discrepancy detailed above.

Tool used

Manual Review

Recommendation

If yield() has bought from the YieldPool iPTs for the user, send them to him, instead of minting extra new ones.

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

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

Impact

Redemption accounting is off, so every user will get less underlying than deserved; the funds could be rescued manually by the Illuminate team.

What the attacker needed

Legitimate use of the protocol

The fix

If yield() has bought iPTs for the user, send those iPTs to the user instead of minting new ones.

How it was found

  1. A user calls the lend function for Illuminate principal.
  2. The function calls yield(), which swaps PTs for iPTs and sends them to the Lender contract.
  3. The function then mints additional iPTs to the user.
  4. The Lender contract retains the swapped iPTs, inflating the total iPT supply.
  5. Upon redemption, the Redeemer distributes underlying based on the inflated iPT supply, so each user receives less than deserved.

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.

When you lend, the protocol first buys some iPT tokens for you from a pool, but those tokens stay in the contract. Then the contract also creates new iPT tokens and gives them to you. This means there are more iPT tokens than there should be, so when everyone redeems, each person gets a smaller share of the underlying asset.

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 kenzo

View all

53 more disclosed reports, best first.

More from Illuminate Round 2

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.