{"id":168,"date":"2018-06-15T22:11:21","date_gmt":"2018-06-15T22:11:21","guid":{"rendered":"http:\/\/kibilogic.com\/?p=168"},"modified":"2018-06-15T22:41:50","modified_gmt":"2018-06-15T22:41:50","slug":"kioptrix-level-1","status":"publish","type":"post","link":"https:\/\/kibilogic.com\/?p=168","title":{"rendered":"kioptrix level 1 &#8211; vulnhub challenge"},"content":{"rendered":"<p>Open up kioptrix in one vm<\/p>\n<p>Open up kali in 2nd vm<\/p>\n<p>Both vm\u2019s are \u201cbridged\u201d<\/p>\n<p>Don\u2019t know anything\u2026username\/password<\/p>\n<p>We do know that the following services are running: (from the details provided on vulnhub)<br \/>\n       \u2022 Apache<br \/>\n       \u2022 OpenSSH<br \/>\n       \u2022 RPC<br \/>\n       \u2022 Samba<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/start_up.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/start_up-300x147.png\" alt=\"\" width=\"300\" height=\"147\" class=\"aligncenter size-medium wp-image-169\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/start_up-300x147.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/start_up.png 696w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>When the OS boots up an IP is assigned. Use netdiscover to find hosts on the network.<\/p>\n<p><strong>netdiscover -i eth0 -r 192.168.1.0\/24<\/strong><\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/netdiscover_kioptrixBoot_2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/netdiscover_kioptrixBoot_2-300x60.png\" alt=\"\" width=\"300\" height=\"60\" class=\"aligncenter size-medium wp-image-170\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/netdiscover_kioptrixBoot_2-300x60.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/netdiscover_kioptrixBoot_2.png 738w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Identify services<\/p>\n<p><strong>nmap -T4  -O -sV -sS 192.168.1.13<\/strong><\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/services.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/services-300x92.png\" alt=\"\" width=\"300\" height=\"92\" class=\"aligncenter size-medium wp-image-171\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/services-300x92.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/services-768x236.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/services.png 936w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Need to determine which of the services has an exploitable vulnerability\u2026lowest hanging fruit wins (could be one or more\u2026)<\/p>\n<p>one of the services running is Samba.<\/p>\n<p>Linux (UNIX) machines can browse and mount SMB shares. Note that this can be done whether the server is a Windows machine or a Samba server.<\/p>\n<p>An SMB client program for UNIX machines is included with the Samba distribution. It provides an ftp-like interface on the command line. You can use this utility to transfer files between a Windows &#8216;server&#8217; and a Linux client. <\/p>\n<p>Most Linux distributions include the useful smbfs package, which allows one to mount and umount SMB shares<\/p>\n<p><strong>\/usr\/bin\/smbclient -L host<\/strong><\/p>\n<p><strong>smbclient &#8211;help<\/strong><\/p>\n<p>Where L, list shares available on the host and N, don\u2019t ask for a password<\/p>\n<p><strong>smbclient -L \\\\192.168.1.13 -N<\/strong><\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/smbclientConnect_2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/smbclientConnect_2-300x106.png\" alt=\"\" width=\"300\" height=\"106\" class=\"aligncenter size-medium wp-image-178\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/smbclientConnect_2-300x106.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/smbclientConnect_2-768x271.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/smbclientConnect_2-1024x362.png 1024w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/smbclientConnect_2.png 1056w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Samba 2.2.8 and earlier versions have a buffer overflow vulnerability that could potentially allow an adversary to execute arbitrary code remotely.  <\/p>\n<p>Launch Metasploit, <strong>msfconsole<\/strong><\/p>\n<p>Search Metasploit for any vulnerable samba modules, <strong>search samba<\/strong><\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/sambaResults.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/sambaResults-300x138.png\" alt=\"\" width=\"300\" height=\"138\" class=\"aligncenter size-medium wp-image-179\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/sambaResults-300x138.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/sambaResults-768x353.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/sambaResults-1024x471.png 1024w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/sambaResults.png 1323w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This exploit should work for versions of Samba between 2.2.0-2.2.8 (<em>but it doesn&#8217;t<\/em>). <\/p>\n<p>First attempt was to try the Samba trans2open exploit for linux (can drop the exploit\/ part)<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/trans2openOptions.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/trans2openOptions-300x165.png\" alt=\"\" width=\"300\" height=\"165\" class=\"aligncenter size-medium wp-image-180\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/trans2openOptions-300x165.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/trans2openOptions.png 579w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Again, it did not work\u2026but turns out there is a public Samba exploit that does.<\/p>\n<p>Search kali\u2019s local repository for exploits, <strong>searchsploit samba 2.2<\/strong><\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/searchsploitSamba22_2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/searchsploitSamba22_2-300x135.png\" alt=\"\" width=\"300\" height=\"135\" class=\"aligncenter size-medium wp-image-181\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/searchsploitSamba22_2-300x135.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/searchsploitSamba22_2-768x346.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/searchsploitSamba22_2-1024x461.png 1024w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/searchsploitSamba22_2.png 1057w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Exit out of Metasploit <\/p>\n<p>Go to the location of exploit <\/p>\n<p><strong>cd \/usr\/share\/exploitdb\/exploits\/multiple\/remote\/<\/strong><\/p>\n<p>Copy file to local directory and build<\/p>\n<p><strong>cp 10.c  \/some\/where\/local<br \/>\ngcc -o samba 10.c<br \/>\n<\/strong><\/p>\n<p>list samba command line options, <\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/samba_options-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/samba_options-1-300x99.png\" alt=\"\" width=\"300\" height=\"99\" class=\"aligncenter size-medium wp-image-187\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/samba_options-1-300x99.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/samba_options-1-768x252.png 768w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/samba_options-1.png 949w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Run samba exploit where -b=0 is linux, -c is the connectback ip address (kali box), and the host ip (kioptrix box)<\/p>\n<p><a href=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/root_yes.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/root_yes-300x87.png\" alt=\"\" width=\"300\" height=\"87\" class=\"aligncenter size-medium wp-image-183\" srcset=\"https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/root_yes-300x87.png 300w, https:\/\/kibilogic.com\/wp-content\/uploads\/2018\/06\/root_yes.png 736w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Happy \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Open up kioptrix in one vm Open up kali in 2nd vm Both vm\u2019s are \u201cbridged\u201d Don\u2019t know anything\u2026username\/password We do know that the following services are running: (from the details provided on vulnhub) \u2022 Apache \u2022 OpenSSH \u2022 RPC \u2022 Samba When the OS boots up an IP is assigned. Use netdiscover to find [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-168","post","type-post","status-publish","format-standard","hentry","category-pentesting"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"bridgette","author_link":"https:\/\/kibilogic.com\/?author=1"},"uagb_comment_info":6,"uagb_excerpt":"Open up kioptrix in one vm Open up kali in 2nd vm Both vm\u2019s are \u201cbridged\u201d Don\u2019t know anything\u2026username\/password We do know that the following services are running: (from the details provided on vulnhub) \u2022 Apache \u2022 OpenSSH \u2022 RPC \u2022 Samba When the OS boots up an IP is assigned. Use netdiscover to find&hellip;","_links":{"self":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts\/168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":24,"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":202,"href":"https:\/\/kibilogic.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/202"}],"wp:attachment":[{"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kibilogic.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}