Bitcoin Forum
November 08, 2024, 07:05:54 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is a block withholding attack? (and solution)  (Read 2525 times)
organofcorti (OP)
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
June 15, 2014, 11:46:04 PM
 #1

There is a lot of confusion over this, but the attack and solutions were covered a couple of years ago in section 6.2.1 of Meni Rosenfeld's "Analysis of Bitcoin Pooled Mining Reward Systems". It has been discussed recently in other threads, this thread is simply to have the canonical information in one place on the forum.

Since I know many of you won't hit the link, I've copied an abridged except of the relevant sections here. AOBPMRS should be considered a bible for miners; you should at least attempt to understand it. If you don't understand something about bitcoin mining it probably has already been explained in this paper.

Also, it should be noted that the most recent example of this attack was apparently not an attack, rather it was probably a software problem - although this should have already been detected during testing on the testnet, so I'm not sure how "unknown" it could have been.

Quote
6.2 Block withholding
The analysis so far rested on the assumption that the atomic action that can be carried out
by participants in a pool is to perform the work needed to find a share, and submit it to the
pool unconditionally. However, with the current protocol, miners can determine whether a share they have found is a valid block or not, and refrain from or delay submitting of blocks.
This can be used for two kinds of attack, sabotage and lie in wait.

6.2.1 Sabotage
The simpler attack is sabotage, where the attacker never submits any blocks. This has no
direct benefit for the attacker, only causing harm to the pool operator or participants. Using a reward system without operator risk like PPLNS, each participant (including the attacker) will lose a portion of his rewards equal to the attacker’s portion of the pool’s hashrate.

.......

6.2.3 Proposed solution – Oblivious shares
One workaround for block withholding attacks is the “pop quiz” – occasionally, the pool will provide miners with work for which a solution is known, and flag participants who do not submit it. However, this leaves much to be desired with both precision and recall. A true solution is to modify the Bitcoin protocol to allow oblivious shares – shares which, when found by miners, cannot be identified as a valid block with submitting to the pool for review.
A possible way to do this will be as follows:
• Every block will have 3 additional field associated with it – SecretSeed, ExtraHash and
SecretHash.
• ExtraHash must be the hash of SecretSeed.
• ExtraHash will be a part of the block header and will be one of the fields used in the
calculation of the block hash.
• SecretHash must be the hash of the concatenation of the block hash and SecretSeed.
• For the block to be valid: Instead of requiring that the block hash is less than 2^256/(2^32D), it is required that the block hash is less than 2^256/2^32 and that SecretHash is less than 2^256/D. The pool operator will choose SecretSeed and keep it secret. He will calculate ExtraHash and provide it to miners along with the other fields that go into the block hash. The miners can calculate the block hash and see if it is less than 2^256/2^32 (which happens with probability 2^−32) and in this case submit it as a share. They do not know if this is a valid block because they don’t know SecretSeed and cannot calculate SecretHash. The operator knows SecretSeed, calculates SecretHash, and if it is less than 2^256/D (with probability p) this is a valid block and it is broadcast to the network.


Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
DrG
Legendary
*
Offline Offline

Activity: 2086
Merit: 1035


View Profile
June 16, 2014, 12:06:53 AM
 #2

I assume that the workaround would require a correction to the Bitcoin protocol which would need a hard fork?  Would it be possible to implement without essentially bricking every ASIC?
-ck
Legendary
*
Offline Offline

Activity: 4284
Merit: 1645


Ruu \o/


View Profile WWW
June 16, 2014, 12:43:52 AM
 #3

Your solution assumes that mining software and its attached hardware will work in a deterministic fashion - this is far from the truth. For numerous high level work generation reasons two miners will almost certainly not generate the same work based on what they're submitted by the pool. For one, the coinbase is different on a per-miner basis meaning you'd have to force miners to be working on the same work (based on extranonce1 in the stratum protocol). You couldn't leave them connected like that indefinitely since they'd just be working on the same thing as other miners over and over so you'd need to disconnect them shortly afterwards and reconnect. Secondly, the extranonce2 field is almost never going to be in the same base place by the miner as it's dependent on runtime, number of pools, speed of devices etc etc. Finally, hardware does not work in a deterministic fashion with respect to finding shares within a nonce range. The ASIC may discard work having never tried it, stop short of the full nonce range to reload new work, it may stop as soon as it has found one nonce - missing any after that, and some chips famously only cover 3/4 of the nonce range in a matrix type pattern that is non-linear in coverage.

Developer/maintainer for cgminer, ckpool/ckproxy, and the -ck kernel
2% Fee Solo mining at solo.ckpool.org
-ck
eleuthria
Legendary
*
Offline Offline

Activity: 1750
Merit: 1007



View Profile
June 16, 2014, 01:46:03 AM
 #4

Also, it should be noted that the most recent example of this attack was apparently not an attack, rather it was probably a software problem - although this should have already been detected during testing on the testnet, so I'm not sure how "unknown" it could have been.

The problem was their software discarding shares that matched 2^32-1 difficulty or better.  Anything UNDER that, they worked fine.  So testnet would not have detected anything wrong.

RIP BTC Guild, April 2011 - June 2015
organofcorti (OP)
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
June 16, 2014, 10:55:16 PM
 #5

I assume that the workaround would require a correction to the Bitcoin protocol which would need a hard fork?  Would it be possible to implement without essentially bricking every ASIC?

No AFAIK, the suggested workaround does not require any fork. However, Meni does state: "However, this leaves much to be desired with both precision and recall. A true solution is to modify the Bitcoin protocol to allow oblivious shares – shares which, when found by miners, cannot be identified as a valid block with submitting to the pool for review."


Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
organofcorti (OP)
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
June 16, 2014, 10:58:35 PM
 #6

Your solution assumes that mining software and its attached hardware will work in a deterministic fashion - this is far from the truth. For numerous high level work generation reasons two miners will almost certainly not generate the same work based on what they're submitted by the pool. For one, the coinbase is different on a per-miner basis meaning you'd have to force miners to be working on the same work (based on extranonce1 in the stratum protocol). You couldn't leave them connected like that indefinitely since they'd just be working on the same thing as other miners over and over so you'd need to disconnect them shortly afterwards and reconnect. Secondly, the extranonce2 field is almost never going to be in the same base place by the miner as it's dependent on runtime, number of pools, speed of devices etc etc. Finally, hardware does not work in a deterministic fashion with respect to finding shares within a nonce range. The ASIC may discard work having never tried it, stop short of the full nonce range to reload new work, it may stop as soon as it has found one nonce - missing any after that, and some chips famously only cover 3/4 of the nonce range in a matrix type pattern that is non-linear in coverage.

Is this in relation to the 'pop quiz' suggestion, or the suggestion to modify the Bitcoin protocol?

Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
organofcorti (OP)
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
June 16, 2014, 11:06:55 PM
 #7

Also, it should be noted that the most recent example of this attack was apparently not an attack, rather it was probably a software problem - although this should have already been detected during testing on the testnet, so I'm not sure how "unknown" it could have been.

The problem was their software discarding shares that matched 2^32-1 difficulty or better.  Anything UNDER that, they worked fine.  So testnet would not have detected anything wrong.

Ah, of course, I see your point.

However, it does make me think of something else - they were at 2Phps, weren't they? The network was at ~ 40 Phps? At 5% of the network there's a one in a million chance they would have not have found a block solomining by the time they had been running for  1.68 days. They could have detected the problem with five nines certainty after only 1.4 days.

If they really did have 5% of the network (and I'm not just mis-remembering) I'd be really surprised if they didn't know about it before-hand.



Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
taipo
Full Member
***
Offline Offline

Activity: 238
Merit: 100

Kia ora!


View Profile WWW
June 16, 2014, 11:31:32 PM
 #8

There is no doubt in my mind this was an intentional attack on mining pools.

Support the two platforms essential to protecting the identities of whistleblowers. Both accept bitcoin donations.
https://globaleaks.org - GlobalLeaks ( btc: see http://goo.gl/D5wM0L )
http://goo.gl/sZg2RN  - SecureDrop: whistleblower submission system
TheJuice
Hero Member
*****
Offline Offline

Activity: 842
Merit: 608


View Profile
June 16, 2014, 11:50:14 PM
 #9

Also, it should be noted that the most recent example of this attack was apparently not an attack, rather it was probably a software problem - although this should have already been detected during testing on the testnet, so I'm not sure how "unknown" it could have been.

The problem was their software discarding shares that matched 2^32-1 difficulty or better.  Anything UNDER that, they worked fine.  So testnet would not have detected anything wrong.

Ah, of course, I see your point.

However, it does make me think of something else - they were at 2Phps, weren't they? The network was at ~ 40 Phps? At 5% of the network there's a one in a million chance they would have not have found a block solomining by the time they had been running for  1.68 days. They could have detected the problem with five nines certainty after only 1.4 days.

If they really did have 5% of the network (and I'm not just mis-remembering) I'd be really surprised if they didn't know about it before-hand.




How does it benefit the attacker if it was intentional? I'm still very confused by this whole ordeal.
organofcorti (OP)
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
June 16, 2014, 11:58:59 PM
 #10

Also, it should be noted that the most recent example of this attack was apparently not an attack, rather it was probably a software problem - although this should have already been detected during testing on the testnet, so I'm not sure how "unknown" it could have been.

The problem was their software discarding shares that matched 2^32-1 difficulty or better.  Anything UNDER that, they worked fine.  So testnet would not have detected anything wrong.

Ah, of course, I see your point.

However, it does make me think of something else - they were at 2Phps, weren't they? The network was at ~ 40 Phps? At 5% of the network there's a one in a million chance they would have not have found a block solomining by the time they had been running for  1.68 days. They could have detected the problem with five nines certainty after only 1.4 days.

If they really did have 5% of the network (and I'm not just mis-remembering) I'd be really surprised if they didn't know about it before-hand.




How does it benefit the attacker if it was intentional? I'm still very confused by this whole ordeal.

If they had originally planned to solomine then they might have found that they couldn't solve a block solomining. In that case, they could at least mine at a pool and still get btc income - even if they weren't contributing any blocks.


Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
DrG
Legendary
*
Offline Offline

Activity: 2086
Merit: 1035


View Profile
June 17, 2014, 06:20:12 AM
 #11

Your solution assumes that mining software and its attached hardware will work in a deterministic fashion - this is far from the truth. For numerous high level work generation reasons two miners will almost certainly not generate the same work based on what they're submitted by the pool. For one, the coinbase is different on a per-miner basis meaning you'd have to force miners to be working on the same work (based on extranonce1 in the stratum protocol). You couldn't leave them connected like that indefinitely since they'd just be working on the same thing as other miners over and over so you'd need to disconnect them shortly afterwards and reconnect. Secondly, the extranonce2 field is almost never going to be in the same base place by the miner as it's dependent on runtime, number of pools, speed of devices etc etc. Finally, hardware does not work in a deterministic fashion with respect to finding shares within a nonce range. The ASIC may discard work having never tried it, stop short of the full nonce range to reload new work, it may stop as soon as it has found one nonce - missing any after that, and some chips famously only cover 3/4 of the nonce range in a matrix type pattern that is non-linear in coverage.


Sadly 1/2 of that went over my head to be honest, but I will read up on it.

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares.  I guess that would require a protocol change since the pool would have to issue the challenge work.
-ck
Legendary
*
Offline Offline

Activity: 4284
Merit: 1645


Ruu \o/


View Profile WWW
June 17, 2014, 07:29:25 AM
 #12

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares. 
Since you basically asked the same question which I gave the long answer to, I'll give you the short version: No

Developer/maintainer for cgminer, ckpool/ckproxy, and the -ck kernel
2% Fee Solo mining at solo.ckpool.org
-ck
DrG
Legendary
*
Offline Offline

Activity: 2086
Merit: 1035


View Profile
June 17, 2014, 07:34:18 AM
 #13

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares. 
Since you basically asked the same question which I gave the long answer to, I'll give you the short version: No

Hey I never said I was intelligent.  I'm a physician damn it, we're not paid to think.  Thank you for the response  Cheesy
eleuthria
Legendary
*
Offline Offline

Activity: 1750
Merit: 1007



View Profile
June 17, 2014, 07:36:40 AM
 #14

Sadly 1/2 of that went over my head to be honest, but I will read up on it.

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares.  I guess that would require a protocol change since the pool would have to issue the challenge work.

ASICs do not always test every nonce from 1 - 2^32.  There's many reasons this may happen such as

1) Many will slice that range into pieces based on the # of chips on the board, giving each one a slice.  If a chip is damaged, that range isn't checked.  Hardware errors.

2) It may be setup to have modules, with each module getting a range, but some units only have 1 or 2 while others have 8.  Instead of splitting the ranges up evenly between available modules, it gives them their static range and ignores the others.

3) It may immediately feed in new work once a solution is found for a nonce range, even though multiple solutions can exist in the full range.



Additionally, modern mining protocols have the miner use a local counter inserted into the coinbase in order to generate work (this is why stratum and GBT are immensely more efficient than getwork, they can make their own work locally).  That counter will be in a different state for every single miner.  If a call were added which forced miners to have that counter in a specific state, you've just clued in a block withholder that the work it received is a test for withholding, so they won't.

RIP BTC Guild, April 2011 - June 2015
Bitsaurus
Hero Member
*****
Offline Offline

Activity: 873
Merit: 1007



View Profile
June 17, 2014, 08:31:39 AM
 #15

Sadly 1/2 of that went over my head to be honest, but I will read up on it.

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares.  I guess that would require a protocol change since the pool would have to issue the challenge work.

ASICs do not always test every nonce from 1 - 2^32.  There's many reasons this may happen such as

1) Many will slice that range into pieces based on the # of chips on the board, giving each one a slice.  If a chip is damaged, that range isn't checked.  Hardware errors.

2) It may be setup to have modules, with each module getting a range, but some units only have 1 or 2 while others have 8.  Instead of splitting the ranges up evenly between available modules, it gives them their static range and ignores the others.

3) It may immediately feed in new work once a solution is found for a nonce range, even though multiple solutions can exist in the full range.



Additionally, modern mining protocols have the miner use a local counter inserted into the coinbase in order to generate work (this is why stratum and GBT are immensely more efficient than getwork, they can make their own work locally).  That counter will be in a different state for every single miner.  If a call were added which forced miners to have that counter in a specific state, you've just clued in a block withholder that the work it received is a test for withholding, so they won't.

So at this point we are left with no workaround or method of detection for withholding attacks short of statistical outlayers?
-ck
Legendary
*
Offline Offline

Activity: 4284
Merit: 1645


Ruu \o/


View Profile WWW
June 17, 2014, 12:14:03 PM
 #16

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares. 
Since you basically asked the same question which I gave the long answer to, I'll give you the short version: No

Hey I never said I was intelligent.  I'm a physician damn it, we're not paid to think.  Thank you for the response  Cheesy
I wasn't saying you were stupid, but it's okay if you don't mind taking advice from an anaesthesiologist.

Developer/maintainer for cgminer, ckpool/ckproxy, and the -ck kernel
2% Fee Solo mining at solo.ckpool.org
-ck
jonnybravo0311
Legendary
*
Offline Offline

Activity: 1344
Merit: 1024


Mine at Jonny's Pool


View Profile WWW
June 17, 2014, 01:56:31 PM
 #17

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares. 
Since you basically asked the same question which I gave the long answer to, I'll give you the short version: No

Hey I never said I was intelligent.  I'm a physician damn it, we're not paid to think.  Thank you for the response  Cheesy
I wasn't saying you were stupid, but it's okay if you don't mind taking advice from an anaesthesiologist.
As long as the advice isn't, "Here, take a bit of this before you do your diagnosis." Smiley

Jonny's Pool - Mine with us and help us grow!  Support a pool that supports Bitcoin, not a hardware manufacturer's pockets!  No SPV cheats.  No empty blocks.
philipma1957
Legendary
*
Online Online

Activity: 4298
Merit: 8820


'The right to privacy matters'


View Profile WWW
June 22, 2014, 10:43:14 PM
 #18

Sadly 1/2 of that went over my head to be honest, but I will read up on it.

Would there be a way to have software implement a query to make sure the miner will submit a winning solve (like a test solve) every X number of shares.  I guess that would require a protocol change since the pool would have to issue the challenge work.

ASICs do not always test every nonce from 1 - 2^32.  There's many reasons this may happen such as

1) Many will slice that range into pieces based on the # of chips on the board, giving each one a slice.  If a chip is damaged, that range isn't checked.  Hardware errors.

2) It may be setup to have modules, with each module getting a range, but some units only have 1 or 2 while others have 8.  Instead of splitting the ranges up evenly between available modules, it gives them their static range and ignores the others.

3) It may immediately feed in new work once a solution is found for a nonce range, even though multiple solutions can exist in the full range.



Additionally, modern mining protocols have the miner use a local counter inserted into the coinbase in order to generate work (this is why stratum and GBT are immensely more efficient than getwork, they can make their own work locally).  That counter will be in a different state for every single miner.  If a call were added which forced miners to have that counter in a specific state, you've just clued in a block withholder that the work it received is a test for withholding, so they won't.

So at this point we are left with no workaround or method of detection for withholding attacks short of statistical outlayers?


   Forced solo mining on all pools   for 1 hour a day . 

We all bear the burden  for that hour and really large  defective miners  could be found out.

 IE a 2ph  mining setup that never makes a block during forced solo mining it would certainly be found easy enough.  Also adds the element of luck for every miner on the pools.

 The cost is nothing for a pool operator for the 1 hour a day. As pools keep track of the block makers any way.

 
   This also make test mining and tweaking a large amount of miners/software such as the 2ph miner less desirable . 
 Since   it may show it is defective during that 1 hour of solo mining.

 So while this is not  a perfect fix it is low cost  to do.  Makes the network far more diverse. 

Frankly where is the down side to it?

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
organofcorti (OP)
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
June 23, 2014, 01:00:26 AM
 #19


   Forced solo mining on all pools   for 1 hour a day . 

We all bear the burden  for that hour and really large  defective miners  could be found out.

 IE a 2ph  mining setup that never makes a block during forced solo mining it would certainly be found easy enough.  Also adds the element of luck for every miner on the pools.

 The cost is nothing for a pool operator for the 1 hour a day. As pools keep track of the block makers any way.

 
   This also make test mining and tweaking a large amount of miners/software such as the 2ph miner less desirable . 
 Since   it may show it is defective during that 1 hour of solo mining.

 So while this is not  a perfect fix it is low cost  to do.  Makes the network far more diverse. 

Frankly where is the down side to it?

Why would this fix anything? Going solo won't make block withholding attacks any easier to spot - why did you think they would? Further, all a bad actor would have to do is split his account into many smaller accounts.

Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!