Anti CSRF tokens - explained

Поділитися
Вставка
  • Опубліковано 21 гру 2024

КОМЕНТАРІ • 19

  • @Michal_Silski
    @Michal_Silski 2 роки тому +1

    HttpOnly cookie doesn't prevent from CSRF. In case you described, if attacker knows API call structure it is still possible to redirect the user to the external site from where malicious API call could be automatically submitted (it includes both cookies so server validates it successfully). To protect against CSRF you need to include csrf token both in cookie and in http call parameter to API.
    HttpOnly can be used rather as protection against XSS.

    • @NevyanNeykov
      @NevyanNeykov  2 роки тому

      I am describing the usage of double submit cookie technique against CSRF. Of course with enough effort it can be bypassed with some kind of MITM attack. The former together with the protection against XSS is a sole responsibility of the application developers.

    • @Michal_Silski
      @Michal_Silski 2 роки тому

      @@NevyanNeykov Thanks for response. Refering to OWASP Cheat Sheet Series
      Cross-Site Request Forgery Prevention guide - (Double Submit Cookie section) it is necessary to include a csrf token in http request parameter/header (besides in the cookie). Without that server is not able to verify if request originates from the client or from malicious page. I missed this information in the video or I misunderstood your idea.

    • @khoroshoigra8388
      @khoroshoigra8388 Рік тому

      best thing there is to get the IP address to as basis of request from the client as another verification

    • @NevyanNeykov
      @NevyanNeykov  Рік тому

      not quite, as it can be easily spoofed.

  • @ravindrabhatt
    @ravindrabhatt Рік тому +1

    why will the attacker modify xcsrf cookie before sending?

    • @NevyanNeykov
      @NevyanNeykov  Рік тому

      can you elaborate your question a little bit?

    • @ravindrabhatt
      @ravindrabhatt Рік тому

      @@NevyanNeykov Sorry for not being clear. At 2.46, Is the session token and CSRF token same? Also, at 5.22 you mentioned, attacker can try to modify the xcsrf cookie, so my question is why will attacker try to modify it? as he can just send as if it is and server will not be able to recognize who is real and who is the attacker. Or, Is there any other information of interest, embedded in the second cookie which is causing the attacker to modify it?

    • @NevyanNeykov
      @NevyanNeykov  Рік тому +1

      Yes they are the same. The attacker wants usually to forge the information inside the cookies/tokens and when doing so the xcsrf check will be triggered and be invalid.

  • @jjenisha-e3c
    @jjenisha-e3c Рік тому

    Thank you, if i use jwt token then csrf is needed ?

  • @vlegend.5516
    @vlegend.5516 2 роки тому

    So the web browser can generate the original crsf token and be valid?

    • @NevyanNeykov
      @NevyanNeykov  2 роки тому

      the browser need to guess the crsf cookie to be matching the original session cookie, which is quite difficult if is not the original set from the server.

  • @yura41
    @yura41 2 роки тому

    I still don't get it

  • @xoxo1171
    @xoxo1171 2 роки тому +2

    Thanks you