Lender.mint() May Take The Illuminate PT As Input Which Will Transfer And Mint More Illuminate PT Cause an Infinite Supply
The Lender.mint() function allows the principal token to be the same as the Illuminate PT, so a user can transfer Illuminate PT to the contract and receive an equal amount of newly minted Illuminate PT. This can be repeated indefinitely, inflating the supply and leaving extra tokens in the Lender contract.
Originally disclosed on Code4rena
Submitted by kirk-baird, also found by cccz, kenzo, and unforgiven
Lender.mint() may use p = 0 which will mean principal is the same as principalToken(u, m) i.e. the Illuminate PT. The impact is we will transfer some principal to the Lender contract and it will mint us an equivalent amount of principal tokens.
This can be repeated indefinitely thereby minting infinite tokens. The extra balance will be store in Lender.
This is rated high as although the attacker does not receive the extra tokens stored within the Lender they may be consumed via any contract which has been approved via the approve() functions (e.g. Redeemer).
Proof of Concept
function mint(
uint8 p,
address u,
uint256 m,
uint256 a
) public returns (bool) {
//use market interface to fetch the market for the given market pair
address principal = IMarketPlace(marketPlace).markets(u, m, p);
//use safe transfer lib and ERC interface...
Safe.transferFrom(IERC20(principal), msg.sender, address(this), a);
//use ERC5095 interface...
IERC5095(principalToken(u, m)).mint(msg.sender, a);
emit Mint(p, u, m, a);
return true;
}
Steps:
-
Lender.lend()withp = 0to get some Illuminate principal tokens -
token.approve()givesLenderallowance to spend these tokens -
loop:
Lender.mint()withp = 0minting more principal tokens
Recommended Mitigation Steps
In Lender.mint() ensure p != uint8(MarketPlace.Principals.Illuminate)) .
gzeoneth (judge) decreased severity to Medium and commented:
The 1:1 circular minting will cause a few issues as highlighted in the duplicate that impact the functionality of the protocol, but no direct fund loss.
sourabhmarathe (Illuminate) disagreed with severity and commented:
As noted above, this will not cause major loss of funds. As a result, this should be considered a lower level issue. However, given that it could lead to problems down the line, we should address this issue.
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 function does not prevent the principal token from being the same as the Illuminate principal token, allowing a circular mint.
Impact
The attacker does not directly receive the extra tokens stored in the Lender, but those tokens could be consumed by any contract approved to spend them, such as the Redeemer; the judge noted no direct fund loss.
What the attacker needed
Ability to call Lender.lend() and Lender.mint(); approval to spend Illuminate PT
The fix
The mint function should be changed to reject the case where the principal is the Illuminate principal token.
How it was found
- Call Lender.lend() with p = 0 to obtain Illuminate principal tokens.
- Approve the Lender contract to spend those tokens.
- Repeatedly call Lender.mint() with p = 0 to mint more principal tokens.
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 smart contract lets you deposit a token and get the same token back as a new mint. Because the contract does not check that the token you deposit is different from the token it creates, you can keep doing this to create more and more tokens. The extra tokens pile up in the contract, and other contracts that trust it might later use them.
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.