T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:561
- Finding
- Active Destructive and High-Volume API Testing Lacks Mandatory Authorization Safeguards<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:561-581`, `SKILL.md:604-617`, and `SKILL.md:645-651` **Vulnerability Type**: Unsafe active security and load-testing defaults **Risk Level**: High The Skill provides executable examples that send destructive SQL injection strings and high volumes of requests to a user-controlled `base_url`. ### Complete Code Snippets **Concurrent performance test (`SKILL.md:561-581`):** ```python def test_concurrent_requests(self): def make_request(): return requests.get(f"{self.base_url}/api/users").status_code start = time.time() with ThreadPoolExecutor(max_workers=50) as executor: results = list(executor.map(lambda _: make_request(), range(500))) duration = time.time() - start success_count = sum(1 for r in results if r == 200) qps = 500 / duration print(f"Total requests: 500") print(f"Successful requests: {success_count}") print(f"QPS: {qps:.2f}") print(f"Total duration: {duration:.2f}s") assert success_count / 500 > 0.99 assert qps > 100 ``` **SQL injection test (`SKILL.md:604-617`):** ```python def test_sql_injection(self): payloads = [ "' OR '1'='1", "'; DROP TABLE users; --", "1 UNION SELECT * FROM users" ] for payload in payloads: response = requests.get( f"{self.base_url}/api/users", params={"search": payload} ) assert response.status_code in [400, 403, 500] ``` **Rate-limit test (`SKILL.md:645-651`):** ```python def test_rate_limiting(self): responses = [] for _ in range(150): response = requests.get(f"{self.base_url}/api/users") responses.append(response.status_code) assert 429 in responses ``` ### Technical Analysis Security and performance testing legitimately require network access, but the examples do not enforce least-privilege safeguards around that access. In particular: - The SQL test includes a payload con ...[truncated 2743 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. **Require explicit authorization before execution** - Ask the operator to confirm ownership or written authorization for the exact hostname. - Record the approved hostname, environment, test type, request budget, and testing window. - Default to generating test plans without executing them. 2. **Block production and third-party targets by default** - Require an explicit override for production environments. - Support a strict hostname allowlist. - Resolve and validate destinations before execution, including redirects, to reduce server-side request forgery and target-switching risks. - Reject metadata, loopback, link-local, and private-network destinations unless expressly approved for the test. 3. **Separate safe and destructive testing modes** - Remove `DROP TABLE` and similarly destructive strings from the default payload set. - Use harmless detection payloads by default. - Require a separate, prominent opt-in before sending destructive payloads. - Prefer disposable test databases and isolated staging environments. 4. **Apply conservative traffic limits** - Begin with one worker and a small request count. - Require explicit approval before increasing concurrency or total requests. - Implement pacing, exponential backoff, jitter, and a global requests-per-second ceiling. - Stop automatically when latency, error rates, or resource consumption exceed safe thresholds. 5. **Add execution safety controls** - Set connection and response timeouts on every request. - Enforce a maximum runtime and total request budget. - Provide an immediate cancellation mechanism. - Avoid automatically retrying unsafe or state-changing operations. 6. **Protect credentials and request data** - Replace hardcoded example passwords with environment-variable or secret-manager placeholders. - Display the final destination before sending authorization headers. - Redact tokens, password ...[truncated 376 chars]
