{"id":41,"date":"2022-03-30T22:58:59","date_gmt":"2022-03-30T22:58:59","guid":{"rendered":"https:\/\/cyberlorenzo.tech\/?p=41"},"modified":"2022-05-12T22:43:43","modified_gmt":"2022-05-12T22:43:43","slug":"project-one","status":"publish","type":"post","link":"https:\/\/cyberlorenzo.tech\/?p=41","title":{"rendered":"Enumerating and Exploiting SMB (Server Message Block Protocol)"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<p><a href=\"https:\/\/tryhackme.com\/\" title=\"\">https:\/\/tryhackme.com\/<\/a> <\/p>\n<\/div>\n<\/div>\n\n\n\n<p><strong>What is SMB?<\/strong><\/p>\n\n\n\n<p>SMB &#8211; Server Message Block Protocol &#8211; is a client-server communication protocol used for sharing access to files, printers, serial ports and other resources on a network. [<a href=\"https:\/\/searchnetworking.techtarget.com\/definition\/Server-Message-Block-Protocol\">source<\/a>]<\/p>\n\n\n\n<p>Servers make file systems and other resources available to clients on the network. Client computers may have their own hard disks, but they also want access to the shared file systems and printers on the servers.<\/p>\n\n\n\n<p>The SMB protocol is known as a response-request protocol, meaning that it transmits multiple messages between the client and server to establish a connection. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Now lets get started!<\/h3>\n\n\n\n<p>The key tool we will be using in this project will be &#8220;Enum4Linux&#8221;. This tool is used specifcally for enumerating SMB shares on both Windows and Linux systems. This is installed by default on Parrot or Kali Linux but if you need to install it you can do so from Github.  <\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/CiscoCXSecurity\/enum4linux\">https:\/\/github.com\/CiscoCXSecurity\/enum4linux<\/a><\/p>\n\n\n\n<p>First we need to enumerate to gather some information on our target machine, in the photo provided you can see that we have identified three ports are open using our NMAP scan. <code><mark style=\"background-color:#db4f3d\" class=\"has-inline-color\">[nmap -sV IP]<\/mark><\/code> <\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\"><\/div><\/div>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"474\" data-id=\"45\" src=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-31-1-1024x474.png\" alt=\"\" class=\"wp-image-45\" srcset=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-31-1-1024x474.png 1024w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-31-1-300x139.png 300w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-31-1-768x355.png 768w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-31-1-1536x711.png 1536w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-31-1.png 1867w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>We can tell from this scan that SMB is running over ports 139\/445 over TCP<\/p>\n\n\n\n<p>Now lets run out Enum4Linux command and see if we can sniff a sharelist and any other possible useful information.<\/p>\n\n\n\n<p>After running the <code><mark style=\"background-color:#db4f3d\" class=\"has-inline-color\">enum4linux -a <\/mark><\/code> command we found out that the workgroup name is &#8220;WORKGROUP&#8221;. We also learned that the name of the machine is &#8220;POLOSMB&#8221; and the sharelist populated as well with an interesting directory that we are interested in looking further into called &#8220;profiles&#8221;. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-33.png\" alt=\"\" class=\"wp-image-47\" width=\"630\" height=\"537\" srcset=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-33.png 1003w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-33-300x256.png 300w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-33-768x655.png 768w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-32.png\" alt=\"\" class=\"wp-image-46\" width=\"672\" height=\"577\"\/><\/figure>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>There are other vulnerabilities that can actually allow remote code execution by exploiting SMB but it&#8217;s said that you are much more likely to find a misconfiguration in the system. In this case we&#8217;re doing just that, we&#8217;re exploiting anonymous SMB share access which is a common misconfiguration that will lead us to a shell.  <\/p>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-34.png\" alt=\"\" class=\"wp-image-49\" width=\"785\" height=\"644\" srcset=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-34.png 1003w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-34-300x246.png 300w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-34-768x631.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<p>In the photo above you can see we used the<code><mark style=\"background-color:#db4f3d\" class=\"has-inline-color\">smbclient \/\/[IP]\/profiles<\/mark><\/code> command and we were prompted with a password entry. We used anonymous and were able to get in. Now using the ls command we were able to get a list of directories within the SMB client. <\/p>\n\n\n\n<p>We took a look around and exfiltrated the &#8220;Working From Home Information.txt&#8221; file to see what information we could gather. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"761\" src=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-35-1024x761.png\" alt=\"\" class=\"wp-image-50\" srcset=\"https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-35-1024x761.png 1024w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-35-300x223.png 300w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-35-768x571.png 768w, https:\/\/cyberlorenzo.tech\/wp-content\/uploads\/2022\/03\/Screenshot-35.png 1074w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Looks like we will hit the jackpot if we can figure out John&#8217;s login credentials. We can tell from the message that he now has full SSH access into the main server and we have also recovered his first and last name which could be his username or profile folder name. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/tryhackme.com\/ What is SMB? SMB &#8211; Server Message Block Protocol &#8211; is a client-server communication protocol used for sharing access to files, printers, serial ports and other resources on a network. [source] Servers make file systems and other resources available to clients on the network. Client computers may have their own hard disks, but they [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":236,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/right-sidebar.php","format":"standard","meta":{"saved_in_kubio":false,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-project-one"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41"}],"version-history":[{"count":7,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions\/138"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=\/wp\/v2\/media\/236"}],"wp:attachment":[{"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cyberlorenzo.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}