T09 · Insecure Skill Coding Practices
- Location
scripts/lakewatch_api_config.yaml:48- Finding
Credential-bearing API connections disable TLS certificate verification by default
- Content
View full analysis
Vulnerability Details
File Location:
scripts/lakewatch_api_config.yaml:48,scripts/manager_api_config.yaml:56,scripts/lakewatch_api_client.py:158-165, 208-224,scripts/manager_api_client.py:160-167, 238-252
Vulnerability Type: Improper certificate validation exposing authentication credentials
Risk Level: HighVulnerable Code
Both shipped configurations disable TLS verification:
yaml # scripts/lakewatch_api_config.yaml:48 verify_ssl: falseyaml # scripts/manager_api_config.yaml:56 verify_ssl: falseBoth clients honor that setting by disabling hostname and certificate validation:
python def _build_ssl_context(config: dict) -> ssl.SSLContext: """根据配置构建 SSL 上下文,支持跳过验证和自定义 CA 证书""" ctx = ssl.create_default_context() verify_ssl = config.get("crypto", {}).get("verify_ssl", True) if not verify_ssl: ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE else: ca_cert = config.get("crypto", {}).get("ca_cert", "") if ca_cert and os.path.isfile(ca_cert): ctx.load_verify_locations(ca_cert) return ctxThe LakeWatch client decrypts and sends the account password in the request body:
python password = decrypt(encrypted_password, self.config) url = f"{scheme}://{host}:{port}/lakewatch/v1/system/get-token" payload = json.dumps({"username": username, "password": password}).encode("utf-8") ctx = _build_ssl_context(self.config) req = urllib.request.Request( url=url, data=payload, headers={"Content-Type": "application/json"}, method="POST", ) try: res = urllib.request.urlopen(req, context=ctx)The Manager client sends reusable account credentials through HTTP Basic authentication:
python _cred_bytes = b":".join([username.encode("utf-8"), password.encode("utf-8")]) credentials = base64.b64encode(_cred_bytes).decode("utf-8") del _cred_bytes req = urllib.request.Request( url=url, data=b"", headers={ "Con ...[truncated 2316 chars]- Remediation
View remediation
Remediation Suggestions
- Change
verify_ssltotruein both shipped configuration files. - Require a valid private CA certificate through
ca_certfor deployments using self-signed or internally issued certificates. - Fail closed if the configured CA file is missing or invalid; do not silently fall back to disabled verification.
- If insecure TLS is retained for exceptional diagnostics, require an explicit per-invocation flag with a prominent warning rather than a persistent default.
- Consider refusing to transmit passwords or Basic authentication credentials whenever certificate validation is disabled.
- Rotate all credentials that may previously have been transmitted using the insecure default.
- Add automated tests verifying that the default SSL context uses
CERT_REQUIREDand performs hostname validation.
- Change
