<?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 RootVuln on Medium]]></title>
        <description><![CDATA[Stories by RootVuln on Medium]]></description>
        <link>https://medium.com/@rootvuln?source=rss-8ffd1b5f4bff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NYhu1jxDzCEBdMm8Ljk-4w.jpeg</url>
            <title>Stories by RootVuln on Medium</title>
            <link>https://medium.com/@rootvuln?source=rss-8ffd1b5f4bff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:48:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rootvuln/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[From File Upload to Remote Code Execution: How I Bypassed MIME Type Validation]]></title>
            <link>https://rootvuln.medium.com/from-file-upload-to-remote-code-execution-how-i-bypassed-mime-type-validation-d571e7c27645?source=rss-8ffd1b5f4bff------2</link>
            <guid isPermaLink="false">https://medium.com/p/d571e7c27645</guid>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[RootVuln]]></dc:creator>
            <pubDate>Fri, 07 Aug 2026 04:38:55 GMT</pubDate>
            <atom:updated>2026-08-07T04:38:55.837Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zAmnjWRkl4GtBUEGeP6P5A.png" /></figure><h3>Introduction</h3><p>Hey everyone, I’m rootvuln, a cybersecurity student, and today I’m going to share how I found an RCE on a target — the result of a couple of bypass chains. I’m going to show how I chained a file upload vulnerability into Remote Code Execution, using example.com as a placeholder for the actual target.</p><blockquote><strong><em>Note:</em></strong><em> All testing was conducted with proper authorization. The target has been notified.</em></blockquote><h3>Testing Flow</h3><blockquote><strong><em>Note:</em></strong><em> For this write-up I’m not using the exact endpoint names, but the methodology is the same.</em></blockquote><p>There was a feature on the site where users can raise support tickets for their queries (example endpoint: https://example.com/help/support). So first I tried for Blind XSS there, but the site was successfully encoding the XSS vectors — input was being properly sanitized, no luck there.</p><p>I then decided to check the upload functionality. I had been testing this site for a couple of days, so I already knew it was running PHP on the backend. That made the upload feature an interesting target — if I could upload a PHP file to a web-accessible path and the server would execute it …</p><h3>Attempt 1 — Direct PHP Upload</h3><p>The most obvious thing to try first: just upload a .php file and see what happens.</p><pre>Content-Disposition: form-data; name=&quot;screenshot&quot;; filename=&quot;rev.php&quot;<br>Content-Type: application/pdf</pre><p><strong>Response:</strong></p><pre>{&quot;status&quot;:false,&quot;message&quot;:&quot;File extension .php is not allowed for security reasons.&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MK_ACNC0t53GFXg2N8kDNw.png" /></figure><p>Extension blocked. Expected. Moving on.</p><h3>Attempt 2 — Double Extension (rev.php.jpg)</h3><p>A classic bypass — append a safe extension after the PHP extension, hoping the server only checks the last extension:</p><pre>filename=&quot;rev.php.jpg&quot;</pre><p><strong>Response:</strong></p><pre>{&quot;status&quot;:false,&quot;message&quot;:&quot;Invalid file name format. Double extensions or hidden script files are forbidden.&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwYKrOvWKsLd0RVlDwjAtg.png" /></figure><p>The server was explicitly checking for double extensions. Solid validation.</p><h3>Attempt 3 — Null Byte Injection (%00)</h3><p>Null bytes (%00) historically cause some parsers to truncate the string at that point, treating rev.php%00.jpg as just rev.php internally while the validator sees .jpg:</p><pre>filename=&quot;rev.php%00&quot;<br>filename=&quot;rev.php%00.jpg&quot;</pre><p><strong>Response:</strong></p><pre>{&quot;status&quot;:false,&quot;message&quot;:&quot;Invalid file extension .php%00. Allowed extensions: jpg, jpeg, png, gif, webp, pdf, doc, docx, txt&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWq8Xxh-1AYBqIJnIzgJ2g.png" /></figure><p>The server was even handling null bytes correctly — stripping them and flagging the underlying .php extension.</p><h3>Attempt 4 — Other Techniques</h3><p>At this point I worked through the remaining standard bypass techniques:</p><ul><li>rev.php%00.jpg — rejected</li><li>Content-Type: image/jpeg with PHP content — rejected</li><li>GIF magic bytes (GIF89a;) prepended to PHP content — rejected</li><li>Various other filename manipulations — all rejected</li></ul><p>The server was handling all of them correctly. Most hunter would have moved on at this point.</p><h3>The Bypass That Worked</h3><p>I decided to try one more combination I hadn’t tested yet — combining two techniques simultaneously rather than individually.</p><p><strong>Technique 1: Double </strong><strong>filename parameter with null-byte (%00)</strong></p><p>Instead of a single filename, I submitted two filename parameters in the same Content-Disposition header:</p><pre>filename=&quot;rev.php%00&quot;; filename=&quot;rev.php%00.gif&quot;</pre><p>Some multipart parsers read the first filename value while the validation logic reads the last (or vice versa). This creates a gap between what gets validated and what actually gets stored on the filesystem.</p><p><strong>Technique 2: Spoofing an allowed </strong><strong>Content-Type</strong></p><p>Instead of claiming application/php or image/jpeg, I changed the Content-Type to application/pdf .</p><p>The full upload part:</p><pre>Content-Disposition: form-data; name=&quot;screenshot&quot;; <br>filename=&quot;rev.php%00&quot;; filename=&quot;rev.php%00.gif&quot;<br>Content-Type: application/pdf</pre><p><strong>Response:</strong></p><pre>{<br>  &quot;status&quot;: true,<br>  &quot;message&quot;: &quot;Ticket created successfully&quot;,<br>  &quot;ticket_id&quot;: 25<br>}</pre><p><strong>HTTP 201 Created.</strong> The file was uploaded successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lDtyfPu0iIjSNm1dSYuGYw.png" /></figure><p>The file had been stored with a .php extension in a web-accessible uploads directory. Now the real question — would the server actually <strong>execute</strong> it?</p><h3>Confirming Execution</h3><p>Rather than immediately trying a full reverse shell, I first uploaded a minimal, single-line proof-of-concept to confirm execution cleanly and responsibly:</p><pre>&lt;?php echo &quot;RCE-&quot; . php_uname(); ?&gt;</pre><p>I then accessed the uploaded file’s direct URL in the browser and got back:</p><pre>RCE-Linux [hostname] 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC <br>XXX XXXX XXXXX UTC 2026 x86_64</pre><p>php_uname() is a PHP runtime function — not static content. Its output appearing in the browser confirmed that the PHP interpreter executed my uploaded file on the production server.</p><p><strong>RCE confirmed. ✅</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q5hASkKPSv86Z5febUflxw.png" /><figcaption><strong>RCE confirmed</strong></figcaption></figure><h3>Why This Worked</h3><p>The server had genuinely good individual checks:</p><ul><li>✅ Correctly blocked .php extensions</li><li>✅ Correctly blocked double extensions</li><li>✅ Correctly handled null bytes in isolation</li><li>✅ Correctly blocked magic byte spoofing</li><li>✅ Correctly blocked obvious Content-Type manipulation</li></ul><p>But the <strong>combination</strong> of the double filename parameter and the application/pdf Content-Type claim created a gap between what the validator inspected and what the filesystem actually stored the file as. Individual defenses were solid — the inconsistency between parsing paths is what made this possible.</p><p><em>Thanks for reading — if you found this useful, follow along for more findings. Stay ethical, stay curious … 🧭</em></p><p><em>Do follow me on X for more security findings and updates … — </em><a href="https://x.com/rootvuln"><em>@rootvuln</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d571e7c27645" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>