T09 · Insecure Skill Coding Practices
- Location
keepass_cli.py:604- Finding
Entry passwords and OTP secrets are exposed through command-line arguments
- Content
View full analysis
Vulnerability Details
File Location:
keepass_cli.py:604-605andkeepass_cli.py:618-623
Vulnerability Type: Sensitive information exposure through process arguments
Risk Level: HighThe CLI requires entry passwords and optionally accepts OTP provisioning URIs as ordinary command-line arguments.
python add.add_argument("--otp", help="otpauth URI") add.add_argument("--password", required=True, help="Password to store on the entry")python edit.add_argument("--new-title") edit.add_argument("--username") edit.add_argument("--password", help="New password to set on the entry") edit.add_argument("--url") edit.add_argument("--notes") edit.add_argument("--otp")The associated documentation confirms that this is the intended secret-input mechanism:
markdown `add-entry` requires `--password`; `edit-entry --password` sets a new one. Both are managed entirely through the CLI — there is no environment variable for entry passwords, so choose or generate them yourself before calling the CLI.Technical Analysis
Command-line arguments are not an appropriate transport for high-value secrets. Depending on the execution environment, arguments may be exposed through:
- Shell history.
- Process inspection facilities.
- Agent or orchestration execution logs.
- Endpoint monitoring and audit systems.
- Error reports or debugging telemetry that record complete invocations.
- Wrapper scripts and job-control systems that persist command lines.
OTP provisioning URIs commonly contain reusable TOTP seed material. Disclosure of such a URI may therefore compromise a second authentication factor, not merely transient authentication output.
The database master password is handled more safely through an environment variable, but equivalent protection is not provided for entry passwords or OTP seeds. Documentation warns users not to log these invocations, but a warning does not pre ...[truncated 1395 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace secret-bearing command-line flags with protected standard-input handling.
- For human use, read secrets with a no-echo prompt such as
getpass.getpass(). - For automated use, support a dedicated inherited file descriptor or standard input with an explicit JSON request contract.
- If file-based input is necessary, require an owner-readable file, reject permissive file modes where supported, avoid following unsafe symbolic links, and document secure deletion limitations.
- Keep secret values out of exception messages, debug output, command summaries, and telemetry.
- Deprecate
--passwordand--otpgradually, and emit a warning until they are removed. - Document secure invocation examples that do not interpolate secrets into shell command lines.
- Add automated tests confirming that secrets do not appear in normal stdout, stderr, exception output, or process arguments under the recommended workflow.
