create account

More Info About How @supercomputing Was Dominating The Mining Queue by abit

View this thread on: hive.blogpeakd.comecency.com
· @abit ·
$454.92
More Info About How @supercomputing Was Dominating The Mining Queue
@arhag wrote a [post](https://steemit.com/steem/@arhag/how-supercomputing-was-able-to-dominate-the-mining-queue-and-how-the-bug-was-fixed) described how @supercomputing was able to dominate the mining queue before hard fork 13.

Here is the old algorithm described in @arhag's post:
```
1) hash1     = SHA256(latest_block_id)

2) hash2     = hash1 except for the first 64-bits replaced by some nonce (basically some random number selected to try to make the final work value have a sufficient number of leading 0 bits)

3) input     = SHA256(hash2)

4) sig       = ECDSA signature (in 65-byte format) of input using d (the active private key) and k (which is just another nonce used for signing)

5) sig_hash  = SHA256(sig)

6) pubkey    = Recover public key (33-byte format) corresponding to the private key that would have signed sig_hash with signature sig

7) work      = SHA256(pubkey)

work must have sufficient number of leading 0 bits matching the current mining difficulty target
```

In the post @arhag described:
> ... quickly (within a millisecond) calculate the corresponding private key necessary to make the new PoW valid according to the mining algorithm ... With the appropriate active private key `d` computed, the attacker can then change their account's active public key to the one corresponding to the private key ...

But there is a hole in the description, because the private key of a given signature shouldn't be so quickly to be resolved -- it's the nature of ECC algo.

**Actually, with the old algorithm, to submit a PoW, an attacker doesn't need to know the private key.**

When an attacker got an `input` with latest `head_block_id` and whatever `nounce` in step 3), and if she already have a known will-work `sig` in step 4), she can simply **recover** the public key (which is needed to put into the PoW operation) with the same method used in step 6). In addition, because a transaction contains only a PoW operation requires no signature (which is another hole in the old algo which got fixed in new algo),  the PoW will be accepted by other nodes.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 70 others
properties (23)
authorabit
permlinkmore-info-about-how-supercomputing-was-dominating-the-mining-queue
categorysteem
json_metadata{"tags":["steem","security","mining"],"users":["arhag","supercomputing"],"links":["https://steemit.com/steem/@arhag/how-supercomputing-was-able-to-dominate-the-mining-queue-and-how-the-bug-was-fixed"]}
created2016-08-17 19:12:09
last_update2016-08-17 19:12:09
depth0
children13
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value355.116 HBD
curator_payout_value99.807 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,083
author_reputation141,171,499,037,785
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id857,596
net_rshares56,261,200,812,970
author_curate_reward""
vote details (134)
@arhag · (edited)
> she can simply recover the public key (which is needed to put into the PoW operation) with the same method used in step 6

> because a transaction contains only a PoW operation requires no signature (which is another hole in the old algo which got fixed in new algo)

Good point.

That means the implementation of the exploit was actually easier than I thought because it didn't require messing around the libsecp256k1 function implementations. The existing APIs could have been used to get the active public key, and that's most likely what was used by @supercomputing.
properties (22)
authorarhag
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160817t205401396z
categorysteem
json_metadata{"tags":["steem"],"users":["supercomputing"]}
created2016-08-17 20:54:00
last_update2016-08-18 01:15:15
depth1
children1
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length572
author_reputation52,490,827,205,383
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id859,327
net_rshares0
@abit ·
I don't know if @supercomputing was doing so with API call. But here is the code I used to compete with @supercomputing, you can see, only need one line to get the public key:
```
//construct pow operation
          chain::pow_operation op;
          op.block_id = block_id;
          op.worker_account = miner;
          op.nonce = start + thread_num;
          op.props = _miner_prop_vote;

// some code omitted here to find a working sig from local db

               op.work.signature = sig;
               op.work.work = work;
               op.work.input = op.work_input();
               //calculate worker
               op.work.worker = fc::ecc::public_key( sig, op.work.input, false );

// construct transaction
...
```
👍  
properties (23)
authorabit
permlinkre-arhag-re-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160818t011047480z
categorysteem
json_metadata{"tags":["steem"],"users":["supercomputing"]}
created2016-08-18 01:10:48
last_update2016-08-18 01:10:48
depth2
children0
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length729
author_reputation141,171,499,037,785
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id863,068
net_rshares2,388,145,666
author_curate_reward""
vote details (1)
@cnfund ·
Good post.
properties (22)
authorcnfund
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160818t023833863z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-18 02:36:57
last_update2016-08-18 02:36:57
depth1
children0
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10
author_reputation105,733,074,011,368
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id864,156
net_rshares0
@cryptohead ·
Now, it seems that the mining queue is  dominated by the  "rabbit" servers.
I wonder if it's necessary to do another fork to fix this:
http://www.crservers.com/images/steem_mining_queue.JPG

