T09 · Insecure Skill Coding Practices
- Location
SKILL.md:358- Finding
Plaintext IAM passwords written to predictable shared temporary files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 358–383
Vulnerability Type: Plaintext sensitive-data exposure through unsafe temporary files
Risk Level: MediumVulnerable Code
bash cat > /tmp/login_profile.json <<'JSON' { "body": {"password": "{password}", "password_reset_required": true}, "path": {"user_id": "{user_id}"} } JSON hcloud IAM CreateLoginProfileV5 --cli-region={region} --cli-jsonInput=/tmp/login_profile.json skill-quality-cli run --skill-name huawei-cloud-iam-manage -- hcloud IAM CreateLoginProfileV5 --cli-region={region} --cli-jsonInput=/tmp/login_profile.json # Update login profile (reset password) — same jsonInput workaround cat > /tmp/update_login_profile.json <<'JSON' { "body": {"password": "{password}", "password_reset_required": false}, "path": {"user_id": "{user_id}"} } JSON hcloud IAM UpdateLoginProfileV5 --cli-region={region} --cli-jsonInput=/tmp/update_login_profile.json skill-quality-cli run --skill-name huawei-cloud-iam-manage -- hcloud IAM UpdateLoginProfileV5 --cli-region={region} --cli-jsonInput=/tmp/update_login_profile.jsonThe subsequent instruction states:
text For the login-profile jsonInput files: the `.json` files are written only to construct the request, then immediately removed — never leave them on disk.Technical Analysis
The prescribed workflow serializes an IAM user's plaintext password into fixed files under the shared
/tmpnamespace:/tmp/login_profile.json/tmp/update_login_profile.json
The command sequence does not set a restrictive
umask, create a private temporary directory, verify file ownership, or use an exit trap. File permissions therefore depend on the agent process's existing umask. Under a common022umask, a newly created file can be readable by other local users.The documentation says the files must be removed immediately, but the executable example contains no corresponding
rmcommand. If the CLI call fails, the agent is in ...[truncated 1662 chars]- Remediation
View remediation
Remediation Suggestions
- Create a private randomized temporary directory and restrict permissions before writing any secret:
bash umask 077 TEMP_DIR="$(mktemp -d)" trap 'rm -rf -- "$TEMP_DIR"' EXIT HUP INT TERM INPUT_FILE="$TEMP_DIR/login-profile.json"-
Write the request only inside that private directory and ensure the resulting file is owned by the current user with mode
0600. -
Use a cleanup trap so the credential is removed on success, command failure, interruption, or early shell exit. Do not rely solely on prose instructing the agent to clean up.
-
Avoid fixed paths in
/tmp. If KooCLI supports secure stdin or another non-file request mechanism, use it instead of storing the password on disk. -
Do not include the password in command-line arguments, previews, telemetry, shell tracing, or logs. Disable shell tracing around secret handling if the surrounding environment may enable it.
-
Update the documented command sequence to include the actual secure creation and cleanup operations so the security requirement is technically enforced rather than advisory.
