T09 · Insecure Skill Coding Practices
- Location
SKILL.md:99- Finding
Plaintext Vault Master Password Storage and Environment Exposure
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 99-157
Vulnerability Type: Plaintext sensitive-data storage and insecure environment-variable propagation
Risk Level: HighThe documented non-interactive authentication pattern stores the Bitwarden/Vaultwarden master password in a plaintext configuration file and imports it into the systemd service environment. The pinentry wrapper then reads the password from that environment.
bash #!/usr/bin/env bash if [ -n "$RBW_MASTER_PASSWORD" ]; then echo "OK Pleased to meet you" while IFS= read -r line; do case "$line" in GETPIN) echo "D $RBW_MASTER_PASSWORD" echo "OK" ;; BYE) echo "OK closing connection" exit 0 ;; *) echo "OK" ;; esac done else exec /usr/bin/pinentry-curses "$@" fibash chmod +x ~/.local/bin/pinentry-rbw-systemd rbw config set pinentry ~/.local/bin/pinentry-rbw-systemd rbw config show # verifytext RBW_MASTER_PASSWORD=your_master_password_hereini [Service] User=tripleight EnvironmentFile=/etc/systemd/rbw-credentials.conf ExecStart=/path/to/script.shbash #!/usr/bin/env bash set -euo pipefail if ! rbw unlocked 2>/dev/null; then rbw unlock || { echo "ERROR: Failed to unlock rbw" >&2; exit 1; } fi rbw sync USERNAME=$(rbw get --folder homelab service_name --field Username 2>/dev/null \ || { echo "ERROR: Cannot read username (homelab/service_name)" >&2; exit 1; }) PASSWORD=$(rbw get --folder homelab service_name 2>/dev/null \ || { echo "ERROR: Cannot read password (homelab/service_name)" >&2; exit 1; }) curl -u "$USERNAME:$PASSWORD" https://api.example.comTechnical Analysis
File permissions of
600and `root:root ...[truncated 2319 chars]- Remediation
View remediation
Remediation Suggestions
- Replace the plaintext
EnvironmentFile=pattern with systemd'sLoadCredential=orLoadCredentialEncrypted=facility. - Read the credential directly from the systemd credential file only inside the pinentry helper rather than exporting it into the service-wide environment.
- Scope the credential to the shortest possible lifetime and remove it immediately after unlocking the vault.
- Ensure unrelated child processes, including API clients such as
curl, do not inherit the master password. - Prefer interactive or hardware-backed unlocking for high-security environments.
- Apply restrictive ownership and permissions to both the credential and pinentry helper, and prevent untrusted users from modifying the helper configured through
rbw config set pinentry. - Exclude credential material from backups, logs, shell history, diagnostics, and crash reports unless those systems provide suitable encryption and access controls.
- If plaintext storage was previously deployed, rotate the vault master password and review vault and account activity for unauthorized access.
- Replace the plaintext
