Potential griefing with DoS by front-running vault creation with same vaultID
A user-chosen vault identifier can be front-run by an attacker who creates a vault with the same identifier, causing the victim's batch transaction to fail. This griefing attack prevents legitimate users from opening vaults and interacting with the protocol.
Yield Witch v2 contest
Originally disclosed on Code4rena
The vaultID for a new vault being built is required to be specified by the user building a vault via the build() function (instead of being assigned by the Cauldron/protocol). An attacker can observe a build() as part of a batch transaction in the mempool, identify the vaultID being requested, and front-run that by constructing a malicious batch transaction with only the build operation with that same vaultID. The protocol would create a vault with that vaultID and assign the attacker as its owner. More importantly, the valid batch transaction in the mempool, which was front-run, will later fail to create its vault because that vaultID already exists, as per the check on Line180 of Cauldron.sol. As a result, the valid batch transaction fails entirely because of the attacker front-running with the observed vaultID.
While the attacker gains nothing except the ownership of an empty vault after spending the gas, this could grief the protocol’s real users by preventing them from opening a vault and interacting with the protocol in any manner.
The rationale for Medium-severity impact: While the likelihood of this may be low, the impact is high because valid vaults from the Yield front-end will never be successfully created and will lead to a DoS against the entire protocol’s functioning. So, with low likelihood and high impact, the severity (according to OWASP) is medium.
Alice uses Yield’s front-end to create a valid batch transaction. Evil Eve observes that in the mempool and identifies the vaultID of the vault being built by Alice. Eve submits her own batch transaction (without using the front-end) with only a build operation using Alice’s vaultID. She uses a higher gas price to front-run Alice’s transaction and get’s the protocol to assign that vaultID to herself. Alice’s batch transaction later fails because the vaultID she requested is already assigned to Eve. Eve can do this for any valid transaction to grief protocol users by wasting her gas to cause DoS.
Recommend mitigating this DoS vector by having the Cauldron assign the vaultID instead of the user specifying it in the build() operation. This would likely require the build() to be a separate non-batch transaction followed by other operations that use the vaultID assigned in build(). Consider the pros/cons of this approach because it will significantly affect the batching/caching logic in Ladle.
Alternatively, consider adding validation logic in Ladle's batching to revert batches that have only build or a subset of the operations that do not make sense to the protocol’s operations per valid recipes, which could be an attacker’s signature pattern.
albertocuestacanada (Yield) confirmed:
Good find. Fix
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 vault identifier is chosen by the user rather than assigned by the protocol, allowing an attacker to pre-emptively claim it.
Impact
Legitimate users could be prevented from creating vaults, causing a denial of service against the protocol, though the attacker gains only an empty vault and spends gas.
What the attacker needed
Attacker can observe mempool transactions; attacker can submit transactions with higher gas
The fix
The protocol should assign the vaultID instead of the user, or validate batches to reject those containing only a build operation.
How it was found
- Alice creates a batch transaction to build a vault with a chosen vaultID.
- Eve observes the transaction in the mempool and identifies the vaultID.
- Eve submits her own batch transaction with only a build operation using the same vaultID and a higher gas price.
- Eve's transaction is mined first, assigning the vaultID to her.
- Alice's transaction later fails because the vaultID already exists.
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.
When you create a vault, you pick a name (the vaultID). An attacker watching pending transactions can quickly create a vault with the same name first. Your transaction then fails because that name is already taken, so you cannot use the service.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.