Skip to content
Access control Audit finding Intermediate

Editions should be checked if they are actually deployed from the legitimate Escher721Factory

The sale factory contracts only checked that the caller had a role on the edition contract supplied in the sale data, without confirming that edition was deployed by the legitimate Escher721Factory. A malicious creator could register a fake edition contract they controlled and use it to take buyers' payments while delivering nothing.

hansfriese Follow with carrotsmuggler, imare and 9 others

Originally disclosed on Code4rena

Submitted by hansfriese, also found by carrotsmuggler, imare, nalus, 0xRobocop, Englave, Dinesh11G, hihen, danyams, MHKK33, Ruhum, and ahmedov

https://github.com/code-423n4/2022-12-escher/blob/5d8be6aa0e8634fdb2f328b99076b0d05fefab73/src/minters/FixedPriceFactory.sol#L29

https://github.com/code-423n4/2022-12-escher/blob/5d8be6aa0e8634fdb2f328b99076b0d05fefab73/src/minters/LPDAFactory.sol#L29

https://github.com/code-423n4/2022-12-escher/blob/5d8be6aa0e8634fdb2f328b99076b0d05fefab73/src/minters/OpenEditionFactory.sol#L29

Impact

For all kinds of sales, the creators create new sales contracts with arbitrary sale data, and the edition is not properly checked.

Malicious creators can create fake contracts that implemented IEscher721 and fake buyers to get free earnings.

Proof of Concept

Sales contracts can be created by any creator and the sale data is filled with the one provided by the creator.

The protocol does not validate the sale.edition provided by the creator and malicious creators can effectively use their fake contract address that implemented IEscher721.

In the worst case, buyers will not get anything after their payments.

function createFixedSale(FixedPrice.Sale calldata _sale) external returns (address clone) {
  require(IEscher721(_sale.edition).hasRole(bytes32(0x00), msg.sender), "NOT AUTHORIZED"); //@audit need to check edition is actually from the legimate escher721 factory
  require(_sale.startTime >= block.timestamp, "START TIME IN PAST");
  require(_sale.finalId > _sale.currentId, "FINAL ID BEFORE CURRENT");

  clone = implementation.clone();
  FixedPrice(clone).initialize(_sale);

  emit NewFixedPriceContract(msg.sender, _sale.edition, clone, _sale);
}

Malicious creators can use a fake contract as an edition to steal funds from users.

Recommended Mitigation Steps

Track all the deployed Escher721 contracts in the Escher721Factory.sol and validate the sale.edition before creating sales contracts.

stevennevins (Escher) disagreed with severity and commented:

Marking as Medium, because funds are not directly at risk but this is a good point for us to keep in mind.

berndartmueller (judge) decreased severity to Medium


The original report as published on Code4rena, by hansfriese. 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 factory contracts trusted the edition address in the sale data and only checked a role on it, rather than verifying it came from the legitimate Escher721Factory.

Impact

Buyers could pay for a sale tied to a fake edition and receive nothing, though the judge rated it Medium because funds were not directly at risk in the protocol itself.

What the attacker needed

Attacker can create a sale; attacker deploys a fake edition contract; buyer pays into the fake sale

The fix

The factories should track every Escher721 deployed by Escher721Factory and validate the sale edition against that list before creating a sale contract.

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.

When someone sets up a sale, the contract trusts the edition address they hand it. If that address is a contract the seller wrote themselves, the seller can make it say whatever they like, for example that the buyer paid and the sale is done, while keeping the money. The fix is to keep a list of editions the real factory made and only accept those.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by hansfriese

View all

65 more disclosed reports, best first.

More from Escher contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.