Skip to content
Business logic Audit finding Intermediate

Lend or mint after maturity

The protocol allows users to mint principal tokens after maturity, which lets a malicious actor sandwich legitimate redemptions and dilute other users' shares to profit. An attacker could mint tokens post-maturity, redeem them for more underlying than deposited, and reduce the amount legitimate users receive.

HonorLt Follow with kenzo and Holmgren

Originally disclosed on Sherlock

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

Found by

HonorLt, kenzo, Holmgren

Summary

The protocol does not forbid lending or minting after the maturity leaving the possibility to profit from early users.

Vulnerability Detail

Let's take the mint function as an example:

Solidity
    function mint(
        uint8 p,
        address u,
        uint256 m,
        uint256 a
    ) external unpaused(u, m, p) returns (bool) {
        // Fetch the desired principal token
        address principal = IMarketPlace(marketPlace).token(u, m, p);

        // Transfer the users principal tokens to the lender contract
        Safe.transferFrom(IERC20(principal), msg.sender, address(this), a);

        // Mint the tokens received from the user
        IERC5095(principalToken(u, m)).authMint(msg.sender, a);

        emit Mint(p, u, m, a);

        return true;
    }

It is a simple function that accepts the principal token and mints the corresponding ERC5095 tokens in return. There are no restrictions on timing, the user can mint even after the maturity. Malicious actors can take this as an advantage to pump their bags on behalf of legitimate early users.

Scenario:

  1. Legitimate users lend and mint their ERC5095 tokens before maturity.
  2. When the maturity kicks in, lender tokens are redeemed and holdings are updated.
  3. Legitimate users try to redeem their ERC5095 for the underlying tokens. The formula is (amount * holdings[u][m]) / token.totalSupply();
  4. A malicious actor sandwiches legitimate users, and mints the ERC5095 thus increasing the totalSupply and reducing other user shares. Then redeem principals again and burn their own shares for increased rewards.

Example with concrete values:

  1. userA deposits 100 tokens, user B deposits 200 tokens. The total supply minted is 300 ERC5095 tokens.
  2. After the maturity the redemption happens and now let's say holdings[u][m] is 330 (+30).
  3. userA tries to redeem the underlying. The expected amount is: 100 * 330 / 300 = 110.

However, this action is frontrunned by userC (malicious) who mints yet another 500 tokens post-maturity. The total supply becomes 800. The real value userA now receives is: 110 * 330 / 800 = 45.375. 4) After that the malicious actor userC invokes the redemption again, and the holdings[u][m] is now 330 - 45.375 + 550 = 834.625. 5) userC redeems the underlying: 500 * 834.625 / 700 ~= 596.16 (expected was 550). 6) Now all the remaining users will also slightly benefit, e.g. in this case userB redeems what's left: 200 * 238.46 / 200 = 238.46 (expected was 220).

Impact

The amount legitimate users receive will be devaluated, while malicious actor can increase their ROI without meaningfully contributing to the protocol and locking their tokens.

Code Snippet

https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Lender.sol#L264-L288

Tool used

Manual Review

Recommendation

Lend/mint should be forbidden post-maturity.

The original report as published on Sherlock, by HonorLt. 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

Root cause

Likely the mint and lend functions lack a check that the current time is before maturity, allowing token supply to change after redemption calculations begin.

Impact

Legitimate users receive less than expected, while the attacker can increase their return without meaningfully contributing to the protocol.

What the attacker needed

Attacker has principal tokens to mint; minting after maturity is allowed; victim redeems after maturity

The fix

Lend and mint should be forbidden after maturity.

How it was found

  1. Legitimate users lend and mint their ERC5095 tokens before maturity.
  2. When maturity occurs, lender tokens are redeemed and holdings are updated.
  3. A malicious actor mints additional ERC5095 tokens after maturity, increasing total supply.
  4. The malicious actor redeems the underlying tokens, receiving more than they deposited.
  5. Legitimate users then redeem and receive less than expected due to the diluted supply.

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.

After a savings product matures, the rules should stop new deposits so that existing savers get their fair share. Here, the contract still allowed new tokens to be created after maturity, and an attacker could create many tokens just before others withdrew, taking a larger slice of the pool and leaving less for everyone else.

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 HonorLt

View all

13 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.