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.
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.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
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.