Notional PT redemptions do not use flash-resistant prices
The Illuminate protocol's redemption logic uses Notional's maxRedeem() to determine how many principal tokens to redeem, but maxRedeem() may return less than the actual balance, leading to fewer tokens being redeemed and users receiving less underlying than owed. This could cause permanent freezing of funds for all Illuminate PT holders in a market.
Source: https://github.com/sherlock-audit/2022-10-illuminate-judging/issues/110
Found by
IllIllI
Summary
Notional PT redemptions do not use the correct function for determining balances, which will lead to principal losses
Vulnerability Detail
EIP-4626 states the following about maxRedeem():
MUST return the maximum amount of shares that could be transferred from `owner` through `redeem` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).
MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.
The above means that the implementer is free to return less than the actual balance, and is in fact required to return zero if the token's backing store is paused, and Notional's can be paused. While neither of these conditions currently apply to the existing wfCashERC4626 implementation, there is nothing stopping Notional from implementing the MUST-return-zero-if-paused fix tomorrow, or from changing their implementation to one that requires maxRedeem() to return something other than the current balance.
Impact
Permanent freezing of funds
If maxRedeem() were to return zero, or some other non-exact value, fewer Notional PTs would be redeemed than are available, and users that redeem()ed their shares, would receive fewer underlying (principal if they minted Illuminate PTs with Notional PTs, e.g. to be an LP in the pool) than they are owed. The Notional PTs that weren't redeemed would still be available for a subsequent call, but if a user already redeemed their Illuminate PTs, their loss will already be locked in, since their Illuminate PTs will have been burned. This would affect ALL Illuminate PT holders of a specific market, not just the ones that provided the Notional PTs, because Illuminate PT redemptions are an a share-of-underlying basis, not on the basis of the originally-provided token. Markets that are already live with Notional set cannot be protected via a redemption pause by the Illuminate admin, because redemption of Lender's external PTs for underlying does not use the unpaused modifier, and does have any access control.
Code Snippet
// File: src/Redeemer.sol : Redeemer.redeem() #1
309 // Retrieve the pool for the principal token
310 address pool = ITempusToken(principal).pool();
311
312 // Redeems principal tokens from Tempus
313 ITempus(tempusAddr).redeemToBacking(pool, amount, 0, address(this));
314 } else if (p == uint8(MarketPlace.Principals.Apwine)) {
315 apwineWithdraw(principal, u, amount);
316 } else if (p == uint8(MarketPlace.Principals.Notional)) {
317 // Redeems principal tokens from Notional
318 INotional(principal).redeem(
319 @> INotional(principal).maxRedeem(address(this)),
320 address(this),
321 address(this)
322 );
323 }
324
325 // Calculate how much underlying was redeemed
326 uint256 redeemed = IERC20(u).balanceOf(address(this)) - starting;
327
328 // Update the holding for this market
329: holdings[u][m] = holdings[u][m] + redeemed;
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L309-L329
Redemptions of Illuminate PTs for underlyings is based on shares of each Illuminate PT's totalSupply() of the available underlying, not the expect underlying total:
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L422
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L464
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L517
Tool used
Manual Review
Recommendation
Use balanceOf() rather than maxRedeem() in the call to INotional.redeem(), and make sure that Illuminate PTs can't be burned if Lender still has Notional PTs that it needs to redeem (based on its own accounting of what is remaining, not based on balance checks, so that it can't be griefed with dust).
Discussion
0x00052
Escalate for 25 USDC
While neither of these conditions currently apply to the existing wfCashERC4626 implementation, there is nothing stopping Notional from implementing the MUST-return-zero-if-paused fix tomorrow, or from changing their implementation to one that requires maxRedeem() to return something other than the current balance.
Watson clearly acknowledges external factors required for loss of funds. There are so many upgradable contracts that Illuminate integrates with. Seems crazy to me to submit a report for every way that any integrated protocol could upgrade to brick/damage this contract. I think low is most appropriate given the requirement that an underlying protocol has to upgrade to cause damage. Worst case medium but I think that is generous.
sherlock-admin
Escalate for 25 USDC
While neither of these conditions currently apply to the existing wfCashERC4626 implementation, there is nothing stopping Notional from implementing the MUST-return-zero-if-paused fix tomorrow, or from changing their implementation to one that requires maxRedeem() to return something other than the current balance.Watson clearly acknowledges external factors required for loss of funds. There are so many upgradable contracts that Illuminate integrates with. Seems crazy to me to submit a report for every way that any integrated protocol could upgrade to brick/damage this contract. I think low is most appropriate given the requirement that an underlying protocol has to upgrade to cause damage. Worst case medium but I think that is generous.
You've created a valid escalation for 25 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.
KenzoAgada
Escalate for 50 USDC See 52's comments above. At the moment no issue is there, the issue is only if Notional's implementation is changed. Might be considered medium severity.
sherlock-admin
Escalate for 50 USDC See 52's comments above. At the moment no issue is there, the issue is only if Notional's implementation is changed. Might be considered medium severity.
You've created a valid escalation for 50 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.
Evert0x
Escalation accepted
sherlock-admin
Escalation accepted
This issue's escalations have been accepted!
Contestants' payouts and scores will be updated according to the changes made on 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
The code uses maxRedeem() instead of balanceOf() to determine the redemption amount, and maxRedeem() is allowed to return a value lower than the actual balance.
Impact
Users could receive fewer underlying tokens than they are owed, and their losses could be locked in if their Illuminate PTs are burned, affecting all holders in the market.
What the attacker needed
Notional changes maxRedeem() to return non-exact value
The fix
The code should use balanceOf() instead of maxRedeem() and ensure Illuminate PTs cannot be burned while Notional PTs remain unredeemed.
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 redeem a token, the system asks the underlying protocol how many tokens it can redeem. That number might be lower than what you actually hold, so you get less than you should. This report points out that the code uses that lower number instead of checking the real balance.
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.