CVE-2018–20587 is an Incorrect Access Control vulnerability that affects all currently released versions of Bitcoin Core, including the latest 0.17.1 (and probably future releases too), as well as Bitcoin Knots prior to 0.17.1.knots20181229.

You may be affected by this issue if you have the RPC service enabled (default, with the headless bitcoind), and other users have access to run their own services on the same computer (either local or remote access). If you are the only user of the computer running your node, you are not affected. If you use the GUI but have not enabled the RPC service, you are not affected.

Generally, it is not recommended to trust a computer that other users have access to, so this vulnerability is considered low risk, and may not be fixed in Bitcoin Core at all.

Note that in all cases with multiple users, attempting to use the RPC service while your node is not running may create a security risk. While your node is not running, it can do nothing to prevent this. Always ensure your node is running before you attempt to access the RPC service! Note that making another RPC call is not sufficient to safely check that it is running. (This risk is not covered by the CVE, and indeed affects all software with RPC services, not just Bitcoin nodes.)

(Also, as a reminder, please note that the RPC service should never be exposed to any untrusted network or host. Do not set “rpcbind” or “rpcallowip” to anything other than “127.0.0.1” unless you are familiar with network security and aware of the potential consequences.)

Workarounds

There are multiple ways to eliminate the risk:

Forbid usage of your computer by other people. This includes remote access. Securing access to login to the computer is outside the scope of this advisory.

Forbid other users of your computer from binding to the RPC port on any network interface. (How to do this is non-trivial and outside the scope of this document.)

Turn off the RPC service, and never attempt to use it. To do this, ensure that your bitcoin.conf file includes the line “server=0”. You can confirm it has been disabled, if the bitcoin-cli program fails to execute any command, saying “Could not connect to the server”.

Before accessing the RPC service, check that your node’s debug.log does not contain any “Binding RPC on address … failed” lines.

Configure your node to only bind a single RPC port. To do this, make sure your bitcoin.conf contains exactly one line beginning with “rpcbind=” and at least one line beginning with “rpcallowip=”. Generally, you want to ensure these are “rpcbind=127.0.0.1” and “rpcallowip=127.0.0.1” (any other values may fail to eliminate the danger). With this configuration, the software will refuse to start unless it successfully binds the appropriate port.

You can also upgrade to Bitcoin Knots 0.17.1.knots20181229 or newer, which has an experimental fix for this issue (but only while it is running, obviously). Since this fix has not been extensively tested, you should still mitigate the vulnerability with one of the above methods, or attempt to compromise your own node as described below (if you do test the exploit, please report whether Knots’ fix does or does not work on your system to luke_bcknots_cve2018_20587@dashjr.org).

Technical Details

By default, the RPC service attempts to bind and listen for connections on both IPv4 localhost and IPv6 localhost. So long as either of these succeeds, startup is considered successful, even if the other fails.

However, this means it is possible for another user on the system to quietly bind the IPv4 localhost port, and forward requests to the IPv6 localhost port, intercepting the request, response, and authentication credentials (including both the RPC server authentication, as well as any wallet password(s) if such wallets are unlocked in this way).

The other user can then use the credentials to make his own requests, including RPC calls that may compromise consensus, send the wallet’s bitcoins elsewhere, and so on.

Timeline