Vulnerability Fixation
CSRF (Cross Site Request Forging) Vulnerability


Vulnerability:

CSRF stand for cross-site request forgery. It is where the attacker sit can remotely, create a dummy form, and submit it via a valid session of a user who is already logged in either via a chat application or a phishing attack.

There are basically 2 ways by which this attack can be performed.

First is, where the attacker tricks the victim to click a link or load a page. This is basically done by social engineering and malicious links.

The second part is where the attacker sends a crafted, legitimate-looking request (Trojan) from the victim?s browser to the website.

Attack

As the name of the attack suggests this forgery is possible only after the request is granted i.e. when the following assumptions are fulfilled:
1) Valid session.
2) Form parameters.
3) Timing of the session execution on the same browser.

Impact

  • Attackers can mass-send requests to capture some valid sessions.
  • If a victim has privileges, the attacker can perform unauthorized actions (data theft, privilege misuse).
  • CSRF can be triggered via phishing and leads to serious integrity/availability issues.

Solution

  • Use a per-form, unguessable CSRF token and validate it server-side.
  • Make tokens unique per session/request and expire them after use.
  • Harden with SameSite cookies and require re-authentication for sensitive actions.

Also Read :