[bug/fuzzing] "panic: runtime error: nil pointer dereference" when processing ProposerSlashing #6127
Labels
Bug
Something isn't working
Fuzz
Anything fuzz testing related!
Good First Issue
Good for newcomers
Help Wanted
Extra attention is needed
🐞 Bug Report
Description
During fuzzing with beaconfuzz, I found the following bug:
what:
panic: runtime error: invalid memory address or nil pointer dereference
where: in
prysm
how: triggered during
ProposerSlashing
processing.The bug is happening mainly in
VerifyProposerSlashing
function.Here is some supposition:
prysm/beacon-chain/core/blocks/block_operations.go
Lines 426 to 432 in a0bf8cb
proposer
will benil
after the call toValidatorAtIndexReadOnly
IsSlashableValidatorUsingTrie
is called with proposerprysm/beacon-chain/core/helpers/validators.go
Lines 50 to 51 in 9a11574
IsSlashableValidatorUsingTrie
will executeval.Slashed()
(val
==proposer
)prysm/beacon-chain/state/getters.go
Lines 76 to 79 in 6a9112b
Slashed
try to dereferencev.validator
without having verify thatv
andv.validator
are notnil
🔥 Error
Download: panic_nil_deref_prysm_proposer.zip
🔬 Minimal Reproduction
I can only reproduce the bug running my fuzzer with the previous crashing ssz file.
Maybe you will succeed to reproduce with your fuzzers as well.
Fuzzing function:
I have nevertheless fix the bug (with the following patch) and the fuzzer is not crashing anymore.
Patch
A simple fix consist to check if
v
andv.validator
arenil
like inWithdrawableEpoch()
andExitEpoch()
functions.instead of:
prysm/beacon-chain/state/getters.go
Lines 77 to 79 in 6a9112b
🌍 Your Environment
Operating System:
OS: Ubuntu 18.04
Go: Go 1.14
What version of Prysm are you running? (Which release)
master
commit: d152b48
The text was updated successfully, but these errors were encountered: