T09 · Insecure Skill Coding Practices
- Location
list_rds.py:223- Finding
Long-Lived Cloud Credentials Stored in Plaintext Configuration
- Content
View full analysis
Vulnerability Details
File Location:
list_rds.py:223-226
Vulnerability Type: Plaintext sensitive credential storage
Risk Level: Mediumpython with open(config_path, "r", encoding="utf-8") as fh: cfg = json.load(fh) ak = (cfg.get("ak") or "").strip() sk = (cfg.get("sk") or "").strip()The plaintext credential format is also demonstrated in
config.example.json:1-6and recommended inSKILL.md:20-34.Technical Analysis
The application requires users to store a Huawei Cloud Access Key ID and Secret Access Key in an unencrypted JSON file. It reads these long-lived credentials directly from the filesystem without checking whether the file has restrictive ownership or permissions.
Although
.gitignoreexcludesconfig.jsonfrom ordinary Git operations, this only reduces accidental repository commits. It does not protect the credentials from other local users, overly broad file permissions, compromised processes, filesystem backups, workspace collection, or accidental transfer through mechanisms outside Git.The credentials are subsequently used to generate authenticated Huawei Cloud API requests. Therefore, disclosure of the configuration file provides reusable authentication material rather than only transient session data.
Attack Path
- A user creates
config.jsonand stores valid Huawei Cloud AK/SK credentials as instructed. - The file is created with permissions that allow another local account or process to read it, or it is copied into an unprotected backup or shared workspace.
- An attacker obtains the file and extracts the plaintext
akandskvalues. - The attacker uses the credentials to sign Huawei Cloud API requests from another system.
- The attacker exercises every permission granted to the associated cloud identity until the credentials are revoked, rotated, or otherwise disabled.
This path requires an attacker to obtain local filesystem, backup, or works ...[truncated 842 chars]
- A user creates
- Remediation
View remediation
Remediation Suggestions
- Prefer short-lived credentials supplied through workload identity, instance identity, federation, or another Huawei Cloud-supported temporary credential mechanism.
- Where static credentials are unavoidable, retrieve them from an operating-system credential manager or dedicated secrets-management service instead of storing them in JSON.
- Support environment-variable credential injection for automation so secrets do not need to reside in the project directory.
- If file-based credentials remain supported:
- Require owner-only permissions, such as mode
0600on POSIX systems. - Verify file ownership and permissions before reading it, and reject insecure files with a clear error.
- Document secure file creation and storage procedures.
- Keep the file outside shared project and workspace directories.
- Require owner-only permissions, such as mode
- Use a dedicated cloud identity restricted to the documented read-only actions and relevant resources.
- Rotate credentials regularly and immediately revoke any credentials suspected of exposure.
- Add automated secret scanning to development and release workflows, while retaining the existing
.gitignorerule as defense in depth.
