Skip to content

Storing Justification Allows Excess Bytes (GSR-13) #2411

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

Closed
danforbes opened this issue Mar 21, 2022 · 0 comments · Fixed by #2618
Closed

Storing Justification Allows Excess Bytes (GSR-13) #2411

danforbes opened this issue Mar 21, 2022 · 0 comments · Fixed by #2618
Assignees

Comments

@danforbes
Copy link
Contributor

danforbes commented Mar 21, 2022

Justifications are sent as raw bytes over the network which are then decoded when they are verified in VerifyBlockJustification().

They are decoded using SCALE decoding, which allows excess bytes to be appended to the end of the data being decoded.

After verification, the original bytes are stored in the block state in handleJustification().

This poses a threat, as a malicious actor may append garbage bytes to the end of the justification. These bytes will then be stored in the block state. This is an attack vector for a user who may unnecessarily fill up disk space on a node with garbage bytes.

The Substrate implementation will decode then encode the justification and store the encoded bytes to ensure excess bytes are not included. Consider taking this approach or alternatively rejecting justifications with excess bytes appended as valid nodes will not include these.

@danforbes danforbes changed the title Storing Justification Allows Excess Bytes Storing Justification Allows Excess Bytes (GSR-13) Mar 21, 2022
@edwardmack edwardmack self-assigned this Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants