Mining Pool Attack
Mining Pool Attack
Mining Pool Attack
net/publication/327471025
CITATION READS
1 1,580
4 authors, including:
Ehab Al-Shaer
University of North Carolina at Charlotte
244 PUBLICATIONS 5,412 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
Prediction of C&C Servers Based on Realtime Cyber Threat Intelligence View project
All content following this page was uploaded by Mohiuddin Ahmed on 31 October 2018.
Abstract. This paper discusses a potentially serious attack against public crypto-
currency mining pools. By deliberately introducing errors under benign miners’
names, this attack can fool the mining pool administrator into punishing any in-
nocent miner; when the top miners are punished, this attack can significantly slow
down the overall production of the mining pool. We show that an attacker needs
only a small fraction (e.g, one millionth) of the resources of a victim mining pool,
which makes this attack scheme very affordable by a less powerful competing
mining pool. We experimentally confirm the effectiveness of this attack scheme
against a few well-known mining pools such as Minergate and Slush Pool.
Keywords: crypto currency · mining pool · invalid share · DoS attack · stratum
protocol
1 Introduction
The emergence of bitcoin in 2009 [24] paves the way for many other crypto-currencies
like monero, litecoin, and etherium. Crypto-currency is the cryptographically protected
digital currency that is built upon the blockchain platform. Blockchain is like a pub-
lic ledger that keeps track of all transactions in each crypto-currency. Blockchain is
shared across all users of a specific crypto-currency. Before adding any transaction to
the blockchain, the transaction needs to be verified, which is called mining. The person
or group of people who is verifying the transaction is called miner. For the verification
of a transaction, the miner receives a reward in the form of crypto-currency where the
mining is performed.
In order to verify a transaction, miners have to solve a cryptographic puzzle. Since
the task of solving the cryptographic puzzle is computation-intensive, the more compu-
tation power a miner has, the more likely he/she can solve the puzzle. If miners follow
mining protocol honestly, they can increase their mining power in two ways: (1) solo
mining, in which a miner can buy new resources and deploy those to mine transactions,
and (2) pool mining, in which miners form a pool and share their resources to solve the
cryptographic puzzle. In pool mining, the reward is distributed among the pool members
based on their contributions. Solo mining is almost obsolete now due to the increasing
difficulty of crypto-currency mining and the emergence of task specific hardware like
ASICs. Instead, pool mining has become a more promising way of mining due to the
trade-off between revenue gain and power usage by resources.
M. Ahmed et al. 2
One important design issue of pool mining is the accurate measurement of member
contributions. To achieve this, two methods have been proposed: Proof of Work (PoW)
and Proof of Stake (PoS). PoW has been used in bitcoin system to reach consensus
on the blockchain status and to defend against double-spending attacks: each worker’s
computational power is calculated based on the shares he submits to the pool. Under
PoS, each pool member’s capability of creating the next block is proportional to the
amount of coin ages he has, and the coin age is defined as currency amount times
holding period [20,11].
The reward provided by the crypto-currency network encourages miners to increase
their mining power through illegal means, represented in multiple kinds of attacks. One
such way is hijacking benign users’ machines and using them to mine on behalf of
the attacker, e.g., botnet mining [17] and drive-by-cryptocurrency mining [4]. A second
major type of attack is DDoS [16]. There are two incentives to perform those DDoS
attacks. Firstly, slowing down the mining task of a pool through DDoS attack might
give an unfair decisive advantage to other pools to win the race for the next bundle of
crypto-currency rewarded for verifying a transaction. Secondly, delayed operation of a
pool may discourage future users to join victim pool and current users might leave the
pool for a better one.
We propose a way of indirect DDoS attack on the mining or crypto-currency pro-
tocol or implementation. Although there have been some attacks [27] using implemen-
tation or protocol vulnerability of mining and crypto-currency, no previous work used
indirect DDoS on the user and pool at the same time. Our attack is mainly focused on
PoW (Proof of Work) based pool mining.
More specifically, we propose to degrade the productivity of a target mining pool
by poisoning its members’ mining results, which causes the pool server to penalize its
benign miners. This attack is enabled by two factors: (1) a lack of miner authentication
and (2) the invalid share policy of the mining pools. The first factor allows an attacker
to submit invalid shares on behalf of a benign miner, and when the number of invalid
shares reaches certain threshold, they trigger penalty or ban of benign members of the
mining pool based on the second factor. Since the ban or penalty to benign pool mem-
bers are imposed inadvertently by the pool manager, we consider our attack technique
indirect and subtle. This attack can be employed by one mining pool to lower the ex-
pected success outlook of a competing mining pool. The essence of our attack is to turn
the invalid shares policy of mining pools against themselves.
We make the following contributions:
– We propose a novel attack scheme that can fool the mining pools into punishing their
productive members.
– We implement a prototype of attack tool that can submit a large number of invalid
shares using the Stratum protocol.
– We evaluate the effectiveness of our attack against Slush Pool and Minergate.
The rest of this paper is organized as follows. Section 2 gives technical background
information about pool-based crypo-currency mining and invalid share policy adopted
by mining pools. Section 3 describes the details of our attack method. Section 4 presents
both theoretical and empirical evaluation of our attack scheme against Minergate and
Slush Pool. Section 5 discusses possible remediation of the attack. Related work is
mentioned in Section 6, and Section 7 concludes the paper.
2 Technical Background
Most of the crypto-currencies currently available on the market are distributed and
decentralized in nature. Those crypto-currency ecosystems consist of users, miners,
blockchain, and mining pools. Users use crypto-currency in the form of transaction.
Miners verify the transaction and append the verified transaction to the publicly shared
ledger called blockchain. Miners are rewarded by the crypto-currency network for ver-
ifying each transaction, which gives them incentives.
Blockchain is a public ledger that records all of the verified transactions. Miners add
new transactions to the blockchain after verification. Verification of transaction is called
mining, which is to solve a cryptographic puzzle. The cryptographic puzzle to solve is
generating a hash that is smaller than a set value provided by the network. The set value
is called difficulty of the network. For bitcoins, this difficulty value is adjusted dynam-
ically such that blocks are generated at an average rate of one every ten minutes [1].
Different cryto-currency use different hashing algorithms. For example, bitcoin and bit-
coincash uses SHA-256 hashing algorithm, Litecoin and Dogecoin uses Scrypt hash-
ing algorithm, Dash (DASH) and CannabisCoin (CANN) uses X11 hashing algorithm,
Monero and Bytecoin uses Cryptonight algorithm and, ethereum and ethereum classic
use Ethash algorithm.
Since solving the cryptographic puzzle is a computation intensive task, it became
increasingly difficult task for solo miners to solve the puzzle. To solve this problem
mining pool has emerged. In a mining pool, all members work together to mine each
block and share their revenues when one of them mines a block. Although joining a
pool does not change a miner’s expected revenue, it decreases the variance and makes
the monthly revenues more predictable.
Popular mining pools consist of thousands of miners. For example, btc.com min-
ing pool has around 56k workers for bitcoin and around 31k workers for bitcoin cash
crypto-currency. The hashrate of this pool is 8.7 EH/s for bitcoin and 401.9 PH/s for
bitcoin cash. Here, pool hashrate is the aggregation of all workers’ hashrate. Each
worker’s hashrate is calculated based on the valid shares that he submits. For exam-
ple, if a worker submits one share of difficulty one, it means that this worker checks
2number o f trailing zeros in target value hash values to generate the valid share. Again, sub-
mitting one share of difficulty two is like submitting two shares of difficulty one.
Moreover, mining pools often offer variable share difficulty, in which the pool as-
signs share targets to miners adaptively based on their computational ability. The pur-
pose of adaptive share difficulty is to make sure that the task is neither too difficult, thus
enabling miners to prove work is done, nor too easy, thus reducing the overhead on the
pool to verify submitted shares.
The cryptographic puzzle to solve is to find a hash using data from assigned job that
is less than a provided target value. For bitcoin, the puzzle consists of a target value
and a tuple, F = (block version number || hash of previous block || root of merkle tree
|| timestamp || Nbits), here || denotes concatenation. target and all fields of tuple F
will be proved in the assigned job. Nbits is the encoded share difficulty. Extranonce2
is changed by the miners by incrementing it in addition to incrementing nonce, so that
there are more possible hashes that can be tried with a given set of transactions. Given
the target and tuple F, the miners will try to find a pair iterating over Extranonce2 and
nonce such that it satisfies the following equation
Stratum is a clear text communication protocol built over TCP/IP using JSON-RPC for-
mat [6]. Although there is no official documentation for this protocol, biticoinwiki [2]
provides details about the protocol. In this section we provide an overview of Stratum
protocol implemented by Slushpool [6] as observed in captured packets of mining in
slushpool.
Authorization of Miner After each connection subscription request, the miner authen-
ticates with the pool through a miner authorization request message in the following
format: [Mining.authorize, username, password]
Here, the username has two parts: miner’s username and worker id to authorize
multiple workers. The password field is provided in clear text, and it is optional for
most mining pools.
Submission of Shares Once a miner finds a solution that satisfies the requirement
provided in Mining.set difficulty method using all of params from Mining.notify job
assignment response and miner’s calculated nonce and extranonce2, it will send the
solution to the pool for verification and credit in the following format [Mining.submit,
user id, job id, time, nonce, extranonce2].
Here, user id is obtained from the response of Mining.authorize request, job id is
obtained from the Mining.notify response. nonce and extranonce2 is the puzzle solution
which meets the difficulty provided in Mining.set difficulty. The pool server will use
these values to reconstruct the F value mentioned in Section 2.2 and verify that Rela-
tion 1 is satisfied. The pool server will respond with a status message denoting accepted
or rejected. A share can be rejected for two reasons: stale share which is submitted too
late, and bad share which does not satisfy the difficulty requirement.
send the share difficulty and multiple new jobs to solve through mining.set difficulty and
mining.notify API. Now, the miner has to find a nonce and extranonce2 for every job it
wants to solve that will satisfy the share difficulty set by the pool server and submit it
to the pool server through mining.submit API.
3 Attack Method
In this paper, we propose a way to attack mining pools using the publicly available in-
formation about the mining pool, miners and mining APIs. This attack will decrease the
hashrate of a mining pool in two ways. First, since the pool server will have to validate
invalid shares submitted by the attacker, it will add workload to the pool server. Second,
decreasing pool hashrate will decrease the earning of the pool, which will discourage
new miners to join the pool and encourage affected miners to leave the pool. Third,
since this attack submits invalid shares on behalf of top benign miners and the pool pol-
icy imposes penalty like ban of miners or penalizing balance, which can greatly reduce
the productivity of the pool and encourage affected members of the pool to leave.
In this section, we outline steps to perform an attack on mining pools. Each step
will be elaborated in subsequent subsections. The steps as shown in Figure 2 are given
below:
1. Collect mining pool and miner information
2. Collect mining API information
3. Submit invalid shares to attack miner reputation
4. Check attack results
(a) if the pool marks the submitted shares as invalid we are successful and exit
(b) otherwise restart from step 1 by collecting new information about pool, miner
and API
In the following, we describe the details of how an attacker can collect miner ac-
count information in Section 3.1 and mining API information in Section 3.2. Then we
discuss the actual attack scheme in Section 3.3.
server addresses for each supported crypto-currency, mining pool server addresses can
be collected from the targeted pool’s website. Miner’s username and contribution to
a specific pool can be collected in two ways. First, some pools like sluspool.com and
minergate.com share information about the top contributors [25] [7] of the pool and
the corresponding user names of the miners. Second, since the communication between
the mining pool and miners happens through the Stratum protocol, a clear-text JSON
format, we can figure out the mining pool’s top contributors by traffic analysis if we
know the miner or mining pool’s address as described in [27]. For slushpool [25], the
top 100 miners contribute more than 90% hashrate of the pool. Therefore, submitting
invalid shares on behalf of these top contributors will trigger the pool policy to penal-
ize the miners, which will encourage the top miners to leave the pool. Additionally,
departure of attacked miners will drastically decrease the hashrate of the pool. For our
analysis, we used publicly available information about miners and mining pools.
Most of the mining pools follow standard API name provided by Stratum protocol [2,6].
However, some of the mining pools like Minergate [5] do not follow the standard API
name. These pools use customized API name instead. Thus, lack of standard Stratum
protocol API name calls for network traffic analysis to discover API name used by the
corresponding mining pool. To get the API name used by a specific mining pool, we
can mine in the pool using their mining application (e.g., [8,9,10]) as a benign user and
capture the network traffic of the mining application. Since Stratum is a clear text JSON
format protocol, the captured traffic will reveal the API name used by the mining pool.
In our analysis, Minergate [5] mining pool does not follow the Stratum protocol
standard [6]. However, mining as a benign user using Minergate’s mining applica-
tion [10] and capturing the mining traffic from the application reveal the API name
used by the Minergate pool server. For the subscription and authorization of miner,
Minergate’s API name is “login” wheres the standard Stratum API name is “subscribe”
and “authorize”. Captured traffic of Minergate application for miner authorization is
given below:
{"id":"1","jsonrpc":"2.0","method":"login","params":{"agent":
"MinerGateMac/6.9","login":"[email protected]", "pass":""}}
Similarly, traffic analysis of Minergate application also tells us the structure of the
JSON-RPC method to submit shares:
{"id":"2","jsonrpc":"2.0","method":"submit","params":{"id":"id
corresponding to username returned in login response", "job id":
"Job id corresponding to job returned in login response", "nonce":
"Random value", "result":"Random value"}}
After getting a victim miner’s username by the approach described in Section 3.1, our
next step is to mine badly on behalf of this miner. We cannot use the official mining
software because it is designed to mine honestly. Therefore, we have to create a special
tool that speaks the mining pool language in order to interact with the pool server but
actually does not do any real mining.
We build a tool to carry out our scheme. First we need to know the protocol to login
to the pool server, get new jobs, and submit results, including method names and the
parameters.
We obtain the above necessary information by analyzing the official mining soft-
ware (e.g., [8,9,10]). From the documentation provided by mining pools, we learn the
command line arguments needed to run the mining executable, such as the username,
mining pool address, and port number. Next, we apply the traffic analysis discussed in
Section 3.2 to learn the mining API.
Using what we learned from software analysis and traffic analysis, we can now
form the login request and submit it to the pool server using a TCP connection. In
response to the login request, the pool server returns data containing job data, job id,
target, time to live and user id corresponding to the username. At that point, the task
of a legitimate miner is to find a nonce and extranonce2 that will generate a hash of job
data concatenated with a nonce and extranonce2 that is less than the provided target. As
our goal is not to help the legitimate miner, we will not generate the hash, instead we
randomly generate a nonce, extranonce2, and the result. It is less likely to get a valid
share from random selection as getting a good share is a difficult task. Now, we submit
the random nonce, random extranonce2, and result to the pool server which will most
likely recognize it as an invalid share. We have developed a tool that can send a large
number of invalid shares to the pool server in a short period of time.
4 Evaluation
We will show that an attacker needs only a small fraction of the resources of a top miner
in order to successfully attack the top miner, i.e., to cause the mining pool administrator
to mistakenly penalize the top miner.
Since a top miner submits valid shares at a very high rate, the attacker also has
to submit invalid shares at a very high rate in order to make the percentage of invalid
shares of the top miner reach the threshold to be punished. This seems to imply that
the attacker would also need significant amount of resources, which increases the cost
of the attack and if the cost is too high, the attack would not be worth it. However, our
analysis below shows that the attacker can reach the required submission rate of invalid
shares at a much lower cost (e.g., 1 millionth of) than the top minor. This is due to the
fact that the top miner has to perform a large number of (e.g., 232 ) hashing operations
between share submissions, while the attacker does not have to.
Specifically, the same amount of resource can be used to submit invalid shares at
a much higher rate than to mine and then submit valid shares. As an illustration, let’s
consider a concrete case. Based on empirical data provided in [27], the average time for
a miner with hashrate 4096 GH/s to find a share with difficulty 1024 is
1024 ∗ 232
=1 (2)
4096 ∗ 230
seconds. In other words, such a miner can submit one (1) valid share per second.
On the other hand, suppose the network bandwidth between the miner and the pool
server is 640 Mbps or 80M bytes per second, since the average size of network packets
containing the shares is 80 bytes, a bad miner can send up to
1−0.2
0.2 ∗ 1, 000, 000 = 4, 000, 000 HNs. This means that an attacker can use much less
resource to get a benign miner punished.
Fig. 5: Account Status after Submission of 40,000 Invalid Shares for Aeon Coin
Slush Pool and us is still going on. We also contacted Minergate through its customer
service email.
6 Related Work
As [13] points out, a mining pool might be able to increase its revenue by attacking
other pools. Eyal et al. propose Selfish Mining [14], an attack against the Bitcoin mining
protocol that allows colluding miners to obtain a revenue larger than their fair share.
Mining pools have been constant targets of DDoS attacks. According to empirical
studies [16], mining pools are the second-most targeted Bitcoin service after currency
exchanges. Among 49 mining pools, 12 encountered DDoS attacks, and at least one
mining pool (Altcoin.pw) had to shut down because of DDoS attacks. However, most of
these DDoS attacks are performed actively by isolating targeted pool from other parts of
the network or making it unavailable to the pool members. Most of those DDoS attacks
can be detected using current DDoS detection tools like cloudFire since the attackers
are using the network, not the mining or crypto-currency protocol or implementation
to perform those attacks. Moreover, [18] presents a game-theoretic analysis of DDoS
attacks against bitcoin mining pools.
Most of the existing attacks [15,19,21,22,26] against mining pools are at the net-
work level, not at the protocol level. In [15,19,26], the authors discuss an eclipse attack
on bitcoin network that is at the network level. [21] proposes the fork after withholding
attack in which miner’s dilemma [13] does not hold. [12] discusses the block with-
holding attack and the corresponding attacker’s strategies based on the mining consen-
sus protocol. In [13], Eyal presents a 51% attack using 51% resources of the network,
which can be achieved using our proposed attack scheme.
7 Conclusion
8 Acknowledgement
This work is partially supported by the US National Security Agency (NSA) under
grant number H98230-17-1-0354, and the US DoD Army Research Office (ARO) under
grant number W911NF-17-1-0437. The views and conclusions contained in this paper
are those of the authors and should not be interpreted as necessarily representing the
official policies, either expressed or implied, of the United States National Security
Agency or Army Research Office. We also thank the anonymous reviewers for their
insightful comments.
References
1. Hash Rate Proof. https://slushpool.com/help/manual/hashrate-proof
2. bitcoinwiki Stratum-protocol. https://en.bitcoin.it/wiki/Stratum_mining_
protocol (2018), [Online; accessed 28-May-2018]
22. Luu, L., Saha, R., Parameshwaran, I., Saxena, P., Hobor, A.: On power splitting
games in distributed computation: The case of bitcoin pooled mining. In: 2015
IEEE 28th Computer Security Foundations Symposium. pp. 397–411 (July 2015).
https://doi.org/10.1109/CSF.2015.34
23. MinerGate: Invalid shares policy. https://minergate.com/faq/
invalid-shares-policy, [Online; accessed 05-February-2018]
24. Nakamoto, S.: Bitcoin: A peer-to-peer electronic cash system. http://bitcoin.org/
bitcoin.pdf (2008), [Online; accessed 28-May-2018]
25. Nakamoto, S.: Slushpool hashrate. https://slushpool.com/stats/?c=btc (2018),
[Online; accessed 28-May-2018]
26. Nayak, K., Kumar, S., Miller, A., Shi, E.: Stubborn mining: Generalizing selfish mining
and combining with an eclipse attack. In: 2016 IEEE European Symposium on Security and
Privacy (EuroS P). pp. 305–320 (March 2016). https://doi.org/10.1109/EuroSP.2016.32
27. Ruben Recabarren, B.C.: Hardening stratum, the bitcoin pool mining protocol. In: 1st Work-
shop on Bitcoin Research