T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:34
- Finding
- Bearer API Key Exposed Through Process Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 34–36 **Vulnerability Type**: API credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```bash curl -H "Authorization: Bearer $AIFS_API_KEY" https://aifs.space/api/files ``` The same credential-handling pattern is repeated across the documented read, write, patch, delete, summary, and logging examples. ### Technical Analysis The shell expands `$AIFS_API_KEY` before starting `curl`. Consequently, the complete bearer token can become part of the process command-line arguments. Depending on the operating system, process isolation settings, monitoring configuration, and privileges of other local users or services, command-line arguments may be observable through process inspection facilities, audit logs, diagnostic tooling, or process-monitoring software. Because the value is a bearer credential, possession of the token is sufficient to authenticate without additional proof of identity. The possible permissions are significant because the documentation supports `admin`, `read-write`, `read-only`, and `write-only` key types. ### Attack Path 1. A user configures `AIFS_API_KEY` and invokes one of the documented `curl` commands. 2. The shell expands the variable into the `Authorization` header before executing `curl`. 3. A malicious or compromised local process, monitoring agent, or sufficiently privileged user inspects the running process's command-line arguments or retained process telemetry. 4. The attacker extracts the bearer API key. 5. The attacker sends authenticated requests directly to `https://aifs.space`. 6. Depending on the key type, the attacker lists, reads, creates, modifies, or deletes cloud-hosted files. ### Impact Assessment A compromised key grants all permissions assigned to that key: - A read-only key can expose stored cloud content. - A write-only key can allow unauthorized file creation or replacement. - A read-write key can perm ...[truncated 294 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not expand bearer credentials directly into command-line arguments. - Prefer an API client or credential mechanism that supplies sensitive headers without placing their values in the process argument list. - If `curl` must be used, load the authorization header through a permission-restricted configuration or header file and remove temporary material immediately after use. - Ensure credential files are readable only by the owning account, such as with mode `0600`. - Use a dedicated least-privilege key for each workflow rather than an administrator key. - Rotate any key suspected of appearing in process telemetry or diagnostic logs. - Prevent shell tracing, verbose HTTP logging, and CI job output from recording authorization headers. - Explicitly document secure secret provisioning and revocation procedures. ]]>
