Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.
This repository was archived by the owner on May 26, 2023. It is now read-only.

usmannk - p2p signatures are not unique per chain #125

@github-actions

Description

@github-actions

usmannk

medium

p2p signatures are not unique per chain

Summary

Signed L2 blocks can be gossiped on the p2p network for any chain.

Vulnerability Detail

Signed L2 blocks are meant to use the L2 Chain ID to create p2p signatures unique to each chain.

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/op-node/rollup/types.go#L44-L45

However, the actual signing code clobbers the chain ID section with the payload hash

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/op-node/p2p/signer.go#L26-L39

msgInput[32:64] is filled with the chain ID and then immediately overwritten. The intended behavior is described in a comment on line 35.

Impact

Blocks signed for one chain id can be injected into the p2p pool on another, where nodes will ingest and attempt to append them to the chain. This will generally fail due to block number or parent root hash mismatch, but causes unnecessary network load and is a DoS vector.

Code Snippet

Tool used

Manual Review

Recommendation

Fix the SigningHash function such that the payload hash is placed into the third 32 bytes of msgInput.

Duplicate of #67

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelEscalation ResolvedThis issue's escalations have been approved/rejectedRewardA payout will be made for this issueSpecificationAn issue related to the specification (low severity)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions