Skip to content
DoS Audit finding Intermediate

Incorrect data location specifier can be abused to cause DoS and fund loss

The withdrawBounty function uses a memory copy of a bounty struct instead of a storage reference, so setting bounty.active to false only modifies the copy and never deactivates the bounty. This causes repeated withdrawal attempts to revert due to insufficient funds, enabling a denial of service that prevents auction settlement and can lead to loss of bonded funds.

0xRajeev Follow

Originally disclosed on Code4rena

Submitted by 0xRajeev, also found by bw and pauliax

Impact

The withdrawBounty() loops through the \_bounties array looking for active bounties and transferring amounts from active ones. However, the data location specifier used for bounty is memory which makes a copy of the \_bounties array member instead of a reference. So when bounty.active is set to false, this is changing only the memory copy and not the array element of the storage variable. This results in bounties never being set to inactive, keeping them always active forever and every withdrawBounty() will attempt to transfer bounty amount from the Auction contract to the msg.sender.

Therefore, while the transfer will work the first time, subsequent attempts to claim this bounty will revert on transfer (because the Auction contract will not have required amount of bounty tokens) causing withdrawBounty() to always revert and therefore preventing settling of any auction.

A malicious attacker can add a tiny bounty on any/every Auction contract to prevent any reindexing on that contract to happen because it will always revert on auction settling. This can be used to cause DoS on any auctionBonder so as to make them lose their bondAmount because their bonded auction cannot be settled.

Proof of Concept

Tools Used

Manual Analysis

Recommended Mitigation Steps

Recommend changing storage specifier of bounty to “storage” instead of “memory”.

frank-beard (Kuiper) confirmed

Alex the Entreprenerd (judge) commented:

Great find, adding the same bounty multiple times can allow the exploiter to drain the entire contract as long as the bounties are denominated in the underlying token

Alex the Entreprenerd (judge) commented:

Because the warden shows a way to cause DOS, which is contingent on setting it as well as redeeming that bounty (which can be avoided by simply not adding it to the bountiesID calldata), I will rate this finding as Medium Severity

The DOS is low severity as it can be sidestep very easily, see #82

However, the warden has identified a technical issue with the protocol (unflagging of bounty), as such I agree with a medium severity

The original report as published on Code4rena, by 0xRajeev. 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 use of the 'memory' data location specifier for a struct in a loop caused modifications to be made to a copy rather than the original storage, so the active flag was never updated.

Impact

A malicious attacker could cause a denial of service on any auction bonder, preventing auction settlement and potentially causing the bonder to lose their bonded amount.

What the attacker needed

Attacker can add a bounty to an auction contract

The fix

The storage specifier should be used instead of memory for the bounty variable to ensure changes affect the actual storage.

How it was found

  1. A malicious attacker adds a tiny bounty to an Auction contract.
  2. The bounty remains active because the active flag is never set to false due to the memory copy.
  3. When withdrawBounty is called, it attempts to transfer the bounty amount again, but the contract lacks sufficient tokens, causing a revert.
  4. The revert prevents auction settlement, causing a denial of service for the auction bonder.

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.

In Solidity, 'memory' creates a temporary copy of data, while 'storage' points to the permanent data on the blockchain. The code mistakenly used 'memory', so when it tried to mark a bounty as inactive, it only changed the copy, not the real record. This means the bounty stayed active forever, and later attempts to claim it failed because the contract ran out of tokens, blocking auction settlement.

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.

More by 0xRajeev

View all

61 more disclosed reports, best first.

More from Kuiper contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.