@@ -5,6 +5,85 @@ The headless daemon `bitcoind` has the JSON-RPC API enabled by default, the GUI
5
5
option. In the GUI it is possible to execute RPC methods in the Debug Console
6
6
Dialog.
7
7
8
+ ## Security
9
+
10
+ The RPC interface allows other programs to control Bitcoin Core,
11
+ including the ability to spend funds from your wallets, affect consensus
12
+ verification, read private data, and otherwise perform operations that
13
+ can cause loss of money, data, or privacy. This section suggests how
14
+ you should use and configure Bitcoin Core to reduce the risk that its
15
+ RPC interface will be abused.
16
+
17
+ - ** Securing the executable:** Anyone with physical or remote access to
18
+ the computer, container, or virtual machine running Bitcoin Core can
19
+ compromise either the whole program or just the RPC interface. This
20
+ includes being able to record any passphrases you enter for unlocking
21
+ your encrypted wallets or changing settings so that your Bitcoin Core
22
+ program tells you that certain transactions have multiple
23
+ confirmations even when they aren't part of the best block chain. For
24
+ this reason, you should not use Bitcoin Core for security sensitive
25
+ operations on systems you do not exclusively control, such as shared
26
+ computers or virtual private servers.
27
+
28
+ - ** Securing local network access:** By default, the RPC interface can
29
+ only be accessed by a client running on the same computer and only
30
+ after the client provides a valid authentication credential (username
31
+ and passphrase). Any program on your computer with access to the file
32
+ system and local network can obtain this level of access.
33
+ Additionally, other programs on your computer can attempt to provide
34
+ an RPC interface on the same port as used by Bitcoin Core in order to
35
+ trick you into revealing your authentication credentials. For this
36
+ reason, it is important to only use Bitcoin Core for
37
+ security-sensitive operations on a computer whose other programs you
38
+ trust.
39
+
40
+ - ** Securing remote network access:** You may optionally allow other
41
+ computers to remotely control Bitcoin Core by setting the ` rpcallowip `
42
+ and ` rpcbind ` configuration parameters. These settings are only meant
43
+ for enabling connections over secure private networks or connections
44
+ that have been otherwise secured (e.g. using a VPN or port forwarding
45
+ with SSH or stunnel). ** Do not enable RPC connections over the public
46
+ Internet.** Although Bitcoin Core's RPC interface does use
47
+ authentication, it does not use encryption, so your login credentials
48
+ are sent as clear text that can be read by anyone on your network
49
+ path. Additionally, the RPC interface has not been hardened to
50
+ withstand arbitrary Internet traffic, so changing the above settings
51
+ to expose it to the Internet (even using something like a Tor hidden
52
+ service) could expose you to unconsidered vulnerabilities. See
53
+ ` bitcoind -help ` for more information about these settings and other
54
+ settings described in this document.
55
+
56
+ Related, if you use Bitcoin Core inside a Docker container, you may
57
+ need to expose the RPC port to the host system. The default way to
58
+ do this in Docker also exposes the port to the public Internet.
59
+ Instead, expose it only on the host system's localhost, for example:
60
+ ` -p 127.0.0.1:8332:8332 `
61
+
62
+ - ** Secure authentication:** By default, Bitcoin Core generates unique
63
+ login credentials each time it restarts and puts them into a file
64
+ readable only by the user that started Bitcoin Core, allowing any of
65
+ that user's RPC clients with read access to the file to login
66
+ automatically. The file is ` .cookie ` in the Bitcoin Core
67
+ configuration directory, and using these credentials is the preferred
68
+ RPC authentication method. If you need to generate static login
69
+ credentials for your programs, you can use the script in the
70
+ ` share/rpcauth ` directory in the Bitcoin Core source tree. As a final
71
+ fallback, you can directly use manually-chosen ` rpcuser ` and
72
+ ` rpcpassword ` configuration parameters---but you must ensure that you
73
+ choose a strong and unique passphrase (and still don't use insecure
74
+ networks, as mentioned above).
75
+
76
+ - ** Secure string handling:** The RPC interface does not guarantee any
77
+ escaping of data beyond what's necessary to encode it as JSON,
78
+ although it does usually provide serialized data using a hex
79
+ representation of the bytes. If you use RPC data in your programs or
80
+ provide its data to other programs, you must ensure any problem
81
+ strings are properly escaped. For example, multiple websites have
82
+ been manipulated because they displayed decoded hex strings that
83
+ included HTML ` <script> ` tags. For this reason, and other
84
+ non-security reasons, it is recommended to display all serialized data
85
+ in hex form only.
86
+
8
87
## RPC consistency guarantees
9
88
10
89
State that can be queried via RPCs is guaranteed to be at least up-to-date with
0 commit comments