T09 · Insecure Skill Coding Practices
Error
- Location
- skill.py:43
- Finding
- Automatic Bypass of Browser TLS Certificate Warnings<![CDATA[ ## Vulnerability Details **File Location**: `skill.py`, lines 43–68 **Vulnerability Type**: TLS certificate validation bypass **Risk Level**: High ### Vulnerable Code ```python # 告警页面处理 def handle_warning(driver): try: # 等待"高级"按钮出现并点击 driver.find_element(By.ID, "details-button").click() print("点击'高级'按钮成功") # 等待"继续访问"链接出现 time.sleep(1) # 点击"继续访问"链接 driver.find_element(By.ID, "proceed-link").click() print("点击'继续访问'链接成功") # 等待页面跳转 time.sleep(1) except Exception as e: print(f"处理安全警告时出错: {e}") # 备选方案:使用JavaScript点击 try: print("尝试使用JavaScript点击...") driver.execute_script("document.getElementById('details-button').click();") time.sleep(1) driver.execute_script("document.getElementById('proceed-link').click();") print("JavaScript点击成功") except Exception as js_error: print(f"JavaScript点击也失败了: {js_error}") ``` ### Technical Analysis The function explicitly interacts with Chrome's certificate-error page and selects the option to continue to the destination despite the TLS warning. It includes both normal DOM interactions and a JavaScript fallback, showing that bypassing the browser warning is intentional and resilient to ordinary interaction failures. The function is called after navigating to the invoice verification site and before uploading the invoice document. Consequently, the workflow may continue even when the remote endpoint cannot prove its identity through a valid certificate. TLS certificate validation is the control that prevents an active network attacker or incorrectly routed endpoint from impersonating the intended website. Automatically bypassing this control eliminates meaningful server authentication. ### Attack Path 1. An attacker gains a network interception position or manipulates DNS or routing for the invoice verification endpoint. 2. Th ...[truncated 1149 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove `handle_warning()` and all automated interactions with `details-button` and `proceed-link`. - Treat any certificate warning as a fatal verification failure. - Require the destination to use a valid certificate issued for the expected hostname. - Verify that the browser remains on the exact expected HTTPS origin before locating the upload field or transmitting an invoice. - Report certificate failures to the caller without retrying through an insecure path. - If a private certificate authority is legitimately required, install and manage that authority through the operating system or browser trust store rather than bypassing validation in application code. - Add an integration test confirming that invalid, expired, mismatched, and self-signed certificates stop the workflow before document upload. ]]>
