Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354469

Keytool exposes the password in plain text when command is piped using | grep

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • 25
    • 8, 25
    • security-libs

      Keytool exposes the password in plain text when command is piped using | grep.

      Keytool -v -list -keystore storename.jks | grep <word>

      This default behavior is an insecure practice, leading to potential leaks especially in shared environments. Some workarounds exist such as using environments variables or password files to avoid unmasked passwords, but still not ideal due to the risk of leaving sensitive data on the disk. We propose:

      - Interactive prompt support: Allow secure masked password input when -storepass is omitted (preferred option)

      or

      - Warn on insecure usage: Detect and warn that passwords will be shown in plaintext when piping the output
      - Improve documentation: Promote other options such as :file and :env along -storepass for piping

            weijun Weijun Wang
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: