T09 · Insecure Skill Coding Practices
- Location
scripts/common.py:10- Finding
Authentication Credentials Transmitted Without TLS Certificate Verification
- Content
View full analysis
dict: """通用 POST 请求,返回响应 JSON""" resp = requests.post(url, headers=headers, json=payload, verify=False, timeout=15) resp.raise_for_status() data = resp.json() if data.get("code") != 0: print(f"错误:API 请求失败({url}):{data.get('msg')}", file=sys.stderr) sys.exit(1) return data ``` ### Technical Analysis The initial API request transmits the `KNOT_JWT_TOKEN` in the JSON body and `KNOT_USERNAME` in an HTTP header. Subsequent requests transmit the generated Knot API token through the `x-knot-api-token` header. Although HTTPS is used, `verify=False` disables validation of the server certificate. The client will therefore accept certificates that are expired, self-signed, issued for another hostname, or supplied by an untrusted certificate authority. Suppressing `InsecureRequestWarning` also conceals the unsafe connection from the operator. The behavior is documented in `references/api.md`, but documenting an insecure requirement does not mitigate the vulnerability. Credential transmission is necessary for the declared functionality; transmission without authenticating the remote server exceeds the minimum safe privilege and trust requirements. ### Attack Path 1. An attacker obtains a network interception position, such as control of a prox ...[truncated 1332 chars]- Remediation
View remediation
