Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update module github.com/btcsuite/btcd to v0.24.2 [security] #2332

Closed

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 28, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
github.com/btcsuite/btcd v0.24.0 -> v0.24.2 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2024-38365

Impact

The btcd Bitcoin client (versions 0.10 to 0.24) did not correctly re-implement Bitcoin Core's "FindAndDelete()" functionality. This
logic is consensus-critical: the difference in behavior with the other Bitcoin clients can lead to btcd clients accepting an invalid Bitcoin block (or rejecting a valid one).

This consensus failure can be leveraged to cause a chain split (accepting an invalid Bitcoin block) or be exploited to DoS the btcd nodes (rejecting a valid Bitcoin block). An attacker can create a standard transaction where FindAndDelete doesn't return a match but removeOpCodeByData does making btcd get a different sighash, leading to a chain split. Importantly, this vulnerability can be exploited remotely by any Bitcoin user and does not require any hash power. This is because the difference in behavior can be triggered by a "standard" Bitcoin
transaction, that is a transaction which gets relayed through the P2P network before it gets included in a Bitcoin block.

FindAndDelete vs. removeOpcodeByData

removeOpcodeByData(script []byte, dataToRemove []byte) removes any data pushes from script that contain dataToRemove. However, FindAndDelete only removes exact matches. So for example, with script = "<data> <data||foo>" and dataToRemove = "data" btcd will remove both data pushes but Bitcoin Core's FindAndDelete only removes the first <data> push.

Patches

This has been patched in btcd version v0.24.2-beta.

References

FindAndDelete: GHSA-27vh-h6mc-q6g8


btcd did not correctly re-implement Bitcoin Core's "FindAndDelete()" functionality

CVE-2024-38365 / GHSA-27vh-h6mc-q6g8 / GO-2024-3189

More information

Details

Impact

The btcd Bitcoin client (versions 0.10 to 0.24) did not correctly re-implement Bitcoin Core's "FindAndDelete()" functionality. This
logic is consensus-critical: the difference in behavior with the other Bitcoin clients can lead to btcd clients accepting an invalid Bitcoin block (or rejecting a valid one).

This consensus failure can be leveraged to cause a chain split (accepting an invalid Bitcoin block) or be exploited to DoS the btcd nodes (rejecting a valid Bitcoin block). An attacker can create a standard transaction where FindAndDelete doesn't return a match but removeOpCodeByData does making btcd get a different sighash, leading to a chain split. Importantly, this vulnerability can be exploited remotely by any Bitcoin user and does not require any hash power. This is because the difference in behavior can be triggered by a "standard" Bitcoin
transaction, that is a transaction which gets relayed through the P2P network before it gets included in a Bitcoin block.

FindAndDelete vs. removeOpcodeByData

removeOpcodeByData(script []byte, dataToRemove []byte) removes any data pushes from script that contain dataToRemove. However, FindAndDelete only removes exact matches. So for example, with script = "<data> <data||foo>" and dataToRemove = "data" btcd will remove both data pushes but Bitcoin Core's FindAndDelete only removes the first <data> push.

Patches

This has been patched in btcd version v0.24.2-beta.

References

FindAndDelete: GHSA-27vh-h6mc-q6g8

Severity

  • CVSS Score: 7.4 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Consensus failure in github.com/btcsuite/btcd

CVE-2024-38365 / GHSA-27vh-h6mc-q6g8 / GO-2024-3189

More information

Details

The btcd Bitcoin client (versions 0.10 to 0.24) did not correctly re-implement Bitcoin Core's 'FindAndDelete()' functionality, causing discrepancies in the validation of Bitcoin blocks. This can lead to a chain split (accepting an invalid block) or Denial of Service (DoS) attacks (rejecting a valid block). An attacker can trigger this vulnerability by constructing a 'standard' Bitcoin transaction that exhibits different behaviors in 'FindAndDelete()' and 'removeOpcodeByData()'.

Severity

Unknown

References

This data is provided by OSV and the Go Vulnerability Database (CC-BY 4.0).


Release Notes

btcsuite/btcd (github.com/btcsuite/btcd)

v0.24.2

Compare Source

This release includes important bug fixes related to subtle interactions related to re-orgs and the UTXO set cache. These fixed are considered security critical.

This release also includes implementations of invalidateblock and reconsiderblock which can be useful in helping nodes that were afflicted by the aforementioned bugs to recover without needing to resync the entire chain.

WIth this release, btcd now also implements the testmempoolaccept RPC which can be useful to check a transaction candidate for validity from a policy and conflict perspective before broadcasting. Along the way, we've added some additional policy checks that exist in other Bitcoin full node implementations.

This release also contains fixes to some parsing issues discovered via fuzz testing.

Finally, as mentioned above release includes important security fixes, with full details to be disclosed in 90 days.

What's Changed

New Contributors

Full Changelog: btcsuite/btcd@v0.24.0...v0.24.2


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link
Contributor Author

renovate bot commented Oct 28, 2024

ℹ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 1 additional dependency was updated

Details:

Package Change
github.com/stretchr/testify v1.8.2 -> v1.8.4

Copy link

github-actions bot commented Oct 28, 2024

Coverage from tests in ./e2e_test/... for ./consensus/istanbul/... at commit 66848e3

coverage: 55.4% of statements across all listed packages
coverage:  68.4% of statements in consensus/istanbul
coverage:  63.6% of statements in consensus/istanbul/announce
coverage:  57.5% of statements in consensus/istanbul/backend
coverage:   0.0% of statements in consensus/istanbul/backend/backendtest
coverage:  24.3% of statements in consensus/istanbul/backend/internal/replica
coverage:  66.5% of statements in consensus/istanbul/core
coverage:  50.0% of statements in consensus/istanbul/db
coverage:   0.0% of statements in consensus/istanbul/proxy
coverage:  64.2% of statements in consensus/istanbul/uptime
coverage:  52.4% of statements in consensus/istanbul/validator
coverage:  79.2% of statements in consensus/istanbul/validator/random

Copy link

github-actions bot commented Oct 28, 2024

5889 passed, 1 failed, 45 skipped

Test failures:
  TestPriorityClient: geth

