simple fix to mask command line arguments after they are copied #7122

pull robegan21 wants to merge 1 commits into bitcoin:master from robegan21:MaskCommandLineArgs changing 1 files +10 −0
  1. robegan21 commented at 9:44 AM on November 28, 2015: none

    This replaces the command line args with Xs for bitcoin-cli so that passwords and private keys can not be observed in the process table while it executes. This trick is borrowed from the mysql codebase.

  2. simple fix to mask command line arguments after they are copied a05df4cb21
  3. gmaxwell commented at 10:00 AM on November 28, 2015: contributor

    Er. This would prevent me from figuring out which of my daemons was testnet/mainnet/regtest... and still doesn't make it actually secure.

  4. sipa commented at 12:00 PM on November 28, 2015: member

    @gmaxwell It's for bitcoin-cli, not bitcoind.

  5. pstratem commented at 10:05 AM on November 29, 2015: contributor

    concept ack

  6. paveljanik commented at 10:49 AM on November 29, 2015: contributor

    I'd rather see any such possibility to enter sensitive information on the command line to be removed. It is not only ps output, but also history etc.

  7. jonasschnelli added the label Utils and libraries on Nov 29, 2015
  8. laanwj commented at 9:13 AM on November 30, 2015: member

    This provides a false sense of security. There is a time window in which the arguments are visible, it may be possible to time this exactly, if not then the brute force 'request the process list in a tight loop' would work to get the credentials at least some of the time (once would be enough.)

    Under Linux you can use the hidepid mount option: http://www.cyberciti.biz/faq/linux-hide-processes-from-other-users/ to hide process information (such as command line, environment) between users.

    I'd rather see any such possibility to enter sensitive information on the command line to be removed

    But it's hard to know what is sensitive information.

    At least the walletpassphrase could be asked on the console. This was considered in the past, but surprisingly difficult to do in a platform-independent and secure way. A dependency on GNU readline isn't deemed worth it.

    (the possibility to read an argument from an arbitrary file or file descriptor may be useful, though, similar to bitcoin-tx's registers)

    (the party line used to be "use the bitrpc python script to enter the passphrase", but this script was unmaintained and doesn't exist anymore as of #6507)

  9. petertodd commented at 11:43 AM on December 5, 2015: contributor

    Sigh, yeah, NACK based on false sense of security.

    Definitely an issue worth fixing somehow though.

  10. laanwj commented at 12:40 PM on December 7, 2015: member

    Simplest solution: what about a bitcoin-cli mode that reads the input as a line from stdin instead of the command line?

  11. GIJensen commented at 3:15 PM on December 7, 2015: none

    Giving bitcoin-cli an interactive mode? I like that idea. "bitcoin-cli -i/--interactive" to enable "stdin mode". I think it'd be a nice step for people who rely on bitcoin-cli.

  12. MarcoFalke commented at 3:43 PM on December 7, 2015: member

    +1 I hate to use bitcoin-cli because you have to type the same stuff all over again in the terminal for every call.

  13. laanwj commented at 4:28 PM on December 7, 2015: member

    I'm not talking about an interactive mode. Interactive mode is less straightforward to implement, e.g. nice prompt handling, intermediate variables, etc. It would be useful but I think it'd be better to write a different script/application for that, e.g. based on a Python (or Javascript) shell.

    No, what I mean is simply to read the input (once) from stdin so a script or user using bitcoin-cli can pipe in the password instead of specifying it on the command line where it can get intercepted.

  14. GIJensen commented at 4:43 PM on December 7, 2015: none

    I understand, +1

  15. laanwj commented at 12:07 PM on January 29, 2016: member

    Closing this. Opened issue #7442 for the bitcoin-cli from stdin option.

  16. laanwj closed this on Jan 29, 2016

  17. DrahtBot locked this on Feb 15, 2022

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-13 15:15 UTC

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