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

[BFT Testing] implements wintermute attack orchestrator #2291

Merged
merged 95 commits into from
Apr 26, 2022

Conversation

yhassanzadeh13
Copy link
Contributor

@yhassanzadeh13 yhassanzadeh13 commented Apr 11, 2022

Implements Wintermute attack orchestrator. The orchestrator takes control of a subset of corrupted execution and verification nodes, and performs the following attack logic:

  • Orchestrator corrupts the result of the first incoming execution receipt from any of the corrupted execution node.
  • The orchestrator sends the corrupted execution result to all corrupted execution nodes.
  • If Orchestrator receives any chunk data pack request for a corrupted chunk from a corrupted verification node, it replies it with attestation for that chunk.
  • If Orchestrator receives any chunk data pack response from a corrupted execution node to an honest verification node, it drops the response if it is for one of the corrupted chunks.
  • Any other incoming messages to the orchestrator are passed through, i.e., are sent as they are in the original Flow network without any tampering.

gomisha and others added 30 commits March 10, 2022 10:56
…_CorruptSingleExecutionResult() so it passes but needs assertions
@yhassanzadeh13 yhassanzadeh13 marked this pull request as ready for review April 14, 2022 00:04
@yhassanzadeh13 yhassanzadeh13 requested review from peterargue and removed request for vishalchangrani and ramtinms April 14, 2022 00:06
@yhassanzadeh13 yhassanzadeh13 requested a review from gomisha April 19, 2022 15:24
@gomisha gomisha requested a review from AlexHentschel April 19, 2022 21:14
@AlexHentschel
Copy link
Member

AlexHentschel commented Apr 21, 2022

I am not sure, though I feel there might be a bit of an imprecision in the terminology here:

  • Here, you define that CorruptedId is the Identifier of a conduit:
    CorruptedId flow.Identifier // identifier of corrupted conduit
    • Presumably, a single node generally has multiple conduits (one conduit per channel?). So for a single node ID, there should be multiple CorruptedId
  • However, I feel there is a conflicting definition in other places in the code:
    corruptedIds flow.IdentifierList // identifier of corrupted nodes.

    Here, we specifically have the Identifiers of the corrupted nodes, and then ask, whether the ID of a particular conduit is part of this list:
    ok := o.corruptedIds.Contains(receiptEvent.CorruptedId)

In short, I feel the code (or documentation?) is conflating conduits and nodes Identifiers.

@gomisha response:
Each corrupted conduit is uniquely identified by 1) corrupted node ID and 2) channel. There is no such thing as the ID of a corrupted conduit.
I have updated the code and comments to clarify this by changing all reference to corruptedId to corruptedNodeId

a235c6a

Copy link
Member

@AlexHentschel AlexHentschel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Mostly focused my efforts on reviewing the attack logic. Its very cool to see that we can encode the entire attack logic for Wintermute in the relatively compact wintermute/attackOrchestrator.go 👏

Most of my comments are w.r.t. documentation. While the flow is coarsely described, I feel we gloss over some important details thereby introducing imprecision and ambiguity that might mislead engineers trying to understand the code. I tried to give detailed explanations in my comments where I think the lack of precision might be misleading.
Overall, very nice work. Thanks.

insecure/wintermute/attackOrchestrator.go Outdated Show resolved Hide resolved
insecure/wintermute/attackOrchestrator.go Show resolved Hide resolved
insecure/wintermute/attackOrchestrator.go Outdated Show resolved Hide resolved
insecure/wintermute/attackOrchestrator.go Outdated Show resolved Hide resolved
insecure/wintermute/attackOrchestrator.go Outdated Show resolved Hide resolved
Copy link
Contributor

@gomisha gomisha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed all PR review comments

@gomisha gomisha merged commit fdcb6b3 into master Apr 26, 2022
@gomisha gomisha deleted the yahya/6211-wintermute-attack branch April 26, 2022 17:11
szegedim pushed a commit to GetElastech/flow-go that referenced this pull request Apr 27, 2022
* BFT Testing - Wintermute - minor clean up

* BFT Testing - Wintermute - more clean up, prep for VN tests

* refactors test for corrupted en to span scenario

* encapsulates corruption logic of execution receipts in a method

* renames part of complete execution result fixture

* implements corruption logic for wintermute attacker

* implements test covering corruption logic for wintermute orchestrator

* implements bounce-back logic

* wip adds event sanity check

* fixes single exeuction receipt test

* refactors corrupted receipt with result

* adds wintermute sanity check for execution results

* fixes and adds documentation to orchestrator output sanity check

* removes debug printing off orchestrator

* implements distinct execution receipt fixture

* re-organizes test with fixtures

* adds comment

* adds receipts with same result fixture

* adds comment for distinct result test

* adds test for the same result

* adds attack state

* refactors attack state

* integrates attack state with orchestrator

* adds sanity check to test fixtures

* makes code more dry

* adds multiple receipts with same result fixture

* adds a comment

* adds a comment

* adds test for multiple receipts

* adds count to receipts with distinct result

* fixes broken tests

* adds test multiple concurrent receipts with distinct results

* fixes a method receivier

* cleans up tests

* implements pre-attack and post-attack scenarios

* encapsulates corrupting execution receipts

* refactors with post attack func

* refactors with post attack func

* adds chunk data request sanity check

* implements chunk data pack request for receipts

* adds pre-attack request response test

* adds chunk index map

* adds responding with attestation for corrupted chunk

* adds corrupted chunk request test

* adds more constraints to the test

* fixes a bug

* toughen up parameters of test

* adds a comment

* adds test for bouncing back

* adds handle chunk data pack response

* adds godoc

* adds godoc

* adds a fatal level log

* adds chunkDataPackResponseForReceipts

* adds TestBouncingBackChunkDataResponse_NoAttack

* adds TestBouncingBackChunkDataResponse_WithAttack

* refactors a test

* refactors a test

* adds TestWintermuteChunkResponseForCorruptedChunks

* moves chunkDataPackRequestForReceipts

* fixes a typo

* fixes lint

* adds protocol to string

* simplifies tests

* adds more cleanup

* fixes the tests

* refactors out chunk index map

* refactors corrupted identifier list

* adds more logging

* refactors comments

* renames to pass through

* clarified explanation of corrupted chunk data pack request

* clarified docs of HandleEventFromCorruptedNode()

Co-authored-by: Alexander Hentschel <alex.hentschel@axiomzen.co>

* updated docs to clarify wintermute behavior, using pass-through term instead of bounce-back

* clarified comments about passing through event for handleChunkDataPackResponseEvent()

* updated docs for handleChunkDataPackRequestEvent() when passing through chunk data request unaltered

* renamed corruptedIds to corruptedNodeIds to remove ambiguity

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>
Co-authored-by: Alexander Hentschel <alex.hentschel@axiomzen.co>
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 this pull request may close these issues.

4 participants