Failed
    les_test.go:121: Initializing geth: [--networkid=42 init ./testdata/clique.json] 
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.429] Maximum peer count                       ETH=175 LES=0 total=175
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.430] Set global gas inflation rate            rate=1.300
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.430] Set global gas cap                       cap=25,000,000
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.430] Allocated cache and file handles         database=/tmp/geth-test3763086258/celo/chaindata cache=16.00MiB handles=16
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.658] Writing custom genesis block 
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.659] Persisted trie from memory database      nodes=4 size=566.00B time=&quot;115.854µs&quot; gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=-82.00B
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.660] Successfully wrote genesis state         database=chaindata                               hash=9195f2..122dcd
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:08.660] Allocated cache and file handles         database=/tmp/geth-test3763086258/celo/lightchaindata cache=16.00MiB handles=16
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.004] Writing custom genesis block 
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.005] Persisted trie from memory database      nodes=4 size=566.00B time=&quot;44.106µs&quot;  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=-82.00B
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.005] Successfully wrote genesis state         database=lightchaindata                          hash=9195f2..122dcd
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.005] Allocated cache and file handles         database=/tmp/geth-test3763086258/celo/lightestchaindata cache=16.00MiB handles=16
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.737] Writing custom genesis block 
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.738] Persisted trie from memory database      nodes=4 size=566.00B time=&quot;55.197µs&quot;  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=-82.00B
test_cmd.go:262: (stderr:31) INFO [11-26|16:29:09.738] Successfully wrote genesis state         database=lightestchaindata                       hash=9195f2..122dcd
les_test.go:130: Importing keys to geth
test_cmd.go:262: (stderr:32) INFO [11-26|16:29:09.773] Maximum peer count                       ETH=175 LES=0 total=175
test_cmd.go:262: (stderr:32) INFO [11-26|16:29:09.774] Set global gas inflation rate            rate=1.300
test_cmd.go:262: (stderr:32) INFO [11-26|16:29:09.774] Set global gas cap                       cap=25,000,000
les_test.go:99: Starting lightserver with rpc: [--networkid=42 --port=0 --ipcpath geth-1.ipc --allow-insecure-unlock --datadir /tmp/geth-test3763086258 --password ./testdata/password.txt --unlock 0x02f0d131f1f97aef08aec6e3291b957d9efe7105 --mine --miner.validator 0x02f0d131f1f97aef08aec6e3291b957d9efe7105 --tx-fee-recipient 0x02f0d131f1f97aef08aec6e3291b957d9efe7105 --light.serve=100 --light.maxpeers=1 --nodiscover --nat=extip:127.0.0.1 --verbosity=4]
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:09.958] Maximum peer count                       ETH=175 LES=1 total=176
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:09.959] FS scan times                            list=&quot;51.663µs&quot; set=&quot;2.951µs&quot; diff=&quot;1.565µs&quot;
test_cmd.go:262: (stderr:33) WARN [11-26|16:29:09.959] LES server cannot serve old transaction status and cannot connect below les/4 protocol version if transaction lookup index is limited 
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:09.959] Sanitizing Go&apos;s GC trigger               percent=100
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:09.959] Set global gas inflation rate            rate=1.300
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:09.959] Set global gas cap                       cap=25,000,000
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:09.959] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:09.959] Allocated cache and file handles         database=/tmp/geth-test3763086258/celo/chaindata cache=512.00MiB handles=524,288
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:10.967] Chain freezer table opened               database=/tmp/geth-test3763086258/celo/chaindata/ancient table=headers items=0 size=0.00B
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:11.265] Chain freezer table opened               database=/tmp/geth-test3763086258/celo/chaindata/ancient table=hashes  items=0 size=0.00B
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:11.589] Chain freezer table opened               database=/tmp/geth-test3763086258/celo/chaindata/ancient table=bodies  items=0 size=0.00B
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:11.657] Chain freezer table opened               database=/tmp/geth-test3763086258/celo/chaindata/ancient table=receipts items=0 size=0.00B
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:11.906] Chain freezer table opened               database=/tmp/geth-test3763086258/celo/chaindata/ancient table=diffs    items=0 size=0.00B
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:11.907] Opened ancient database                  database=/tmp/geth-test3763086258/celo/chaindata/ancient readonly=false
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:11.952] Current full block not old enough        number=0 hash=9195f2..122dcd delay=90000
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:11.953] Initialised chain configuration          config=&quot;{ChainID: 15 Homestead: 0 DAO: &lt;nil&gt; DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: &lt;nil&gt; Churrito: &lt;nil&gt;, Donut: &lt;nil&gt;, Espresso: &lt;nil&gt;, Gingerbread: &lt;nil&gt;, Gingerbread P2: &lt;nil&gt;, HForkBlock: &lt;nil&gt;, Engine: istanbul}&quot;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:11.953] Setting up Istanbul consensus engine 
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.329] Initialising Ethereum protocol           versions=[67] network=42 dbversion=&lt;nil&gt;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.330] Loading Last State: 0 
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.330] Loaded most recent local header          number=0 hash=9195f2..122dcd td=1 age=55y8mo1w
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.330] Loaded most recent local full block      number=0 hash=9195f2..122dcd td=1 age=55y8mo1w
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.331] Loaded most recent local fast block      number=0 hash=9195f2..122dcd td=1 age=55y8mo1w
test_cmd.go:262: (stderr:33) WARN [11-26|16:29:14.331] Failed to load snapshot, regenerating    err=&quot;missing or corrupted snapshot&quot;
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.331] Rebuilding state snapshot 
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.331] Journalled generator progress            progress=empty
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.331] Start snapshot generation                root=8a7a77..f86ff6
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.331] Resuming state snapshot generation       root=8a7a77..f86ff6 accounts=0 slots=0 storage=0.00B elapsed=&quot;393.759µs&quot;
test_cmd.go:262: (stderr:33) ERROR[11-26|16:29:14.331] Error invoking evm function: EVM call failure to=0x000000000000000000000000000000000000ce10 method=getAddressFor input=0xdd9272338b91d837e1684f7353d73b6197230894243cf869282f722841df96b441303f37 maxgas=100,000 err=&quot;execution reverted&quot;            message=&quot;No Implementation set&quot;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.331] Registry contract not yet deployed       function=blockGasLimit registryId=0x8b91d837e1684f7353d73b6197230894243cf869282f722841df96b441303f37
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.331] Error calling blockGasLimit              err=&quot;Registry not deployed&quot;         contract=0x8b91d837e1684f7353d73b6197230894243cf869282f722841df96b441303f37
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.331] Regenerated state range                  kind=storage prefix=0x6fc8292a2675fd2df398d2f757c44afe1b96e4c7ba26dac7ed67cdef77799ef404 root=09f508..8cb885 last=0x count=1 created=1 updated=0 untouched=0 deleted=0
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.331] Regenerated state range                  kind=account prefix=0x61 root=8a7a77..f86ff6 last=0x count=2 created=2 updated=0 untouched=0 deleted=0
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.332] Journalled generator progress            progress=done
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.332] Generated state snapshot                 accounts=2 slots=1 storage=230.00B elapsed=&quot;845.078µs&quot;
test_cmd.go:262: (stderr:33) ERROR[11-26|16:29:14.331] Error invoking evm function: EVM call failure to=0x000000000000000000000000000000000000ce10 method=getAddressFor input=0xdd92723348766a30bcca8b3c8b03b4e4b1f6510aee73f7b41aa6c7578a97040d20334f42 maxgas=100,000 err=&quot;execution reverted&quot;            message=&quot;No Implementation set&quot;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.332] Registry contract not yet deployed       function=gasPriceMinimumFloor registryId=0x48766a30bcca8b3c8b03b4e4b1f6510aee73f7b41aa6c7578a97040d20334f42
test_cmd.go:262: (stderr:33) ERROR[11-26|16:29:14.332] Error invoking evm function: EVM call failure to=0x000000000000000000000000000000000000ce10 method=getAddressFor input=0xdd9272338b91d837e1684f7353d73b6197230894243cf869282f722841df96b441303f37 maxgas=100,000 err=&quot;execution reverted&quot;            message=&quot;No Implementation set&quot;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.332] Registry contract not yet deployed       function=intrinsicGasForAlternativeFeeCurrency registryId=0x8b91d837e1684f7353d73b6197230894243cf869282f722841df96b441303f37
test_cmd.go:262: (stderr:33) ERROR[11-26|16:29:14.332] Error invoking evm function: EVM call failure to=0x000000000000000000000000000000000000ce10 method=getAddressFor input=0xdd9272338f897d9543fdc9082789208180c3e3d11f7473aaef3e249ab0020ea0c761c1b6 maxgas=100,000 err=&quot;execution reverted&quot;            message=&quot;No Implementation set&quot;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.332] Registry contract not yet deployed       function=getWhitelist                          registryId=0x8f897d9543fdc9082789208180c3e3d11f7473aaef3e249ab0020ea0c761c1b6
test_cmd.go:262: (stderr:33) ERROR[11-26|16:29:14.332] getWhitelist invocation failed           err=&quot;Registry not deployed&quot;
test_cmd.go:262: (stderr:33) ERROR[11-26|16:29:14.332] Error invoking evm function: EVM call failure to=0x000000000000000000000000000000000000ce10 method=getAddressFor input=0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf maxgas=100,000 err=&quot;execution reverted&quot;            message=&quot;No Implementation set&quot;
test_cmd.go:262: (stderr:33) DEBUG[11-26|16:29:14.332] Reinjecting stale transactions           count=0
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.332] Regenerated local transaction journal    transactions=0 accounts=0
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.344] Allocated fast sync bloom                size=512.00MiB
test_cmd.go:262: (stderr:33) WARN [11-26|16:29:14.344] Error reading unclean shutdown markers   error=&quot;leveldb: not found&quot;
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.344] Initialized state bloom                  items=5 errorrate=0.000 elapsed=&quot;527.042µs&quot;
test_cmd.go:262: (stderr:33) INFO [11-26|16:29:14.379] Allocated cache and file handles         database=/tmp/geth-test3763086258/celo/les.server cache=16.00MiB  handles=16
les_test.go:115: lightserver rpc connect to /tmp/geth-test3763086258/geth-1.ipc: dial unix /tmp/geth-test3763086258/geth-1.ipc: connect: no such file or directory</code></pre></td></tr>
This test report was produced by the test-summary action.  Made with ❤️ in Cambridge.

@renovate renovate bot force-pushed the renovate/go-github.com-btcsuite-btcd-vulnerability branch from 9283f30 to 14179c1 Compare November 26, 2024 15:03
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/go-github.com-btcsuite-btcd-vulnerability branch from 14179c1 to 9043267 Compare November 26, 2024 15:18
@palango palango closed this Nov 26, 2024
Copy link
Contributor Author

renovate bot commented Nov 26, 2024

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (v0.24.2). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant