{"id":704,"date":"2020-08-23T00:05:28","date_gmt":"2020-08-22T23:05:28","guid":{"rendered":"https:\/\/cybercop-training.ch\/?p=704"},"modified":"2020-09-07T21:25:43","modified_gmt":"2020-09-07T20:25:43","slug":"analyzing-router-firmware-p4","status":"publish","type":"post","link":"https:\/\/cybercop-training.ch\/?p=704","title":{"rendered":"Analyzing Router Firmware P4"},"content":{"rendered":"<p><strong>Challenge 4 &#8211; Investigating Modifications<\/strong><\/p>\n<blockquote>\n<p style=\"text-align: justify;\">Original and modified\u00a0<a href=\"https:\/\/openwrt.org\/\">OpenWRT<\/a>\u00a0router firmware are provided to us (<strong>openwrt-ar750-sysupgrade.bin.orig<\/strong> and <strong>openwrt-ar750-sysupgrade.bin respectively<\/strong>). Analyze the firmware and answer the following questions:<\/p>\n<ol>\n<li style=\"text-align: justify;\">When was the libc package was added in modified firmware? Provide the time in DD\/MM\/YY HH:MM:SS PM format (GMT).<\/li>\n<li style=\"text-align: justify;\">A file was modified to add a backdoor to the firmware. Provide the name the file.<\/li>\n<li style=\"text-align: justify;\">A newly added file contains a token for Amazon cloud. Locate that file and retrieve the token.<\/li>\n<\/ol>\n<\/blockquote>\n<p>Let&#8217;s begin \ud83d\ude0e<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/challenge4-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-707\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/challenge4-1.png\" alt=\"\" width=\"630\" height=\"244\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/challenge4-1.png 630w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/challenge4-1-300x116.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>After extraction of both firmware files, I need a tool to compare and locate file changes.<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-711\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk14.png\" alt=\"\" width=\"526\" height=\"300\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk14.png 526w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/binwalk14-300x171.png 300w\" sizes=\"auto, (max-width: 526px) 100vw, 526px\" \/><\/a><\/p>\n<p>For that I&#8217;ll use the <a href=\"https:\/\/git-scm.com\/docs\/git-diff\" target=\"_blank\" rel=\"noopener noreferrer\">git diff command<\/a><\/p>\n<p><code>git diff --no-index _openwrt-ar750-sysupgrade.bin.orig.extracted\/ _openwrt-ar750-sysupgrade.bin.extracted\/<\/code><\/p>\n<ul>\n<li>When was the libc package was added in modified firmware? Provide the time in DD\/MM\/YY HH:MM:SS PM format (GMT).<\/li>\n<\/ul>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-712\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git1.png\" alt=\"\" width=\"379\" height=\"148\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git1.png 379w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git1-300x117.png 300w\" sizes=\"auto, (max-width: 379px) 100vw, 379px\" \/><\/a><\/p>\n<p>To answer this question I need a <a href=\"https:\/\/www.epochconverter.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">converter<\/a> to get the GMT time format. This was also part of <a href=\"https:\/\/cybercop-training.ch\/?p=488\" target=\"_blank\" rel=\"noopener noreferrer\">another challenge<\/a> to get a ticket for the Bsides event in London last year.<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/epoch_convert.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-713\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/epoch_convert.png\" alt=\"\" width=\"678\" height=\"243\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/epoch_convert.png 678w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/epoch_convert-300x108.png 300w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/a><\/p>\n<ul>\n<li>A file was modified to add a backdoor to the firmware. Provide the name the file.<\/li>\n<\/ul>\n<p>It&#8217;s the file <strong>rc.local<\/strong>. We can see a netcat listener on port 30000<\/p>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-714\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git2.png\" alt=\"\" width=\"645\" height=\"200\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git2.png 645w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git2-300x93.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/a><\/p>\n<ul>\n<li>A newly added file contains a token for Amazon cloud. Locate that file and retrieve the token<\/li>\n<\/ul>\n<p><a href=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-715\" src=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git3.png\" alt=\"\" width=\"798\" height=\"156\" srcset=\"https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git3.png 798w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git3-300x59.png 300w, https:\/\/cybercop-training.ch\/wp-content\/uploads\/2020\/08\/git3-768x150.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/a><\/p>\n<p>Amazon token is: <strong>65eb14e6f3c3475d6b00867c2f0e4a3c<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Challenge 4 &#8211; Investigating Modifications Original and modified\u00a0OpenWRT\u00a0router firmware are provided to us (openwrt-ar750-sysupgrade.bin.orig and openwrt-ar750-sysupgrade.bin respectively). Analyze the firmware and answer the following questions: <a class=\"mh-excerpt-more\" href=\"https:\/\/cybercop-training.ch\/?p=704\" title=\"Analyzing Router Firmware P4\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":2,"featured_media":709,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4,17,16],"tags":[],"class_list":["post-704","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\/704","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=704"}],"version-history":[{"count":4,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/posts\/704\/revisions"}],"predecessor-version":[{"id":716,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/posts\/704\/revisions\/716"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=\/wp\/v2\/media\/709"}],"wp:attachment":[{"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cybercop-training.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}