Skip to content
Business logic Audit finding Intermediate

Able to mint any amount of PT

The lend functions in the Illuminate protocol did not validate the addresses of external contracts (Yieldspace pool, Sense AMM, APWine pool) passed as arguments. A malicious user could supply a contract they control that returns an arbitrary value for the amount of principal tokens (PT) gained, causing the protocol to mint more PT than deserved.

dipp Follow

Originally disclosed on Code4rena

Submitted by dipp, also found by 0x1f8b, bardamu, Chom, datapunk, Alex the Entreprenerd, GimelSec, hyh, jah, kenzo, kirk-baird, Kumpa, ladboy233, Metatron, oyc109, shenwilly, simon135, unforgiven, and zer0dot_

Lender.sol#L192-L235

Lender.sol#L486-L534

Lender.sol#L545-L589

Impact

Some of the lend functions do not validate addresses sent as input which could lead to a malicous user being able to mint more PT tokens than they should.

Functions affect:

Proof of Concept

In the Illuminate and Yield lend function:

  1. Let the Yieldspace pool y be a malicious contract that implements the IYield interface.
  2. The base and maturity functions for y may return any value so the conditions on lines 208 and 210 are easily passed.
  3. The caller of lend sends any amount a for the desired underlying u.
  4. If principal token p corresponds to the Yield principal, then the yield function is called which has a return value controlled by the malicious contract y.
  5. The mint function is then called for the principal token with an underlying u and a maturity m which will then mint the returned amount of principal tokens to the malicious user.

In the Sense lend function:

  1. Let the amm x input variable be a malicous contract that implements the ISense interface.
  2. The malicious user sends any amount of underlying to Lender.sol.
  3. Since the amm isn’t validated, the swapUnderlyingForPTs function can return any amount for returned that is used to mint the Illuminate tokens.
  4. The malicious user gains a disproportionate amount of PT.

In the APWine lend function:

  1. Let the APWine pool input variable be a malicous contract that implements the IAPWineRouter interface.
  2. The malicious user sends any amount of underlying to Lender.sol.
  3. The swapExactAmountIn function of the malicious pool contract returns any amount for returned.
  4. The mint function is called for the PT with underlying u and maturity m with the attacker controlled returned amount.

Recommmended Mitigation Steps

Consider validating the input addresses of y, x and pool through a whitelisting procedure if possible or validating that the returned amounts correspond with the amount of PT gained from the protocols by checking the balance before and after the PTs are gained and checking the difference is equal to returned.

sourabhmarathe (Illuminate) confirmed


The original report as published on Code4rena, by dipp. 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 the lack of validation (e.g., whitelisting) on the external contract addresses passed to the lend functions, allowing an attacker to supply a malicious contract that returns an arbitrary value used for minting.

Impact

A malicious user could mint more PT tokens than they should, potentially gaining a disproportionate amount of PT.

What the attacker needed

Attacker can deploy a malicious contract; attacker can call the lend function

The fix

The protocol should validate the input addresses (y, x, pool) through a whitelisting procedure or verify that the returned amounts match the actual PT gained by checking balances before and after.

How it was found

  1. Deploy a malicious contract implementing the IYield interface.
  2. Call the Illuminate and Yield lend function with this malicious contract as the Yieldspace pool.
  3. The malicious contract's base and maturity functions return values that pass the checks.
  4. Send any amount of underlying tokens to the lend function.
  5. The malicious contract's yield function returns an arbitrary amount.
  6. The protocol mints that arbitrary amount of principal tokens to the attacker.

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.

The protocol lets users lend tokens through other services. It trusted whatever address the user gave for that service. An attacker could give their own fake service that lies about how many tokens it returned, so the protocol gave the attacker extra tokens.

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 dipp

View all

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