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.
Removed adapter can still hold funds, removed token can still be deposited to a market
Summary
Removed adapter can still hold funds, removed token can still be deposited to a market.
Vulnerability Detail
When removing an adapter, there's no check for whether it's still holding funds (AssetManager.sol#L440). The same is true for tokens: when removing a token, there's no check for whether any of the supported adapters is still holding assets in this token.
Impact
In case an adapter that's being removed still holds funds, these funds will be removed from the total TVL until the removed adapter is re-added. And if there's no plans to re-add the adapter, the remaining funds will be locked in the adapter indefinitely.
Similarly to tokens: if any of the supported markets is still holding a token that's being removed, the token assets held by the market will be removed from the total TVL and users won't be able to get their funds.
function removeToken(addresstokenAddress) externaloverride onlyAdmin {
bool isExist =false;
uint256 index;
uint256 supportedTokensLength = supportedTokensList.length;
for (uint256 i =0; i < supportedTokensLength; i++) {
if (tokenAddress ==address(supportedTokensList[i])) {
isExist =true;
index = i;
break;
}
}
if (isExist) {
supportedTokensList[index] = supportedTokensList[supportedTokensLength -1];
supportedTokensList.pop();
supportedMarkets[tokenAddress] =false;
}
}
Tool used
Manual Review
Recommendation
In the removeAdapter function, check market's supply by calling moneyMarket.getSupply(token) before removing an adapter. In the removeToken function, iterate over all supported adapters and check if they're still holding the token by calling moneyMarket.getSupply(token).
The text was updated successfully, but these errors were encountered:
Jeiwan
medium
Removed adapter can still hold funds, removed token can still be deposited to a market
Summary
Removed adapter can still hold funds, removed token can still be deposited to a market.
Vulnerability Detail
When removing an adapter, there's no check for whether it's still holding funds (AssetManager.sol#L440). The same is true for tokens: when removing a token, there's no check for whether any of the supported adapters is still holding assets in this token.
Impact
In case an adapter that's being removed still holds funds, these funds will be removed from the total TVL until the removed adapter is re-added. And if there's no plans to re-add the adapter, the remaining funds will be locked in the adapter indefinitely.
Similarly to tokens: if any of the supported markets is still holding a token that's being removed, the token assets held by the market will be removed from the total TVL and users won't be able to get their funds.
Code Snippet
AssetManager.sol#L440:
AssetManager.sol#L396:
Tool used
Manual Review
Recommendation
In the
removeAdapter
function, check market's supply by callingmoneyMarket.getSupply(token)
before removing an adapter. In theremoveToken
function, iterate over all supported adapters and check if they're still holding the token by callingmoneyMarket.getSupply(token)
.The text was updated successfully, but these errors were encountered: