Skip to content
Race condition Audit finding Intermediate

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:

  1. Stealing of user’s deposit amount: The public readability of the salt parameter 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 same salt value, the attacker can receive the deposit intended for the user’s Well and withdraw the funds.
  2. DoS for boreWell: Another attack vector involves an attacker deploying a Well with the same salt value as the user’s intended Well. This causes the user’s transaction to be reverted, resulting in a denial-of-service (DoS) attack on the boreWell function. The attacker can repeatedly execute this attack, preventing users from creating new Wells.

The original report as published on Code4rena, by tonisives. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

  1. Attacker observes a pending boreWell transaction and its salt value.
  2. Attacker submits their own boreWell transaction with the same salt before the victim's.
  3. Attacker's transaction is mined first, creating the Well and receiving the deposit.
  4. 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.

More from Basin Invitational

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.