Skip to content

bitcoind: custom RPC users' passwordHMAC is written to the world-readable Nix store #64

Closed

Description

@ostermayer

Problem

modules/bitcoind.nix writes bitcoin.conf with builtins.toFile (line 294). For each RPC user with passwordHMACFromFile = false, the file contains rpcauth=<name>:<salt>$<hmac> (line 334). The Nix store is world-readable. So every local user can read the salt and the HMAC of that RPC password.

With the salt and the HMAC, a local user can test password guesses offline. A strong random password is safe. A weak user-chosen password isn't.

The built-in users public, privileged and btcpayserver set passwordHMACFromFile = true (lines 371 to 374), so they aren't affected. The option passwordHMACFromFile defaults to false (line 141). So every custom RPC user is affected unless the operator knows this option.

Suggested fix

One of:

  • Default passwordHMACFromFile to true and make passwordHMAC an error when the file option is set. The secret then stays in secretsDir.
  • Keep the default but add a warning in the option description and in docs/configuration.md: "This value is written to the world-readable Nix store. Use passwordHMACFromFile for passwords that a person chose."

How found

LLM review (Kimi K3 max, GLM 5.3 max) flagged this. I verified it against the code. Severity: medium for weak passwords, low otherwise.

Activity

  1. added
    area: modules
    type: security
    on Oct 23, 2026
  2. added a commit that references this issue on Nov 18, 2026
    85e625d
  3. added a commit that references this issue on Nov 18, 2026
    4eedfd8
  4. added a commit that references this issue on Nov 18, 2026
    30c3cc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: modulestype: security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions