Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash/Fuzzing] IndexError during AttesterSlashing processing #1207

Closed
pventuzelo opened this issue Jun 19, 2020 · 1 comment
Closed

[Crash/Fuzzing] IndexError during AttesterSlashing processing #1207

pventuzelo opened this issue Jun 19, 2020 · 1 comment

Comments

@pventuzelo
Copy link

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]
@tersec
Copy link
Contributor

tersec commented Jun 22, 2020

Fixed by #1214

@tersec tersec closed this as completed Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants