# Secure and Privacy-Aware Blockchain Design: Requirements, Challenges and Solutions
## 4 Attacks and Countermeasures
### Privacy Attacks and Countermeasures  
As a complement to previous categories, we identified the most relevant privacy attacks and their countermeasures, that focus on exploiting available data to gain knowledge of privacy-sensitive information.  
* **Homogeneity attack and background knowledge attack:** Homogeneity attack discloses privacy-sensitive information and breaks privacy when all values of a quasi-identifier attribute (e.g., zip code, date of birth, and gender) are similar in a given table [114]. Background knowledge attack occurs when an adversary has a background knowledge of a quasi-identifier to reveal the user's sensitive attributes [67].
* **Countermeasures:** K-anonymity is based on quasi-identifier attributes to hide user's identity in a dataset [45] by providing at least k identical records in the data set for each quasi-identifier attribute. Thus, even if an attacker accesses the data set, he could not identify the real identity of a person due to a similar record in the data set. However, background knowledge attacks can still link outside information to disclose sensitive information. L-diversity extends k-anonymity to prevent homogeneity attack and background knowledge attack as it normalizes data distribution. It improves the diversity of user's sensitive information in the data set to achieve higher privacy. It ensures data privacy without disclosure of sensitive attributes. However, it is vulnerable to skewness and similarity attacks [67].
* **Skewness attack and similarity attack:** Skewness attack occurs when the values in the table have a non-uniform distribution, a malicious user obtains a sensitive value based on its higher frequency distribution over a subset of the data [115]. A similarity attack happens when the values of sensitive attributes are distinct but semantically similar, and the attacker uses the meaning of data to infer missing information [49].
* **Countermeasures:** The t-closeness approach [49] improves privacy by integrating k-anonymity and l-diversity. It provides protection against sensitive attribute disclosure. This approach works properly if the distance between two distributions in the table should not more than the given threshold value. It does not work properly if the distribution of sensitive values in a class is not close to the distribution of sensitive values in the overall dataset.  
* **Statistical modeling:** Such attacks are specific to blockchain implementations that use decoys to prevent transaction identification, such as Monero. Statistical modeling, coupled with a heuristic approach for decoy elimination is believed to be the attack vector CipherTrace is using to attempt to trace Monero transactions at the time of writing [116]. The accuracy of such models can be increased significantly when coupled with other privacy attacks such as blockchain poisoning.
* **Countermeasures:** Statistical modeling can be prevented with binned mixin sampling, which changes the current mixin sampling process. The idea is to combine outputs into groups of some fixed size in the Monero blockchain, called bins. Each input transaction is referencing an output transaction in a bin, either as a mixin or spend. It estimates the real spend-time distribution, and then sample mixins according to this distribution. It helps to prevent the traceability of transaction input and disclosure of mixin sampling distribution [117].  
Figure 2: Classification of attacks and countermeasures.  
As a summary, the main highlight is the diversity of attacks that blockchain-based solutions face at the network, blockchain and privacy levels. Therefore, today's solutions must combine existing techniques to guarantee reasonable protection from this diversity of potential breaches. In particular, data confidentiality, privacy, and smart contract execution are vital challenges for blockchain implementations. We discuss this further in the following section.