-
Notifications
You must be signed in to change notification settings - Fork 220
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
The sender can change the script of a UTXO before submitting to the blockchain #2997
Comments
I may be misrepresenting @SWvheerden and @philipr-za on this, but their view in the discussion on #2988 is that this is not an issue, and we can allow it. Some counter points to that:
Lastly, this one is more of a gut feel, but Alice is mostly not going to be involved when this UTXO is spent. This may be years down the line and Bob may require a specific wallet to spend it. It feels wrong that Alice has the power to dictate how this UTXO can be spent when she has no interest in it, and will not be involved in that interaction. Bob's wallet that negotiates the transaction inherently knows it's capabilities, and will only choose scripts that it knows how to spend. Once the transaction is mined with an incompatible script, the process is irreversible, when this could have easily been avoided during the negotiation stage. |
My suggestion is to add a comsig field to the UTXO instead of adding beta. I don't know all of the attack vectors on bulletproofs, so I'm not sure how solid the beta approach would be. A comsig signing the script and features would prove that the owner of the blinding factor has agreed to the script that is eventually published on the blockchain and cannot falsely accuse Alice of changing the script |
I far prefer doing this using a signature meant for the job rather than the addition of Beta to the range proof as that is adding complexity to an already complex cryptographic element of a transaction where the problem is really one that a Signature should be solving. Upfront, I will say that I agree that its addition is useful as an error checking step so that the script doesn't accidentally get mangled before the Sender publishes it. I can also see how this could be part of the strategy for when Bob needs to supply parameters for the script to Alice, to project from a 3rd party changing those parameters before Alice constructs the final transaction. I do think that when we get to those more complex negotiations we will still need to implement more security around the extra rounds of communications than this but this can contribute to that. My critique of your points that follow is primarily due to the fact that I think we disagree on some fundamentals of the game theory of the interaction between a Sender and a Receiver.
I disagree with the statement that the Protocol (between sender and receiver) doesn't strictly forbid this. This has been my contention during this entire discussion that the Receiver does not trust the Sender at all and that the only when the Receiver sees the outputs, as they expect it to be, on the blockchain can they trust it. This final verification by the Receiver is very much part of the protocol! It is how it exists in our code right now and the addition of this signature doesn't remove the need for this to be part of the protocol.
Ok, you prefer this mental model of the interaction but because Bob can detect when Alice has not collaborated in good faith I don't think it changes the security levels at all.
The original addition of Beta was to solve a different problem (That Bob could alter his script after the transaction is in the mempool) so I don't feel like this is a material argument to whether this is needed in our current system.
This is the main statement that I disagree with because I feel like we are on different pages when it comes to what the two parties in this negotiation care about. Why would Bob ever suggest a script? Bob would always prefer a script with no conditions. It is not Bob that wants to apply the script to his output. It is ALICE that wants to apply a condition to her payment to Bob. An application of the proposed commitment to the script by Bob could be useful in situations where Bob needs to supply parameters to Alice for inclusion in the script (such as a Public Key or a Hash) to protect those values from being interfered with by a 3rd party. But, it is not to protect Bob from Alice! If Alice were to change one of those parameters then during the final stage of verification by Bob he will not find that output on the blockchain and so will never consider the transaction complete. If Alice wants Bob to see the transaction as successfully completed she has to include the output EXACTLY as he would expect it. If she doesn't then she has essentially burned that output with no loss to Bob. In a distributed system she cannot say "Well I paid you...with this extra condition". Bob must just not accept that as a matter of course. In fact as the system is currently built his wallet will not even be able to find that output by its hash and his wallet would not have marked the transaction as complete.
I feel this view is incorrect. Alice is the only party who cares how Bob can spend the output (other than Bob keeping track of how he can spend it). She is the only party that would ever want Bob to have anything other than a Nop. So I do see some benefits in including this change as I stated at the start of this response. I would prefer it is done as a CommSig rather than by adding a Beta to the rangeproof. My arguments have mainly been so that we can build up a shared mental model of the dynamics and threat models of the Sender and Receiver as they interact in our decentralized system. |
I agree with @philipr-za here, I think the main "problem" point here is the power play that Alice can dictate how Bob spends "his" UTXO. Which I feel is no problem as Alice is the provider of these funds, she has the final say over what conditions it can be spent. Let us consider the following examples:
In a blockchain world, the security lies in the mined transactions, and only the mined transactions. We cannot trust any transactions that are just signed. For example what if Alice sends you a perfectly normal-looking signed transaction, with everything fine, but the utxo was already spent? The only security Bob has for his transaction to know its correct is to check if it's mined. And with this check, he does not check if Alice spent her UTXO's he checked if his UTXO's are on the blockchain. He does not check the commitment, he checks the UTXO. He does not own a commitment, he owns a UTXO that contains a commitment. |
I do not believe we would gain anything using a comsig for Bob here, just adding more space to the blockchain, as the modified Bulletproof already contains the zero-knowledge proof.
In this setting knowledge about |
I think this is a flaw as well in our wallet code; identification of a UTXO should be based on the value commitment alone. This is how wallet recovery works in any case; Bulletproof rewinding only looks at the ability to open the value commitment inside a UTXO, not at the UTXOs hash. |
We can never know what the out-of-band agreement between Alice and Bob will be, which will be reflected in the script as far as possible, so it is incorrect to assume Bob would always prefer a script with no conditions. |
As the Receiver he would though. He and Alice might come to some out of band agreement on how he will receive his payment but because it is Alice's funds that are being received by him it is in her interest to apply the script. He is the one who will be spending it in the future, not her. So for him the conditions are a nuisance. The only reason he accepts the conditions on how he can spend it is because that is his deal with Alice. Can you name a scenario where Bob is the receiver only and would prefer a script on his output? I mean he will accept a payment from Alice with conditions if the alternative is not getting anything but he would still prefer no conditions. |
Examples with out-of-band agreements:
|
But this the great thing about a decentralized blockchain, you don't need out-of-band agreements. With all of the above examples, if the UTXO is not correct, then it did not happen.
As with any blockchain. Of these are only provable and we know they are correct if they are mined on the blockchain. Never before. |
@stringhandler, did the introduction of the metadata signature not close this issue, as the script Bob agrees to is signed? |
100%. |
Problem:
In the negotiation of the transaction between Alice and Bob, when Bob sends the UTXO to Alice, Alice can change the script before signing the UTXO with the script offset key.
History:
This is a continuation of a discussion on PR #2988.
In the initial version of Tari script, the script and other parts of the UTXO was included in the rangeproof as
beta
. Due to another vulnerability noted in https://gist.github.com/DavidBurkett/b2ace786c6298179607b1337c3657a78, a signature by Alice was added to the UTXO, andbeta
was removed. After it was removed, it is now possible for Alice to change the script before she signs it.Possible solutions:
The text was updated successfully, but these errors were encountered: