T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:34
- Finding
- WeChat AppSecret Persisted in a Shell Startup File<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:34-35` **Vulnerability Type**: Plaintext long-lived credential storage **Risk Level**: Medium ### Vulnerable Code ```bash export WECHAT_APPID="your-app-id" export WECHAT_APPSECRET="your-app-secret" ``` ### Technical Analysis The installation instructions recommend storing the WeChat AppSecret directly in `~/.zshrc`. A shell startup file is plaintext, is loaded by every interactive shell, and is commonly copied into workstation backups or included unintentionally in diagnostic archives and configuration repositories. The AppSecret is a long-lived account credential used with the AppID to request WeChat access tokens. Unlike a short-lived token, disclosure can permit repeated token acquisition until the secret is rotated. Although transmitting the credential to the official WeChat API is necessary for this Skill, persistent storage in a general-purpose shell configuration file is not the minimum-privilege storage method. Exploitation requires an attacker, malicious local process, backup operator, or accidentally exposed repository to obtain read access to the user's shell configuration. The finding does not indicate that the Skill sends the secret to any unauthorized endpoint. ### Attack Path 1. A user follows the documented setup instructions and writes the AppID and AppSecret to `~/.zshrc`. 2. The file is exposed through local account compromise, overly broad permissions, workstation backup access, support bundles, dotfile synchronization, or accidental source-control inclusion. 3. An attacker extracts `WECHAT_APPID` and `WECHAT_APPSECRET`. 4. The attacker submits the credentials to the official WeChat token endpoint. 5. Subject to WeChat account permissions and controls such as IP allowlisting, the attacker obtains an access token and invokes authorized account APIs. 6. The attacker can operate on drafts or publishing resources available to the compromised WeChat application identity. ## ...[truncated 660 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not recommend storing the AppSecret in `.zshrc`, `.bashrc`, or another general-purpose shell startup file. 2. Store the credential in an operating-system keychain or a dedicated secret manager. 3. Retrieve the credential only when the command is invoked and keep it out of shell history, process arguments, logs, and source-controlled configuration. 4. If a local environment file is unavoidable: - Place it in a dedicated directory with mode `0700`. - Set the file mode to `0600`. - Exclude it explicitly from source control and backup exports where appropriate. - Load it only for the relevant process rather than every interactive shell. 5. Document AppSecret rotation and incident-response procedures. 6. Retain and clearly document WeChat IP allowlisting as an additional defense, but do not treat it as a substitute for secure secret storage. ]]>
