Vaults steal rebasing tokens’ rewards
The vault contract records the initial deposit amount and later transfers only that fixed amount, ignoring any growth from rebasing tokens. As a result, rewards that accrue to the vault cannot be withdrawn by either the option seller or the owner and remain locked forever.
Submitted by IllIllI, also found by horsefacts and smilingheretic_
Rebasing tokens are tokens that have each holder’s balanceof() increase over time. Aave aTokens are an example of such tokens.
Impact
If rebasing tokens are used as the vault token, rewards accrue to the vault and cannot be withdrawn by either the option seller or the owner, and remain locked forever.
Proof of Concept
The amount ‘available’ for withdrawal comes from an input parameter and is stored for later operations:
File: contracts/src/Cally.sol #1
173 Vault memory vault = Vault({
174 tokenIdOrAmount: tokenIdOrAmount,
175 token: token,
176 premiumIndex: premiumIndex,
177 durationDays: durationDays,
178 dutchAuctionStartingStrikeIndex: dutchAuctionStartingStrikeIndex,
179 currentExpiration: uint32(block.timestamp),
180 isExercised: false,
181 isWithdrawing: false,
182 tokenType: tokenType,
183 currentStrike: 0,
184 dutchAuctionReserveStrike: dutchAuctionReserveStrike
185 });
186
187 // vault index should always be odd
188 vaultIndex += 2;
189 vaultId = vaultIndex;
190 _vaults[vaultId] = vault;
191
192 // give msg.sender vault token
193 _mint(msg.sender, vaultId);
194
195 emit NewVault(vaultId, msg.sender, token);
196
197 // transfer the NFTs or ERC20s to the contract
198 vault.tokenType == TokenType.ERC721
199 ? ERC721(vault.token).transferFrom(msg.sender, address(this), vault.tokenIdOrAmount)
200 : ERC20(vault.token).safeTransferFrom(msg.sender, address(this), vault.tokenIdOrAmount);
The amount actually available grows over time and is only known at the time of withdrawal. The option withdrawal/exercise use the original amount:
File: contracts/src/Cally.sol #2
345 : ERC20(vault.token).safeTransfer(msg.sender, vault.tokenIdOrAmount);
File: contracts/src/Cally.sol #3
296 : ERC20(vault.token).safeTransfer(msg.sender, vault.tokenIdOrAmount);
Recommended Mitigation Steps
Track total amounts currently deposited and allow vault creators to withdraw excess on a pro-rata basis
outdoteth (Cally) acknowledged and commented:
This is technically an issue however we have no intention of supporting rebase tokens
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
Likely the contract stores the initial deposit amount and uses that fixed value for withdrawals, without accounting for balance changes caused by rebasing tokens.
What the attacker needed
Vault uses a rebasing token
The fix
The contract should track total deposited amounts and allow vault creators to withdraw excess on a pro-rata basis.
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.
Some tokens automatically increase each holder's balance over time; these are called rebasing tokens. The vault contract only remembers the original deposit amount and pays out exactly that, so any extra tokens that appear are stuck in the contract with no way to retrieve them.
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.