Sc open redirect

From ersinkoc/security-check · View interactive version

Sc open redirect is an AI agent skill from the GitHub repository ersinkoc/security-check. Open redirect detection — unvalidated redirect URLs, protocol-relative bypasses, and URI scheme abuse

How to use this skill

Skill file

SC: Open Redirect

Purpose

Detects open redirect vulnerabilities where user-controlled input determines the destination of HTTP redirects, enabling phishing attacks, OAuth token theft, and SSRF chaining. Covers URL parameter redirects, protocol-relative URL bypasses, backslash tricks, and JavaScript/data URI schemes.

Activation

Called by sc-orchestrator during Phase 2 when redirect functionality is detected.

Phase 1: Discovery

Keyword Patterns to Search

"redirect(", "res.redirect(", "response.sendRedirect(",
"http.Redirect(", "redirect_to(", "RedirectToAction(",
"Location:", "window.location", "document.location",
"return_url", "redirect_url", "next=", "callback=", "url=", "goto="

Vulnerability Pattern

// VULNERABLE: Unvalidated redirect
app.get('/redirect', (req, res) => {
  res.redirect(req.query.url);  // url=https://evil.com
});

// SAFE: Allowlist validation
const ALLOWED_HOSTS = ['example.com', 'app.example.com'];
app.get('/redirect', (req, res) => {
  const url = new URL(req.query.url, 'https://example.com');
  if (!ALLOWED_HOSTS.includes(url.hostname)) {
    return res.status(400).send('Invalid redirect');
  }
  res.redirect(url.toString());
});

Bypass Techniques to Check

Severity Classification

Output Format

Finding: REDIR-{NNN}

Common False Positives

  1. Relative redirects — /dashboard or ./profile cannot redirect to external domains
  2. Hardcoded redirect URLs — redirect to constant URLs
  3. Framework-safe redirects — some frameworks validate redirect URLs by default
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.