#37246 [BC-Low] lodestar snappy checksum issue
Submitted on Nov 29th 2024 at 22:23:56 UTC by @gln for Attackathon | Ethereum Protocol
Report ID: #37246
Report Type: Blockchain/DLT
Report severity: Low
Target: https://github.com/chainsafe/lodestar
Impacts:
Unintended permanent chain split affecting greater than or equal to 25% of the network, requiring hard fork (network partition requiring hard fork)
Description
Brief/Intro
Lodestar does not verify checksum in snappy framing uncompressed chunks.
Vulnerability Details
In Req/Resp protocol the messages are encoded by using ssz_snappy encoding, which is a snappy framing compression over ssz encoded message.
In snappy framing format there are uncompressed chunks, each such chunk is prefixed with a checksum.
Let's see how golang implementation parses such chunks - https://github.com/golang/snappy/blob/master/decode.go#L176
As you can see, if checksum is incorrect, decoder fails and returns error.
Now let's look at lodestar decoder https://github.com/ChainSafe/lodestar/blob/unstable/packages/reqresp/src/encodingStrategies/sszSnappy/snappyFrames/uncompress.ts#L17
As you can see, checksum is not verified, bytes are appended to 'result'
Impact Details
Faulty nodes may trigger chain stall by sending p2p messages with incorrect checksum. Such messages will be parsed by lodestar clients by will be rejected by another implementations.
Link to Proof of Concept
https://gist.github.com/gln7/aab55674431b1c8d42a59ccf9d7cbf60
Proof of Concept
Proof of Concept
How to reproduce:
get poc via gist link and run it:
Was this helpful?