T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/instagram_analyzer.py:119- Finding
Unrestricted Browser Navigation Enables Server-Side Request Forgery
- Content
View full analysis
dict: """Analyze a single Instagram post/Reel""" result = { "url": post_url, "post_type": "reel" if "/reel/" in post_url else "post", "username": "", "metrics": {}, "ratios": {}, "timing": {}, "error": None, "timestamp": datetime.utcnow().isoformat() } print(f"📊 Analyzing: {post_url}") with sync_playwright() as p: browser = p.chromium.launch(headless=self.config["scraper"]["headless"]) context = browser.new_context( user_agent=self.config["browser"]["user_agent"], viewport={"width": 390, "height": 844} ) page = context.new_page() try: page.goto(post_url, timeout=self.config["scraper"]["timeout"]) ``` ### Technical Analysis The `post` command accepts an arbitrary URL and passes it directly to Playwright's `page.goto()` without validating its scheme, hostname, port, resolved IP address, or redirect chain. Nothing enforces the documented restriction that the destination must be an Instagram post or Reel. Because Chromium makes the request from the host running the analyzer, a caller can direct it to services that are inaccessible from the caller's own network. Potential destinations include loopback interfaces, private network ranges, link-local addresses, and cloud instance metadata services. A public URL that redirects to an internal address can also bypass a hostname-only check unless each redirect is validated. The implementation subsequently calls `page.content()` and attempts to process the rendered document. Although the returned metrics expose only limited content, errors, timing, p ...[truncated 1656 chars]- Remediation
View remediation
