Skip to content

Password leaked to stdout in --verbose mode (qpdf/gs strategies) #7

Description

@Sdaas

Summary

In --verbose mode, decrypt-pdf prints the PDF password in plaintext to stdout via the log_verbose "Running: ${cmd[*]}" lines, because the command array embeds --password=<PASSWORD>.

Affected strategies

  • try_qpdf_basic (decrypt-pdf:312)
  • try_qpdf_hex (decrypt-pdf:331) — logs the hex-encoded password
  • try_qpdf_advanced (decrypt-pdf:346)
  • try_gs_basic / try_gs_compat14 (via ${cmd[*]})

try_mutool already does the right thing — it logs -p '***' (decrypt-pdf:356).

Impact

Anyone running with --verbose (or capturing logs / CI output) exposes the secret. Low severity for interactive one-off use, but a real secret-in-logs leak.

Suggested fix

Mask the password in the logged command string, e.g. build a display copy of the command with --password=*** before logging, mirroring what try_mutool already does. The actual executed command keeps the real password.

Note

A characterization test (test_verbose_mode in decrypt-pdf_test.sh) asserts only that Running:/[DEBUG] appears, not the password — so masking is safe and won't break the suite.

Filed during a repo-hardening pass.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions