Sitemap

SlowMist: BCH Mining Software Bitcoin-ABC Fork Vulnerability Analysis (Released in 2018)

3 min readMay 8, 2023

--

Press enter or click to view image in full size

Background

On May 7th, the official site of Bitcoin-ABC issued a document:

On May 7th, the Bitcoin-ABC official website released a document stating that the Bitcoin-ABC development team was notified of a critical vulnerability in the Bitcoin-ABC client version 0.17.0 and below used by Bitcoin Cash miners on April 26th through an anonymous report. The team quickly analyzed the vulnerability, developed a patch, and released the updated client version 0.17.1. They also sent the software to the BCH mining pool to prevent any potential exploitation of the vulnerability.

Vulnerability Analysis

After analyzing the Bitcoin-ABC commit repair code (https://reviews.bitcoinabc.org/D1313), the SlowMist security team arrived at the following conclusion:

Press enter or click to view image in full size

The function name was modified and the value of the baseType parameter was adjusted by the official from line 70 of the src/script/sighashtype.h file. It was changed from BaseSigHashType(sigHash & 0x1f) to BaseSigHashType(sigHash & ~(SIGHASH_FORKID | SIGHASH_ANYONECANPAY)) as seen in the Bitcoin-ABC commit repair code analyzed by the SlowMist security team.

The constants SIGHASH_FORKID and SIGHASH_ANYONECANPAY are defined in the src/script/sighashtype.h header file as 0x40 and 0x80.

So ~(SIGHASH_FORKID | SIGHASH_ANYONECANPAY) results in 0x3f.

Suppose sigHash is 0x21, converted to binary: 0x1f = 0b00011111, 0x21 = 0b00100001, 0x3f = 0b00111111.

In version 0.17.0, the check digit was 0x1f, but in version 0.17.1, it was updated to 0x3f. The baseType calculation process was 0x21 & 0x1f = 1, and 0x01 & 0x1f was also 1. After the check digit was updated to 0x3f in version 0.17.1, the baseType became 0x21 & 0x3f = 21, which is outside of the valid range and was filtered out. Therefore, the issue was fixed by setting the check digit to 0x20.

Vulnerability Impact

The Bitcoin-ABC development team has stated that a serious vulnerability in versions 0.17.0 and below of the Bitcoin-ABC client used by Bitcoin Cash miners could potentially cause a fork in the network. The vulnerability allows an attacker to create a malicious transaction that can be accepted by Bitcoin-ABC miners and included in a block, while other Bitcoin Cash-compatible mining applications, such as the Bitcoin Unlimited client, will reject the block.

“Both BUCash and Bitcoin-ABC client versions before 0.17.0 may be split from the main chain — only Bitcoin-ABC and BUCash nodes were included in the vulnerability analysis.” stated development team.

“Bitcoin ABC handled the issue very professionally and responsibly — they quickly fixed the bug and (software) released it privately to the miners, reducing the risk of blockchain forks.” stated Shaun Chong, CEO of Bitcoin.com Mining Pool.

Thank You

Bingshan, affiliated to Meoww Security, head of Bitmain security risk control technology.

About SlowMist

SlowMist is a blockchain security firm established in January 2018. The firm was started by a team with over ten years of network security experience to become a global force. Our goal is to make the blockchain ecosystem as secure as possible for everyone. We are now a renowned international blockchain security firm that has worked on various well-known projects such as Huobi, OKX, Binance, imToken, Crypto.com, Amber Group, Klaytn, EOS, 1inch, PancakeSwap, TUSD, Alpaca Finance, MultiChain, O3Swap, etc.

Website:
https://www.slowmist.com
Twitter:
https://twitter.com/SlowMist_Team
Github:
https://github.com/slowmist/

--

--

SlowMist
SlowMist

Written by SlowMist

SlowMist is a Blockchain security firm established in 2018, providing services such as security audits, security consultants, red teaming, and more.