Missing specification logic
The Lodestar beacon node does not enforce the consensus-layer limit on the number of KZG commitments per block. An attacker could submit a block with more blobs than MAX_BLOBS_PER_BLOCK, and the client would not reject it as the specification requires.
- Disclosed after under an hour
#37568 [BC-Insight] missing specification logic
#37568 [BC-Insight] Missing Specification Logic
Submitted on Dec 9th 2024 at 10:53:20 UTC by @Pig46940 for Attackathon | Ethereum Protocol
- Report ID: #37568
- Report Type: Blockchain/DLT
- Report severity: Insight
- Target: https://github.com/chainsafe/lodestar
- Impacts:
- (Specifications) A bug in specifications with no direct impact on client implementations
Description
Brief/Intro
Lacking the logic which the length of KZG commitments is less than or equal to the limitation defined in Consensus Layer
Vulnerability Details
Lacking the logic of the following.
The type of the payload of this topic changes to the (modified) SignedBeaconBlock found in Deneb.
[Modified in Deneb:EIP4844]
New validation:
[REJECT] The length of KZG commitments is less than or equal to the limitation defined in Consensus Layer -- i.e. validate that len(body.signed_beacon_block.message.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK
Impact Details
A bug in specifications with no direct impact on client implementations
References
Specs
https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/p2p-interface.md#beacon\\_block
Codes
- https://github.com/ChainSafe/lodestar/blob/dad9037e7739d5bcbccfe627e715ef40e9ba935b/packages/beacon-node/src/chain/blocks/verifyBlock.ts
- https://github.com/ChainSafe/lodestar/blob/dad9037e7739d5bcbccfe627e715ef40e9ba935b/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts
Proof of Concept
Proof of Concept
To adhere to the specification, you would need an explicit check like:
if (numBlobs > MAX_BLOBS_PER_BLOCK) {
throw new BlockError(block0, {
code: BlockErrorCode.INVALID_BLOB_COUNT,
error: new Error(Block contains ${numBlobs} blobs, exceeding MAX_BLOBS_PER_BLOCK=${MAX_BLOBS_PER_BLOCK}),
});
}
While the code references and interacts with blobKzgCommitments, it does not implement the specification's requirement to validate the blob count against MAX_BLOBS_PER_BLOCK. Adding the explicit validation step is necessary to ensure compliance.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the block verification code reads the KZG commitments but never compares their count to MAX_BLOBS_PER_BLOCK.
Impact
A bug in specifications with no direct impact on client implementations, though the client would accept blocks that violate the consensus rule.
What the attacker needed
None
The fix
An explicit check should be added that throws an error when the number of blobs exceeds MAX_BLOBS_PER_BLOCK.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A beacon node is software that follows Ethereum's consensus rules. The rules say a block may contain only a limited number of blob commitments, but this client never checks that limit. So a block with too many blobs would be accepted instead of rejected.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.