An attack with fake outputs from malicious node #51
Replies: 3 comments 14 replies
-
This problem is present and known in many other UTXO based DLTs, such as Bitcoin for example. One example is this attack. Bitcoin (partly) mitigates these type of attacks with SegWit transactions as per BIP-0143. It describes a commitment to the bitcoin amounts in inputs in the signature generated by the client. If the outputs used as inputs actually have different amounts, the signature of the client is invalid. The solution @lunfardo314 describes is a more generalized version of this approach, where the commitment is actually made to the raw output content. What are the implications of putting the commitment to the content of inputs:
|
Beta Was this translation helpful? Give feedback.
-
The problem you have outlined is completely correct, there is currently no commitment by the client about the data of the inputs of their transaction, hence a node supplying altered output data can have severe effects if the application is reliant on the information within the outputs. Adding the commitment as outlined would in the worst case only result in an invalid transaction. As @jorgemmsilva mentioned, appending the hash to the signing function instead of adding it to the tx should work, I believe the only thing we would lose is the ability to say straight away: "the inputs don't match" (as a step before signature verification). Would the addition of having to hash the inputs have any impact on hardware based signers? Having said that, I do not believe that adding this lifts the requirement of having clients to trust the nodes they connect to. By trust I mean not only retrieving untampered data but also valid responses of any kind for queries the client runs against the node: i.e. nodes responding with data being absent (even if it actually exists) or not pushing data (in event based clients). Also assurance of having the client's transaction disseminated requires trust for the node to do the right thing. Arguable these aren't very critical but you still would not connect to any random node to interact with the network because of them. It also is an open question whether producing invalid transactions is something a client is ok with. In most cases I presume clients do not even want to run into the risks of producing them, hence they use a trusted node in the first place. |
Beta Was this translation helpful? Give feedback.
-
I want to chime into this discussion and we are facing a very similar problem in goshimmer. For local snapshots and to detect the possible corruptions of the snapshost files by malicious actors, we are going to create cryptographic commitments in the messages that commit to the root of a merkle tree over all unspent outputs from some epochs ago (we commit to the OutputID of the existing Output). Currently, the OutputID does however only depend on the TransactionID and its index, which doesn't allow us to do any verification of the content of that Output (in regards to its OutputID). What we would essentially need is a way for the OutputID to commit not just to its "origin" (TransactionID + Index) but also to its "content/metadata". I therefore propose the following change to the way we calculate the OutputID: OutputStateCommitment = Hash(DataInOutput) OutputID = Hash(TransactionID + OutputIndex + StateCommitment) This now gives us the ability to associate the OutputID with its actual content which will not just enable validate-able local snapshots for goshimmer, but it will also prevent the attack discussed above without putting any extra effort on hardware signers for transactions (as the OutputID is provided by the node). I think this solution is much more powerful and efficient, than to put extra commitments into each Transaction that the user needs to sign. |
Beta Was this translation helpful? Give feedback.
-
An attack with fake outputs
Assumptions
The attack
Malicious public node which wallet is connected to, can easily fake the output data, while keeping genuine output IDs. Wallet has no means to check validity of it.
Specifically, mutable metadata block is not validated by the protocol, therefore it can be replaced by arbitrary data.
This feature makes it possible for the malicious node attack the L2 apps which interpret metadata field in it own way.
Examples
Naughty Eve
Alice is running an app:
love
tohate
.I love you
.1000i from Bob: I hate you
.Potential stealing of funds
If L2 wallet interprets the metadata block as a command to send funds or sender block as owner of funds, the funds can easily be stolen with this attack. This is exactly the case Stardust VM, especially if smart contract chain is run with one validator.
Proposed solution at the protocol level
In the protocol, we could require hash of all concatenated data of inputs used to produce the transaction by the wallet as a part of the transaction essence (signed).
This way the transaction will contain not only output IDs of outputs, but also commitment to the data of outputs used to produce the transaction.
The validation of transaction should be extended with checking in the validation context if hash of referenced outputs by inputs is equal to the hash included into the essence. If wallet used faked inputs, the transaction will be invalidated.
Pros
iota.go
Cons
Beta Was this translation helpful? Give feedback.
All reactions