-
Notifications
You must be signed in to change notification settings - Fork 0
neumo - Users can loose their Illuminate tokens if amount to redeem is greater than holdings[u][m] #81
Comments
We expect the user to confirm that the redemption process is fully complete prior to redeeming their Illuminate PTs. We believe this check is best done off-chain and as a result do not include it in Illuminate's |
Escalate for 100 USDC uint256 redeemed = (amount * holdings[u][m]) / token.totalSupply(); Gets the amount to redeem. But this other line (428 in Redeemer.sol) token.authBurn(msg.sender, amount); burns the amount passed in. So if a user has (to make it simple) |
You've created a valid escalation for 100 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Escalation accepted, enforcing a specific order of contract calls off-chain is not secure. Rewarding a medium severity. |
This issue's escalations have been accepted! Contestants' payouts and scores will be updated according to the changes made on this issue. |
I would comment that this is less of a vulnerability and more of an admin issue given it would actually rely on those creating markets to make errors in doing so, allowing no window for keepers or otherwise to themselves call You should not rely on an off chain check, you should rely on keepers and sufficient time between external principal token maturity and iPT maturity to ensure users do not need to check anything whatsoever. (what we do now / a ton of mechanisms share similar time based assumptions e.g. optimistic anythings ) |
neumo
high
Users can loose their Illuminate tokens if amount to redeem is greater than holdings[u][m]
Summary
When a user tries to redeem Illuminate tokens (using the Redeemer contract), the call will burn his/her illuminate tokens in exchange of zero underlying tokens if the amount to redeem exceeds the holdings value for that
[underlying, maturity]
pair.Vulnerability Detail
Holdings mapping for a
[underlying, maturity]
pair is only increased in certain function calls.redeem method for Swivel, Yield, Element, Pendle, APWine, Tempus and Notional protocols
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L329
redeem method signature for Sense
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L394
But it is decreased in a number of other places, for instance in this function:
https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L403-L434
Which
burns Illuminate principal tokens and sends underlying to user
.Acording to the documentation,
So it could happen that a user minted Illuminate tokens, and after maturity try to redeem the underlying before any call has been made to the
redeem
functions above (the ones that increase the holdings). This means thatholdings[u][m]
would be zero and the call toredeem(address u, uint256 m)
by the user would just burn their Illuminate principal in return for nothing.https://github.com/sherlock-audit/2022-10-illuminate/blob/main/src/Redeemer.sol#L422-L431
Note that in line 422, the
redeemed
amount is zero becauseholdings[u][m]
is zero. So in line 428, the Illuminate tokens are burnt and in line 431 zero (redeemed
) underlying is transferred to the user.This issue is present also in funtions
autoRedeem
andauthRedeem
because both calculate the amount of underlying to redeem asuint256 redeemed = (amount * holdings[u][m]) / pt.totalSupply();
. For the sake of simplicity, I only present below a PoC of the case of theredeem(address u, uint256 m)
function to prove the loss of funds.Impact
Loss of user funds in certin scenarios.
Code Snippet
For the case of the
redeem(address u, uint256 m)
function of the Redeemer contract, I wrote the following test that can be included in Redeemer.t.sol.You can see how the user mints Illuminate from Yield tokens, then redeems through the Redeemer and ends up with the loss of the Yield tokens he/she used to mint Illuminate.
Tool used
Forge tests and manual Review
Recommendation
Using the
holdings
mapping to track the redeemable Illuminate tokens in the Redeemer contract can only be done if there is no way for an address to have a positive Illuminate tokens balance without the knowledge of the Redeemer contract. I think the team should rethink the way this contract works.Duplicate of #239
The text was updated successfully, but these errors were encountered: