T09 · Insecure Skill Coding Practices
Error
- Location
- verify_skill.py:164
- Finding
- Hardcoded Jenkins API Token Used by Executable Verification Code## Vulnerability Details **File Location**: `verify_skill.py:164-171` **Vulnerability Type**: Hardcoded reusable credential **Risk Level**: High ### Vulnerable Code ```python jenkins_url = "http://localhost:8080" jenkins_user = "devops" jenkins_token = "110ffb6071ded434a52bd153217f3fc873" try: response = requests.get( f"{jenkins_url}/job/codeql-security-scan/api/json", auth=(jenkins_user, jenkins_token), timeout=10 ) ``` The same token is also disclosed repeatedly in tracked documentation, including: - `Jenkins_Pipeline_更新指南.md:254-260` - `最终完成报告.md:159,188,250` - `配置完成报告.md:21,71,115,193` - `配置检查完成报告.md:107` - `配置检查报告.md:74` The repository also documents `devsecops` as a Jenkins or Gitea password/token in several files. ### Technical Analysis A reusable Jenkins credential is embedded directly in executable code and copied into documentation. Repository readers, package consumers, build-log viewers, and anyone with access to repository history can recover it. The code actively sends the credential using HTTP Basic Authentication. Basic Authentication encodes rather than encrypts the username and token, so confidentiality depends entirely on TLS. Here, the configured URL uses plaintext HTTP. The effective privileges depend on the Jenkins permissions assigned to the `devops` account. They may include reading job configuration, triggering builds, changing pipelines, accessing artifacts, or executing build-controlled commands. ### Attack Path 1. An attacker obtains the Skill package or its repository history. 2. The attacker extracts the hardcoded username and token. 3. The attacker identifies a reachable Jenkins instance using the documented address or local network discovery. 4. The attacker authenticates as `devops`. 5. The attacker performs every operation allowed to that account, such as reading jobs, triggering builds, or modifying pipelines if the token ...[truncated 401 chars]
- Remediation
- ## Remediation Suggestions 1. Revoke and rotate the exposed Jenkins token immediately. 2. Rotate the documented Gitea and Jenkins passwords if they were ever active. 3. Remove credentials from current files and purge them from repository history. 4. Load credentials from a Jenkins credential binding, operating-system keyring, or dedicated secret manager. 5. Replace all documentation values with unmistakable placeholders. 6. Restrict the service account to the minimum required permissions. 7. Add secret scanning to pre-commit and CI workflows. 8. Review Jenkins audit logs for use of the disclosed token.
