{"id":1160,"date":"2018-12-19T05:52:43","date_gmt":"2018-12-19T11:52:43","guid":{"rendered":"http:\/\/www.jedge.com\/wordpress\/?p=1160"},"modified":"2018-12-19T05:54:10","modified_gmt":"2018-12-19T11:54:10","slug":"have-fun-at-goodwill-part-2-finding-networking-equipment-for-fun-and-profit","status":"publish","type":"post","link":"https:\/\/www.jedge.com\/wordpress\/2018\/12\/have-fun-at-goodwill-part-2-finding-networking-equipment-for-fun-and-profit\/","title":{"rendered":"Have fun at Goodwill part 2 \u2013 Finding Networking Equipment for Fun and Profit"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft\" src=\"http:\/\/www.jedge.com\/images\/netgear.wgt624.jpg\" alt=\"Netgear WGT624\" width=\"289\" height=\"201\" \/>As I&#8217;ve written about previously, a great place to pick up outdated, and potentially vulnerable, wireless routers is your local Goodwill. Depending on the store those shelves can be packed with devices for only a couple bucks. While you are there you can just Google the model number followed by &#8220;exploit&#8221;, &#8220;openwrt&#8221;, or &#8220;dd-wrt&#8221; to see if you have a device worth playing with. Today I got a Netgear WGT624v2 which dates back to POTUS 43&#8217;s first term. I will detail a different adventure than my <a href=\"http:\/\/www.jedge.com\/wordpress\/2018\/06\/have-fun-at-goodwill-finding-networking-equipment-for-fun-and-profit\/\" target=\"_blank\" rel=\"noopener\">previous post<\/a>. When cracking open this device I was greeted with two pre-populated headers! We will use the JTAGulator and Dangerous Prototypes BusBlaster v4 to get access via UART and JTAG.<br \/>\n<!--more--><br \/>\n<a href=\"https:\/\/wikidevi.com\/wiki\/Netgear_WGT624v2\" target=\"_blank\" rel=\"noopener\">WikiDevi<\/a> provides some details on this device but other information is missing or incorrect. Here we will fill in the gaps. The main chip listed on the wiki is the Atheros AR2313 but this device has the same chip (<a href=\"http:\/\/www.jedge.com\/cpg15x\/displayimage.php?pid=135&amp;fullsize=1\" target=\"_blank\" rel=\"noopener\">AR2312A<\/a>) as version 1. When packaged with wireless <a href=\"http:\/\/www.jedge.com\/cpg15x\/displayimage.php?pid=141&amp;fullsize=1\" target=\"_blank\" rel=\"noopener\">AR2112A<\/a> chip it is referred to as AR5002AP-G.\u00a0 with the The SDRAM is a <a href=\"http:\/\/www.jedge.com\/cpg15x\/displayimage.php?pid=137&amp;fullsize=1\" target=\"_blank\" rel=\"noopener\">Winbond W981216BH-75<\/a>. On this device the flash chip is a Macronix International <a href=\"http:\/\/www.jedge.com\/cpg15x\/displayimage.php?pid=138&amp;fullsize=1\" target=\"_blank\" rel=\"noopener\">mx29lv320t-90<\/a> which is 4mb of storage just like version 1 of this device. The <a href=\"https:\/\/oldwiki.archive.openwrt.org\/oldwiki\/OpenWrtDocs\/Hardware\/Netgear\/WGT624\" target=\"_blank\" rel=\"noopener\">openwrt wiki<\/a> says this version should only have 2mb of flash storage. Some Googling reveals questions on how to debrick these devices after an official Netgear firmware update. It may have something to do with the boards being difference for the same &#8220;version&#8221;. No matter, we will work with what we got!<\/p>\n<p>I used the <a href=\"http:\/\/www.grandideastudio.com\/jtagulator\/\" target=\"_blank\" rel=\"noopener\">JTAGulator<\/a> to identify the UART (<a href=\"http:\/\/www.jedge.com\/cpg15x\/displayimage.php?pid=131&amp;fullsize=1\" target=\"_blank\" rel=\"noopener\">img<\/a>) (<a href=\"http:\/\/www.jedge.com\/code\/JTAGulator_WGT624v2_UART_discovery.txt\" target=\"_blank\" rel=\"noopener\">output<\/a>) and the JTAG (<a href=\"http:\/\/www.jedge.com\/cpg15x\/displayimage.php?pid=134&amp;fullsize=1\" target=\"_blank\" rel=\"noopener\">img<\/a>) (<a href=\"http:\/\/www.jedge.com\/code\/netgearWGT624v2_JTAGulator_JTAG_discovery.txt\" target=\"_blank\" rel=\"noopener\">output<\/a>) pinouts. Below are the mappings for the UART and the JTAG. You can confirm the JTAG pinout from this DD-WRT <a href=\"https:\/\/forum.dd-wrt.com\/phpBB2\/viewtopic.php?t=33975\" target=\"_blank\" rel=\"noopener\">forum post<\/a>. You can confirm the UART pinout from <a href=\"http:\/\/www.embraceit.com.au\/wgt624\/WGT624SerialDiagram.jpg\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p><a href=\"http:\/\/www.jedge.com\/images\/WGT624v2%20UART%20JTAG%20Pinout.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone \" src=\"http:\/\/www.jedge.com\/images\/WGT624v2%20UART%20JTAG%20Pinout.png\" alt=\"WGT624v2 UART JTAG Pinout\" width=\"500\" height=\"330\" \/><\/a><\/p>\n<p>You can now connect to the WGT624v2 over serial and monitor the <a href=\"http:\/\/www.jedge.com\/code\/netgear_wgt624v2_uart_boot.txt\" target=\"_blank\" rel=\"noopener\">boot process<\/a>.\u00a0 Plenty of online resources show how to send a magic packet to enable Telnet on Netgear devices.\u00a0 The credentials they list are Gearbuy \/ Geardog (case sensitive).\u00a0 I found that these creds did not work over the serial connection.\u00a0 I don&#8217;t know if the previous owner changed the password.\u00a0 As of yet I have not done a reset of the device.\u00a0 It would be unlikely the previous owner would change the password as after some guessing I found the password to be &#8220;password&#8221;.\u00a0You can now authenticate to the device to obtain menu-command\u00a0 access.\u00a0 You will quickly find out that the OS for this device is VxWorks version 5.4.2. We will leave exploring the OS to another time.<\/p>\n<p>While connected via UART we also connect via JTAG and use the open source\u00a0Open On-Chip Debugger (openocd). This software will allow use to interface with the device over JTAG (hopefully). Many options exist to configure openocd to communicate with the device and a lot of the information needs to be obtained from datasheets (<a href=\"http:\/\/www.jedge.com\/docs\/winbond_W981216BH-75.pdf\" target=\"_blank\" rel=\"noopener\">Winbond<\/a>, <a href=\"http:\/\/www.jedge.com\/docs\/Macronix%20International%20mx29lv320.pdf\" target=\"_blank\" rel=\"noopener\">MXIC<\/a>, Atheros) for the chips on board. For our purposes we get a little lucky and can leverage an existing configuration script.<\/p>\n<p>Before leveraging a previous configuration script we will try to create our own.\u00a0 Openocd is capable of &#8220;auto probing&#8221; to try and identify the CPU. The CPU is the main target we will need in order to communicate with the device.<br \/>\n<pre><code>root@KALI:~# openocd -f \/usr\/share\/openocd\/scripts\/interface\/ftdi\/dp_busblaster.cfg -c &quot;adapter_khz 100; transport select jtag&quot;\nOpen On-Chip Debugger 0.10.0\nLicensed under GNU GPL v2\nFor bug reports, read\nhttp:\/\/openocd.org\/doc\/doxygen\/bugs.html\nInfo : If you need SWD support, flash KT-Link buffer from https:\/\/github.com\/bharrisau\/busblaster\nand use dp_busblaster_kt-link.cfg instead\nadapter speed: 100 kHz\njtag\nInfo : clock speed 100 kHz\nWarn : There are no enabled taps.&nbsp;&nbsp;AUTO PROBING MIGHT NOT WORK!!\nError: JTAG scan chain interrogation failed: all zeroes\nError: Check JTAG interface, timings, target power, etc.\nError: Trying to use configured scan chain anyway...\nError: IR capture error at bit 0, saw 0x00 not 0x...3\nWarn : Bypassing JTAG setup events due to errors\nWarn : gdb services need one or more targets defined<\/code><\/pre><br \/>\nUnfortunately the &#8220;auto probing&#8221; fails. We identified the CPU as an AR2312A.\u00a0 There is the following target script for the AR2313 (atheros_ar2313.cfg)<br \/>\n<pre><code>set _CHIPNAME ar2313\nset _CPUTAPID 0x00000001\njtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID\nset _TARGETNAME $_CHIPNAME.cpu\ntarget create $_TARGETNAME mips_m4k -endian big -chain-position $_TARGETNAME<\/code><\/pre>An <a href=\"https:\/\/forum.archive.openwrt.org\/viewtopic.php?id=14205\" target=\"_blank\" rel=\"noopener\">archived Openwrt forum post<\/a>\u00a0for the ATT\u00a06800G helps us confirm that the above information will also work for the AR2312A.\u00a0 In the forum post a <a href=\"https:\/\/oldwiki.archive.openwrt.org\/doc\/hardware\/port.jtag.cable.buffered\" target=\"_blank\" rel=\"noopener\">WIGGLER<\/a> was created and the EJTAG software used to communicate with the ATT 6800G which has the same SoC as our device.\u00a0 Also confirmed in this <a href=\"https:\/\/community.ubnt.com\/t5\/NanoStation-and-Loco-Devices\/flash-memory-address-of-redboot\/td-p\/257677\" target=\"_blank\" rel=\"noopener\">blog post<\/a>. One more item will need to be set so we can see if the configuration file for the AR2313 will work with our device. We will need to set the &#8220;reset_config&#8221; option. Normally this is set in the board configuration file, which we will get to in a bit. We will set it at the command line for now. We only identified TRST with the JTAGulator.  This is not enough to get a reset to work.  We will also need SRST. A <a href=\"https:\/\/forum.dd-wrt.com\/phpBB2\/viewtopic.php?t=33975\" target=\"_blank\">dd-wrt<\/a> forum post identifies the header as a 14 Pin header (Standard MIPS EJTAG 2.5). We connect pin 11 to TSRST on the Bus Blaster. With both reset pins we can<br \/>\n<pre><code>root@KALI:~# openocd -f \/usr\/share\/openocd\/scripts\/interface\/ftdi\/dp_busblaster.cfg -f \/usr\/share\/openocd\/scripts\/target\/atheros_ar2313.cfg -c &quot;adapter_khz 100; transport select jtag; reset_config trst_and_srst&quot;\nOpen On-Chip Debugger 0.10.0+dev-00622-g322d2fa1 (2018-12-17-06:47)\nLicensed under GNU GPL v2\nFor bug reports, read\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http:\/\/openocd.org\/doc\/doxygen\/bugs.html\nInfo : If you need SWD support, flash KT-Link buffer from https:\/\/github.com\/bharrisau\/busblaster\nand use dp_busblaster_kt-link.cfg instead\nInfo : auto-selecting first available session transport &quot;jtag&quot;. To override use &#039;transport select &lt;transport&gt;&#039;.\nar2313.cpu\nadapter speed: 100 kHz\nWarn : Transport &quot;jtag&quot; was already selected\ntrst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst\nInfo : Listening on port 6666 for tcl connections\nInfo : Listening on port 4444 for telnet connections\nInfo : clock speed 100 kHz\nInfo : JTAG tap: ar2313.cpu tap\/device found: 0x00000001 (mfg: 0x000 (&lt;invalid&gt;), part: 0x0000, ver: 0x0)\nInfo : Listening on port 3333 for gdb connections\n<\/code><\/pre>We are now connected via JTAG to the Netgear WGT624v2 via the Bus Blaster.  We can now connect and interact with the device over telnet or the GNU Project debugger (GDB). The output listed below shows a simple interaction where we connect via telnet. We list the contents of the registers.  When they do not show anything we then <strong>halt<\/strong> the system and show that the registers are now populated.  Then we perform a <strong>reset halt<\/strong> and step through a few instructions, showing the program counter (reg pc).<br \/>\n<pre><code>root@KALI:~# telnet localhost 4444\nTrying ::1...\nTrying 127.0.0.1...\nConnected to localhost.\nEscape character is &#039;^]&#039;.\nOpen On-Chip Debugger\n&gt; reg\n===== mips32 registers\n(0) r0 (\/32)\n(1) r1 (\/32)\n(2) r2 (\/32)\n(3) r3 (\/32)\n(4) r4 (\/32)\n(5) r5 (\/32)\n(6) r6 (\/32)\n(7) r7 (\/32)\n\n. . . SNIP . . .\n\n(71) fir (\/32): 0x00000000\n&gt; halt\nMIPS32 only implemented\ntarget halted in MIPS32 mode due to debug-request, pc: 0x80242ba0\n&gt; reg\n===== mips32 registers\n(0) r0 (\/32): 0x00000000\n(1) r1 (\/32): 0x804D0000\n(2) r2 (\/32): 0x00000002\n(3) r3 (\/32): 0x00011CB5\n(4) r4 (\/32): 0x80FA56E0\n(5) r5 (\/32): 0x00000000\n(6) r6 (\/32): 0x80FA56E0\n(7) r7 (\/32): 0x80FA56E0\n(\n. . . SNIP . . .\n\n(37) pc (\/32): 0x80242BA0\n\n. . . SNIP . . .\n\n&gt; reset halt\nJTAG tap: ar2313.cpu tap\/device found: 0x00000001 (mfg: 0x000 (&lt;invalid&gt;), part: 0x0000, ver: 0x0)\ntarget halted in MIPS32 mode due to debug-request, pc: 0xbfc00000\n&gt; reg\n===== mips32 registers\n(0) r0 (\/32): 0x00000000\n(1) r1 (\/32): 0x00080000\n(2) r2 (\/32): 0x00000002\n(3) r3 (\/32): 0x00011CB5\n(4) r4 (\/32): 0x80FA56E0\n(5) r5 (\/32): 0x00000000\n(6) r6 (\/32): 0x80FA56E0\n\n. . . SNIP . . .\n\n(37) pc (\/32): 0xBFC00000\n\n. . . SNIP . . .\n\n&gt; step; reg pc\ntarget halted in MIPS32 mode due to single-step, pc: 0xbfc00004\npc (\/32): 0xBFC00004\n\n. . . SNIP . . .\n\n&gt; step; reg pc\ntarget halted in MIPS32 mode due to single-step, pc: 0xbfc00554\npc (\/32): 0xBFC00554\n&gt; dump_image 0xBFC00554.bin 0xBFC00554 0x1000\ndumped 4096 bytes in 7.579714s (0.528 KiB\/s)<\/code><\/pre>Complete <a target=\"_blank\" href=\"http:\/\/www.jedge.com\/code\/netgear_wgt624v2_openocd_interaction.txt\">output<\/a> of telnet commands.<br \/>\nWe did a dump of memory (dump_image) and quickly examine what we obtained via the &#8220;strings&#8221; command.  The result shows that we got hit by the watchdog timer.  We will need to conduct additional research on how to avoid this.  That will be for another post.  The next post will deal with a setup of the board configuration file that includes communication with the device&#8217;s flash. Maybe a post of interaction with GDB will follow as well.<pre><code>root@KALI:~# strings 0xBFC00554.bin\n. . . SNIP . . .\nar531x rev\n firmware startup...\nSDRAM TEST...\nPASSED\nFAILED at address:\n exp\n got\npanic: romStart failed!\n0123456789abcdef&lt;\nNMI (watchdog): ErrorPC:\nsysConsoleDump: type\n. . . SNIP . . .<\/code><\/pre><\/p>\n<p><strong>Resources<\/strong><br \/>\n<a href=\"https:\/\/www.netgear.com\/support\/product\/WGT624v2.aspx\" target=\"_blank\" rel=\"noopener\">https:\/\/www.netgear.com\/support\/product\/WGT624v2.aspx<\/a><br \/>\n<a href=\"https:\/\/wikidevi.com\/wiki\/Netgear_WGT624v2\" target=\"_blank\" rel=\"noopener\">https:\/\/wikidevi.com\/wiki\/Netgear_WGT624v2<\/a><br \/>\n<a href=\"https:\/\/wikidevi.com\/wiki\/Netgear_WGT624v1\" target=\"_blank\" rel=\"noopener\">https:\/\/wikidevi.com\/wiki\/Netgear_WGT624v1<\/a><br \/>\n<a href=\"https:\/\/wikidevi.com\/wiki\/Atheros_AR2313\" target=\"_blank\" rel=\"noopener\">https:\/\/wikidevi.com\/wiki\/Atheros_AR2313<\/a><br \/>\n<a href=\"http:\/\/www.jedge.com\/docs\/winbond_W981216BH-75.pdf\" target=\"_blank\" rel=\"noopener\">http:\/\/www.jedge.com\/docs\/winbond_W981216BH-75.pdf<\/a><br \/>\n<a href=\"http:\/\/www.jedge.com\/docs\/Atheros_AR2112.pdf\" target=\"_blank\" rel=\"noopener\">http:\/\/www.jedge.com\/docs\/Atheros_AR2112.pdf<\/a><br \/>\n<a href=\"http:\/\/www.jedge.com\/docs\/Macronix International mx29lv320.pdf\" target=\"_blank\" rel=\"noopener\">http:\/\/www.jedge.com\/docs\/Macronix International mx29lv320.pdf<\/a><br \/>\n<a href=\"http:\/\/web.archive.org\/web\/20040408111939\/http:\/\/www.atheros.com:80\/pt\/AR5002AP-GBulletin.htm\" target=\"_blank\" rel=\"noopener\">http:\/\/www.atheros.com:80\/pt\/AR5002AP-GBulletin.htm<\/a><\/p>\n<p><a href=\"https:\/\/forum.dd-wrt.com\/phpBB2\/viewtopic.php?t=33975\" target=\"_blank\" rel=\"noopener\">https:\/\/forum.dd-wrt.com\/phpBB2\/viewtopic.php?t=33975<\/a><br \/>\n<a href=\"https:\/\/forum.archive.openwrt.org\/viewtopic.php?id=12672\" target=\"_blank\" rel=\"noopener\">https:\/\/forum.archive.openwrt.org\/viewtopic.php?id=12672<\/a><br \/>\n<a href=\"https:\/\/oldwiki.archive.openwrt.org\/oldwiki\/OpenWrtDocs\/Hardware\/Netgear\/WGT624\" target=\"_blank\" rel=\"noopener\">https:\/\/oldwiki.archive.openwrt.org\/oldwiki\/OpenWrtDocs\/Hardware\/Netgear\/WGT624<\/a><br \/>\n<a href=\"https:\/\/forum.archive.openwrt.org\/viewtopic.php?id=14205\" target=\"_blank\" rel=\"noopener\">https:\/\/forum.archive.openwrt.org\/viewtopic.php?id=14205<\/a><br \/>\n<a href=\"https:\/\/community.ubnt.com\/t5\/NanoStation-and-Loco-Devices\/flash-memory-address-of-redboot\/td-p\/257677\" target=\"_blank\" rel=\"noopener\">https:\/\/community.ubnt.com\/t5\/NanoStation-and-Loco-Devices\/flash-memory-address-of-redboot\/td-p\/257677<\/a><\/p>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=IwnPbNhd2GM&lt;\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/watch?v=IwnPbNhd2GM<\/a><br \/>\n<a href=\"http:\/\/techwithdave.davevw.com\/2013\/07\/getting-started-with-openocd.html\" target=\"_blank\" rel=\"noopener\">http:\/\/techwithdave.davevw.com\/2013\/07\/getting-started-with-openocd.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I&#8217;ve written about previously, a great place to pick up outdated, and potentially vulnerable, wireless routers is your local Goodwill. Depending on the store those shelves can be packed with devices for only a couple bucks. While you are there you can just Google the model number followed by &#8220;exploit&#8221;, &#8220;openwrt&#8221;, or &#8220;dd-wrt&#8221; to [&hellip;]<\/p>\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":[3,163,114],"tags":[172,176,171],"class_list":["post-1160","post","type-post","status-publish","format-standard","hentry","category-configuration","category-hacking","category-hardware-hacking","tag-jtagulator","tag-openocd","tag-uart"],"_links":{"self":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts\/1160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1160"}],"version-history":[{"count":25,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts\/1160\/revisions"}],"predecessor-version":[{"id":1186,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts\/1160\/revisions\/1186"}],"wp:attachment":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}