{"id":682,"date":"2020-08-17T22:35:59","date_gmt":"2020-08-17T21:35:59","guid":{"rendered":"https:\/\/cybercop-training.ch\/?p=682"},"modified":"2020-09-07T21:26:06","modified_gmt":"2020-09-07T20:26:06","slug":"analyzing-router-firmware-p2","status":"publish","type":"post","link":"https:\/\/cybercop-training.ch\/?p=682","title":{"rendered":"Analyzing Router Firmware P2"},"content":{"rendered":"<p><strong>Challenge 2 &#8211; weak root password<\/strong><\/p>\n<blockquote>\n<p style=\"text-align: justify;\">You&#8217;ve received an OpenWRT based firmware for analysis. The company assures you that the firmware is secure. You have your doubts!<\/p>\n<p style=\"text-align: justify;\">Your mission is to recover the root password hash from the firmware and crack it!<\/p>\n<\/blockquote>\n<p>In this challenge we have a file called firmware.bin and a passwordlist that I&#8217;ll later use for a bruteforce attack.<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-683\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk6.png\" alt=\"\" width=\"545\" height=\"212\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk6.png 545w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk6-300x117.png 300w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><\/a><\/p>\n<p><strong><code>binwalk firmware.bin<\/code><\/strong><\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-684\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk7.png\" alt=\"\" width=\"496\" height=\"183\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk7.png 496w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk7-300x111.png 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/a><\/p>\n<p>Again it&#8217;s a Squashfs filesystem. Let&#8217;s extract it.<\/p>\n<p><strong><code>binwalk -e firmware.bin<\/code><\/strong><\/p>\n<p>Let&#8217;s browse to the \/etc directory and have a look for the <strong>shadow<\/strong> file<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-685\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk8.png\" alt=\"\" width=\"553\" height=\"141\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk8.png 553w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk8-300x76.png 300w\" sizes=\"auto, (max-width: 553px) 100vw, 553px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-687\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk9.png\" alt=\"\" width=\"869\" height=\"318\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk9.png 869w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk9-300x110.png 300w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk9-768x281.png 768w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/a><\/p>\n<p><strong><code>cp shadow \/home\/student<\/code><\/strong><\/p>\n<p>Let&#8217;s copy the shadow file over to my student home directory and do a vi of the file to remove all the other accounts<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-689\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk10.png\" alt=\"\" width=\"866\" height=\"113\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk10.png 866w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk10-300x39.png 300w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk10-768x100.png 768w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/a><\/p>\n<p><strong><code>:wq<\/code><\/strong><\/p>\n<p>For the cracking part I use the tool <a href=\"https:\/\/hashcat.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">hashcat<\/a><\/p>\n<p><strong><code>hashcat -m 1800 -a 0 shadow 1000000-password-seclist.txt<\/code><\/strong><\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-690\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat1.png\" alt=\"\" width=\"821\" height=\"538\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat1.png 821w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat1-300x197.png 300w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat1-768x503.png 768w\" sizes=\"auto, (max-width: 821px) 100vw, 821px\" \/><\/a><\/p>\n<p>Bruteforce attacks always took some time&#8230;<\/p>\n<p>Ther&#8217;e we are, the root password is q1w2e3r4<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-691\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat2.png\" alt=\"\" width=\"798\" height=\"336\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat2.png 798w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat2-300x126.png 300w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/hashcat2-768x323.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Challenge 2 &#8211; weak root password You&#8217;ve received an OpenWRT based firmware for analysis. The company assures you that the firmware is secure. You have <a class=\"mh-excerpt-more\" href=\"https:\/\/cybercop-training.ch\/?p=682\" title=\"Analyzing Router Firmware P2\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":2,"featured_media":664,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4,17,16],"tags":[],"class_list":["post-682","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-forensic","category-hacking","category-iot-stuff","category-linux"],"_links":{"self":[{"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/posts\/682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=682"}],"version-history":[{"count":4,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/posts\/682\/revisions"}],"predecessor-version":[{"id":694,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/posts\/682\/revisions\/694"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/media\/664"}],"wp:attachment":[{"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}