T09 · Insecure Skill Coding Practices
- Location
SKILL.md:16- Finding
Long-Lived Home Assistant Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:16-24
Additional Locations:README.md:13-17,README.md:35-40
Vulnerability Type: Exposure of credentials through process arguments and shell history
Risk Level: HighVulnerable Code Snippet
markdown ### Configuration (One-Command) ```bash # Run this to configure ha-cli setup <HA_URL> <TOKEN> # Example: ha-cli setup 192.168.1.100 your_long_lived_token_heretext The same insecure invocation pattern is presented in `README.md`: ```markdown # One-command setup ha-cli setup 192.168.1.100 your_long_lived_tokenTechnical Analysis
The documented setup procedure requires the user to supply a long-lived Home Assistant access token as a command-line argument. Command-line secrets can be exposed through:
- Shell history files.
- Process listings and process-monitoring utilities.
- Terminal session recording.
- System command auditing.
- Diagnostic logs or support bundles.
- Automation logs that echo executed commands.
A Home Assistant long-lived access token is a bearer credential. Anyone who obtains it can authenticate without possessing an additional secret for as long as the token remains valid. The actual
ha-cliexecutable is absent from the audited package, so its implementation and any attempted argument redaction could not be verified. Nevertheless, the documented invocation itself creates exposure through mechanisms outside the executable.Attack Path
- A user follows the documented setup command and places the long-lived token directly on the command line.
- The shell records the complete command in its history, or the argument is captured by process monitoring, terminal logging, or command auditing.
- An attacker with access to the affected local account, history file, monitoring output, backup, or log store retrieves the token.
- The attacker identifies the Home Assistant endpoint from the same command, configuration, or local network disc ...[truncated 875 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not accept access tokens as ordinary command-line arguments.
- Prompt for the token interactively using a no-echo input mechanism.
- Alternatively, accept the token through protected standard input or retrieve it directly from an operating-system credential manager.
- If environment-variable input is supported, clearly warn that environment variables may be exposed through debugging, subprocess inheritance, crash reports, and misconfigured process inspection.
- Ensure the CLI never prints, logs, or includes the token in error messages.
- Redact credentials from diagnostics and structured logs.
- Update every setup example to use a secure workflow, such as:
bash ha-cli setup --url http://homeassistant.local:8123 # The CLI then prompts for the token without echoing it.- Instruct existing users to remove exposed commands from shell history and revoke and replace any token previously entered on the command line.
- Use a dedicated Home Assistant account and token with the minimum permissions needed for the intended devices and operations.
