{"id":142,"date":"2023-06-10T21:33:42","date_gmt":"2023-06-10T21:33:42","guid":{"rendered":"https:\/\/justatrainingblog.co.uk\/?p=142"},"modified":"2023-06-10T21:33:42","modified_gmt":"2023-06-10T21:33:42","slug":"thm-exploiting-unsecured-nfs","status":"publish","type":"post","link":"https:\/\/justatrainingblog.co.uk\/?p=142","title":{"rendered":"THM &#8211; Exploiting unsecured NFS"},"content":{"rendered":"\n<p>As part of the Network Services room in TryHackMe, one of the areas covered is NFS. I will cover the technology in more detail at a later point but this article is dedicated towards a practice senario concerning how an unsecured NFS share can be exploited. <\/p>\n\n\n\n<p>To start with as always, we need to find what the server is running. To do so we run Nmap. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"954\" height=\"817\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Namp-NFS.png\" alt=\"\" class=\"wp-image-143\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Namp-NFS.png 954w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Namp-NFS-300x257.png 300w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Namp-NFS-768x658.png 768w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Namp-NFS-850x728.png 850w\" sizes=\"(max-width: 954px) 100vw, 954px\" \/><\/figure>\n\n\n\n<p>Ok so we can see that port 2049 is open running NFS. This is the generally default port for this protocol so nothing surprising here. <\/p>\n\n\n\n<p>So now we know nfs is open on the machine lets check for any shares<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"698\" height=\"80\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mount-find.png\" alt=\"\" class=\"wp-image-144\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mount-find.png 698w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mount-find-300x34.png 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/figure>\n\n\n\n<p>Perfect, we have a share called \/home. Lets try mounting it to our own machine. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"944\" height=\"36\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mounting.png\" alt=\"\" class=\"wp-image-145\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mounting.png 944w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mounting-300x11.png 300w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mounting-768x29.png 768w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/Mounting-850x32.png 850w\" sizes=\"(max-width: 944px) 100vw, 944px\" \/><\/figure>\n\n\n\n<p>and now lets see if we can access it<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"146\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-3.png\" alt=\"\" class=\"wp-image-146\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-3.png 644w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-3-300x68.png 300w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<p>We can! We can see in the home directory a folder named Cappucino. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"299\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-4.png\" alt=\"\" class=\"wp-image-147\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-4.png 793w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-4-300x113.png 300w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/image-4-768x290.png 768w\" sizes=\"(max-width: 793px) 100vw, 793px\" \/><\/figure>\n\n\n\n<p>Accessing the folder reveals a number of folders. The one we really find interesting here is .ssh. <\/p>\n\n\n\n<p>Accessing the folder shows a file named rsa_id, this is the defualt name for SSH private keys so is exactly what we need (unfortunately lost the screenshots). By running mv rsa_id \/root we moved the file to our local directory. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"51\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/chmod.png\" alt=\"\" class=\"wp-image-148\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/chmod.png 704w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/chmod-300x22.png 300w\" sizes=\"(max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<p>Next we run chmod 600 to change the permissions to something our machine can access and finally we&#8217;ll try connecting using an assumed username of Cappucino:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"947\" height=\"825\" src=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/SSH-Access.png\" alt=\"\" class=\"wp-image-149\" srcset=\"https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/SSH-Access.png 947w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/SSH-Access-300x261.png 300w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/SSH-Access-768x669.png 768w, https:\/\/justatrainingblog.co.uk\/wp-content\/uploads\/2023\/06\/SSH-Access-850x740.png 850w\" sizes=\"(max-width: 947px) 100vw, 947px\" \/><\/figure>\n\n\n\n<p>Success! We have now signed in remotely as Cappucino .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As part of the Network Services room in TryHackMe, one of the areas covered is NFS. I will cover the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-142","post","type-post","status-publish","format-standard","hentry","category-learning","category-tryhackme"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=142"}],"version-history":[{"count":1,"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/142\/revisions\/150"}],"wp:attachment":[{"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/justatrainingblog.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}