Skip to content
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] A malicious validator can broadcast invalid BatchCertificate or Propose that cause other validators stack overflow #2935

Open
feezybabee opened this issue Dec 20, 2023 · 5 comments · May be fixed by #2956
Labels
bug Incorrect or unexpected behavior

Comments

@feezybabee
Copy link

https://hackerone.com/reports/2279584

Summary:

The Primary recursively fetch certificates from other peer upon receiving new Propose and BatchCertificate . Although it will check the certificate before storing into db, the check is at end of the recursion.

A malicious validator can create fake certificate that contains other fake certificate at the same round. Then the recursion will never ends and lead to stack overflow. The call stack will be like this:

sync_with_certificate_from_peer
    sync_with_batch_header_from_peer
        sync_with_certificate_from_peer
             ....

The attacker can crash all other validator in this way.

Steps To Reproduce:

See the commit: Gooong@3e7c686

  1. Clone the repo above
  2. Run ./devnet.sh
  3. Wait round 5
  4. Check the log and we will find some node crashed: fatal runtime error: stack overflow

Proof-of-Concept (PoC)

How this bug can be exploited:

The attacker just broadcast fake certificate. This will cause all other validator continously crash and shutdown the network.

Supporting Material/References:

See the attachment

Impact

Cause validators crash and shutdown the network.

Fix suggestions:

Strictly check certificate before the recursion.

@feezybabee feezybabee added the bug Incorrect or unexpected behavior label Dec 20, 2023
@feezybabee
Copy link
Author

Is this a duplicate of https://github.com/AleoHQ/snarkOS/issues/2883?

@niklaslong
Copy link
Collaborator

This is a different, #2883 is mostly about deserialisation, here the root cause is recursively fetching certificates from peers.

@niklaslong niklaslong self-assigned this Dec 21, 2023
@niklaslong
Copy link
Collaborator

I haven't yet been able to reproduce this bug with a single malicious validator in a cluster of 4. @feezybabee, were you running 4 malicious nodes at the same time?

@randomsleep
Copy link
Contributor

I can reproduce it with a single malicious validator in 4 nodes. @niklaslong Make sure to start the malicious validator before round 5. Also, use the same snarkOS version.

@niklaslong
Copy link
Collaborator

Reproduced, looking at a fix now.

@joske joske linked a pull request Dec 27, 2023 that will close this issue
@niklaslong niklaslong removed their assignment Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants