test: Assert RPC Server binds before creating cookie #26964

pull willcl-ark wants to merge 3 commits into bitcoin:master from willcl-ark:2023-01-cookie-bind changing 2 files +22 −5
  1. willcl-ark commented at 8:27 AM on January 25, 2023: member

    If the RPC server does not bind first there exists a race condition between malware and bitcoind to bind to the port and recieve a cookie request from external application.

    This test relies on the order of log messages, which may (I don't know) be slightly brittle. However because both InitHTTPServer() and StartHTTPRPC() are called in single-threaded series from within AppInitServers() it should work well enough.

    https://github.com/bitcoin/bitcoin/blob/50ac8f57748edd0bf4d42031710a59ebb8068a63/src/init.cpp#L667-L672

  2. test: add ordered log checking to assert_debug_log
    This allows specification that log entries should be detected in the
    order they are passed in through their argument list.
    373ba6025a
  3. test: assert RPC binds before creating cookie
    If we don't bind before creating the authentication cookie a race
    condition exists where malware could restart the node, bind to the RPC
    port and read the current cookie before bitcoind binds.
    4c4b01e4bc
  4. test: remove unused `url` from rpc_users.py 1c075644a2
  5. DrahtBot commented at 8:27 AM on January 25, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  6. maflcko renamed this:
    Assert RPC Server binds before creating cookie
    test: Assert RPC Server binds before creating cookie
    on Jan 25, 2023
  7. DrahtBot added the label Tests on Jan 25, 2023
  8. achow101 commented at 3:57 PM on April 25, 2023: member

    The feature request didn't seem to attract much attention in the past. Also, the issue seems not important enough right now to keep it sitting around idle in the list of open issues.

    Closing due to lack of interest. Pull requests with improvements are always welcome.

  9. achow101 closed this on Apr 25, 2023

  10. luke-jr commented at 7:05 PM on June 22, 2023: member

    Is this related to CVE-2018-20587?

    @achow101 This appears to be a security fix, not a feature request :|

    Edit: This doesn't fix anything, just tests for correct behaviour.

  11. bitcoin locked this on Sep 14, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me