-
Notifications
You must be signed in to change notification settings - Fork 2
sinarette - Bidding could spend more quotes than it is supposed to #48
Comments
I believe it is a non-issue if the SetToken spends untracked quote asset units, no other modules rely on that functionality (and we do not allow external positions for rebalancing components) |
Agree - I don't think it's a problem that SetToken spends untracked quote assets. |
Not an issue |
Escalate Even if the module is allowed to spend untracked quote assets, it is impossible to do so unless it spends up all the remaining assets ( BTW, at the point when I wrote the report the sponsor acknowledged that it is an issue that untracked assets could be spent (through DM); therefore I had to shift my focus towards it, from the underflow/revert and DoS issue. |
The escalation could not be created because you are not exceeding the escalation threshold. You can view the required number of additional valid issues/judging contest payouts in your Profile page, |
sinarette
medium
Bidding could spend more quotes than it is supposed to
Summary
After a bid is executed, the position units are updated through
Position.sol # calculateAndEditDefaultPosition
. Under certain conditions, it could allow the rebalance module to spend more quotes than it is supposed to.Vulnerability Detail
While bidding, after the bid is executed the position units of
sendToken
andreceiveToken
should be updated through_updatePositionState
. Here, the preBidTokenBalance represents the token balance before bid execution.In Position.sol,
As you can see, underflows could happen if
airdroppedAmount > _postTotalNotional
.For this to be the case,
_preTotalNotional
should be greater than_postTotalNotional
( = for sendTokens) and the difference(spent amount) should be bigger than the tracked amount (_prePositionUnit * _setTokenSupply
in theairdroppeAmount
calculation).Reverting on excess spending of quote assets (more than the tracked amount) could be a desired feature, since it is not allowed for modules to spend over the tracked units.
For non-quote component assets, since there are proper checks against the maximum bid quantity, this could not be the case.
However for quote assets, this might be the case since there is no checks on the quote asset usage boundary.
Returning to Position.sol, if the
currentBalance
is zero, it would not revert; allowing the rebalance module to spend up all the quote assets, including the airdropped amounts.Impact
The module could spend untracked quote assets; which could interrupt other modules' functionalities
Code Snippet
https://github.com/sherlock-audit/2023-06-Index/blob/main/index-protocol/contracts/protocol/modules/v1/AuctionRebalanceModuleV1.sol#L867-L874
Tool used
Manual Review
Recommendation
Add checks for quote assets if it spends more than the tracked units
The text was updated successfully, but these errors were encountered: