You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
User can accidentally burn their iPT tokens during redemption
Summary
User can accidentally burn their iPT tokens during redemption
Vulnerability Detail
The redeem function that redeems iPT tokens burns iPT tokens even when the holdings mapping is empty and the redeemed amount is 0 (Redeemer.sol#L403-L434).
Impact
A user can accidentally call the redeem function after maturity but before the other redeem function is called (the one that burns external PT tokens–they have identical names). User's iPT tokens will be burned and no underlying tokens will be sent in exchange.
function redeem(addressu, uint256m) externalunpaused(u, m) {
// Get Illuminate's principal token for this marketIERC5095 token =IERC5095(
IMarketPlace(marketPlace).token(
u,
m,
uint8(MarketPlace.Principals.Illuminate)
)
);
// Verify the token has maturedif (block.timestamp< token.maturity()) {
revertException(7, block.timestamp, m, address(0), address(0));
}
// Get the amount of tokens to be redeemed from the senderuint256 amount = token.balanceOf(msg.sender);
// Calculate how many tokens the user should receiveuint256 redeemed = (amount * holdings[u][m]) / token.totalSupply();
// Update holdings of underlying
holdings[u][m] = holdings[u][m] - redeemed;
// Burn the user's principal tokens// @audit burns iPT tokens even if the holdings mapping is empty
token.authBurn(msg.sender, amount);
// Transfer the original underlying token back to the user
Safe.transfer(IERC20(u), msg.sender, redeemed);
emitRedeem(0, u, m, redeemed, msg.sender);
}
Tool used
Manual Review
Recommendation
Consider disallowing calling the second redeem function (the one that redeems iPT tokens) before the first redeem function (the one that redeems external PT tokens) is called.
Input validation is not within the scope of the audit. We expect to use other resources to ensure that users are executing the redemptions properly outside of the smart contract.
Jeiwan
high
User can accidentally burn their iPT tokens during redemption
Summary
User can accidentally burn their iPT tokens during redemption
Vulnerability Detail
The
redeem
function that redeems iPT tokens burns iPT tokens even when theholdings
mapping is empty and the redeemed amount is 0 (Redeemer.sol#L403-L434).Impact
A user can accidentally call the
redeem
function after maturity but before the otherredeem
function is called (the one that burns external PT tokens–they have identical names). User's iPT tokens will be burned and no underlying tokens will be sent in exchange.Code Snippet
Redeemer.sol#L403:
Tool used
Manual Review
Recommendation
Consider disallowing calling the second
redeem
function (the one that redeems iPT tokens) before the firstredeem
function (the one that redeems external PT tokens) is called.Duplicate of #81
The text was updated successfully, but these errors were encountered: