T09 · Insecure Skill Coding Practices
- Location
plugin.py:885- Finding
Unrestricted Global Proxy Configuration Enables SSRF and Cross-User Authentication Traffic Hijacking
- Content
View full analysis
str: """设置代理 API 地址""" import json from pathlib import Path config_file = Path(__file__).parent / "data" / "proxy_config.json" config = {} if config_file.exists(): try: with open(config_file, "r", encoding="utf-8") as f: config = json.load(f) except Exception: pass config["api_url"] = url config["last_fetch_time"] = 0 config["fetch_count_hour"] = 0 config["hour_start"] = 0 config_file.parent.mkdir(parents=True, exist_ok=True) with open(config_file, "w", encoding="utf-8") as f: json.dump(config, f, ensure_ascii=False, indent=2) ``` ```python # src/sms_login.py:54-94 def _get_proxy() -> str: config = _load_proxy_config() api_url = config.get("api_url", "") if not api_url: return "" now = time.time() max_per_hour = config.get("max_per_hour", 20) cooldown = config.get("cooldown_seconds", 30) last_fetch = config.get("last_fetch_time", 0) if now - last_fetch < cooldown: return "" hour_start = config.get("hour_start", 0) if now - hour_start > 3600: config["hour_start"] = now config["fetch_count_hour"] = 0 if config.get("fetch_count_hour", 0) >= max_per_hour: return "" try: import urllib.request req = urllib.request.Request(api_url, method="GET") with urllib.reques ...[truncated 2709 chars]- Remediation
View remediation
