Skip to content
Business logic Audit finding Intermediate

Illuminate's PT doesn't respect users' slippage specifications for underlyings

The ERC5095 contract's withdraw and redeem functions add an extra 1% slippage tolerance on top of the user's specified limit, so users may receive less underlying than they requested. This could cause users to lose part of their principal if they used an external principal token to mint the Illuminate PT.

IllIllI Follow

Originally disclosed on Sherlock

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

Found by

IllIllI

Summary

Illuminate's PT doesn't respect users' slippage specifications for underlyings, and allows more slippage than is requested

Vulnerability Detail

ERC5095.withdraw()/redeem()'s code adds extra underlying slippage on top of what the user requests

Impact

At the end of withdrawal/redemption, the user will end up receiving less underlying than they asked for, due to slippage. If the user had used a external PT to mint the Illuminate PT, they will have lost part of their principal.

Code Snippet

Solidity
// File: src/tokens/ERC5095.sol : ERC5095.withdraw()   #1

271                    uint128 returned = IMarketPlace(marketplace).sellPrincipalToken(
272                        underlying,
273                        maturity,
274                        shares,
275 @>                     Cast.u128(a - (a / 100))
276:                   );

https://github.com/sherlock-audit/2023-01-illuminate/blob/main/src/tokens/ERC5095.sol#L271-L276

Solidity
// File: src/tokens/ERC5095.sol : ERC5095.withdraw()   #2

302                    uint128 returned = IMarketPlace(marketplace).sellPrincipalToken(
303                        underlying,
304                        maturity,
305                        Cast.u128(shares),
306 @>                     Cast.u128(a - (a / 100))
307:                   );

https://github.com/sherlock-audit/2023-01-illuminate/blob/main/src/tokens/ERC5095.sol#L302-L307

redeem() has the same issue

Tool used

Manual Review

Recommendation

This is the same issue that I described in the last contest. In the original issue, the finding was disputed because there wasn't a clean solution for slippage protection on the number of shares burned in order to satisfy the input underlying amount. During the discussion of the issue, it became clear that the ERC5095 contract was supposed to be cross-compatable with the ERC4626 standard, and that standard has this to say:

If implementors intend to support EOA account access directly, they should consider adding an additional function call for deposit/mint/withdraw/redeem with the means to accommodate slippage loss or unexpected deposit/withdrawal limits, since they have no other means to revert the transaction if the exact output amount is not achieved. https://eips.ethereum.org/EIPS/eip-4626

In other words, it's not up to the ERC4626/ERC5095 contract implementation itself to determine whether too many shares needed to be burned in order to satisfy the request for exactly the provided number of underlying - it's up to the caller to have extra code to determine whether the number is satsifactory itself. Note though that both standards are very clear that the exact number of underlying must be provided back, and the implmentation as it stands does not do this.

Discussion

sourabhmarathe

We believe this issue and its duplicates are related to the same underlying problem of complying with ERC4626.

We will address this issue and its duplicates altogether in one PR.

thereksfour

Escalate for 5 USDC

Slight-moderate incorrect slippage controls historically have been graded as medium not high. Look at the Criteria for Issues:

Medium: There is a viable scenario (even if unlikely) that could cause the protocol to enter a state where a material amount of funds can be lost. The attack path is possible with assumptions that either mimic on-chain conditions or reflect conditions that have a reasonable chance of becoming true in the future. The more expensive the attack is for an attacker, the less likely it will be included as a Medium (holding all other factors constant). The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.

High: This vulnerability would result in a material loss of funds and the cost of the attack is low (relative to the amount of funds lost). The attack path is possible with reasonable assumptions that mimic on-chain conditions. The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.

The cost to the attacker to exploit this vulnerability is not low

sherlock-admin

Escalate for 5 USDC

Slight-moderate incorrect slippage controls historically have been graded as medium not high. Look at the Criteria for Issues:

Medium: There is a viable scenario (even if unlikely) that could cause the protocol to enter a state where a material amount of funds can be lost. The attack path is possible with assumptions that either mimic on-chain conditions or reflect conditions that have a reasonable chance of becoming true in the future. The more expensive the attack is for an attacker, the less likely it will be included as a Medium (holding all other factors constant). The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.

High: This vulnerability would result in a material loss of funds and the cost of the attack is low (relative to the amount of funds lost). The attack path is possible with reasonable assumptions that mimic on-chain conditions. The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.

The cost to the attacker to exploit this vulnerability is not low

You've created a valid escalation for 5 USDC!

To remove the escalation from consideration: Delete your comment. To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

hrishibhat

Escalation rejected

The cost is extremely low for a MEV bot to trigger slippage, and the slippage amount is hard-coded, so the issue exists for all the users every time the protocol is used

sherlock-admin

Escalation rejected

The cost is extremely low for a MEV bot to trigger slippage, and the slippage amount is hard-coded, so the issue exists for all the users every time the protocol is used

This issue's escalations have been rejected!

Watsons who escalated this issue will have their escalation amount deducted from their next payout.

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

The contract hard-codes an additional 1% slippage tolerance instead of respecting the user's specified limit.

Impact

Users could receive less underlying than they requested, potentially losing part of their principal, and the hard-coded slippage makes this issue present for all users every time the protocol is used.

What the attacker needed

User interacts with withdraw or redeem

The fix

The contract should be updated to respect the user's slippage specification and not add extra slippage, as the team said they will address it in a PR.

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 withdraw funds from a smart contract, you can set a limit on how much slippage you will accept. This report says the contract ignores that limit and adds an extra 1% slippage, so you might get less than you asked for. That means you could lose money without agreeing to it.

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.