Skip to content

[Crash/Fuzzing] IndexError during AttesterSlashing processing #1207

Closed
@pventuzelo

Description

@pventuzelo

During fuzzing with beacon-fuzz, I triggered an IndexError during AttesterSlashing processing with mainnet preset.

Error: unhandled exception: index 6368 not in 0 .. 255 [IndexError]

Reproducing

Download: indexError_AttesterSlashing_nimbus.zip

branch: devel
commit: 089b365

Debug program:

import
  confutils, os, strutils, chronicles, json_serialization,
  ../beacon_chain/spec/crypto,
  ../beacon_chain/spec/datatypes,
  ../beacon_chain/spec/digest,
  ../beacon_chain/spec/validator,
  ../beacon_chain/spec/beaconstate,
  ../beacon_chain/spec/state_transition_block,
  ../beacon_chain/ssz,
  ../beacon_chain/extras,
  ../beacon_chain/state_transition,
  ../beacon_chain/eth2_discovery

cli do(beacon: string, container: string):
  try :
    var b = SSZ.loadFile(beacon, BeaconState)
    var c = SSZ.loadFile(container, AttesterSlashing)
    var cache = get_empty_per_epoch_cache()
    discard process_attester_slashing(b, c, {}, cache)
  except SSZError:
    quit 1
  quit 0

I have replace the code inside ncli_pretty to reuse makefile and run the following:

$ make ncli_pretty
# or ./env.sh nim c -d:const_preset=mainnet ncli/ncli_pretty

$ cd ncli

$ ./ncli_pretty --beacon=38542f2a6666ae61361a7d8249eb0a55.ssz --container=indexError_AttesterSlashing_nimbus.ssz 
Traceback (most recent call last, using override)
/nim-beacon-chain/vendor/nim-confutils/confutils.nim(981) confutils
/nim-beacon-chain/ncli/ncli_pretty.nim(24) CLI
/nim-beacon-chain/vendor/nimbus-build-system/vendor/Nim/lib/system/excpt.nim(407) reportUnhandledError
/nim-beacon-chain/vendor/nimbus-build-system/vendor/Nim/lib/system/excpt.nim(358) reportUnhandledErrorAux
Error: unhandled exception: index 6368 not in 0 .. 255 [IndexError]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions