Ethereum Blog

Transaction spam attack: Next Steps

Introduction

user

Vitalik Buterin


LATEST POSTS

Roundup Round III 24th May, 2017

Ethereum Dev Roundup: Q1 (Boring Edition) 07th April, 2017

the project

Transaction spam attack: Next Steps

Posted on .

Today the network was attacked by a transaction spam attack that repeatedly called the EXTCODESIZE opcode (see trace sample here), thereby creating blocks that take up to ~20-60 seconds to validate due to the ~50,000 disk fetches needed to process the transaction. The result of this was a ~2-3x reduction in the rate of block creation while the attack was taking place; there was NO consensus failure (ie. network fork) and neither the network nor any client at any point fully halted. The attack has since, as of the time of this writing, mostly halted, and the network has for the time being recovered.

The short-term fix is for users, including miners, enterprise users (including exchanges) and individuals to run geth with the flags:

--cache 1024 --targetgaslimit 1500000 --gasprice 20000000000

Or Parity with the flags:

--cache-size-db 1024 --gas-floor-target 1500000 --gasprice 20000000000 --gas-cap 1500000

This (i) increases the cache size, reducing the number of disk reads that nodes need to make, and (ii) votes the gas limit down by ~3x, reducing the maximum processing time of a block by a similar factor.

In the medium term (ie. several days to a week), we are actively working on several fixes for the Go client that should both provide a more stable resolution for the present issue and mitigate the risk of similar attacks, including:

  • A change to miner software that automatically temporarily cuts the gas limit target by 2x when the miner sees a block that takes longer than 5 seconds to process, allowing for adjustments similar to what was coordinated today to happen automatically (see here for a pull request; note that this is a miner strategy change and NOT a soft fork or hard fork)
  • Numerical tweaks to cache settings
  • Adding additional caches
  • Adding an additional cache for EXTCODESIZE specifically (as it is likely that EXTCODESIZE reads are several times slower than other IO-heavy operations since the contracts that are being read are ~18 KB long)
  • An on-disk cache of state values that allows them to be more quickly (ie. O(log(n)) speedup) accessed

We are also exploring the option of replacing the leveldb database with something more performant and optimized for our use case, though such a change would not come soon. The Parity team is working on their own performance improvements.

In the longer term, there are low-level protocol changes that can also be explored. For example it may be wise to add a feature to Metropolis to increase the gas costs of opcodes that require reads of account state (SLOAD, EXTCODESIZE, CALL, etc), and especially read operations that read external accounts; increasing the gas cost of all of these operations to at least 500 would likely be sufficient, though care would need to be taken to avoid breaking existing contracts (eg. simultaneously implementing EIP 90 would suffice).

This would put a much lower upper bound on the maximum number of bytes that a transaction may read, increasing safety against all potential attacks of this kind, and reducing the size of Merkle proofs and hence improving security for both light clients and sharding as a side effect. At present, we are focusing on the more immediate software-level changes; however, in the long term such proposals should be discussed and contract developers should be aware that changes of this sort may take place.

profile

Vitalik Buterin

https://ethereum.org

Comments
user

Author Michael Kilday

Posted at 10:06 pm September 22, 2016.

Blessings in disguise, the earlier discovered the better. Another couple years and you all will have hardened the network quite nicely from these occurrences.

Reply
    user

    Author Jaylon Jaylon

    Posted at 4:12 am September 23, 2016.

    Hi @taoteh1221 can you upvote my comment please

    Reply
user

Author Crypto Rush

Posted at 10:19 pm September 22, 2016.

“allowing for adjustments similar to what was coordinated today to happen automatically”. So next time if attacker will spam network nodes automatically will stop transaction mining?

Reply
    user

    Author eesupreme

    Posted at 5:53 pm September 23, 2016.

    It speed reads transaction spam instead…

    Reply
user

Author oAPMo

Posted at 10:56 pm September 22, 2016.

Tried geth from ethereum wallet 0.8.2, 0.8.3 and from https://github.com/ethereum/go-ethereum/releases/tag/v1.4.12 all of them show this:

I0922 23:47:14.588592 eth/downloader/downloader.go:319] Block synchronisation started
I0922 23:48:13.344953 eth/handler.go:290] Peer 6988c51f9f5935ff [eth/63]: timed out DAO fork-check, dropping
I0922 23:48:19.631313 eth/handler.go:290] Peer 5790e3a20a64d3a1 [eth/63]: timed out DAO fork-check, dropping

Once every 5-10minutes it syncs one block. Also 0.8.3 wallet doesn’t load wallet file, shows no account, how do you make it load the wallet file ?

Reply
user

Author evily

Posted at 12:49 am September 23, 2016.

Are there any more securituy flaws?

Reply
    user

    Author Chef

    Posted at 4:01 am September 23, 2016.

    you bet there are!

    Reply
user

Author Andrey Zamovskiy

Posted at 2:08 am September 23, 2016.

Why gas limit keeps going down far below 1500000?

Reply
user

Author spiroseliot

Posted at 3:02 am September 23, 2016.

lol 😀
What a crap system you create….
Don’t worry guys. Your Scientology Jesus “Vitalik” will fix the problem until…
the next attack 😛

Reply
    user

    Author enky nakamura

    Posted at 12:45 pm September 23, 2016.

    ahah well said, i’ll never understand why all this interest in that crappy altcoin. vitalik FU

    Reply
      user

      Author spiroseliot

      Posted at 1:16 pm September 23, 2016.

      etc FTW!

      Reply
        user

        Author Crypto Rush

        Posted at 2:43 pm September 24, 2016.

        ETC uses same code and has same bugs, idiot.

        Reply
          user

          Author spiroseliot

          Posted at 12:11 am September 25, 2016.

          etc is one hard fork and two network crashes behind fool… 😛

      user

      Author Swapster_com

      Posted at 4:00 am September 24, 2016.

      Why the hate? Such immaturity, you make a fool of yourself.

      Reply
user

Author Luis Daniel Lucio Quiroz

Posted at 2:24 am September 24, 2016.

Have you guys considered memcached support to save some I/O?

Reply
user

Author Adam Byrne

Posted at 4:09 pm September 24, 2016.

Any chance you could put in plain English how to make Parity and/or Mist to work?

Would that be too much to ask?

Reply
user

Author Dunja Despot

Posted at 3:58 pm September 30, 2016.

May the Force be with you!

Reply

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

View Comments (17) ...
Navigation