T09 · Insecure Skill Coding Practices
- Location
scripts/wangcut_api.py:125- Finding
Reusable Account Password Stored in Plaintext
- Content
View full analysis
Vulnerability Details
File Location:
scripts/wangcut_api.py:125-136
Vulnerability Type: Plaintext storage of sensitive credentials
Risk Level: MediumVulnerable Code
python # 更新账号配置 if not config.has_section('wangcut'): config.add_section('wangcut') config.set('wangcut', 'username', username) config.set('wangcut', 'password', password)The function documentation also incorrectly states that the password will be transformed before storage:
python password: 密码(明文,会自动MD5加密存储)Technical Analysis
setup_config()writes the supplied reusable account password directly intoconfig.ini. No encryption, operating-system credential store, or restrictive file-permission handling is used. Although the documentation claims that the password is MD5-processed before being stored, the assignment at line 136 stores the originalpasswordvalue unchanged.The installation documentation advises users not to commit
config.ini, but this does not protect the credential from local processes, overly broad filesystem permissions, workspace sharing, backups, or accidental repository commits.Attack Path
- A user provides a valid Wangcut username and password to
setup_config(). - The function writes both values into
config.ini, with the password unchanged. - The configuration file is created using the process and environment's default permissions rather than explicit owner-only permissions.
- Another local user or process, a shared-workspace participant, a backup collector, or a party with access to an accidentally committed file reads
config.ini. - The exposed reusable password is used to authenticate to the victim's Wangcut account.
Exploitation requires read access to the generated configuration file or an accidental disclosure channel; this issue does not independently grant remote filesystem access.
Impact Assessment
Successful exploitation exposes the ...[truncated 455 chars]
- A user provides a valid Wangcut username and password to
- Remediation
View remediation
Remediation Suggestions
- Store the password in an operating-system credential manager or another dedicated secret store instead of
config.ini. - Prefer a revocable API token or service-supported authorization flow that does not require retaining a reusable password.
- If file-backed storage is unavoidable:
- Create the file atomically with owner-only permissions such as
0600. - Reject configuration paths located in shared or repository-controlled directories.
- Avoid copying the file into logs, backups, or source-control archives.
- Provide explicit warnings that the file contains a reusable secret.
- Create the file atomically with owner-only permissions such as
- Correct the documentation so that it does not claim the stored password is MD5-processed.
- Add
config.inito a distributed.gitignorerather than relying solely on installation instructions. - Where practical, migrate existing plaintext credentials out of configuration files and advise affected users to rotate passwords that may have been exposed.
- Store the password in an operating-system credential manager or another dedicated secret store instead of
