-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[bug/fuzzing] "panic: runtime error: slice bounds out of range" when parsing SSZ #6083
Comments
Additional info (zcli): $ zcli panic_slice_out_range_prysm.ssz
cannot load input
cannot decode ssz: expected object length is larger than given bytesLen |
We are in the process of deprecating go-ssz in favor of generated ssz methods. Please prefer We should fix this panic nonetheless. Thanks for reporting |
@prestonvanloon please triage |
* Check struct offset range. Bug prysmaticlabs/prysm#6083 * add secondary check * fix build * Update types/struct.go * Update types/struct.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
The fix provided resolves only one branch of code (see line 244): and the one within the first condition's body (containing line 233 - where panic occurs), doesn't seem to check for the bounds. To reproduce (reported by @pventuzelo): package main
import (
"fmt"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
testpb "github.com/prysmaticlabs/prysm/proto/testing"
)
func DecodeTestSimpleMessageCrash() {
data := []byte("\x01\x00\x8f")
params.UseMainnetConfig()
input := &testpb.TestSimpleMessage{}
e := encoder.SszNetworkEncoder{}
if err := e.DecodeGossip(data, input); err != nil {
_ = err
return
}
return
}
func main() {
fmt.Println("prysm: Crash reproducer")
// change the following function to trigger different bugs
DecodeTestSimpleMessageCrash()
}
// Run with:
// go run main.go Error:
❗ Even if we do not fix this issue in func TestSszNetworkEncoder_EmptyMessage(t *testing.T) {
data := []byte("\x01\x00\x8f")
params.UseMainnetConfig()
input := &testpb.TestSimpleMessage{}
e := encoder.SszNetworkEncoder{}
assert.NoError(t, e.DecodeGossip(data, input))
} |
No longer using go-ssz |
🐞 Bug Report
Description
During fuzzing with beaconfuzz, I found the following bug:
panic: runtime error: slice bounds out of range
prysm go-ssz
librarySSZ
parsing withssz.Unmarshal
.🔬 Minimal Reproduction
Install:
Testing program with
Attestation
parsing:Compilation:
🔥 Error
Download:
panic_slice_out_range_prysm.zip
Run:
🌍 Your Environment
Operating System:
OS: Ubuntu 18.04
What version of Prysm are you running? (Which release)
master
The text was updated successfully, but these errors were encountered: