Lack of 0 amount check allows malicious user to create infinite vaults
The createVault function did not check that the amount was greater than zero, so a user could create unlimited zero-value vaults. This could clutter the front-end and let a user accidentally buy a call on a worthless vault.
Submitted by 0xDjango
A griefer is able to create as many vaults as they want by simply calling createVault() with tokenIdOrAmount = 0. This will most likely pose problems on the front-end of the Cally protocol because there will be a ridiculously high number of malicious vaults displayed to actual users.
I define these vaults as malicious because it is possible that a user accidently buys a call on this vault which provides 0 value in return. Overall, the presence of zero-amount vaults is damaging to Cally’s product image and functionality.
Proof of Concept
- User calls
createVault(0,,,,);with an ERC20 type. - There is no validation that
amount > 0 - Function will complete successfully, granting the new vault NFT to the caller.
- Cally protocol is filled with unwanted 0 amount vaults.
Recommended Mitigation Steps
Add the simple check require(tokenIdOrAmount > 0, "Amount must be greater than 0");
outdoteth (Cally) confirmed and commented:
This check should only be applied on ERC20 tokens because ERC721 tokens can still have tokenIds that have ID’s with a value of 0.
this issue is fixed here: https://github.com/outdoteth/cally/pull/12
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 createVault function lacked a validation that the token amount is greater than zero.
Impact
A user could create unlimited zero-value vaults, which may clutter the front-end and could lead someone to buy a call on a worthless vault.
What the attacker needed
None
The fix
The issue was fixed by adding a check that the amount is greater than zero, applied only to ERC20 tokens because ERC721 token IDs can legitimately be zero.
How it was found
- Call createVault with an ERC20 token type and an amount of zero.
- The function completes without any amount check.
- The caller receives a new vault NFT representing a zero-amount vault.
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.
A vault is a smart contract that holds a token and lets someone buy the right to use it later. The code that creates a vault never checked that the amount was more than zero, so anyone could make endless empty vaults. That fills the user interface with junk and could trick someone into buying a worthless option.
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.