{"id":12,"date":"2023-01-28T19:30:45","date_gmt":"2023-01-28T18:30:45","guid":{"rendered":"https:\/\/babdcatha.net\/?p=12"},"modified":"2023-01-31T00:18:07","modified_gmt":"2023-01-30T23:18:07","slug":"tryhackme-takeover","status":"publish","type":"post","link":"https:\/\/babdcatha.net\/index.php\/2023\/01\/28\/tryhackme-takeover\/","title":{"rendered":"TryHackMe : TakeOver"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi ! Today we&#8217;re going to take a look at the <a rel=\"noreferrer noopener\" href=\"https:\/\/tryhackme.com\/room\/takeover\" target=\"_blank\">TakeOver<\/a> room on TryHackMe. As its description states, this challenge revolves around subdomain enumeration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As advised by the author, the first thing to do is add the provided IP for <a href=\"http:\/\/futurevera.thm\">futurevera.thm<\/a> to our \/etc\/hosts file in order to resolve the URL on our machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once, that is done, we can take a first look at the website :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full has-custom-border wp-duotone-unset-1\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"942\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/first_look-2.png\" alt=\"\" class=\"wp-image-29\" style=\"border-style:none;border-width:0px\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/first_look-2.png 962w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/first_look-2-300x294.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/first_look-2-768x752.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This looks like a basic company website, nothing special in the cookies or in the source of the page, so we move on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next step I took was to scan the ports of the target machine :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-2\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"474\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/nmap_scan.png\" alt=\"\" class=\"wp-image-35\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/nmap_scan.png 960w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/nmap_scan-300x148.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/nmap_scan-768x379.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As expected, we can see an Apache server on ports 80 and 443. However, there doesn&#8217;t seem to be any DNS service running on the machine. Since .thm is not a real tld (top-level domain), there also won&#8217;t be any information on public DNS servers. This means that in order to find subdomains of this website, we are probably going to need to use <a href=\"https:\/\/en.wikipedia.org\/wiki\/Virtual_hosting\">virtual hosts<\/a> enumeration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do this, we&#8217;re going to use ffuf, with the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">ffuf -w $wordlist -H \"Host: FUZZ.futurevera.thm\" -u https:\/\/futurevera.thm -ac<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">in order so send requests to the website, but with different subdomains in the Host header to see if any of them return anything special. We&#8217;re going to run this command on both HTTP and HTTPS protocols, to see if anything comes up. I used <a href=\"https:\/\/raw.githubusercontent.com\/theMiddleBlue\/DNSenum\/master\/wordlist\/subdomains-top1mil-20000.txt\">this<\/a> wordlist. Here are the results :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-3\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"938\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_enum.png\" alt=\"\" class=\"wp-image-45\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_enum.png 960w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_enum-300x293.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_enum-768x750.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Yay ! We found two subdomains ! Let&#8217;s add them to \/etc\/hosts and see whats on them :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-4\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"261\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/portal_visit.png\" alt=\"\" class=\"wp-image-47\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/portal_visit.png 962w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/portal_visit-300x81.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/portal_visit-768x208.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Well, unfortunately, nothing interesting is on these two pages. We have to dig deeper, but where ? The wordlist I tried contains 20.000 guesses, and this is an easy challenge, so it is likely in there. Isn&#8217;t it a bit weird that we found HTTP subdomains but no HTTPS subdomain ? Maybe there was a problem with the way we ran ffuf ? Let&#8217;s try it without the -ac flag and without rejecting any response code using the -mc all flag to see what kind of responses we are getting :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-5\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"938\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_all.png\" alt=\"\" class=\"wp-image-52\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_all.png 960w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_all-300x293.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_all-768x750.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Suddenly, everything matches ! That&#8217;s not going to help us, is it ? But wait, the first try resulted in a different response code than all of the others here : 421 misdirected request. Could it be that <a href=\"http:\/\/support.futurevera.thm\">https:\/\/support.futurevera.thm<\/a> is a valid subdomain ? Let&#8217;s first re-run ffuf while filtering the answers that are 4605 bytes long :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">ffuf -w $wordlist -H \"Host: FUZZ.futurevera.thm\" -u https:\/\/futurevera.thm -mc all -fs 4605<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Bingo, we find three more subdomains : <\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-6\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"614\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_good.png\" alt=\"\" class=\"wp-image-55\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_good.png 960w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_good-300x192.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/ffuf_good-768x491.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">#www and #mail are probably errors judging from the 400 code they returned, so we&#8217;ll ignore them, at least for now. Let&#8217;s add the two other subdomains to \/etc\/hosts and visit them :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-7\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"942\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/support_visit.png\" alt=\"\" class=\"wp-image-57\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/support_visit.png 962w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/support_visit-300x294.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/support_visit-768x752.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">They look more promising than the two HTTP subdomains we found before. However, searching the source code and trying to enumerate directories did not return anything useful. Are we in a dead end again ? What is different between http and https ?! : https uses certificates to prove the identity of the server, and these certificates usually contain useful information about the domain !<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Look at what we find in the certificate for <a href=\"https:\/\/support.futurevera.thm\">https:\/\/support.futurevera.thm<\/a> :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-8\"><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"124\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/cert_alt_name.png\" alt=\"\" class=\"wp-image-58\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/cert_alt_name.png 813w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/cert_alt_name-300x46.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/cert_alt_name-768x117.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s also make this domain point to the IP of the target machine and visit it. The flag suddenly appears in front of our eyes :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-unset-9\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"942\" src=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/flag_blur.png\" alt=\"\" class=\"wp-image-59\" srcset=\"https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/flag_blur.png 962w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/flag_blur-300x294.png 300w, https:\/\/babdcatha.net\/wp-content\/uploads\/2023\/01\/flag_blur-768x752.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We can now enter it and get the points !<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope you found this interesting and helpful !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi ! Today we&#8217;re going to take a look at the TakeOver room on TryHackMe. As its description states, this challenge revolves around subdomain enumeration. As advised by the author, the first thing to do is add the provided IP for futurevera.thm to our \/etc\/hosts file in order to resolve the URL on our machine. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[4],"tags":[6,7,10,9,8],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-writeups","tag-domain-enumeration","tag-ffuf","tag-futurevera","tag-takeover","tag-tryhackme"],"featured_image_src":null,"author_info":{"display_name":"BabdCatha","author_link":"https:\/\/babdcatha.net\/index.php\/author\/admin4804\/"},"_links":{"self":[{"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":22,"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/babdcatha.net\/index.php\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}