Is there no need to defend against csrf when the browser is so secure?

Source: Internet
Author: User
First, you need to set whether cross-origin requests and cross-origin frame requests are allowed for nginx on the server side (both are not allowed by default ). Furthermore, the browser imposes strict cross-origin ajax restrictions and does not allow cross-origin access cookies. So what we do for csrf during web development (generally we add a hiddencsrftokeninput to form) is unnecessary? First, you need to set whether cross-origin requests and cross-origin frame requests are allowed for nginx on the server side (both are not allowed by default ).
Furthermore, the browser imposes strict cross-origin ajax restrictions and does not allow cross-origin access cookies.

So what we do for csrf during web development (generally we add a hidden csrf token input to form) is unnecessary? Reply content: Hahaha, of course, still needed.

After nginx is configured with 'x-Frame-options' to 'sameorigin', iframe cannot be used for different subdomains in the same domain, since it cannot be opened, let alone get the cookie through js to get the session id.

However, a simpler attack is still unavoidable:

If you are in a Wi-Fi environment (LAN) where I have my hands and feet, I have contaminated the dns and made a malicious website called csrf-attack, then you log on to a website without csrf defense called no-csrf-token, and then I made a page in csrf-attack, which contains a form like this:

The browser cannot prevent crsf attacks. [The browser is so secure now ]......

This is really not a phishing post? Everything is visible in the background.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.