T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/dify-workflow.sh:8
- Finding
- Hardcoded Dify API Bearer Credential<![CDATA[ ## Vulnerability Details **File Location**: `scripts/dify-workflow.sh:8-9`; duplicated in `SKILL.md:34-38` **Vulnerability Type**: Hardcoded secret **Risk Level**: High ### Vulnerable Code ```bash # Configuration from environment or defaults DIFY_BASE_URL="${DIFY_BASE_URL:-http://10.10.10.159/v1}" DIFY_API_KEY="${DIFY_API_KEY:-app-jUhDcPj3lcnEG04JW4gRsfyy}" ``` The same credential is disclosed in the documentation: ```markdown **Base URL**: `http://10.10.10.159/v1` **API Key**: `app-jUhDcPj3lcnEG04JW4gRsfyy` ``` ### Technical Analysis A live-looking Dify bearer token is embedded directly in both the executable script and its documentation. The environment-variable fallback does not protect the credential: whenever `DIFY_API_KEY` is unset, the script automatically uses the exposed value. Anyone who can read the distributed Skill package, a repository copy, an archive, or relevant build artifacts can recover the token. Because bearer tokens confer access through possession, no additional authentication material is necessarily required to reuse it. ### Attack Path 1. An attacker obtains a copy of the Skill package or reads its repository. 2. The attacker extracts the hardcoded API key and internal Dify service address. 3. If the Dify endpoint is reachable from the attacker's position, the attacker submits API requests with: `Authorization: Bearer app-jUhDcPj3lcnEG04JW4gRsfyy`. 4. The attacker invokes the API capabilities authorized for the associated Dify application. 5. The attacker may repeat requests until the credential is revoked, expires, or is otherwise restricted. Successful exploitation depends on network access to the configured service and the permissions assigned to the exposed key. ### Impact Assessment The exposed credential may permit unauthorized knowledge-base queries, ChatApp requests, workflow execution, resource consumption, and access to application responses. The precise scope is limited by the Dify application's per ...[truncated 171 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed credential immediately; removing it from the current files does not invalidate copies in repository history or distributed artifacts. 2. Remove the API key from both `scripts/dify-workflow.sh` and `SKILL.md`. 3. Require `DIFY_API_KEY` to be provided at runtime and terminate safely if it is absent: ```bash : "${DIFY_API_KEY:?DIFY_API_KEY must be supplied through a protected secret store}" ``` 4. Supply the key through an approved secret manager or protected runtime environment rather than source control. 5. Restrict the replacement credential to the minimum required Dify application permissions. 6. Apply network-level restrictions, expiration, rotation, and usage monitoring where supported. 7. Search repository history, release archives, logs, and package registries for the exposed value and purge it where feasible. 8. Add automated secret scanning to the development and release pipelines. ]]>
