COTI 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 6쪽 중 3쪽

First, we introduce new data types in order to capture the fact that information of this type must be kept secret; then, we introduce new operations that can perform manipulation on secret data types without disclosing the secrets; and finally, we must take extra care on the way we manage and protect these new data type against attackers who wish to mount some sort of a replay attack. We discuss all these topics in this section. 2.6.1 gcEVM-Related Data Types Similar to other systems, all the information in the EVM sub-state, including the balance, nonce, and any- thing residing in the data structure maintained by smart contracts, is stored in atomic typed variables, namely, variables that capture a certain type of information, be it small or large, signed or unsigned integers, strings, or bytes. Let Types be the set of data types supported by the EVM. For the purpose of supporting confidentiality, we introduce a new set of data types, denoted STypes, that is analogous to Types; each data type in STypes is basically the secure version of one data type from Types. For example, we have uint8, uint16, uint32, uint64∈ Types, then their secure version are suint8, suint16, suint32, suint64∈ STypes. Generally speaking, the secure version of an EVM data type will have the same name, prepended with the letter ‘ s’ (to indicate a secret). A smart contract developer must use these types if it wishes the underlying information to remain secret. These data types in STypes are all referred as an abstract data type, called CT (for ‘ciphertext’), which is essentially a re-definition of uint256, whereas data types in Types are referred as PT (for ‘plaintext’). Looking ahead, having a ciphertext in a smart contract state, or in the memory during an execution does not necessarily mean that it is authenticated; the gcEVM must make sure that a ciphertext is authenticated before entering it into any secure computation procedure. 2Computation over a client’s private data must be under the client’s consent, a constraint we deal with in the next sections. 11 We make a distinction between secret data types that are used for security ‘at rest’, ‘in transit’, or ‘in use’. That is, while the ciphertext data type (denoted CT) are use to secure data at rest (be it the persistent storage or the volatile memory used in the course of an execution of a transaction), we use the inputtext data type (denoted IT) for protecting data in transit and the garbledtext™data type (denoted GT) for protecting data in use. Protecting data in transit means protecting the ciphertexts that a user wish to send to some smart contract function in a transaction. Specifically, the goal is that when a user incorporate some ciphertext in its trans- action, this ciphertext will be used only in the context of this transaction and cannot be re-used in other transactions (by malicious actors). For example, if a user participates in a sealed bid auction and sends a ciphertext in its transaction that hides its plaintext bid, we must prevent an adversary from copying that user’s ciphertext and submitting it as its own bid; furthermore, we must prevent an adversary from using that ciphertext in any way, so that the gcEVM will not agree to perform any secure operation on it. Protecting data in use refers to the fact that even when data is secure on storage or on memory, its security might be broken when performing some operations on it, like using it within a secure computation protocol. In the following we give a formal description of the three data types: • ciphertext (CT). This data type represents the result of a CPA-secure encryption scheme and used for securing data at rest. It is the actual datatype visible in the system’s state. Due to other security mech- anisms employed in the system, like authenticated memory and storage, and the fact that decryption is performed to ‘well formed’ ciphertexts only, we do not need to use a CCA-secure encryption scheme (the attacker does not get to choose the ciphertexts to be decrypted by the system). Formally, let Enc = ( kgen, enc, dec) be a CPA-secure encryption scheme, for a message m = ({0, 1}ℓ)∗ (i.e., the message length is a multiple of the encryption block length ℓ) we have: CT = c← enck(m) (1) where (ek, dk)← Enc.kgen(1κ)3 and κ is the computational security parameter. Looking ahead, by default, instances of CT will be the result of encryption using the system’s key, whereas some CTs will be the result of encryption using a client’s key. The encryption scheme we use is AES128 in the counter mode (CTR), thus, for a message m = m1∥m1| . . . (with|mi| = 128) the encryption result is c = c0∥c1∥ . . . where c0 = r, ci = AES128k(r+ i)⊕ mi, and r is chosen uniformly at random. CTR mode is advantageous as it allows a random ac- cess to a specific slot in the plaintext, and it only performs a forward evaluation of the underlying PRF (AES). • inputtext ( IT). This data type is a wrapper of CT only used to infiltrated data to the gcEVM from the outside world. The role of IT is to make sure that the wrapped CT is used only for the purpose it is intended to by the user who sent it. An IT may be formed of an authenticated encryption (e.g., using the encrypt-then-authenticate approach) or a signcryption; 4 in both cases the associated data being authenticated must contain the identities of the sender and the receiver. The gcEVM inherits the transaction format from the EVM and so every message is already signed, and the signature is applied on those identities, as required. The sender’s identity (which is the user) is extracted from 3Since we use a symmetric encryption scheme we have k = ek = dk, but asymmetric schemes may be used in the same way 4See [KL20] for a discussion about authenticated encryption and signcryption, and [ BSW06, SPW07] for a signatures with strong security; in [BMP22] they argue that ECDSA has strong security (also called enhanced unforgeability). 12 the signature itself, while the receiver’s identity is combined of the contract address and the function within that contract to be invoked. The above suggests that IT can be in the exact same format as CT, however, there are subtleties that require us taking some extra care. Specifically, instead of fully relying on the signature on the transaction as a whole, we ask the user to individually sign each CT (as well as the identities). This is important for security at least for the support of view functions in a setting of a single gcEVM node (i.e., the entire system consists of a single node). Since invocation of view functions do not trigger the verification of a signature on the transaction (in fact, calls to view functions do not have to be signed at all), it means that an attacker may ‘steal’ an honest user’s ciphertext: the attacker’s contract will have a function like leakData(CT c, address sender) , which onboards the ciphertext c to the system’s memory using the sender’s key, and then decrypts it, so that the plaintext hidden by c is revealed to everyone (and to the attacker in particular). The attacker now takes some ciphertext c sent to the gcEVM earlier by an honest user of address user_addr, and calls the above function with leakData(c, user_addr) , which reveals the value that the honest user intended to keep private. Signing each ciphertext individually prevent such an attacks. Then, we formalize an inputtext as follows. Let ctm be a ciphertext for message m and let Sig = (kgen, sign, verify) be an unforgeable signature scheme; the inputtext format for m is: IT = (ctm, σ) = ( ctm, signsk(d∥ctm)) (2) where (sk, vk)← Sig.kgen(1κ), κ is the computational security parameter, and d encapsulates the identities, namely, d = user_addr∥contract_addr∥func. (3) Given IT = ( ct, σ), before the gcEVM agrees to work with ct it must first check the identity of the sender and then decrypt ct using that sender’s key. Specifically, this is done by: m = { deck(c) if verifypk(d∥c, σ) = 1 ⊥ otherwise (4) We instantiate Sig with the ECDSA scheme over secp256k1. • garbledtext™(GT). This datatype is used to securely handle data while in use. Unlike inputtext and ciphertext, garbledtext is in a form that is readily available for manipulation (e.g., making arithmetics over the plaintext it hides) which is made inside the garbled execution environment (see below). 5 Using a binary-projective implementation of a garbling scheme the garbledtext version of a message m = (m1, . . . , mℓ) where mi∈{ 0, 1}, is gt of type GT, such that gt = L1, . . . ,Lℓ (5) where Lℓ is a κ-bit label (typically κ = 128 ). Overall, a garbled-text expands the underlying data by a factor of κ. This expansion has no effect on the long-term storage requirement of the system, as the lifetime of garbledtexts is short (it is only valid during the execution time of a transaction). The garbledtexts themselves are not utilized by smart contracts and are not appear in their raw form in the gcEVM memory or storage, instead, their handles are being used, where a handle of a garbledtext is 5We note that in FHE-based solutions there is no distinction in the representation of hidden data at rest and in use. 13 simply a hash on the list of its labels; namely, hgt = H(gt) is the handle of gt, where H is a hash function. We instantiate H by Keccak, which is a collision resistant hash function, therefore, the probability of two garbledtexts having the same handle is negligible. The nodes who take part in evaluation or verification of garbled circuits do obtain the raw representa- tion of garbledtext (the labels). Those nodes store a map of the form hgt→ gt; whenever a secure operation is invoked on garbledtext(s) the evaluation nodes perform the actual computation, which mostly results with another garbledtext, whereas verification nodes have the result of the computation and verify its correctness. The fact that evaluation nodes obtain the raw form of garbledtexts forces the protocol design to assume the worst-case scenario, that the attacker obtains them too (e.g., an attacker who corrupts an evaluation node). Thus, the system must protect itself from theft of garbledtexts . For example, suppose that a corrupted evaluation node knows that gt is a garbledtext result of some secure operation in the next block, then it may inject hgt to a function of some contract in the next block, such that the function performs decryption of that garbledtext. Fortunately, the garbling scheme ensures that all garbledtexts are unpredictable and are only known to the evaluation nodes at the moment of evaluation and never before. 2.6.2 The gcEVM Data-Flow Before delving into technical details, let us describe the data-flow at a high level, which is also depicted in Figure 1. In order to preserve security in the course of the execution, the network and the users maintain multiple keys: • Network key : nk is the network symmetric key. This key is being distributively generated on the network’s startup (via a key-generation protocol) which results with a key share nki to MPC node number i. A refresh protocol is applied to the network key, which results with a new key share nk′i to the nodes, but the secret key nk itself remains the same; such mechanism is intended to protect from adaptive adversaries, who can corrupt a dynamic subset of the parties at every given moment, and thwart accumulation of their power. In addition, a re-generation of the network key would take place from time to tiem, according to the network’s policy (e.g., upon accumulation of additional 20% of staked funds); this re-generation protocol would generate a new network key nk∗ and re-encrypt all ciphertexts under this new one. • User key: Apart from the secret signing key that users usually maintain in their wallet, the user has a symmetric key uk with which it enters new data to the network. Like the network key nk, the user key uk is distributively generated and is secret shared among the network nodes (so node number i holds share uki). Thus, when a new data is to be entered (e.g., to a function of a smart contract) the user encrypts it and the function asks to decrypt and use it. As will be shortly explained, such a decryption does not reveal the plaintext to the function (or in public in any way), rather, it transform the data into a garbledtext, which enables the function to securely operate on it. • Key-retrieval key: This is a public-key that is generated by a user in order to retrieve its symmetric key from the network. This is done by a generation of asymmetric encryption and decryption keys ek, dk by the user, and submitting ek to the network (via a transaction). Upon receiving the encryption key ek, the network encrypts the user’s symmetric key uk under the temporary public encryption key ek, 14 and returns the encryption result to the user. The user then uses the secret decryption key dk to decrypt that message and obtain the symmetric key uk that is also maintained by the network. The user can now use uk in order to enter encrypted data to the network. The network maintains its own symmetric encryption key as well as a symmetric encryption key for every user that wants to benefit from data privacy in the system. In contrast to a signature key-pair, which is generated at the user and can be used without any on-boarding process, the encryption key for each user is generated by the network and can be used by the user only after on-boarding, which entails a simple query to the system to generate its key (or to retrieve it if it already exists) via the key-retrieval key. Note that the key may be generated prior to the user’s query, in cases a smart contract already performed an encryption toward that user (meaning that the smart contract decided that some information should be decipherable by that user only). For a user to bring encrypted data to the gcEVM, it has to encrypt it using its own symmetric key, and sign it using its own signing key. These two form an inputtext (as detailed above). Once this inputtext reaches a function of a contract, the function first has to verify its authenticity and that the inputtext has landed where the sender (user) really intended it to land; the result of a successful verification will be a garbledtext that is ready to work with (it can serve as an input for secure operations) inside the garbled execution environment (GEE). The verification procedure is according to Equation 4 above. The above is one path to the GEE; a second path to the GEE would be to ‘onboard’ a ciphertext, which turns a ciphertext into a garbledtext (both hiding the same plaintext). Ciphertexts reside in the state of each contract and ‘belong’ to the contract where they reside, meaning that a function on one contract cannot request the onboarding of a ciphertext in another contract, which is critical for the security and privacy of users’ data. Figure 1: Transition between data types. 15 2.7 Authentic Memory and Storage It is crucial to ensure the authenticity of all three data types within the operation of the network, safeguarding them against any potential malicious manipulation. Given the transparency of the blockchain, inputtext and ciphertext are susceptible to malicious copying or unauthorized acquisition. Contrarily, we argue that garbledtexts cannot be predicted, copied or obtained outside the transaction’s execution. Generally speaking, the challenge of protecting private data in the context of blockchains mostly deals with ensuring an adequate and tight access control to those ciphertexts. The use of the plaintext behind an inputtext or a ciphertext must be permitted only if this usage complies with the intentions of the contract that is owning or receiving them, and the users who contributed those inputtexts. In a high level, the system employs three types of protection mechanisms: authenticated storage, authenti- cated memory and garbled execution environment (GEE™): • Authenticated storage protects ciphertexts ‘at rest’; each ciphertext is associated with one or more contract addresses in a way that permits onboarding of the ciphertext only in the execution of those contracts; this means that copying a ciphertext from one contract to another is futile. By copying a ciphertext ct we mean either hardcoding the content of ct into another contract, or transmitting it within a transaction as an argument. • Authenticated memory is the vehicle between the storage and the execution environment. The function first loads the ciphertext from storage into the execution environment memory, from which it may turn into a garbledtext. On the other way around, to store the plaintext value behind a garbledtext to storage, it has to be offboarded first into a ciphertext that resides in memory, from which it is actually stored in the storage. • Ciphertexts cannot be transferred between contracts, which means it is useless to pass a ciphertext as an argument between different contracts. The way to pass private information between contracts is for the caller contract to turn the ciphertext into a garbledtext first, which puts it in the garbled execution environment, and then pass the garbledtext to the callee contract, this way, the garbledtext is available for secure manipulation by the caller as well. Garbledtexts are protected by the fact that they are random and unpredictable values generated ‘on-the-fly’. Authenticated Memory & Storage. Memory refers to the EVM run-time memory, which is stack-based, and storage refers to the EVM persistent storage, which is maintained per address. Recall that only contracts’ addresses (i.e., to exclude EOA addresses) are associated with actual storage, whereas EOAs are associated with the their balance and nonce only. For a function to perform some computation on a state variable, it has to first load it from the contract’s storage and to know its exact location in the storage. To do that, the function provides the variable’s location loc to the sload opcode, which triggers the EVM to execute it and push the variable’s content to the memory stack.6 On the other way around, for a function to persistently save some value into some state variable, it provides the location loc of that variable as well as the value to the sstore opcode. The EVM keeps track of the depth of the execution, that is, when an EOA calls some function func1 on a certain contract contract1, the execution of func1 begins at depth = 1 ; if that function calls function, say func2, on another contract, say contract2, then depth changes to 2 (and changes back to 1 when func2 returns to func1), and so on. Note that function calls within the same contract do not change depth. 6Location is also known as ‘key’ in the context of the EVM storage, as the storage is simply a key-value store. 16 The gcEVM provides an extension to the ‘normal’ EVM memory and storage operation described above, which we call authenticated memory and authenticated storage. The authenticated memory maintains a map of the form µ : N→ CT∗, that is, for each execution depth the map maintains all authenticated ciphertexts for that depth. To check whether a ciphertext ct is authenticated for depth d, we check if ct∈ µ(d). In our context, a ciphertext may arrive in memory by either loading it from storage via the sload opcode or as a result of the Offboard mechanism (which, given a garbledtext, returns a ciphertext). Authenticated storage is maintained in a per-contract basis; each contract, say on address addr, is asso- ciated with another contract at address addr′ that contains only storage (and no bytecode). The relation between addr and addr′ must be one-to-one, so that a malicious entity would not be able to associate an- other address addr′′ to neither addr or addr′. The associated contract at addr′ forms the authenticated storage of the contract at addr; this authenticated storage is only accessible from the EVM and not by the contract developer. If a valid ciphertext ct resides at location loc of the storage of address
프로젝트로 돌아가기