Problem
When bitcoind starts and the HTTP IPv4 listen address is occupied by another process, but the IPv6 address is available, the server fails open and generates a cookie file. When bitcoin-cli is run it picks up the cookie file and sends the credentials in plain text to the non-bitcoind process running on the default IPv4 port. An attacker can then use the credentials to commandeer bitcoind over IPv6.
Solution
Safe defaults:
- When running with default settings, we now require that the IPv4 bind succeeds.
- When
-rpcbindis specified, we now require all HTTP listen socket binds to succeed (fail closed-behavior).
Node runners who only have IPv6 are now required to override -rpcbind to only specify the working interface if they were not doing so already.
The problem of bitcoin-cli sending the credentials to what could possibly be the wrong process remains in non-default setups.
History
c1d79812f428860e6f624835851d6f3ecd86bbb3 (#1822) from 2012 seems to have introduced this kind of fail open-behavior, making IPv4 continue even though IPv6 was not available (what we want to return to). Later changes made IPv4/IPv6 equivalent, only requiring one.
#14968 from 2018 was an attempt to change the behavior to require all binds to succeed. But it ran into issues with poor IPv6 support on CI. Notable is that towards the end they wanted to still allow fail-open for the default bind addresses, but ran into issues with libevent.
Severity
This credential exfiltration attack requires capability to launch processes on the bitcoind host machine. If we are on the same account we can already read the cookie credentials off disk. So it's only really interesting when an attacker is on a different user account on the same machine.