M-03 wrong token address on `ShortLongSpell.sol`
The ShortLongSpell contract passes the underlying token address instead of the vault share token address when burning collateral, so the burn call will fail. This means the short/long spell functionality will never work.
Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/114
Found by
Ch_301
Summary
Vulnerability Detail
ShortLongSpell.openPosition() send uToken to SoftVault then deposit it into the Compound protocol to earn a passive yield. In return, SPELL receives share tokes of SoftVault address(strategy.vault)
WERC20.sol should receive address(strategy.vault) token, but the logic of ShortLongSpell.sol subcall (WERC20.sol) wrapper.burn() and pass the uToken address (please check the Code Snippet part) instead of strategy.vault address
Impact
Short/Long Spell will never work
Code Snippet
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);
}
// 1. Take out collateral
bank.takeCollateral(param.amountPosRemove);
werc20.burn(
address(ISoftVault(strategy.vault).uToken()),
param.amountPosRemove
);
Tool used
Manual Review
Recommendation
1-
- address burnToken = address(ISoftVault(strategy.vault).uToken());
+ address burnToken = strategy.vault;
if (collSize > 0) {
if (posCollToken != address(wrapper))
revert Errors.INCORRECT_COLTOKEN(posCollToken);
bank.takeCollateral(collSize);
wrapper.burn(burnToken, collSize);
_doRefund(burnToken);
}
2-
// 1. Take out collateral
bank.takeCollateral(param.amountPosRemove);
werc20.burn(
- address(ISoftVault(strategy.vault).uToken()),
+ strategy.vault,
param.amountPosRemove
);
Discussion
Ch-301
Escalate for 10 USDC
The same reason as #116 but in a different implementation and it needs another solution
sherlock-admin
Escalate for 10 USDC
The same reason as #116 but in a different implementation and it needs another solution
You've created a valid escalation for 10 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.
hrishibhat
Escalation accepted
Valid medium This is a valid issue
sherlock-admin
Escalation accepted
Valid medium This is a valid issue
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
What the attacker needed
None
The fix
The fix is to use the vault address (strategy.vault) instead of the underlying token address when calling the burn function.
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 the code sends the wrong token address to a function that burns tokens. Because the address is wrong, the function will not find the tokens and the whole operation fails, so a feature that lets users open short or long positions cannot be used.
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.