Skip to content
Smart contracts Audit finding Intermediate

Not minting iPTs for lenders in several lend functions

Several lend functions in the Lender contract transfer the lender's funds to external principal token protocols but never mint the corresponding Illuminate principal tokens back to the lender. A lender using these functions would lose their funds without receiving the iPTs they expected.

Metatron Follow

Originally disclosed on Code4rena

Submitted by Metatron, also found by 0x52, auditor0517, cccz, datapunk, hansfriese, hyh, kenzo, kirk-baird, shenwilly, unforgiven, and WatchPug

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L317-L367

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L192-L235

Impact

Using any of the lend function mentioned, will result in loss of funds to the lender - as the funds are transferred from them but no iPTs are sent back to them!

Basically making lending via these external PTs unusable.

Proof of Concept

There is no minting of iPTs to the lender (or at all) in the 2 lend functions below: https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L247-L305

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L317-L367

Corresponding to lending of (respectively): swivel element

Furthermore, in: https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L227-L234 Comment says “Purchase illuminate PTs directly to msg.sender”, but this is not happening. sending yield PTs at best.

Recommended Mitigation Steps

Mint the appropriate amount of iPTs to the lender - like in the rest of the lend functions.

sourabhmarathe (Illuminate) confirmed


The original report as published on Code4rena, by Metatron. 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 lend functions for the swivel and element protocols (and one branch of another) omit the minting call that the other lend functions perform, so no iPTs are issued to the lender.

Impact

A lender using these lend functions loses the transferred funds because no iPTs are returned, making lending through these external PTs unusable.

What the attacker needed

Lender uses an affected lend function

The fix

The lend functions should mint the appropriate amount of iPTs to the lender, as the other lend functions do.

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.

A principal token (PT) is a token representing a deposit that will be repaid later. Here, when someone lends through certain functions, their money is moved out but the matching token that proves they are owed money is never created for them, so they lose the funds.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by Metatron

View all

1 more disclosed report, 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.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.