Ask Your Question
3

What is the process of carrying out a CSRF attack through a badly configured CORS?

asked 2022-08-14 11:00:00 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-11-02 14:00:00 +0000

woof gravatar image

A CSRF (Cross-Site Request Forgery) attack through a badly configured CORS (Cross-Origin Resource Sharing) involves the following steps:

  1. The attacker creates a malicious website and embeds a script into it.
  2. The victim visits the malicious website while being logged into a legitimate website in the same browser session.
  3. The script on the malicious website sends a request to the legitimate website, using the victim's session cookies, to perform a specific action on behalf of the victim. This action can be anything that the victim has the authorization to perform on the legitimate website, such as changing the password or making a purchase.
  4. However, the request is blocked by the same-origin policy, as the request is coming from a different domain than the legitimate website.
  5. To circumvent the same-origin policy, the attacker exploits the badly configured CORS on the legitimate website by setting the Access-Control-Allow-Origin header to allow requests from any domain. This allows the malicious script to send the request successfully, as the browser now allows cross-origin requests.
  6. The legitimate website performs the action requested by the attacker, believing it was coming from the victim.

In summary, a badly configured CORS can allow an attacker to bypass the same-origin policy and carry out a CSRF attack on a legitimate website with the victim's credentials.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-08-14 11:00:00 +0000

Seen: 11 times

Last updated: Nov 02 '22