Skip to content
DoS Audit finding Intermediate

RubiconMarket.feeTo set to zero-address can DoS buy function

The contract allows the owner to set the fee recipient to the zero address, and some ERC20 tokens such as USDC revert on transfers to that address. As a result, all buy calls using those tokens would fail.

berndartmueller Follow

Originally disclosed on Code4rena

Submitted by berndartmueller, also found by 0x1f8b and blackscale

In the RubiconMarket contract, the feeTo storage variable stores the recipient of taker trade fees (i.e. buy function). feeTo can be set to any arbitrary address in setFeeTo(address newFeeTo). As there is no zero-address validation, the owner can set a zero-address as the feeTo address.

All subsequent buy function calls with a _offer.buy_gem ERC20 token reverting on zero-address transfers (e.g. USDC), will revert.

Proof of Concept

RubiconMarket.sol#L297-L300

require(
    _offer.buy_gem.transferFrom(msg.sender, feeTo, fee),
    "Insufficient funds to cover fee"
);

Recommended Mitigation Steps

Check if feeTo is set to a non-zero address before transferring fees.

bghughes (Rubicon) disputed and commented:

I do not believe having the fee recipient as the zero address would cause these transactions to revert according to EIP-20.

Note, #344

HickupHH3 (judge) commented:

Yes it will. USDC implementation: https://etherscan.io/address/0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf#code

function _transfer(
   address from,
   address to,
   uint256 value
) internal override {
   require(from != address(0), "ERC20: transfer from the zero address");
   require(to != address(0), "ERC20: transfer to the zero address");

The original report as published on Code4rena, by berndartmueller. 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 setFeeTo function lacks a check that the new fee recipient is not the zero address, and the buy function does not guard against a zero feeTo before transferring fees.

What the attacker needed

Owner sets feeTo to zero address; buy uses a token that reverts on zero-address transfer

The fix

The contract should check that feeTo is a non-zero address before transferring fees.

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 has a setting for where trading fees go. The owner can accidentally set that to the zero address, which is like a black hole. Some tokens refuse to send money there, so buying with those tokens stops working.

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 berndartmueller

View all

97 more disclosed reports, best first.

More from Rubicon v2

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.