Skip to content
Business logic Audit finding Intermediate

Protocol fees not taken on premium

The Swivel version of the lend function allows users to use extra underlying premium to buy more iPTs without paying a protocol fee on that premium. Attackers could exploit this to avoid fees by using the Swivel version instead of the Illuminate version.

IllIllI Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-01-illuminate-judging/issues/22

Found by

IllIllI

Summary

Protocol fees not taken on premium

Vulnerability Detail

The Swivel version of lend() allows the user to use any extra underlying premium from their Swivel orders, to buy more iPTs via a swap or minting directly, but no fee is taken from this premium.

Impact

Rather than using the Illuminate version of lend(), which charges a fee, users could use the Swivel version, and ensure the fee portion is small, and the premium non-fee portion is large, so that Illuminate misses out on fees.

Code Snippet

The fee is calculated based on the amount listed in the orders:

Solidity
// File: src/Lender.sol : Lender.lend()   #1

488            // Lent represents the total amount of underlying to be lent
489 @>         uint256 lent = swivelAmount(a);
490    
491            // Get the underlying balance prior to calling initiate
492            uint256 starting = IERC20(u).balanceOf(address(this));
493    
494            // Transfer underlying token from user to Illuminate
495            Safe.transferFrom(IERC20(u), msg.sender, address(this), lent);
496    
497            // Calculate fee for the total amount to be lent
498:@>         uint256 fee = lent / feenominator;

https://github.com/sherlock-audit/2023-01-illuminate/blob/main/src/Lender.sol#L488-L498

But the premium is the balance change after the orders have executed (can be thought of as positive slippage):

Solidity
// File: src/Lender.sol : Lender.lend()   #2
525                // Calculate the premium
526 @>             uint256 premium = (IERC20(u).balanceOf(address(this)) - starting) -
527:                   fee;

https://github.com/sherlock-audit/2023-01-illuminate/blob/main/src/Lender.sol#L525-L527

And no fee is charged on this premium, either when swapping in the yield pool, or when minting iPTs directly.

Tool used

Manual Review

Recommendation

Calculate the fee after the order, on the full balance change

This is similar to a finding from the previous contest, but the mitigation was to remove the amount fee from the premium, but didn't address the fee for the premium itself

The original report as published on Sherlock, by IllIllI. 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 fee is calculated only on the initial lent amount, not on the premium (balance increase) after orders execute.

Impact

Users could avoid paying fees on the premium portion, causing the protocol to miss out on fee revenue.

What the attacker needed

Access to Swivel version of lend()

The fix

Calculate the fee after the order, on the full balance change.

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.

This is a smart contract bug where a function that lends money does not charge a fee on extra money (premium) that users get. Users can use a different function that skips the fee, so the protocol loses out on fees it should collect.

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 IllIllI

View all

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