Can somebody explain what is going on?
Thanks
properties (22)
authorcryptohead
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160901t005026786z
categorysteem
json_metadata{"tags":["steem"],"image":["http://www.crservers.com/images/steem_mining_queue.JPG"]}
created2016-09-01 00:50:24
last_update2016-09-01 00:50:24
depth1
children4
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length236
author_reputation607,929,583,052
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,078,620
net_rshares0
@abit ·
Probably a GPU miner cluster.
properties (22)
authorabit
permlinkre-cryptohead-re-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160902t163448662z
categorysteem
json_metadata{"tags":["steem"]}
created2016-09-02 16:34:48
last_update2016-09-02 16:34:48
depth2
children3
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length29
author_reputation141,171,499,037,785
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,100,434
net_rshares0
@cryptohead ·
I understand there is only CPU mining  for Steem
properties (22)
authorcryptohead
permlinkre-abit-re-cryptohead-re-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160902t181614200z
categorysteem
json_metadata{"tags":["steem"]}
created2016-09-02 18:16:36
last_update2016-09-02 18:16:36
depth3
children2
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length48
author_reputation607,929,583,052
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,101,535
net_rshares0
@minfon ·
原來是 POW 作業時不需簽名中有流程代碼的漏洞,在hard Fork 13版以後应該修正了吧?!
properties (22)
authorminfon
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160821t042955685z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-21 04:29:57
last_update2016-08-21 04:29:57
depth1
children1
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length49
author_reputation4,620,523,428,308
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id916,008
net_rshares0
@abit ·
新版的挖矿算法严谨多了,暂时还没找到漏洞。
老版也是运行几个月了才有人发现这个,虽然是比较低级的错误。
properties (22)
authorabit
permlinkre-minfon-re-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160821t193237911z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-21 19:32:36
last_update2016-08-21 19:32:36
depth2
children0
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length51
author_reputation141,171,499,037,785
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id924,217
net_rshares0
@oflyhigh ·
好深奥
properties (22)
authoroflyhigh
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160818t023407147z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-18 02:34:09
last_update2016-08-18 02:34:09
depth1
children0
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3
author_reputation6,307,181,401,566,315
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id864,126
net_rshares0
@vi1son ·
> But there is a hole in the description, because the private key of a given signature shouldn't be so quickly to be resolved -- it's the nature of ECC algo.

Is it bad?
properties (22)
authorvi1son
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160817t193631631z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-17 19:36:30
last_update2016-08-17 19:36:30
depth1
children0
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length169
author_reputation6,286,810,078,777
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id857,951
net_rshares0
@zzzzzzzzz ·
Thank you for information. Now I will keep in mind.
properties (22)
authorzzzzzzzzz
permlinkre-abit-more-info-about-how-supercomputing-was-dominating-the-mining-queue-20160818t184737363z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-18 18:48:21
last_update2016-08-18 18:48:21
depth1
children0
last_payout2016-09-18 02:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length51
author_reputation-236,169,662,480
root_title"More Info About How @supercomputing Was Dominating The Mining Queue"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id875,531
net_rshares0