ShortLongSpell#openPosition attempts to burn wrong token
The ShortLongSpell#openPosition function attempts to burn the wrong token (vault.uToken instead of vault) when adding to an existing position, causing the function to always revert. This makes the function completely nonfunctional for users adding to their position.
Source: https://github.com/sherlock-audit/2023-05-blueberry-judging/issues/30
Found by
0x52
Summary
ShortLongSpell#openPosition attempts to burn vault.uToken when it should be using vault instead. The result is that ShortLongSpell#openPosition will be completely nonfunctional when the user is adding to their position
Vulnerability Detail
address burnToken = address(ISoftVault(strategy.vault).uToken());
if (collSize > 0) {
if (posCollToken != address(wrapper))
revert Errors.INCORRECT_COLTOKEN(posCollToken);
bank.takeCollateral(collSize);
wrapper.burn(burnToken, collSize);
_doRefund(burnToken);
}
We see above that the contract attempts to withdraw vault.uToken from the wrapper.
_doPutCollateral(
vault,
IERC20Upgradeable(ISoftVault(vault).uToken()).balanceOf(
address(this)
)
);
This is in direct conflict with the collateral that is actually deposited which is vault. This will cause the function to always revert when adding to an existing position.
Impact
ShortLongSpell#openPosition will be completely nonfunctional when the user is adding to their position
Code Snippet
Tool used
Manual Review
Recommendation
Burn token should be vault rather than vault.uToken
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 the underlying token (vault.uToken) instead of the vault token itself when burning collateral, which does not match the token that was deposited.
Impact
ShortLongSpell#openPosition will be completely nonfunctional when the user is adding to their position.
What the attacker needed
User has an existing position; user calls openPosition to add collateral
The fix
The burn token should be vault rather than vault.uToken.
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.
This is a smart contract bug where a function tries to remove the wrong type of token from a user's account. Because the token it tries to remove is not the one actually deposited, the operation always fails, so users cannot add to their existing position.
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.