CSRF protection of GET links

故事扮演 提交于 2019-12-21 18:05:15

问题


I need to add CSRF protection to a web application.

Problem is in the fact that the app relies heavily on links (GET requests that is) to make changes in the database.

Links are generated using a class, so I could easily add an extra parameter for CSRF token to each link.

However, I understand that CSRF token in a GET request might not be a good enough protection.

Note that app is only available over HTTPS, so GET params can not be exposed/stolen during client/server communication (but history stealing issue remains).

Could GET CSRF token param be considered "safe enough" in this setting?

If not, what is the best way to solve this problem? Only thing that comes to my mind is to wrap each of my links into a form (ether explicitly, or creating form onSubmit using JavaScript).


回答1:


To be able to read the response to a CSRF attack’s request, an attacker would need to get the victim to execute his JavaScript code. So, CSRF for a "GET" request is almost not useful. This is assuming you have followed the standards that "GET" requests should not modify any data and any modifications need to be done only using "POST"

  1. Using cookie based authentication and SSL should keep you away from a guy who is trying to change the parameters
  2. You may want to introduce some signing based on timestamp to avoid replay attacks

That said, if you have any POST requests, you should consider the CSRF protection.



来源:https://stackoverflow.com/questions/12370919/csrf-protection-of-get-links

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!