{"id":11693,"date":"2024-02-10T18:17:31","date_gmt":"2024-02-10T12:47:31","guid":{"rendered":"https:\/\/reconforce.in\/blog\/?p=11623"},"modified":"2024-02-10T18:17:31","modified_gmt":"2024-02-10T12:47:31","slug":"overlayfs-ctf-walkthrough-2024-tryhackme","status":"publish","type":"post","link":"https:\/\/reconcybersecurity.com\/blogs\/overlayfs-ctf-walkthrough-2024-tryhackme\/","title":{"rendered":"OverlayFS CTF Walkthrough 2024 &#8211; TryHackMe"},"content":{"rendered":"\n<h2 id=\"introduction\" class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>OverlayFS is a powerful filesystem technology that allows you to layer multiple filesystems on top of one another, merging them into a single unified view. In this CTF, you&#8217;ll explore the functionalities of OverlayFS, learning how it facilitates efficient storage management and simplifies the organization of data. <\/p>\n\n\n\n<h3 id=\"setup-environment\" class=\"wp-block-heading\"><strong>Setup Environment<\/strong><\/h3>\n\n\n\n<p>Join OverlayFS CTF room on <strong>TryHackMe<\/strong> by clicking <a href=\"https:\/\/tryhackme.com\/room\/mrrobot\" target=\"_blank\" rel=\"noreferrer noopener\">HERE<\/a>.<\/p>\n\n\n\n<p><strong>Through TryHackMe:<\/strong> The process of setting up environment and connecting to the machine is a part of our CTF. So simply follow the provided steps below to finish this short yet engaging CTF.<\/p>\n\n\n\n<p><strong>Note: <\/strong>The vulnerability targeted in this CTF has been patched already, and the focus is on understanding the concept behind that vulnerability and exploring potential actions within a system once it&#8217;s exploited.<\/p>\n\n\n\n<h2 id=\"overlayfs-ctf-tasks\" class=\"wp-block-heading\"><strong>OverlayFS CTF &#8211; Tasks<\/strong><\/h2>\n\n\n\n<h3 id=\"task-1-what-is-overlayfs\" class=\"wp-block-heading\"><strong>Task 1:<\/strong> What is OverlayFS?<\/h3>\n\n\n\n<p><strong>Question:<\/strong> I have a very rough overview of what OverlayFS is&#8230;<\/p>\n\n\n\n<p><strong>Answer:<\/strong> No Answer Needed<\/p>\n\n\n\n<h2 id=\"cve-2021-3493-overlayfs-exploit\" class=\"wp-block-heading\"><strong>CVE-2021-3493 &#8211; OverlayFS Exploit<\/strong><\/h2>\n\n\n\n<p>Credentials for <strong>SSH<\/strong> are written below&#8230;<\/p>\n\n\n\n<p><strong>Username:<\/strong> overlay<br><strong>Password:<\/strong> tryhackme123<\/p>\n\n\n\n<h5 id=\"overlayfs-ctf-solving\" class=\"wp-block-heading\"><strong>OverlayFS CTF Solving<\/strong><\/h5>\n\n\n\n<p>Below are solutions to the questions asked in your OverlayFS Capture The Flag (CTF) challenge.<\/p>\n\n\n\n<p><strong>Question 1:<\/strong> Deploy the machine with the Start Machine button in this task and wait up to 2 minutes for the VM to boot<strong> &#8211; No Answer Needed.<\/strong><\/p>\n\n\n\n<p><strong>Note:<\/strong> Please utilize the <strong>Attackbox<\/strong> machine provided by TryHackMe for future exploits. The terminal accessible by clicking &#8220;Start Machine&#8221; doesn&#8217;t support copying and pasting content from outside sources, so using Attackbox will allow for seamless execution of exploits.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"186\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-1024x186.png\" alt=\"OverlayFS\" class=\"wp-image-11626\" srcset=\"https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-1024x186.png 1024w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-300x55.png 300w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-768x140.png 768w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-380x69.png 380w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-800x145.png 800w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32-1160x211.png 1160w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-32.png 1221w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Question 2:<\/strong> SSH into the machine with the credentials provided in the task text<strong> &#8211; No Answer Needed.<\/strong><\/p>\n\n\n\n<p><strong>Command: <\/strong><code>ssh overlay@MACHINE-IP<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"682\" height=\"174\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/2024-02-10_14-39.png\" alt=\"\" class=\"wp-image-11627\" srcset=\"https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-39.png 682w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-39-300x77.png 300w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/2024-02-10_14-39-380x97.png 380w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/figure>\n\n\n\n<p><strong>Question 3:<\/strong> Grab the source code for the exploit from <a href=\"https:\/\/ssd-disclosure.com\/ssd-advisory-overlayfs-pe\/\" target=\"_blank\" rel=\"noreferrer noopener\">SSD-Disclosure here<\/a> and save it as exploit.c on the target machine.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> Type nano exploit.c on your attackbox terminal and save the code inside it you got by clicking the above link<\/p>\n\n\n\n<p><strong>Question 4:<\/strong> Compile the exploit with gcc. If you&#8217;re finding this difficult, a command is given in the hints.<\/p>\n\n\n\n<p><strong>Command: <\/strong><code>gcc -o exploit exploit.c<\/code>.<\/p>\n\n\n\n<p><strong>Question 5:<\/strong> Run your compiled exploit, and get root! What&#8217;s the flag in \/root\/?<\/p>\n\n\n\n<p><strong>Solution<\/strong>: To run the exploit, type <code><strong>.\/exploit<\/strong><\/code> in your terminal and you will get a bash shell. Now change your directory to the root folder by <code><strong>cd \/root\/<\/strong><\/code> command. You can see a file called <strong>flag.txt<\/strong> by <strong><code>ls<\/code><\/strong> command inside root directory. Copy the content inside that file and paste it in the last answer slot of you CTF.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/2024-02-10_14-54.png\" alt=\"\" class=\"wp-image-11628\"\/><\/figure>\n\n\n\n<p>That your OverlayFS CTF machine, it&#8217;s a very short machine just an introduction of a critical vulnerability that has been patched very long time ago. So make sure to try other CTF machines as it makes your skills sharp and up to date.<\/p>\n\n\n\n<p>Checkout our Mr. Robot CTF Walkthrough by clicking <a href=\"https:\/\/reconforce.in\/blog\/mr-robot-ctf-walkthrough-tryhackme-2024\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"Introduction OverlayFS is a powerful filesystem technology that allows you to layer multiple filesystems on top of one&hellip;\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2326],"tags":[],"class_list":{"0":"post-11693","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-blogs"},"_links":{"self":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/posts\/11693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/comments?post=11693"}],"version-history":[{"count":0,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/posts\/11693\/revisions"}],"wp:attachment":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/media?parent=11693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/categories?post=11693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/tags?post=11693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}