boreWell can be frontrun/DoS-d
The boreWell function in the Aquifer contract uses a publicly visible salt parameter when creating new Wells. An attacker can frontrun a user's transaction with the same salt to either capture the deposit intended for that Well or cause the user's transaction to revert, repeatedly blocking Well creation.
tonisives Follow with Inspecktor, peanuts and 3 others
Originally disclosed on Code4rena
Submitted by tonisives, also found by Inspecktor, peanuts, sces60107, Qeew, and MohammedRizwan
The boreWell function in the Aquifer contract is responsible for creating new Wells. However, there are two critical security issues:
- Stealing of user’s deposit amount: The public readability of the
saltparameter allows an attacker to frontrun a user’s transaction and capture the deposit amount intended for the user’s Well. By creating a Well with the samesaltvalue, the attacker can receive the deposit intended for the user’s Well and withdraw the funds. - DoS for
boreWell: Another attack vector involves an attacker deploying a Well with the samesaltvalue as the user’s intended Well. This causes the user’s transaction to be reverted, resulting in a denial-of-service (DoS) attack on theboreWellfunction. The attacker can repeatedly execute this attack, preventing users from creating new Wells.
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 salt used to identify a new Well is predictable and not bound to the caller, so anyone can create a Well with the same salt before the intended user's transaction is mined.
Impact
An attacker could steal a user's deposit or repeatedly cause boreWell transactions to revert, blocking users from creating new Wells.
What the attacker needed
Attacker can see pending transactions; attacker can submit transactions first
How it was found
- Attacker observes a pending boreWell transaction and its salt value.
- Attacker submits their own boreWell transaction with the same salt before the victim's.
- Attacker's transaction is mined first, creating the Well and receiving the deposit.
- Victim's transaction reverts, or the attacker repeats the same salt to keep blocking Well creation.
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 smart contract lets people create new 'Wells' by sending a transaction that includes a value called a salt. Because the salt is visible before the transaction is confirmed, someone else can send their own transaction first using the same salt. That lets them take the deposit meant for the original user, or make the original transaction fail.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.