Users can mint free Illuminate PTs if underlying decimals don't match external PTs
The Illuminate PT minting function does not adjust for decimal differences between external principal tokens and the underlying asset, so users can mint Illuminate PTs at a 1:1 ratio regardless of decimals. An attacker could mint large amounts of Illuminate PTs using external PTs with fewer decimals, inflating away the value of existing Illuminate PTs.
Source: https://github.com/sherlock-audit/2022-10-illuminate-judging/issues/120
Found by
IllIllI
Summary
Users can mint free Illuminate PTs if underlying decimals don't match external PTs
Vulnerability Detail
The Illuminate PTs always match the decimals of the underlying, but when external PTs are used for minting Illuminate PTs, the amount minted is not adjusted for the differences in decimals.
Impact
Users can inflate away the value of Illuminate PTs by minting using external PTs with different decimals than the underlying
Code Snippet
There are no conversions based on decimals - one input external PT results in one Illuminate PT:
// File: src/Lender.sol : Lender.mint() #1
270 function mint(
271 uint8 p,
272 address u,
273 uint256 m,
274 uint256 a
275 ) external unpaused(u, m, p) returns (bool) {
276 // Fetch the desired principal token
277 address principal = IMarketPlace(marketPlace).token(u, m, p);
278
279 // Transfer the users principal tokens to the lender contract
280 Safe.transferFrom(IERC20(principal), msg.sender, address(this), a);
281
282 // Mint the tokens received from the user
283 IERC5095(principalToken(u, m)).authMint(msg.sender, a);
284
285 emit Mint(p, u, m, a);
286
287 return true;
288: }
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Lender.sol#L270-L288
For example, Swivel tokens are all locked at 18 decimals, Pendle uses the decimals of the yield token (e.g. cDai) rather than the decimals of the underlying, and (Notional)[https://github.com/notional-finance/wrapped-fcash/blob/ad5c145d9988eeee6e36cf93cc3412449e4e7eba/contracts/wfCashBase.sol#L103] locks the decimals to 8.
Tool used
Manual Review
Recommendation
Convert the decimals of the PT to those of the underlying, and adjust the number of Illuminate PTs minted based on that conversion
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
The mint function does not convert the decimals of the external principal token to match the underlying asset's decimals before minting Illuminate PTs.
What the attacker needed
External PT with different decimals than underlying; ability to call mint function
The fix
The decimals of the external PT should be converted to those of the underlying, and the number of Illuminate PTs minted should be adjusted accordingly.
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 deposit a token to get a receipt token, the system should account for the fact that different tokens can have different numbers of decimal places. Here, the code gives you one receipt token for each token you deposit, without checking decimals. So if you deposit a token with fewer decimals, you get more receipt tokens than you should, which makes everyone else's receipt tokens worth less.
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.