Skip to content
Memory corruption Advisory Advanced CVE-2017-14457

CPP-Ethereum libevm create2 Information Leak Vulnerability

The create2 opcode handler in cpp-ethereum's libevm did not validate the initSize parameter, leading to an out-of-bounds read when hashing the contract code. An attacker could craft a smart contract to cause a denial of service or leak memory contents via the resulting contract address.

Marcin 'Icewall' Noga Follow

Originally disclosed on Cisco Talos

High 8.2 View original

The create2 opcode is currently associate with Constantinople fork and its implementation looks as follows:

Marcin 'Icewall' Noga, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

The initSize parameter from the create2 opcode was used directly as the size of a memory reference without validating it against the actual memory bounds.

Impact

The vulnerability could cause a denial of service on all nodes using this implementation, or leak memory contents that an attacker could brute-force from the resulting contract address.

What the attacker needed

Ability to create or send a smart contract

How it was found

  1. Deploy or send a smart contract containing the create2 opcode with a large initSize value.
  2. The opcode handler reads the initSize without bounds checking.
  3. A memory reference with the oversized length is created.
  4. The reference is passed to a SHA3 hash function, causing an out-of-bounds read.
  5. The node may crash (denial of service) or the hash result may leak memory contents.

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 can ask the Ethereum virtual machine to create a new contract, specifying how much code to use. The software did not check that this size was within the actual memory, so it read past the end of the buffer. This could crash nodes or leak memory data through the computed address.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Marcin 'Icewall' Noga

View all

146 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.