{"id":7411,"date":"2022-04-15T12:33:50","date_gmt":"2022-04-15T19:33:50","guid":{"rendered":"https:\/\/webdev.securin.xyz\/?p=7411"},"modified":"2023-04-05T12:33:54","modified_gmt":"2023-04-05T19:33:54","slug":"account-take-over-attack-series-1-cross-site-request-forgery-account-takeover","status":"publish","type":"post","link":"https:\/\/webdev.securin.xyz\/articles\/account-take-over-attack-series-1-cross-site-request-forgery-account-takeover\/","title":{"rendered":"Account Take Over Attack Series 1: Cross-Site Request Forgery Account Takeover"},"content":{"rendered":"

Cross-Site Request Forgery (CSRF) is a vulnerability that lets an attacker execute some action on the web application on behalf of an authenticated victim user. So, for taking over an account, an attacker can update the password of the victim user. Other possibilities include updating the email or phone number of the victim and then resetting the password.<\/p>\n

As a demonstration, we will be using a vulnerable application having Cross-Site Request Forgery as a known vulnerability.<\/p>\n\n\n\n\n\n\n
Particulars<\/strong><\/td>\nDetails<\/strong><\/td>\n<\/tr>\n
Vulnerable Application<\/td>\nCups Easy 1.0<\/a><\/td>\n<\/tr>\n
Associated CVE<\/td>\nCVE-2020-8425<\/a>, CVE-2020-8424<\/a><\/td>\n<\/tr>\n
Exploit<\/td>\nExploit-DB<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

Attack Scenario<\/h2>\n

Marty is an attacker and he wants to take over his friend Elif\u2019s account.<\/p>\n

Steps to Reproduce<\/h2>\n
    \n
  1. \n

    Login to the application as Marty and click on Password from the Utils dropdown.<\/p>\n<\/li>\n<\/ol>\n

    <\/p>\n

      \n
    1. \n

      Click on Change my password and the password change option will show up.<\/p>\n<\/li>\n<\/ol>\n

      <\/p>\n

        \n
      1. \n

        Next, fill up the password input with the password of your choice and click on Change.<\/p>\n<\/li>\n<\/ol>\n

        <\/p>\n

          \n
        1. \n

          Intercept this request in a proxy server such as Burp and send it to the repeater. Drop the request from the proxy tab.<\/p>\n<\/li>\n<\/ol>\n

          <\/p>\n

          Note:<\/strong> The request needs to be dropped because if it reaches the server, then Marty\u2019s password will be changed. Our current objective is to change Elif\u2019s password.<\/p>\n

            \n
          1. \n

            Go to the CSRF POC generator<\/a> and fill up the required details accordingly.<\/p>\n<\/li>\n<\/ol>\n

            Note:<\/strong> Do not forget to change the username to elif. Click on Download CSRF POC to download the HTML file.<\/p>\n

            <\/p>\n

              \n
            1. \n

              The POC that was downloaded needs to be hosted on a server. For this, we can use the http.server module from python to create a server.<\/p>\n<\/li>\n<\/ol>\n

              <\/p>\n

                \n
              1. \n

                After getting hosted, our page looks like this:<\/p>\n<\/li>\n<\/ol>\n

                <\/p>\n

                 <\/p>\n

                Note: <\/strong>This is just a simulation of an attack. The sensitive parameters are clearly visible in the page, but these things can easily be hidden in HTML through the hidden attribute. Consult the exploit link in the description.<\/p>\n

                  \n
                1. \n

                  Now we need to lure Elif to our page. This can be done through social engineering.<\/p>\n<\/li>\n

                2. \n

                  As soon as Elif visits our page (with an active session on the application) and clicks on the button, a password change request will be sent to the server.<\/p>\n<\/li>\n<\/ol>\n

                  The password change message will now appear on the browser saying the password was updated successfully.<\/p>\n

                  <\/p>\n

                    \n
                  1. \n

                    Now Marty can access Elif\u2019s account through the known password.<\/p>\n<\/li>\n<\/ol>\n

                    Mitigation<\/h2>\n
                      \n
                    1. \n

                      The most common and easy method of prevention against CSRF is to include a unique CSRF token with each and every request. The token should be completely random and should be strictly validated at the backend.<\/p>\n<\/li>\n

                    2. \n

                      A same-site attribute in the cookie can also be used as a CSRF prevention mechanism. The same-site attribute tells the browser not to include the user\u2019s session cookie in the requests that do not originate from the original domain.<\/p>\n<\/li>\n<\/ol>\n

                      Related Blogs<\/h2>\n

                      What is Account Take Over Attack (ATO)?<\/a><\/p>\n

                       <\/p>\n

                      Start Protecting your Credentials Today! Get in touch with CSW for Red Teaming and VMaaS services.<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"

                      All scanners list out security vulnerabilities but does the developer know what to fix first and how to go about it?<\/p>\n","protected":false},"author":14,"featured_media":7404,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[80,127,123],"tags":[352,442,476],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/posts\/7411"}],"collection":[{"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/comments?post=7411"}],"version-history":[{"count":3,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/posts\/7411\/revisions"}],"predecessor-version":[{"id":13443,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/posts\/7411\/revisions\/13443"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/media\/7404"}],"wp:attachment":[{"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/media?parent=7411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/categories?post=7411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webdev.securin.xyz\/wp-json\/wp\/v2\/tags?post=7411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}