open-redirect
Skill2 starsChanged 4 months agoMITView on GitHub
SAST detection methodology for open redirect (CWE-601), including filter bypasses (//evil.com, backslash tricks, @ userinfo, substring/suffix whitelist flaws, CRLF), redirect_uri / RelayState / next / returnUrl parameter abuse in OAuth/SSO flows, and header/meta-refresh/JS location sinks. Emphasizes its role as a chaining primitive for token theft, phishing, and SSRF filter bypass. Use when reviewing code that redirects a browser to a URL derived from input. Writes confirmed findings to findings/16-open-redirect.md.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- mahumadad/quarrytheir own version, first seen Nov 8, 2026
- TaiMaBenJi/taima-skillstheir own version, first seen Oct 11, 2026
- cdxiaodong/cain-agenttheir own version, first seen Oct 8, 2026
- emre-guler/websectheir own version, first seen Aug 27, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- Kur1sulab/blackboxtheir own version, first seen Aug 12, 2026
Used with
Projects with it also use ssti, path-traversal and 5 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SubhiSecSkillssti
Hunt Server-Side Template Injection (SSTI) in Jinja2, Twig, Freemarker, Velocity, Smarty, ERB, Handlebars, Mustache, and Spring (SpEL). Use when input is reflected in a way that suggests template rendering — error pages, email templates, PDF generators, dynamic content systems.
Also in 5 projects that use this
langbyyiSkillpath-traversal
Path traversal and LFI playbook. Use when file paths, download endpoints, include operations, archive extraction, or wrapper behavior may expose filesystem control.
Also in 4 projects that use this
SubhiSecSkillxss
Hunt reflected, stored, and DOM-based Cross-Site Scripting (XSS) including CSP bypass, polyglot payloads, mutation XSS (mXSS), markdown XSS, and template XSS. Use when the user has identified a parameter or input that reflects to the page, or wants to test for XSS in a specific input.
Also in 4 projects that use this
iAskShahramSkillfile-upload
Uploads a local file to Cloudflare R2 bucket `public` with wrangler and returns the public URL on assets.shahram.dev. Use when the user wants a public link, public URL, or to host/upload a local image or file to R2.
Also in 6 projects that use this
langbyyiSkilldeserialization
Insecure deserialization playbook. Use when Java, PHP, or Python applications deserialize untrusted data via ObjectInputStream, unserialize, pickle, or similar mechanisms that may lead to RCE, file access, or privilege escalation.
Also in 3 projects that use this
- +2 more from SubhiSec
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- yaklang/hack-skills★ 2.4ksame name
- cdxiaodong/cain-agent★ 953same name
- thejefflarson/soundcheck★ 20same name
- langbyyi/websec-skills★ 4same name
- Kur1sulab/blackbox★ 3same name
- emre-guler/websec★ 2same name
- JustineDevs/premortem★ 2same name
- mahumadad/quarry★ 1same name
- TaiMaBenJi/taima-skills★ 1same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- authentication-flawsSkill
- broken-access-control-idorSkill
- business-logic-flawsSkill
- cicd-and-pipeline-injectionSkill
- code-injectionSkill
- command-injectionSkill
- cors-misconfigurationSkill
- crlf-and-header-injectionSkill
- cross-site-scriptingSkill
- csrfSkill
- dependency-and-supply-chainSkill
- dom-clobbering-and-postmessageSkill
- graphql-injection-and-abuseSkill
- hardcoded-secretsSkill
- http-request-smugglingSkill
- iac-misconfigurationSkill
- information-disclosureSkill
- insecure-deserializationSkill
- insecure-randomnessSkill
- jwt-vulnerabilitiesSkill
- ldap-injectionSkill
- llm-and-ai-application-securitySkill
- mass-assignmentSkill
- memory-safetySkill
- mobile-android-securitySkill
- mobile-ios-securitySkill
- nosql-injectionSkill
- oauth-oidc-saml-flawsSkill
- path-traversal-and-file-inclusionSkill
- prototype-pollutionSkill
- race-conditions-and-toctouSkill
- redosSkill
- sast-final-reportSkill
- sast-finding-validationSkill
- sast-methodologySkill
- security-logging-and-monitoring-failuresSkill
- security-misconfiguration-and-headersSkill
- server-side-template-injectionSkill
- session-managementSkill
- smart-contract-securitySkill
- sql-injectionSkill
- ssrfSkill
- unrestricted-file-uploadSkill
- unsafe-parsers-and-yamlSkill
- weak-cryptographySkill
- web-cache-poisoning-and-deceptionSkill
- websocket-securitySkill
- xpath-and-xml-injectionSkill
- xxeSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
All HTTP inputs (query/body/path/header/cookie) supplying a URL or path — most commonly the next/returnUrl/redirect/url/callback/RelayState …
- Very specific: line 88
Don't redirect to a full URL from input at all — accept a relative path only and reject anything with a scheme or host.
- Very specific: line 136
Check OAuth/SSO context: if the param is redirect_uri/RelayState, is it exact-matched against registered values?
- Distinctive: line 190
Prefer never redirecting to an input-supplied absolute URL: accept a relative path only, or map an opaque token to a server-side allowlist.
- Very specific: line 202
Chain potential: always name the primitive it provides: *trusted-origin redirect* → candidate chains include OAuth/SSO token theft (→ …
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Open Redirect — SAST Methodology
Class: Open Redirect · CWE-601 · OWASP: A01 Broken Access Control
Findings file: findings/16-open-redirect.md
1. Overview
Open redirect occurs when attacker-controlled input determines the destination of
a browser redirect without validation restricting it to the application's own
origin. Low impact alone, but a potent chaining primitive: it lends the
target's trusted domain to phishing, steals OAuth/SSO tokens via a poisoned
redirect_uri, and defeats SSRF/URL-allowlist filters that trust the first host.
The core test: does a source reach a redirect sink (Location header, framework
redirect(), window.location, meta-refresh), and is the destination validated
against a strict same-origin/allowlist rule that a bypass string can't slip past?
2. Where it lives
- Post-login/logout landing:
?next=,?returnUrl=,?redirect=,?url=,?dest=,?continue=,?callback=,?return_to=,?RelayState=. - OAuth/OIDC
redirect_uriand SAMLRelayStatehandling. - Generic "go back" / deep-link handlers, URL shorteners, tracking/exit redirectors, language/region switchers that preserve the current path.
- Any place setting
Location, callingres.redirect/redirect()/RedirectView,sendRedirect, or assigningwindow.location/location.href/window.open.
3. Sources (tainted input)
All HTTP inputs (query/body/path/header/cookie) supplying a URL or path — most
commonly the next/returnUrl/redirect/url/callback/RelayState family.
Also document.referrer, location.hash/search for client-side redirects, and
second-order: a stored "home URL"/"post-login destination" read back and redirected
to.
4. Sinks (dangerous operations)
# Python — dangerous
return redirect(request.args.get('next')) # Flask, no validation
return HttpResponseRedirect(request.GET['url']) # Django
response.headers['Location'] = user_url # raw header// Node/Express — dangerous
res.redirect(req.query.url);
res.writeHead(302, { Location: req.query.next });
// Client-side — dangerous
window.location = params.get('redirect');
location.href = decodeURIComponent(location.hash.slice(1));
window.open(userUrl);// Java — dangerous
response.sendRedirect(request.getParameter("url"));
return new RedirectView(request.getParameter("next")); // Spring
return "redirect:" + userUrl; // Spring MVC prefix// C# / ASP.NET — dangerous
return Redirect(returnUrl); // not LocalRedirect
Response.Redirect(Request.QueryString["url"]);// PHP — dangerous
header("Location: " . $_GET['url']);<!-- Meta refresh — dangerous -->
<meta http-equiv="refresh" content="0;url={{ user_url }}">5. Sanitizers / safe patterns
Safe:
- Don't redirect to a full URL from input at all — accept a relative path only
and reject anything with a scheme or host. Enforce it starts with a single
/and not//or/\. - Map an opaque token/enum to a server-side allowlist of destinations
(
?next=dashboard→{'dashboard': '/app/home'}). - Framework-native local-only helpers: ASP.NET
LocalRedirect/Url.IsLocalUrl, Djangourl_has_allowed_host_and_scheme(url, allowed_hosts), Railsredirect_towithonly_path: true. - Parse with a real URL parser, then compare the resulting host against an
exact allowlist (
parsed.host === 'app.example.com'), rejecting non-http(s) schemes. - For OAuth
redirect_uri: exact-match against pre-registered URIs (full string, including path), never prefix/substring.
Fails / not a real sanitizer:
startsWith('/')alone —//evil.comand/\evil.comare protocol-relative / backslash escapes to another host.startsWith('https://trusted.com')— matcheshttps://trusted.com.evil.comandhttps://trusted.com@evil.com.contains('trusted.com')/ suffixendsWith('trusted.com')— matchesevil-trusted.com,trusted.com.evil.com,eviltrusted.com.- Blocking
http:///https://but allowing//host,\/\/host,https:evil.com(scheme-relative),javascript:/data:(for JS-location sinks), or backslash/tab/newline obfuscation the browser normalizes. - Validating a decoded value but redirecting with a re-encoded/raw one (or vice
versa) — double-encoding and
@userinfo confusion. - Regex host checks with an unescaped
.or no anchors. - CRLF (
%0d%0a) in the value splitting theLocationheader (also header injection) — the redirect filter that ignores control chars.
6. Detection methodology
- Find redirect sinks:
rg -n 'redirect\(|sendRedirect|RedirectView|HttpResponseRedirect|writeHead\([^)]*Location|res\.redirect' rg -n 'Location["\x27]?\s*[:=]|header\(\s*["\x27]Location' rg -n 'window\.location|location\.(href|assign|replace)|window\.open\(' rg -n 'http-equiv=["\x27]?refresh' - Find the redirect-param sources:
rg -n '\b(next|returnUrl|return_to|redirect|redirect_uri|url|dest|destination|continue|callback|RelayState)\b' - Confirm the destination is input-derived and reaches the sink.
- Audit the validation: is it relative-path-only / exact-host allowlist / a
framework local-redirect helper? Or a bypassable
startsWith/contains/suffix check? Test mentally against//evil.com,/\evil.com,https:evil.com,https://trusted@evil.com,https://trusted.com.evil.com, backslash and CRLF. - Check OAuth/SSO context: if the param is
redirect_uri/RelayState, is it exact-matched against registered values? A loose match here is token-theft grade. - Confirm reachability (route exposed, pre-auth login redirect is worst case).
7. Modern & niche variants
- Protocol-relative & backslash bypasses:
//evil.com,/\evil.com,\/\/evil.com,/%5cevil.com,https:/evil.com,https:evil.com(scheme with missing slashes the browser fixes up). AstartsWith('/')check passes them all. @userinfo confusion:https://trusted.com@evil.com— everything before@is userinfo; the real host isevil.com. Substring/prefix checks fortrusted.comare fooled.- Whitelist-as-substring/suffix:
trusted.com.evil.com(suffix confusion),evil-trusted.com,trusted.com.attacker.io, unescaped-dot regex — the allowlist domain appears in the string but isn't the effective host. - CRLF into
Location:%0d%0aSet-Cookie:…or header/body splitting via the redirect param — overlapscrlf-and-header-injection; note both. - OAuth
redirect_uri/ OIDC / SAMLRelayState: the highest-impact form. A looseredirect_uri(prefix match, wildcard subdomain, path not checked) lets an attacker receive the authorizationcode/token → account takeover.RelayStateandnext/returnUrlin SSO flows carry the same risk. Always check for exact, full-URI registration. - Meta-refresh & JS-location sinks:
<meta http-equiv=refresh content="0;url=…">andwindow.location/location.href/window.openassignment — client-side, may also acceptjavascript:/data:schemes escalating to XSS. - Chaining primitive (emphasize): open redirect on a trusted domain is the glue
for other attacks — (1) token theft: steal OAuth codes / leak
Authorizationor session via redirect to attacker; (2) phishing: attacker URL wears the victim's domain; (3) SSRF filter bypass: a server-side fetcher that allowlists an internal/trusted host but follows redirects is walked to an arbitrary target; (4) CSP/referrer/OAuth-state laundering. Report it as a link that provides a trusted-origin redirect primitive.
8. Common false positives
- Redirects to a hard-coded/constant URL or a server-side enum→path map.
- Relative-path-only redirects that reject scheme/host and
////\(verified). - ASP.NET
LocalRedirect/IsLocalUrl, Djangourl_has_allowed_host_and_scheme, Railsonly_path: true, or exact-host allowlist parsing. - OAuth
redirect_uriexact-matched against registered URIs. - Redirects to a value that is the app's own request path echoed back after strict validation.
9. Severity & exploitability
Base Low standalone. Rises sharply in a chain: Medium when it enables
phishing on a trusted domain or leaks referrer-borne secrets; High/Critical as a
chain when it steals OAuth/SSO tokens (redirect_uri/RelayState → account
takeover) or bypasses an SSRF/URL allowlist to reach internal services. Per the
model, the chain severity = the highest impact reached at the chain's end. See
references/severity-model.md.
10. Remediation
Prefer never redirecting to an input-supplied absolute URL: accept a relative path
only, or map an opaque token to a server-side allowlist. If external redirects are
required, parse the URL and exact-match the host against an allowlist while
rejecting non-http(s) schemes and ////\ protocol-relative forms. Use framework
local-redirect helpers (LocalRedirect, url_has_allowed_host_and_scheme,
only_path: true). For OAuth, exact-match redirect_uri against pre-registered
full URIs. Strip CR/LF from any value placed in Location.
11. Output
Append each confirmed finding to findings/16-open-redirect.md using
references/finding-template.md. Set Class: Open Redirect, CWE: CWE-601, and in
Chain potential always name the primitive it provides: trusted-origin
redirect → candidate chains include OAuth/SSO token theft (→ account takeover),
phishing delivery, ssrf URL-allowlist bypass (follows redirect to internal host),
and crlf-and-header-injection when CRLF is accepted. Note what it consumes
(usually nothing — it is a starting/pivot link). Given its low standalone severity,
its value in the final report is almost entirely as a chain link — flag the chains.
Primitives (controlled): provides URL_CONTROL; consumes none
References
- CWE-601; OWASP A01:2021; OWASP Unvalidated Redirects & Forwards Cheat Sheet; OAuth 2.0 Security BCP (redirect_uri validation); PortSwigger SSRF-via-open-redirect notes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

