Mining attacks on PoRA (Proof of Random Access)
This is a crosspost with ethresear.ch/t/mining-attacks-on-pora-proof-of-random-access.
Abstract
This article analyzes the security of Proof of Random Access (PoRA) consensus mechanism against potential mining attacks. The focus is on two main attack vectors: the shrink attack, where an attacker uses cheaper or smaller storage devices with the same throughput to gain an economic advantage, and the Moore attack, where an attacker leverages advancements in technology to increase throughput while maintaining the same cost. The article examines these attacks under both unlimited and limited mining throughput scenarios and provides mathematical analysis to determine the conditions under which the attacks could be economically viable for miners.
Security model
In our security model, we consider an attacker who aims to optimize their mining procedure to gain an economic advantage over honest miners. The attacker can employ various strategies to achieve this goal:
-
Equipment replacement: The attacker may replace their storage equipment with more efficient or cost-effective alternatives. This strategy allows the attacker to maintain or increase their mining performance while reducing costs.
-
Partial fraction mining: The attacker can utilize a portion of their storage space and throughput for one client while using the remaining resources for another client. This allows the attacker to optimize their resource allocation and potentially gain an advantage by serving multiple clients simultaneously.
We will analyze two specific attack vectors:
-
Shrink attack: In this attack, the attacker replaces their storage device with a cheaper one that offers the same performance. For example, an attacker might replace a more expensive 1TiB NVMe drive with a cheaper 1TB drive that has the same throughput. This allows the attacker to reduce their storage costs while maintaining their mining performance. The key idea behind the shrink attack is that the attacker can take advantage of the fact that the consensus mechanism may not distinguish between storage devices of different sizes as long as they offer the same throughput.
-
Moore attack: This attack involves the attacker replacing their storage equipment with a newer, more advanced version that offers better performance at the same cost. For example, an attacker might replace a gen 4 storage device with a gen 5 device that has twice the throughput at the same cost. This allows the attacker to increase their mining performance without incurring additional expenses.
It is important to note that the Proof of Random Access (PoRA) consensus mechanism is well-scalable, meaning that there is no single machine limitation. This scalability allows for the possibility of using RAM rigs on tiny devices, such as single-board computers or even smartphones, to participate in the mining process. The absence of a single machine limitation opens up new opportunities for attackers to optimize their mining setups and potentially gain an advantage over honest miners.
Furthermore, the ability to perform partial fraction mining, where an attacker can allocate a portion of their storage space and throughput to one client while using the remaining resources for another client, adds another layer of complexity to the security model. This flexibility in resource allocation allows attackers to optimize their mining strategies and potentially gain an edge by serving multiple clients simultaneously.
Throughout the following sections, we will examine these attack vectors in detail, considering both unlimited and limited mining throughput scenarios. Our analysis will focus on determining the conditions under which these attacks could be economically viable for miners, and we will provide mathematical derivations to support our findings
Shrink attack
In the following sections, we consider three different attacks. The first attack assumes that the mining throughput is not limited and shows how in this case the adversary can gain advantage over honest miners by using a different hardware configuration. In the follwing two attacks, we assume that the mining throughput was limited to mitigate the first attack, but we show that new issues arise: adversary can be economically incentivised to drop some part of the stored file, and perform Moore attack using more efficient hardware than that of honest miners.
In our costs analyses we make a few reasonable assumptions about the relationship between the costs and make conservative estimates of adversary advantage.
Unlimited throughput: achieving advantage over honest miners
In this scenario, we consider the case where an attacker reduces the size of their memory module to gain an economic advantage. We make a pessimistic assumption that if the memory size is reduced by half, the maintenance cost (energy consumption) and throughput will remain the same, while the cost will be reduced by half. In reality, the energy consumption would likely be lower, but this assumption can only make our analysis more conservative.
To compare the cost efficiency of the attacker and the reference miner, we normalize the values by the cost and present them in the following table:
Cost | Maintenance | Throughput | |
---|---|---|---|
reference | 1 | 1 | |
attacker | 1 |
-
The reference miner's cost of purchasing one unit of hardware is set to 1 as a baseline; this is without loss of generality as we normalize other values with respect to this, eliminating a free variable.
-
represents the maintenance cost (energy consumption) per time unit for the reference miner, which is assumed to be close to 1 for simplicity.
-
The reference miner's throughput is also normalized to 1.
-
The attacker's cost is set to 1, assuming that one unit of attacker's hardware has the same cost as that of a reference miner. This is a conservative estimate, since one unit of attacker's hardware is assumed to be less efficient than that of a reference miner.
-
The attacker's maintenance cost is , where represents the throughput advantage of the attacker. This is because the attacker's memory size is smaller, but the energy consumption per unit of memory remains the same.
-
The attacker's throughput is , reflecting their advantage in terms of throughput per unit cost.
To compare the total cost efficiency, we calculate the throughput per unit of total cost (cost + maintenance) for both the reference miner and the attacker:
Reference miner:
Attacker:
Since when the attacker reduces the memory size, we can conclude that:
This inequality demonstrates that the attacker has a better total cost efficiency compared to the reference miner.
Therefore, the original PoRA is not resistant to shrink attacks under unlimited mining throughput conditions. The only way to protect against this vulnerability is to limit the mining rewards, which would discourage attackers from exploiting this weakness.
Limited throughput: not storing part of the file
In this scenario, we consider the case where the mining throughput is limited to an optimal value of 1, and we analyze the cost efficiency for an attacker who uses only a fraction of their memory.
Let's define the following variables:
-
: the number of random accesses
-
, assuming
-
: the efficient average number of accesses, given by
-
: the success probability, given by
-
: the slowdown of sampling, given by
-
: the sampling cost, assumed to be much smaller than 1 () to ensure that the main cost of the algorithm is not CPU PoW
We can compare the reference miner and the attacker using the following table:
Cost | Maintenance | Sampling | Throughput | |
---|---|---|---|---|
reference | 1 | 1 | ||
attacker | 1 | |||
attacker |
-
The reference miner's costs and throughput are normalized to 1.
-
The attacker's cost and throughput are scaled by when using the full memory.
-
When the attacker uses only a fraction of their memory, their cost, maintenance, and throughput are scaled by , while the sampling cost is scaled by to account for the slowdown in sampling.
For , we have , which means .
To consume all throughput, the attacker must satisfy the equation: .
For efficient mining, the following condition must be met:
Simplifying this condition, we get:
To estimate , let's consider the example of a Samsung 970 SSD with a throughput of 2GB/s, TDP of 6W, and a value size of 1MB. The hash efficiency for CPU is 30MH/J, and for ASIC, it is 3GH/J.
The additional TDP for sampling will be:
-
For CPU:
-
For ASIC:
By dividing these values by the TDP, we can roughly estimate to be in the range of to .
This means that should be greater than to to make the shrink attack inefficient, which may not be practical in real-world scenarios.
When , can take any value. For example, with a storage size of 1TB, value size of 1MB, , and , we get , which means that 100 MB of data could be forgotten while still providing economic benefits for the miner.
Limited throughput: Moore attack
When considering the Moore attack, it's important to note that miners will align their throughput to the limit imposed by the system. Let's analyze the cost efficiency of the reference miner and the attacker in this scenario.
Cost + Maintenance | Sampling | Throughput | |
---|---|---|---|
reference | 1 | 1 | |
attacker | 1 | ||
attacker |