T05 · Unauthorized Access and Privilege Escalation
- Location
.- Finding
Unrestricted Website Audit Requests Enable Server-Side Request Forgery
- Content
View full analysis
requests.Response: return requests.get( url, headers={"User-Agent": USER_AGENT, "Accept-Encoding": "gzip, br"}, timeout=REQUEST_TIMEOUT, allow_redirects=True, ) def safe_fetch(url: str) -> requests.Response | None: try: return fetch(url) except Exception as exc: print(f" ⚠️ Failed to fetch {url}: {exc}", file=sys.stderr) return None def extract_sitemap_urls(sitemap_url: str) -> list[str]: resp = safe_fetch(sitemap_url) if not resp or resp.status_code != 200: return [] content = resp.text urls = [] if "\s*(.*?)\s*', content) for sub_url in sub_sitemaps: sub_resp = safe_fetch(sub_url) if sub_resp and sub_resp.status_code == 200: urls.extend(re.findall(r'\s*(.*?)\s*', sub_resp.text)) else: urls = re.findall(r'\s*(.*?)\s*', content) return urls ``` #### `scripts/seo_audit.py:52-59` ```python def fetch(url: str, *, follow_redirects: bool = True) -> requests.Response: """Fetch a URL with standard headers.""" return requests.get( url, headers={"User-Agent": USER_AGENT, "Accept-Encoding": "gzip, br"}, timeout=REQUEST_TIMEOUT, allow_redirects=follow_redirects, ) ``` #### `scripts/seo_audit.py:215- ...[truncated 6593 chars]- Remediation
View remediation
