Blog

What Is a Cross-Site Request Forgery (CSRF) Attack? How Burp Suite, OWASP ZAP, and Developer Tools Help

Cross-Site Request Forgery, or CSRF, tricks a signed-in user’s browser into sending an unwanted request to a trusted site. The user may never see it happen. If the site accepts the request without a strong check, the attack can change an email address, transfer funds, reset a password, or alter settings. OWASP describes CSRF as an attack that forces an authenticated user to submit a request to a web application where they are already logged in [source: OWASP].

TLDR: CSRF abuses trust between a browser and a website, usually through cookies that are sent automatically. For example, if 50 employees stay logged in to an internal admin panel and one clicks a crafted link, one hidden request could change a shared setting for all users. Burp Suite, OWASP ZAP, and browser Developer Tools help confirm whether sensitive actions have proper CSRF defenses. The key test is simple: can the same action be replayed without a valid, unique token?

How a CSRF Attack Works

A CSRF attack does not usually steal a password. It does something sneakier. It uses the victim’s already authenticated session.

Say a user is logged in to a banking site. In another tab, they open a harmful page. That page silently submits a form to the bank, such as:

  • Change the account email
  • Add a new payment recipient
  • Turn off alerts
  • Submit a money transfer request

If the bank relies only on the session cookie, the browser will send that cookie. The bank may think the request is real. That is the core problem.

The attacker does not need to read the response. They only need the action to succeed. This is why CSRF often targets state-changing requests, not simple page views.

Why CSRF Still Matters

Modern browsers have improved cookie behavior. Many frameworks also add CSRF protection by default. Good. Still, real systems get messy. Old endpoints stay online. APIs get added in a hurry. Admin panels get fewer reviews than public screens. It drives me crazy that one forgotten “save settings” form can undo weeks of careful security work.

CSRF risk is higher when a request has these traits:

  • It changes data or user permissions.
  • It uses cookies for authentication.
  • It accepts simple form requests.
  • It has no CSRF token.
  • It does not check the request origin.

How Burp Suite Helps

Burp Suite is one of the most useful tools for testing CSRF because it lets you capture and replay real browser traffic. A tester can log in, perform an action, and inspect the request in detail.

With Burp, you can check:

  • Whether a CSRF token exists
  • Whether the token changes per request
  • Whether the server rejects a missing token
  • Whether the server rejects an old token
  • Whether changing the Origin or Referer header matters

Burp can also generate a CSRF proof of concept from a captured request. That is useful for reporting, but use it only in approved testing. A written report with a safe demo is often enough.

The catch is that Burp can feel heavy for quick checks. Starting the proxy, installing certificates, and routing browser traffic can add a few minutes when you only want to inspect one request. Still, for serious web app testing, it is hard to beat.

Image not found in postmeta

How OWASP ZAP Helps

OWASP ZAP is a free security testing proxy. It captures requests, scans for issues, and helps testers review application behavior. For teams with smaller budgets, ZAP is a strong choice.

ZAP can help spot missing anti-CSRF controls. It can also passively inspect traffic while you use the app. That means you can browse normally and then review which endpoints look risky.

Use ZAP to ask practical questions:

  • Did the request include a token?
  • Was the token tied to the user session?
  • Did logout destroy the token?
  • Could the request be repeated after a delay?

ZAP also has automation options. That helps teams add basic checks into a test pipeline. Do not treat scanner output as final proof, though. CSRF depends on context. A scanner may flag harmless endpoints or miss custom flows.

How Browser Developer Tools Help

Browser Developer Tools are simple, fast, and often enough for the first check. Open the Network tab, perform an action, and inspect the request.

Look for these items:

  • Method: Sensitive actions should not rely on unsafe GET requests.
  • Cookies: Check if session cookies are sent automatically.
  • Headers: Review Origin, Referer, and custom headers.
  • Payload: Find any CSRF token in form data or JSON.
  • Response: Confirm failed requests are rejected clearly.

Developer Tools are also helpful for checking cookie flags. SameSite, Secure, and HttpOnly all matter. SameSite can reduce CSRF risk, but it should not be the only defense.

Best Defenses Against CSRF

The best CSRF defense is layered. Do not depend on one control.

  • Use CSRF tokens. Tokens should be unique, secret, and checked server-side.
  • Set SameSite cookies. Use Lax or Strict where possible.
  • Check Origin and Referer. Reject requests from untrusted sources.
  • Avoid state changes with GET. Use POST, PUT, PATCH, or DELETE with checks.
  • Require re-authentication for critical actions. Password changes and payments deserve extra friction.
  • Test real workflows. Do not assume the framework protected every endpoint.

Final Thoughts

CSRF is not flashy, but it is serious. It turns a trusted browser session into a tool for unwanted action. Burp Suite gives deep control, OWASP ZAP gives accessible scanning and proxy testing, and Developer Tools give quick visibility. Used together, they help teams find weak requests before attackers do.