<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3638505461399232379</id><updated>2012-01-24T11:27:14.805-05:00</updated><category term='arts-n-crafts'/><category term='em250'/><category term='frame injection'/><category term='logic analyzer'/><category term='keykeriki'/><category term='simulator'/><category term='static analysis'/><category term='news'/><category term='latex'/><category term='27c3'/><category term='pip'/><category term='globalstar'/><category term='hid'/><category term='iar-kickstart'/><category term='ToorCon'/><category term='half-blind'/><category term='info'/><category term='ecc'/><category term='rs232'/><category term='msp430 bsl timing'/><category term='openbeacon'/><category term='mspgcc'/><category term='mc13226'/><category term='packet in packet'/><category term='firmware'/><category term='nordic'/><category term='stack depth'/><category term='clicker'/><category term='spot'/><category term='imagecraft'/><category term='goodfet'/><category term='smartgrid'/><category term='msp430static'/><category term='ami'/><category term='decapped'/><category term='workshop'/><category term='cuda'/><category term='brother kh930'/><category term='as430'/><category term='em260'/><category term='mica'/><category term='devcamp10'/><category term='chemistry'/><category term='nrf24e1'/><category term='i2c'/><category term='nhbadge'/><category term='IAR'/><category term='l-band'/><category term='zombiegotcha'/><category term='emulator'/><category term='TIDC'/><category term='errata'/><category term='cc2530'/><category term='disassembly'/><category term='nvidia'/><category term='satellite'/><category term='tusb3410'/><category term='avr'/><category term='compiler'/><category term='berlin'/><category term='ptx'/><category term='ember'/><category term='challenge'/><category term='uart'/><category term='cc1110'/><category term='msp430rf2500'/><category term='telosb'/><category term='keypad'/><category term='cc2430'/><category term='eeprom'/><category term='hope'/><category term='nrf24l01+'/><category term='802.15.4'/><category term='8051'/><category term='ez430'/><category term='chipcon'/><category term='knoxville'/><category term='zigbee'/><category term='tmote'/><category term='nrf2401'/><category term='arduino'/><category term='imme'/><category term='msp430fet'/><category term='speaking'/><category term='mc13224'/><category term='usb'/><category term='killerbee'/><category term='tutorial'/><category term='woot'/><category term='spi'/><category term='freescale'/><category term='hno3'/><category term='bsl'/><category term='tinyos'/><category term='shipping'/><category term='source'/><category term='msp430simu'/><category term='bluetooth'/><category term='notacon'/><category term='knitting'/><category term='scada'/><category term='usenix'/><category term='802.11'/><category term='Linux'/><category term='CALDCO'/><category term='zstack'/><category term='hardhack'/><category term='msp430f2xx'/><category term='microsoft'/><category term='phneutral'/><category term='gcc'/><category term='msp430'/><category term='assembly language'/><title type='text'>Travis Goodspeed's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>92</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5226524194149074806</id><published>2011-12-04T15:25:00.000-05:00</published><updated>2011-12-04T15:29:53.157-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='satellite'/><category scheme='http://www.blogger.com/atom/ns#' term='globalstar'/><category scheme='http://www.blogger.com/atom/ns#' term='spot'/><category scheme='http://www.blogger.com/atom/ns#' term='l-band'/><title type='text'>Introduction to Bluetooth RFCOMM Reverse Engineering</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;with thanks to &lt;a href="http://natrium42.com/"&gt;Alexei Karpenko&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6388584445/" title="Spot Connect (cropped) by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm8.staticflickr.com/7171/6388584445_b1f9542de4_m.jpg" width="240" height="211" alt="Spot Connect (cropped)"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Reverse engineering a Bluetooth device is rather straightforward, but quite a few good neighbors don't know where to begin.  This article demonstrates exactly how an Android client was reverse engineered in order to produce open source clients in Python and QT Mobility.  I'm writing with the assumption that you are trying to reverse engineering your own device, which is similar but not identical to mine.  As this is an introductory guide, I'll stay clear of any code reverse engineering, sticking only to network traffic.&lt;br /&gt;&lt;br /&gt;The subject of this article is the &lt;a href="http://www.findmespot.com/en/index.php?cid=116"&gt;Spot Connect&lt;/a&gt;, which transmits one-way text messages and GPS coordinates by L-band to the GlobalStar satellite constellation.  These messages are then forwarded by email or SMS.  Except in its emergency mode, the device is operated through Bluetooth by a smart phone.  Thanks to Android's use of the Bluez bluetooth stack, it is rather easy to get the necessary traffic dumps.&lt;br /&gt;&lt;br /&gt;Kind thanks are due to Alexei Karpenko (Natrium42) for his article on &lt;a href="http://natrium42.com/projects/spot/"&gt;SPOT Reverse Engineering&lt;/a&gt;, which covers the original SPOT unit in excellent and thorough detail.  It was his article that got me looking at the Spot Connect, and his description of the GPS format saved me quite a bit of travel for sample collection.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6340739819/" title="GlobalStar Beacon by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6110/6340739819_cf093debb1.jpg" width="375" height="278" alt="GlobalStar Beacon"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Sniffing RFCOMM&lt;/h3&gt;&lt;br /&gt;The first step is to load the official client onto a rooted Android phone, in my case a Nexus S.  I had to swap SIM cards as my Brazilian one put me in a region of the Android market that didn't have the application.  Switching to a Swiss card fixed this, and a moment later the app was installing.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6341490393/" title="SPOT Connect by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6107/6341490393_f0ba102413_m.jpg" width="135" height="240" alt="SPOT Connect"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Spot Connect uses RFCOMM, which is Bluetooth's alternative to a TCP socket or a UART.  As it is easy to prototype and always delivers packets in order, RFCOMM has become the standard way of implementing custom protocols.  To sniff the traffic before knowing the mode, we'll use hcidump running in a debugging shell of the phone.  For this, run &lt;i&gt;adb shell hcidump -X | tee spotlog.txt&lt;/i&gt; on your workstation, send a transmission, and watch the result in the log.&lt;br /&gt;&lt;br /&gt;The message being sent stands out as ASCII, of course, so it's the first thing to look for.  With no knowledge of the HCI protocol, you can still be sure that you have a cleartext recording.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6388996157/" title="HCIDump Screenshot by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6116/6388996157_f6282e9e29.jpg" width="400" height="240" alt="HCIDump Screenshot"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;35 00 40 00 0b ef 63 aa 31 26 01 00 01 00 01 4d  5.@...c.1&amp;.....M&lt;br /&gt;72 2e 20 57 61 74 73 6f 6e 2c 20 63 6f 6d 65 20  r. Watson, come &lt;br /&gt;68 65 72 65 2e 20 49 20 77 61 6e 74 20 74 6f 20  here. I want to &lt;br /&gt;73 65 65 20 79 6f 75 2e 9a                       see you..&lt;/pre&gt;&lt;br /&gt;From Alexei's article, you can expect that frames inside of RFCOMM will begin with 0xAA, followed by a length, followed by a verb and the objects.  These bytes will be wrapped in padding on the outbound end, and they'll be fragmented on the inbound end.  Sure enough, these are the bytes that come before the word ``Watson'':&lt;br /&gt;&lt;pre&gt;aa Preamble&lt;br /&gt;31 Length&lt;br /&gt;26 Verb&lt;br /&gt;01 00 01 00 01 Flags (OK, Check In)&lt;br /&gt;4d 72 2e 20 57 ASCII Message (abbreviated)&lt;/pre&gt;&lt;br /&gt;Counting 0x31 bytes out, notice that the packet ends exactly on a byte of the ASCII message, without a checksum!  By looking for bytes of AA and searching for length, with allowances for packet fragmentation and the RFCOMM wrapper, it becomes possible to decode every command and its matching response.&lt;br /&gt;&lt;br /&gt;Be aware that responses will be fragmented more than transmissions.  If you need to reverse engineer longer transactions or have a more complete log, it will be handy to have a script to reassembly from the HCI frames.  In those cases, toss together a proper HCI decoder to get a more accurate interpretation of the records.&lt;br /&gt;&lt;br /&gt;Looking through the entire log, it the protocol appears to be as follows.  First, the client queries the Device ID with verb 0x01, using the exact same format as Alexei's article.  Then it uses verb 0x25 to query the last known position of the device, which will be returned in the style that Alexei reverse engineered from the original unit.  Use pen and paper to decode these transactions from my Python client.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6389276441/" title="Location Query by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm8.staticflickr.com/7151/6389276441_4898e203a2.jpg" width="338" height="100" alt="Location Query"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;First Implementation&lt;/h3&gt;&lt;br /&gt;With these recordings in hand, the complete language can now be described and implemented.  Luckily, three verbs make for a quick implementation!&lt;br /&gt;&lt;br /&gt;I use &lt;a href="http://code.google.com/p/pybluez/"&gt;py-bluez&lt;/a&gt; for prototyping such implementations, as its &lt;a href="http://code.google.com/p/pybluez/source/browse/trunk/examples/simple/rfcomm-client.py"&gt;rfcomm-client.py&lt;/a&gt; example is simple enough to get a working client in minutes.  As py-bluez is specific to Linux, Mac users might prefer &lt;a href="http://lightblue.sourceforge.net/"&gt;lightblue&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For simplicity, cut the UUID code or switch it to RFCOMM's UUID, which is 00001101-0000-1000-8000-00805F9B34FB.  For a list of all services on a device, run 'sdptool records $adr'.  This only lists those which are publicly announced by SDP, the Service Discovery Protocol.  To scan for unadvertised services, try &lt;a href="http://www.betaversion.net/btdsd/download/"&gt;BT Audit&lt;/a&gt; from Collin Mulliner.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;0x01 -- Get ID&lt;/b&gt;&lt;br /&gt;A minimal test client will just test the serial number of the device.  To do this, simply send "\xAA\x03\x01" and then catch the reply with verb 0x01.  Bytes 3, 4, 5, and 6 of the reply will contain the serial number in Big Endian notation.  For this first implementation, commands and their responses may be handled synchronously for simplicity.&lt;br /&gt;&lt;br /&gt;Where self.tx() takes a frame as its input and returns the response, this is implemented in Python as the following.  What could be simpler?&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6430848699/" title="SpotConnect.getid(self) by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm8.staticflickr.com/7002/6430848699_8290716b1b.jpg" width="253" height="116" alt="SpotConnect.getid(self)"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;0x25 -- Get Last Position&lt;/b&gt;&lt;br /&gt;Similar in calling convention, the 0x25 verb requests the last known GPS position of the device.  The coordinate format is exactly the same as in Alexei Karpenko's &lt;a href="http://natrium42.com/projects/spot/"&gt;Spot Hacking&lt;/a&gt; article, consisting of three bytes apiece to describe latitude and longitude.  The following is my C++ code for parsing the position data, which has already been requested as "\xAA\x03\x25".&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6430890283/" title="SpotConnect::parsePosition(char*) by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm8.staticflickr.com/7143/6430890283_2c3b2e4d34.jpg" width="391" height="360" alt="SpotConnect::parsePosition(char*)"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;0x26 -- Transmit Text&lt;/b&gt;&lt;br /&gt;Transmitting text is just as easy, with the Spot Connect handling all the work after a message has been loaded.  The following is Python code to transmit a short text message with the OK message-code.  This lacks length checks and doesn't support the changing of flags, but it will work perfectly well for a test.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6430980859/" title="SpotConnect.checkin() by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6101/6430980859_b594d90a64.jpg" width="376" height="94" alt="SpotConnect.checkin()"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After the device receives this command, it will reply with an acknowledgment and then begin to attempt transmissions at irregular intervals.  Each transmission consists of a number of fragments, such that the packet can be reassembled so long as one copy of each fragment makes it through.  If you have a clear view of the sky and have configured the first destination to be your email address, you should receive a notification within a few minutes.  If you don't receive a notification by the time the mailbox icon has ceased blinking, then the transmission failed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Other Verbs&lt;/b&gt;&lt;br /&gt;These three verbse--0x01, 0x25, and x026--are sufficient to implement a minimal client for the Spot Connect.  If you'd care to help out, it would be useful to have more documentation for the flags of the 0x26 verb, as well as documentation for 0x52, 0x40, and 0x38.  By scanning and listening for error codes, it should be possible to get a complete list of those verbs that are unused by the Android application.&lt;br /&gt;&lt;br /&gt;You can find my Python client at &lt;a href="https://github.com/travisgoodspeed/pyspot"&gt;https://github.com/travisgoodspeed/pyspot&lt;/a&gt; .  It ought to run as-is on Linux with py-bluez, including the Nokia N900.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;A Graphical Client&lt;/h3&gt;&lt;br /&gt;Now that the protocol has been sufficiently well documented to have a Python implementation, it is worthwhile to rewrite it as a GUI.  In my case, I wanted a QT Mobility client for my Nokia N9.  You can find my work in progress at &lt;a href="https://github.com/travisgoodspeed/goodspot"&gt;https://github.com/travisgoodspeed/goodspot&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6426692031/" title="Pacific Ocean by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm8.staticflickr.com/7032/6426692031_4328a89076.jpg" width="281" height="500" alt="Pacific Ocean"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Other Methods&lt;/h3&gt;&lt;br /&gt;If hcidump isn't available for your platform, you might try &lt;a href="http://www.usenix.org/event/woot07/tech/full_papers/spill/spill_html/"&gt;Sniffing with a USRP&lt;/a&gt; or &lt;a href="http://www.remote-exploit.org/wp-content/uploads/2010/01/busting_bluetooth_myth.pdf"&gt;reflashing a dongle&lt;/a&gt; to become a commercial sniffer.  For a jailbroken iPhone, see the &lt;a href="http://theiphonewiki.com/wiki/index.php?title=Bluetooth"&gt;iPhone Wiki's&lt;/a&gt; documentation.&lt;br /&gt;&lt;br /&gt;Another option would be to create a Bluetooth proxy, relying on the slim authentication performed in the protocol.  In this case, the proxy would open all relevant port to the device being reverse engineered, ferrying commands back and forth as a way to record them.  You might also need to experiment with changing the device class and, in the case of iOS devices, there is also a lockout sequence that must be implemented.&lt;br /&gt;&lt;br /&gt;If none of that works for your device, you could sniff the UART lines that come from the bluetooth module, shown here on the left board.  This particular module happens to be a BT23, and Page 8 of &lt;a href="http://www.ampedrf.com/datasheets/BT23_Datasheet.pdf"&gt;BT23_Datasheet.pdf&lt;/a&gt; shows that pins 14 and 13 should be tapped to get a communications log.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6341493229/" title="SPOT Connect by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6229/6341493229_d3334298aa.jpg" width="500" height="282" alt="SPOT Connect"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As a last resort, you could always ask for documentation.  I didn't bother with this because of my own impatience, but for some devices, such as the &lt;a href="http://www.metawatch.org/developers/"&gt;Metawatch&lt;/a&gt;, documentation is freely available.  More than once, a neighborly vendor has been so kind as to give me the source code or documentation just to be neighborly.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Future Work&lt;/h3&gt;&lt;br /&gt;This article will be followed with one on the physical layer protocol of the SPOT, which I've been able to sniff thanks to some kind help from Michael Ossmann.  For a preview of that technique, you are welcome to stalk my &lt;a href="http://www.flickr.com/photos/travisgoodspeed/sets/72157628136605956/"&gt;SPOT Connect Set&lt;/a&gt; on Flickr.  The most neighborly of these shows individual bits from a FunCube Dongle recording of the transmission.  It's cleartext, of course.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6382817421/" title="Bits from SPOT Connect by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.staticflickr.com/6097/6382817421_1191864a81.jpg" width="354" height="500" alt="Bits from SPOT Connect"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Replacement firmware is also a possibility.  The Spot Connect uses an MSP430F5xx microcontroller with the standard USB bootloader, using a Java client on Windows and an Objective C client on OS X.  The firmware itself is downloaded by HTTPS, and a copy could be acquired either by a MITM attack on HTTPS or by asking the bootloader politely, using the password that is to be found within the firmware update.  Be careful when doing this to test on a unit without a service contract, as service cannot be moved from one unit to another and bricking is a distinct possibility.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusions&lt;/h3&gt;&lt;br /&gt;I hope that this article has given you a decent overview of the methods for reverse engineering Bluetooth RFCOMM devices.  While my subject was the Spot Connect, these methods would apply equally well to something like a GPS, the Metawatch, Bluetooth chat applications, and multiplayer games.  Other brands of Bluetooth satellite communicators are available, and open documentation for them would be quite handy.  For a list of a few thousand potential targets, search the Bluetooth SIG's &lt;a href="http://gadgetguide.bluetooth.com/gadgetGuide.cfm#"&gt;Gadget Guide&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5226524194149074806?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5226524194149074806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5226524194149074806' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5226524194149074806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5226524194149074806'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/12/introduction-to-bluetooth-rfcomm.html' title='Introduction to Bluetooth RFCOMM Reverse Engineering'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7713187611413616922</id><published>2011-09-06T09:09:00.002-04:00</published><updated>2011-09-06T09:09:00.551-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nrf24l01+'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='nhbadge'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>A Bluetooth GoodFET for the N900</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;continuing &lt;a href="http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html"&gt;Promiscuity is the NRF24L01+'s Duty&lt;/a&gt;&lt;br /&gt;with kind thanks to @fbz, @skytee, and their &lt;a href="http://hackerhostel.org/"&gt;Hacker Hostel&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6093058810/" title="Bluetooth GoodFET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6200/6093058810_18e3320884.jpg" width="500" height="375" alt="Bluetooth GoodFET"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Since building my &lt;a href="http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html"&gt;packet sniffer for the Microsoft 2.4GHz keyboards&lt;/a&gt;, I've frequently wanted to demo it without having to drag out a laptop.  Laptops are heavy, they are inconvenient, and cables just make matters worse.  While it is possible to port it to a standalone board or to add an LCD to the Next Hope Badge, I'd rather have the entire GoodFET client library available over bluetooth to my Nokia N900.  Pictured above is my prototype build, which reliably sniffs keyboard traffic on battery power for a more than an hour.  Rather than serving as a build tutorial, this article will chronicle the bugs that cropped up during the port, in the hope that they'll help other neighbors trying to port the GoodFET firmware to new devices.&lt;br /&gt;&lt;br /&gt;This sniffer was assembled from a &lt;a href="http://goodfet.sourceforge.net/hardware/nhb12/"&gt;Next Hope Badge&lt;/a&gt; running the GoodFET firmware with hardwired DCO calibrations, a Roving Networks RN41 module, and three NiMH batteries.  The client uses py-bluez at the moment, but I might port it to LightBlue for OS X support.  Future models will use a GirlTech IMME or Telos B in place of the Next Hope Badge, to allow me to play with APCO P25 or ZigBee networks without a laptop.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Compiling the Firmware&lt;/h3&gt;&lt;br /&gt;Most of the GoodFET devices are built around an FT232RL and MSP430, with the FTDI taking care of USB to serial conversions.  The client software just opens /dev/ttyUSB0 or its local equivalent through py-serial, then uses the DTR and RTS lines to reset the MSP430 into either the GoodFET application or a masked-ROM bootloader, the BSL.  The client and the hardware do a little initialization dance in which the GoodFET is reset until the clock configuration register within the device matches 16MHz.  So when you run 'goodfet.monitor info' and it replies with "Clocked at 0x8f9e", the devices has rebooted several times until it finds by chance that 0x8F9E is a stable clock configuration for 16MHz.&lt;br /&gt;&lt;br /&gt;When replacing the FTDI with a Bluetooth module, the DTR and RTS lines are unavailable with the timing resolution that is necessary to enter the BSL.  Rather than rely upon them, I left them disconnected and instead ran only the TX and RX lines from the RN41 to the NHBadge.  The !RST signal is also disconnected, so the GoodFET will boot when power is applied and cannot be rebooted except by the appropriate software command.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6112216039/" title="Bluetooth GoodFET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6183/6112216039_aeb03a184b.jpg" width="500" height="281" alt="Bluetooth GoodFET"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This creates a number of complications in the client, which I'll get to later, but the important thing for firmware is that the clock configuration must be explicitly known by the firmware at compile or link time.  To specify this at compile time, set &lt;i&gt;CFLAGS="-DSTATICDCO=0x8F9E"&lt;/i&gt;.  To specify it at link time, just flash the image without erasing the INFO flash that resides from 0x1000 to 0x1100 in the MSP430X chips.&lt;br /&gt;&lt;br /&gt;Additionally, the firmware must be told which pins to use and which microcontroller to target.  These are specified by exporting &lt;i&gt;platform="nhb12b"&lt;/i&gt; and &lt;i&gt;mcu="msp430x2618"&lt;/i&gt;.  If an NHB12 were used instead of the NHB12B, then the platform would be redefined appropriately.  Finally, the firmware size (and thus the flashing time) can be significantly reduced by exporting &lt;i&gt;config="monitor nrf spi"&lt;/i&gt; to reduce the set of applications to only the Monitor, &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.nrf/"&gt;Nordic RF&lt;/a&gt;, and SPI applications.&lt;br /&gt;&lt;br /&gt;To ease in reconfiguring my build environment, I left a script to create these settings in trunk/firmware/configs/examples/bluetooth-nhb12b.sh .  Be sure to change the STATICDCO value to that of your own hardware when building it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6112758420/" title="Next Hope Badge Flashing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6072/6112758420_7b9b66af92.jpg" width="500" height="281" alt="Next Hope Badge Flashing"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Finally, the firmware had to be flashed by JTAG, rather than BSL.  This was done the same way the Next Hope Badges were originally programmed at the factory, by wedging the board into a GoodFET programmer and running 'goodfet.msp430 flash goodfet.hex', then verifying with 'goodfet.msp430 verify goodfet.hex'.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Patching the Client&lt;/h3&gt;&lt;br /&gt;Recalling that the client was initially designed to use py-serial, a few changes were required to make it function through &lt;a href="http://code.google.com/p/pybluez/"&gt;py-bluez&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Before writing a proper client, I wrote a quick py-bluez script to connect to the GoodFET and print any string that is received.  Briefly touching the !RST signal on the JTAG connector to its GND pin resets the device, causing it this client to print "http://goodfet.sf.net/".  If the default GoodFET firmware is flashed, with no STATICDCO or Info Flash, the string will be printed as garbage most times, with one attempt in ten producing a legible string.&lt;br /&gt;&lt;br /&gt;Having verified that the timing and baud rate were correct, I continued by writing a communications module, GoodFETbtser(), that emulates the read() and write() functions of serial.Serial() used by the rest of the application.  Additionally, the GoodFETbtser.read() function is written so as to always return the exact number of bytes requested by the receiver, as Bluetooth buffering sometimes breaks apart packets that would otherwise reliably be received as contiguous chunks.&lt;br /&gt;&lt;br /&gt;The following is a screenshot (with GoodFET.verbose=1) of a transmission being split in half because of a read() request returning too few bytes.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6092264993/" title="Bluetooth Packetization Bug by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6196/6092264993_50b8b11e02.jpg" width="500" height="372" alt="Bluetooth Packetization Bug"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Additionally, the initialization routine was modified such that if the GOODFET environment variable is set to a six byte MAC address.  Setting it to "bluetooth" causes the firmware to search for Bluetooth devices by name, then exit with instructions for setting the MAC.  Later revisions might attempt to use the first observed RFCOMM adapter.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusions&lt;/h3&gt;&lt;br /&gt;The final client is already mainstreamed into the GoodFET's subversion repository, and it looks a little like the following when packet sniffing encrypted &lt;a href="http://www.openbeacon.org/"&gt;OpenBeacon&lt;/a&gt; traffic.  It can also sniff &lt;a href="http://travisgoodspeed.blogspot.com/2010/07/reversing-rf-clicker.html"&gt;Turning Point Clickers&lt;/a&gt;, &lt;a href="http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html"&gt;Microsoft Keyboards&lt;/a&gt;, and anything else that uses the 2.4GHz Nordic chips.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6092876724/" title="Bluetooth GoodFET OpenBeacon Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6075/6092876724_a1b049fbea.jpg" width="301" height="128" alt="Bluetooth GoodFET OpenBeacon Sniffing"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I've already ordered parts to build Bluetooth versions of the Girltech IMME and the Telos B for mobile sniffing of APCO P25 and ZigBee.  My rebuilds will include integrated battery charging from USB and the option of running standalone with the bluetooth module disabled, in order to greatly increase battery life.  The client ought to run unmodified on rooted Android devices by use of SL4A and py-bluez.  Additionally, I'm planning a firmware port to the &lt;a href="http://www.openbeacon.org/OpenBeacon_USB_2"&gt;OpenBeacon USB 2&lt;/a&gt; module from Bitmanufaktur GmbH.&lt;br /&gt;&lt;br /&gt;As a final note, I would like to remind all good neighbors that there is no reason why offensive security can't be fun for the whole family.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6112218273/" title="Bluetooth GoodFET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6203/6112218273_a77f4ab87e.jpg" width="281" height="500" alt="Bluetooth GoodFET"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-7713187611413616922?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/7713187611413616922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=7713187611413616922' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7713187611413616922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7713187611413616922'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/09/bluetooth-goodfet-for-n900.html' title='A Bluetooth GoodFET for the N900'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm7.static.flickr.com/6200/6093058810_18e3320884_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1198064875286712841</id><published>2011-09-01T01:57:00.001-04:00</published><updated>2011-09-01T01:57:00.841-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pip'/><category scheme='http://www.blogger.com/atom/ns#' term='nordic'/><category scheme='http://www.blogger.com/atom/ns#' term='802.11'/><category scheme='http://www.blogger.com/atom/ns#' term='frame injection'/><category scheme='http://www.blogger.com/atom/ns#' term='packet in packet'/><category scheme='http://www.blogger.com/atom/ns#' term='802.15.4'/><title type='text'>Remotely Exploiting the PHY Layer</title><content type='html'>or, Bobby Tables from 1938 to 2011&lt;br /&gt;&lt;br /&gt;by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning research performed in collaboration with&lt;br /&gt;Sergey Bratus, Ricky Melgares, Rebecca Shapiro, and Ryan Speers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6052809032/" title="20110808_001 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6070/6052809032_85af2f97d5.jpg" width="400" height="224" alt="20110808_001"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The following technique is a trick that some very good neighbors and I present in &lt;a href="http://www.usenix.org/events/woot11/tech/final_files/Goodspeed.pdf"&gt;Packets in Packets: Orson Welles' In-Band Signaling Attacks for Modern Radios&lt;/a&gt; (pdf) at Usenix WOOT 2011.  As the title suggests, Orson Welles authored and implemented the attack in 1938 as a form of social engineering, but our version acts to remotely inject raw frames into wireless networks by abuse of the PHY layer.  As that paper is limited to a formal, academic style, I'd like to take the opportunity to describe the technique here in my people's native language, which has none of that formal mumbo-jumbo and high-faluttin' wordsmithin'.  This being just a teaser, please read the paper for full technical details.&lt;br /&gt;&lt;br /&gt;The idea is this: Layer 1 radio protocols are vulnerable injections similar to those that plague naively implemented SQL websites.  You can place one packet &lt;i&gt;inside of another packet&lt;/i&gt; and have the inner packet drop out to become a frame of its own.  We call the technique Packet-in-Packet, or PIP for short.&lt;br /&gt;&lt;br /&gt;As I've mentioned in my article on &lt;a href="http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html"&gt;promiscuously sniffing nRF24L01+ traffic&lt;/a&gt;, every modern digital radio has a Layer 1 form that consists of a Preamble, followed by a Sync, followed by a Body.  The Body here is Layer 2, and that is the lowest that a normal packet sniffer will give you.  (&lt;a href="http://www.remote-exploit.org/?p=437"&gt;Keykeriki&lt;/a&gt;, &lt;a href="http://ubertooth.sourceforge.net/"&gt;Ubertooth&lt;/a&gt;, and &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.nrf/"&gt;GoodFET/NRF&lt;/a&gt; give a bit more.)&lt;br /&gt;&lt;br /&gt;In the specific case of IEEE 802.15.4, which underlies ZigBee, the Preamble consists of the 0 symbol repeated eight times, or 00000000.  The Sync is A7.  After that comes the Body, which begins with a byte for the length, a few bytes for flags, the addresses, and some sort of data.  Suppose that an attacker, Mallory, controls some of that data, in the same way that she might control an HTTP GET parameter.  To cause a PIP injection of a Layer 2 packet, she need only prepend that packet with 00000000A7 then retransmit a large--but not unmanageably large--number of times.  I'm not joking, and I'm not exaggerating.  It actually works like that.&lt;br /&gt;&lt;br /&gt;Below is a photograph of the first packet capture in which we had this technique working.  The upper packet capture shows those packets addressed to any address, while the lower capture only sniffs broadcast (0xFFFF) messages.  The highlighted region is a PIP injection, a broadcast packet that the transmitter intended to only be data within the payload of an outer packet.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/6052809378/" title="20110808_003 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6206/6052809378_4bec3866b2.jpg" width="500" height="281" alt="20110808_003"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;How it works.&lt;/h3&gt;&lt;br /&gt;When Alice transmits a packet containing Mallory's PIP to Bob, Bob's interpretation can go one of three ways, two of which are depicted in the diagram below.  In the first case, as shown in the left column, Bob receives every symbol correctly and interprets the packet as Alice would like him to, with Mallory's payload sitting harmlessly in the Body.  In the second case, which is not depicted, a symbol error within the Body causes the packet's checksum to fail, and Mallory's packet is dropped along with the rest of Alice's.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5872168506/" title="802.15.4 PIP by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3187/5872168506_92eb6c9c7b_m.jpg" width="240" height="144" alt="802.15.4 PIP"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The third interpretation, shown above in the right column, is the interesting one.  If a symbol error occurs before the Body, &lt;i&gt;within the Preamble or the Sync&lt;/i&gt;, then there's no checksum to cause the packet to be dropped.  Instead, the receiver &lt;i&gt;does not know&lt;/i&gt; that it is within a packet, and Mallory's PIP is mistaken as a frame of its own.  Mallory's Preamble and Sync will mark the start of the frame, and Mallory's Body will be returned to the receiver.&lt;br /&gt;&lt;br /&gt;In this way, Mallory can remotely inject radio frames from anywhere on the network to which she can send her payload.  That is, this is a PHY-Layer radio vulnerability that requires &lt;i&gt;no physical access&lt;/i&gt; to the radio environment.  Read the WOOT paper for complications that arise when applying this to IEEE 802.11, as well as the conditions under which a PIP injection can succeed on every attempt.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;War of the Worlds&lt;/h3&gt;&lt;br /&gt;In 1938, Orson Welles implemented a similar exploit as a form of social engineering in order to cause panic with his War of the Worlds (&lt;a href="http://www.archive.org/details/OrsonWellesMrBruns"&gt;mp3&lt;/a&gt;, &lt;a href="http://www.sacred-texts.com/ufo/mars/wow.htm"&gt;transcript&lt;/a&gt;) performance.&lt;br /&gt;&lt;br /&gt;Recall that PIP injection works by having the victim miss the real start of frame marker, then fraudulently including another start of frame marker inside of the broadcast.  As per the FCC requirements of his time, Orson begins with a real start of broadcast marker:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;ANNOUNCER: The Columbia Broadcasting System and its affiliated stations present Orson Welles and the Mercury Theatre on the Air in The War of the Worlds by H. G. Wells.&lt;br /&gt;&lt;br /&gt;(MUSIC: MERCURY THEATRE MUSICAL THEME)&lt;br /&gt;&lt;br /&gt;ANNOUNCER: Ladies and gentlemen: the director of the Mercury Theatre and star of these broadcasts, Orson Welles . . .&lt;br /&gt;&lt;br /&gt;ORSON WELLES: We know now that in the early years of the twentieth century this world was being watched closely by intelligences greater than man's and yet as mortal as his own. We know now that as human beings busied themselves about their various concerns they were scrutinized and studied, perhaps almost as narrowly as a man with a microscope might scrutinize the transient creatures that swarm and multiply in a drop of water. With infinite complacence people went to and fro over the earth about their little affairs, serene in the assurance of their dominion over this small spinning fragment of solar driftwood which by chance or design man has inherited out of the dark mystery of Time and Space. Yet across an immense ethereal gulf, minds that to our minds as ours are to the beasts in the jungle, intellects vast, cool and unsympathetic, regarded this earth with envious eyes and slowly and surely drew their plans against us. In the thirty-ninth year of the twentieth century came the great disillusionment.&lt;br /&gt;It was near the end of October. Business was better. The war scare was over. More men were back at work. Sales were picking up. On this particular evening, October 30, the Crosley service estimated that thirty-two million people were listening in on radios.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;That introduction is two minutes and twenty seconds long, and it was scheduled to begin while a popular show on another station was still in progress.  Many of the listeners tuned in late, causing them to miss the Sync and not know which show they were listening to, just as in a PIP injection!  What follows is thirty-eight minutes of a first act, without a single word out of character or a single commercial message from a sponsor.  The play begins in the middle of a weather report, followed by repeated false station and show announcements, a few of which follow.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;We now take you to the Meridian Room in the Hotel Park Plaza in downtown New York, where you will be entertained by the music of Ramón Raquello and his orchestra.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;From the Meridian Room in the Park Plaza in New York City, we bring you the music of Ramón Raquello and his orchestra.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Ladies and gentlemen, we interrupt our program of dance music to bring you a special bulletin from the Intercontinental Radio News.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;We are now ready to take you to the Princeton Observatory at Princeton where Carl Phillips, or commentator, will interview Professor Richard Pierson, famous astronomer.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Good evening, ladies and gentlemen. This is Carl Phillips, speaking to you from the observatory at Princeton.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Just a moment, ladies and gentlemen, someone has just handed Professor Pierson a message. While he reads it, let me remind you that we are speaking to you from the observatory in Princeton, New Jersey, where we are interviewing the world- famous astronomer, Professor Pierson.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;By repeatedly lying to the listeners about the station and the program, Welles was able to convince them that they were listening to legitimate news broadcasts of an alien invasion.  Ensuring that the listener missed the starting broadcast announcement breaks the encapsulation that was intended to prevent such confusion, just as a PIP injection relies upon the start of frame to be missed in order to break OSI model encapsulation.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;How the hell did this happen?&lt;/h3&gt;&lt;br /&gt;This class of vulnerability is a really, &lt;i&gt;really&lt;/i&gt; big deal.  An attacker can use it to inject raw frames into any wireless network that lacks cryptography, such as a satellite link or an open wifi hotspot.  Not only that, but because the injection is remote, the attacker needs no radio to perform the injection!  Not only that, but this vulnerability has sat unexploited in nearly every unencrypted digital radio protocol that allows for variable frame length since digital radio began!  So why did no one notice before 2011? &lt;br /&gt;&lt;br /&gt;Packet in Packet injection works because when Bob forwards a wrapped string to Alice over the air, he is trusting Mallory to control the radio symbols that are broadcast for that amount of time.  The potential for abusing that trust wasn't considered, despite communications experts knowing full well that sometimes a false Sync was detected or a true Sync missed.  This is because a symbol error in the Sync field causes the packet to be &lt;i&gt;implicitly dropped&lt;/i&gt;, with the same behavioral effect that would be had if the error were later in the packet and it were &lt;i&gt;explicitly&lt;/i&gt; dropped.  Except when faced with a weaponized PIP injection, nothing seems strange or amiss.  Sync errors were just a nuisance to communications engineers, as we security guys were staying a few layers higher, allowing those layers of abstraction to become boundaries of competence.&lt;br /&gt;&lt;br /&gt;That same trust is given in wired networks and busses, with the lesser probability of missing a Sync being the only defense against PIP injection.  Just as PIP has shown that unencrypted wireless networks are vulnerable even when the attacker is not physically present, I expect wired networks to be found vulnerable as soon as an appropriate source of packet errors is identified.  Packet collisions provide this in unswitched Ethernet networks, and noisy or especially long links might provide it for more modern wired networks.&lt;br /&gt;&lt;br /&gt;If I've not yet convinced you that this attack is worth studying, I probably won't be able to.  For the rest of you, please print and read &lt;a href="http://www.usenix.org/events/woot11/tech/final_files/Goodspeed.pdf"&gt;the paper&lt;/a&gt; and extend this research yourself.  There's a hell of a lot left to be done at the PHY layer, and it might as well be you who does it.&lt;br /&gt;&lt;br /&gt;Thank you kindly,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1198064875286712841?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1198064875286712841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1198064875286712841' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1198064875286712841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1198064875286712841'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/09/remotely-exploiting-phy-layer.html' title='Remotely Exploiting the PHY Layer'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm7.static.flickr.com/6070/6052809032_85af2f97d5_t.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3209537937223674653</id><published>2011-05-24T08:00:00.003-04:00</published><updated>2011-05-24T08:00:08.081-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mc13226'/><category scheme='http://www.blogger.com/atom/ns#' term='zigbee'/><category scheme='http://www.blogger.com/atom/ns#' term='mc13224'/><category scheme='http://www.blogger.com/atom/ns#' term='802.15.4'/><category scheme='http://www.blogger.com/atom/ns#' term='freescale'/><title type='text'>Practical MC13224 Firmware Extraction</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;as presented at &lt;a href="http://2011.confidence.org.pl/agenda"&gt;CONFidence Krakow, 2011&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5540047761/" title="MC13224 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5051/5540047761_d302653d6a.jpg" width="500" height="375" alt="MC13224" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Pictured above is a &lt;a href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MC13224V"&gt;Freescale MC13224&lt;/a&gt; chip, having been partially decapped with nitric acid in my lab.  This is the chip used in the &lt;a href="http://ninjas.org/badges/defcon18.html"&gt;Defcon 18 Ninja Badge&lt;/a&gt; and the &lt;a href="http://www.redwirellc.com/store/node/1"&gt;Redwire Econotag&lt;/a&gt;.  This brief demonstrates two methods for extracting the firmware from an MC13224 or MC13226 which has been read-protected by placing "SECU" as the first four bytes of Flash memory.&lt;br /&gt;&lt;br /&gt;Rather, pictured above are the &lt;i&gt;three chips&lt;/i&gt; and a few discrete components that comprise the MC13224.  The smallest chip is a radio balun, while the largest is a CPU+radio and the third chip is Flash memory.  This brief article will present two methods for forcibly extracting firmware from a locked MC13224, the latter of which is non-invasive and requires only a bit of soldering skill.&lt;br /&gt;&lt;br /&gt;For a more thorough discussion of the MC13224, read &lt;a href="http://freaklabs.org/index.php/Blog/Zigbee/freescale-mc13224-review.html"&gt;Akiba's MC13224 Review&lt;/a&gt;.  In short, the strong point of this chip is its radio, which integrates analog components on chip.  Literally everything except for the antenna is included, so a 50&amp;Omega; trace antenna is the only external radio component.  Most of these components aren't on-die, just in-package.  You can see the 0402 components used in this in the photo below, which is slightly less etched than the one at the beginning of this article.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5540047603/" title="MC13224 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5055/5540047603_79a42d9947.jpg" width="500" height="375" alt="MC13224" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Unlike many competing microcontrollers, the MC13224 is unable to execute code directly from Flash.  Rather, a ROM bootloader copies a working image from Flash into RAM.  If the security word "OKOK" is seen, then JTAG access is enabled before the bootloader branches into RAM.  If the security word is instead set to "SECU", then JTAG access is not enabled and the chip remains in its default, locked state.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5540268655/" title="MC13224 CPU by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5094/5540268655_6ed46c1967_m.jpg" width="240" height="155" alt="MC13224 CPU" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5540141987/" title="MC13224 Little by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5018/5540141987_a0cce3d672_m.jpg" width="240" height="227" alt="MC13224 Little" /&gt;&lt;/a&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5540763624/" title="MC13224 Flash (SST24WF010) by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5014/5540763624_ba52329c14_m.jpg" width="186" height="240" alt="MC13224 Flash (SST25WF010)" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The final chip shown above is the Flash memory.  Its badge is in the corner near a bonding wire, clearly identifying the chip as an &lt;a href="http://www.sst.com/products/?inode=41343"&gt;SST25WF010&lt;/a&gt;, a SPI flash chip that aside from its low voltage is easily interfaced with a GoodFET or Arduino.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5559270923/" title="SST25WF010 Badge by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5176/5559270923_616d67d23b_m.jpg" width="240" height="230" alt="SST25WF010 Badge" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The first method for recovery requires access to some rather--but not terribly--expensive equipment.  First, use HNO3 or H2SO4 to remove the packaging and expose the SST25WF010 die.  Then use a wedge wire-bonder to place the chip into a new package.  The die has ten bonding pads while only eight pins are documented, but these can be guessed quickly enough if it is supposed that the sides of the chip are kept constant.&lt;br /&gt;&lt;br /&gt;A second extraction technique takes advantage of the fact that, while the SPI bus is not bound out to external pins, the power and ground lines are exposed.  Still better, the supply line to the SST25 has its own pin!  Pin #133, NVM_REG, is the voltage regulator output for the flash memory, which is exposed in order to allow an external voltage regular to replace the internal one.  In ZigBee applications, power could be saved by shutting down the SST25 after booting.  This pin is highlighted below.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5541052982/" title="MC13224 NVM_REG by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5051/5541052982_9847652e73.jpg" width="500" height="432" alt="MC13224 NVM_REG"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Given that a local attacker can control power to just the SST25 Flash chip, what would happen if he disabled the chip by cutting its power?  &lt;a href="http://www.freescale.com/files/rf_if/doc/ref_manual/MC1322xRM.pdf"&gt;MC1322xRM.pdf&lt;/a&gt; explains in Figure 3-22 on page 93 that the MC13224 will enable JTAG access then try to boot from UART1, as a SPI slave, as a SPI master, or as an I2C master.  If none of these methods work, the chip will hang in an infinite loop.&lt;br /&gt;&lt;br /&gt;So all that is needed to recover a copy of an MC13224's flash memory is a board that holds Pin 133 too low during a reset, then loads a new executable into RAM that--when Pin 133 is allowed to swing high--will read firmware out of the SST25WF010 and exfiltrate it through an I/O pin.&lt;br /&gt;&lt;br /&gt;Toward that end, I've made a small batch of modified Econotag boards that expose this pin to a jumper.  A pair of tweezers can then hold the line low during a reboot in order to unlock JTAG.  Once the tweezers are removed, a client for the internal SST25 flash chip can be used through the board's built-in OpenOCD implementation to dump the firmware.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5724960117/" title="RedBee w/ SECU Bypass by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5129/5724960117_bb2b465a4b.jpg" width="500" height="375" alt="RedBee w/ SECU Bypass"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Please note that the MC13224 and MC13226 are the only Freescale 802.15.4 chips with an ARM and external flash die.  Both older and more recent devices use an 8-bit HCS08 microcontroller with built-in flash memory.&lt;br /&gt;&lt;br /&gt;Freescale could certainly patch the boot behavior, but this would bring its own complications.  Mandating an erase and erase-check on failure would cause the chip to self-destruct when being supplied with noisy power.  Not mandating that erase would make the chip difficult to recover if improperly flashed.&lt;br /&gt;&lt;br /&gt;But even if they were to patch the ROM behavior, successfully, the first vulnerability would still remain.  The SST25WF010 chip can still be rebonded into a new package.  Further, MC1322x family appears to be an evolutionary dead-end.  There have been no new releases since the initial pair of chips, and Freescale's more recent designs have abandoned the ARM7 for the less expensive HCS08 core they maintain in-house.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3209537937223674653?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3209537937223674653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3209537937223674653' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3209537937223674653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3209537937223674653'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/03/practical-mc13224-firmware-extraction.html' title='Practical MC13224 Firmware Extraction'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm6.static.flickr.com/5051/5540047761_d302653d6a_t.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2205090301805122245</id><published>2011-03-01T03:41:00.001-05:00</published><updated>2011-03-01T03:41:00.453-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='zigbee'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='tmote'/><category scheme='http://www.blogger.com/atom/ns#' term='telosb'/><category scheme='http://www.blogger.com/atom/ns#' term='killerbee'/><category scheme='http://www.blogger.com/atom/ns#' term='802.15.4'/><category scheme='http://www.blogger.com/atom/ns#' term='tinyos'/><title type='text'>GoodFET on the TelosB, TMote Sky</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;with kind thanks to &lt;a href="http://www.cs.dartmouth.edu/~sergey/"&gt;Sergey Bratus&lt;/a&gt;, &lt;a href="http://rmspeers.com/"&gt;Ryan Speers&lt;/a&gt;, and Ricky Melgares,&lt;br /&gt;for contributions of code, conversation, and general neighborliness.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3118926786/" title="Telos B by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3235/3118926786_c0b724ec36_m.jpg" width="240" height="104" alt="Telos B" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As I was recently reminded that the Crossbow Telos B and Sentilla TMote Sky devices litter most universities, left over from wireless sensor network research, it seemed like a perfect target.  As such, I'm happy to announce that the GoodFET firmware now fully supports the Telos B and TMote, and also that support for the &lt;a href="http://www.zolertia.com/products/Z1"&gt;Zolertia Z1&lt;/a&gt; mote will be coming soon.  KillerBee integration should come in the next few weeks, but there's plenty of fun to be had in the meantime.&lt;br /&gt;&lt;br /&gt;This brief tutorial will walk you through cross-compiling the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; firmware for the &lt;a href="http://goodfet.sourceforge.net/hardware/telosb/"&gt;Telos B or TMote Sky&lt;/a&gt;, as well as simple packet sniffing and injection.  As the GoodFET project is always being refactored in one way or another, you can expect a bit of this to change.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Compiling the Firmware&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;A port of the GoodFET firmware is defined by three things.  First, the $platform environment variable defines the header file from which port definitions come.  Most platforms just use platforms/goodfet.h, which is loaded when $platform is undefined or set to 'goodfet'.  Some devices, such as the two varieties of the &lt;a href="http://goodfet.sourceforge.net/hardware/nhb12/"&gt;Next Hope Badge&lt;/a&gt; and the Telos B, use ports which are not the same as the standard GoodFET's layout.  In particular, it's rather common for the Slave-Select (!SS) line to be unique to the hardware layout of a particular board.  Setting $platform to 'telosb' takes care of this.&lt;br /&gt;&lt;br /&gt;Additionally, the Telos B uses the &lt;a href="http://focus.ti.com/docs/prod/folders/print/msp430f1611.html"&gt;MSP430F1611&lt;/a&gt; chip, so $mcu must be set to 'msp430x1611'.  (That's with an 'x', as the linker doesn't care whether the chip is in the F, G, or C variants.)&lt;br /&gt;&lt;br /&gt;Finally, a normal GoodFET includes a lot of modules for things like JTAG and similar protocols that the Telos B does not include wiring for.  Although leaving them in doesn't hurt, it does make the firmware larger, which is annoying when repeatedly recompiling and reflashing during firmware development.  To restrict support to just the monitor, the SPI Flash chip, and the Chipcon SPI radio, it is handy to set $config to '&lt;a href="http://goodfet.sourceforge.net/clients/goodfet.monitor/"&gt;monitor&lt;/a&gt; &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.spiflash/"&gt;spi&lt;/a&gt; &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.ccspi/"&gt;ccspi&lt;/a&gt;'.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;export platform=telosb&lt;br /&gt;export mcu=msp430x1611&lt;br /&gt;export config='monitor ccspi spi'&lt;br /&gt;make clean install&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Accessing the SPI Flash&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The Telos B is reset in a manner very different from the GoodFET, courtesy of a bit-banged I2C controller.  Someday we'll figure out how to auto-detect this, but until then you will need to have $platform set to 'telosb' just as you did when compiling.&lt;br /&gt;&lt;br /&gt;The Telos B contains a Numonyx M25P80 SPI Flash chip, which is compatible with the goodfet.spiflash client.  Unfortunately, most units use a variety of this chip that does not respond to a request for its model number.  (According to the datasheet, this feature is only available in the 110nm version.  Datasheets have a way of phrasing bugs as if they were just optional features.)  On those lucky units with a properly behaving chip, run 'goodfet.spiflash info' to get its capacity and model number.  Upgrading to a larger chip or replacing the SMD unit with a socketed one will cause no problems, as the client will automatically adapt.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5422687146/" title="GoodFET for the Telos B by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5019/5422687146_ecf2966955_m.jpg" width="207" height="132" alt="GoodFET for the Telos B" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You may also use the standard peek, erase, dump, and flash verbs to access the contents of the chip.  When the chip refuses to identify itself, the GoodFET will default to a size of 8Mb, so explicit ranges needed be given for things like 'goodfet.spiflash dump telosb_m25p80.bin'.&lt;br /&gt;&lt;br /&gt;As the M25P80 chip is not access-controlled in any way, it's a handy way to grab old data from a node.  On some academically-sourced devices, you might find leftover data or code from LogStorage or Deluge.  On commercial devices, these chips sometimes keep hold more interesting things.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sniffing ZigBee, 802.15.4&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;While the Flash chip is a neat little toy and handy for forensics, most users of the Telos B port will be interested in the CC2420 radio.  As a final collaboration between Ember and Chipcon, the '2420 was one of the first popular 802.15.4 chips, and it is still quite handy for reversing and exploit ZigBee devices.  Just as before, you &lt;i&gt;must&lt;/i&gt; set $platform to be 'telosb' or the client will not connect.&lt;br /&gt;&lt;br /&gt;To sniff raw 802.15.4 packets on channel 11, just call 'goodfet.ccspi sniff 11'.  This enables promiscuous mode, so you will see traffic from all PANs and to all MACs in the region.  If you are only interested in broadcast traffic, use 'goodfet.ccspi bsniff 11' instead.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5479801716/" title="goodfet.ccspi sniff 11 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5291/5479801716_dffc676d0b.jpg" width="271" height="104" alt="goodfet.ccspi sniff 11" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As much fun as it is to sit with the 802.15.4 and ZigBee protocol documentation to figure out what a packet means the first time, white-washing this particular fence quickly becomes boring.  For that reason, Ryan Speers and Ricky Melgares at Dartmouth tossed together a &lt;a href="http://www.secdev.org/projects/scapy/"&gt;Scapy&lt;/a&gt; module for dissecting these sorts of packets.  It's in the scappy-com Mercurial repository, so check it out with "hg clone http://hg.secdev.org/scapy-com" then run "sudo python setup.py install" after the prerequisite packages have been installed.&lt;br /&gt;&lt;br /&gt;Once the community build of Scapy has been installed, you can run 'goodfet.ccspi sniffdissect 11' to print the Scapy dissections of various packets.  As this code is less than a week old, there are a few kinks to work out, so ignore the warning messages that pop up at the beginning of the log.  (Scapy likes to initialize the operating system's networking stack even though we're using a GoodFET instead.  This is infuriating on OpenBSD, but merely an annoyance on OS X and Linux.)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5476495293/" title="802.15.4 Scapy by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5172/5476495293_f6d131247d.jpg" width="269" height="271" alt="802.15.4 Scapy" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you have no other 15.4 equipment to play with, you can do a transmission test with 'goodfet.ccspi txtest 11'.  In the following section, I'll show you to how to send and receive packets in a Python script, which is useful for talking to the myriad of wireless sensors that have less than serious security.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Scripting the CC2420&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The GoodFET project is built as a number of client scripts which are written in spaghetti code, features from which are slowly moved out of spaghetti and into classes.  That is to say, the heavy lifting should be in GoodFETCCSPI.py, while short and sweet client scripts will be found in goodfet.ccspi.  As an example, this section will cover the functioning of 'goodfet.ccspi txtoscount' which implements the radio protocol spoken by the TinyOS &lt;a href="http://www.tinyos.net/tinyos-2.x/apps/RadioCountToLeds/README.txt"&gt;RadioCountToLeds&lt;/a&gt; application.&lt;br /&gt;&lt;br /&gt;Rather than go into too much detail, I'll just point out the lines that are most instructive.  Just like sing-along cartoons, this only works if you read the code, so please open up your favorite editor and follow along.  While you're at it, use 'svn blame' to figure out which new GoodFET developer wrote that routine.  If too much time has passed, you'll also need to back up to the revision that was current when I wrote this review.  Then jump back a few more revisions to figure out which bugs of mine had to be fixed before his code worked.  Isn't revision control nifty?&lt;br /&gt;&lt;br /&gt;By default, the CC2420 only receives packets addressed to the local PAN and MAC as well as those sent to the broadcast address.  In order to receive promiscuously, allowing the client to automatically identify any devices on the channel, it is necessary to enable promiscuous mode with 'client.RF_promiscuity(1)'.  You might also want to tune away from the default channel with 'client.RF_setchan()'.&lt;br /&gt;&lt;br /&gt;Also, as checksums must be correct in any outbound traffic, it is necessary to enable the AUTOCRC mode with 'client.RF_autocrc(1)'.  This appends a checksum to every outbound packet, and it also rejects any inbound packets with invalid checksums, which is helpful to reduce noise but would sometimes accidentally rejects packets from non-compliant devices during sniffing.  (TinyOS always uses the AUTOCRC feature, so it isn't an issue in this particular application.)&lt;br /&gt;&lt;br /&gt;Packet reception, as is standard among the radio modules, is performed by 'client.RF_rxpacket()'.  This method returns None if no packet has been received, so a synchronous application ought to spin in a loop until something else is returned.&lt;br /&gt;&lt;br /&gt;Finally, the routine needs to broadcast its own reply, either from a stock template or from the sniffed packet.  This is accomplished by passing an array of bytes to 'client.RF_txpacket(packet)'.&lt;br /&gt;&lt;br /&gt;That's really all there is to it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The GoodFET is primarily a tool for reverse engineering, and integration with other tools is a priority.  KillerBee and Kismet plugins are already in development, and clients for all sorts of 802.15.4 devices will be written as hardware becomes available.  Support for the CC2420's AES engine will also be added, so that encrypted packets can be sniffed once keys are sniffed from the air or &lt;a href="http://travisgoodspeed.blogspot.com/2009/03/breaking-802154-aes128-by-syringe.html"&gt;by syringe&lt;/a&gt; with a bus analyzer.&lt;br /&gt;&lt;br /&gt;That's all folks.  Grab a Telos B or TMote and start poking at devices.  Good targets might include &lt;a href="http://www.digitalmunition.com/_/Blog/Entries/2010/11/29_Starting_to_reverse_a_Z-wave_door_lock_kit.html"&gt;Z-Wave door locks&lt;/a&gt; and &lt;a href="http://www.digitalmunition.com/_/Blog/Entries/2010/11/25_More_small_steps_with_Saleae.html"&gt;ZigBee thermostats&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2205090301805122245?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2205090301805122245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2205090301805122245' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2205090301805122245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2205090301805122245'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/03/goodfet-on-telosb-tmote-sky.html' title='GoodFET on the TelosB, TMote Sky'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3235/3118926786_c0b724ec36_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7248065449116362673</id><published>2011-02-07T01:09:00.001-05:00</published><updated>2011-02-07T01:42:36.321-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nrf24l01+'/><category scheme='http://www.blogger.com/atom/ns#' term='nordic'/><category scheme='http://www.blogger.com/atom/ns#' term='keykeriki'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><title type='text'>Promiscuity is the nRF24L01+'s Duty</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;extending the work of Thorsten Schröder and Max Moser&lt;br /&gt;of the &lt;a href="http://www.remote-exploit.org/?page_id=602"&gt;KeyKeriki v2.0&lt;/a&gt; project.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5385189893/" title="NHBadge and a Keyboard by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5213/5385189893_898a16ccf2.jpg" width="500" height="375" alt="NHBadge and a Keyboard" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Similar to Bluetooth, the protocols of the Nordic VLSI &lt;a href="http://www.nordicsemi.com/index.cfm?obj=product&amp;act=display&amp;pro=94"&gt;nRF24L01+&lt;/a&gt; chip are designed such that the MAC address of a network participant doubles as a SYNC field, making promiscuous sniffing difficult both by configuration and by hardware.  In this short article, I present a nifty technique for promiscuously sniffing such radios by (1) limiting the MAC address to 2 bytes, (2) disabling checksums, (3) setting the MAC to be the same as the preamble, and (4) sorting received noise for valid MAC addresses which may later be sniffed explicitly.  This method results in a rather high false-positive rate for packet reception as well as a terribly high drop rate, but once a few packets of the same address have been captured, that address can be sniffed directly with normal error rates.&lt;br /&gt;&lt;br /&gt;As proof of concept, I present a promiscuous sniffer for the &lt;a href="http://www.microsoft.com/hardware/mouseandkeyboard/ProductDetails.aspx?pid=117"&gt;Microsoft Comfort Desktop 5000&lt;/a&gt; and similar 2.4GHz wireless keyboards.  This vulnerability was previously documented at CanSecWest by Thorsten Schröder and Max Moser, and an exploit has been available since then as part of the &lt;a href="http://www.remote-exploit.org/?page_id=602"&gt;KeyKeriki v2.0&lt;/a&gt; project.  My implementation differs in that it runs with a single radio and a low-end microcontroller, rather than requiring two radios and a high-end microcontroller.  My target hardware is the conference badge that I designed for the &lt;a href="http://thenexthope.org/"&gt;Next Hope&lt;/a&gt;, running the &lt;a href="http://goodfet.sourceforge.net/hardware/nhb12/"&gt;GoodFET Firmware&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 1: or, Why sniffing is hard.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5180664232/" title="nRF24L01 Die by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1437/5180664232_4f105b824f.jpg" width="488" height="500" alt="nRF24L01 Die" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Radio packets usually begin with a preamble, followed by a SYNC field.  In the &lt;a href="http://www.ti.com/corp/docs/landing/simpliciTI/"&gt;SimpliciTI&lt;/a&gt; protocol, the SYNC is 0xD391, so the radio packets will begin with {0xAA,0xD3,0xD91} or {0x55,0xD3,0x91}.  The AA or 55 in the beginning is a preamble, which is almost universally a byte of alternating 1's and 0's to note that a packet is beginning, followed by the SYNC field which makes sure that the remainder of the packet is byte-aligned.&lt;br /&gt;&lt;br /&gt;In the case of the Nordic radios, there is no SYNC pattern unique to the radio.  Instead, the MAC address itself serves this purpose.  So an &lt;a href="http://www.openbeacon.org/"&gt;OpenBeacon&lt;/a&gt; packet will begin with {0x55, 0x01, 0x02, 0x03, 0x02, 0x01} while a &lt;a href="http://travisgoodspeed.blogspot.com/2010/07/reversing-rf-clicker.html"&gt;Turning Point Clicker&lt;/a&gt;'s packets will begin with {0x55, 0x12, 0x34, 0x56}.  The preamble in this case will be 0x55 if the first bit of the SYNC/MAC is a 0 and 0xAA if the first bit is a 1.  To make matters worse, the chip does not allow a MAC shorter than three bytes, so previously it was believed that at least so many bytes of the destination address must be known in order to receive a packet with this chip.&lt;br /&gt;&lt;br /&gt;Moser and Schröder solved this problem by using an &lt;a href="www.amiccom.com.tw"&gt;AMICCOM&lt;/a&gt; A7125 chip, which is a low-level 2FSK transceiver, to dump raw bits out to an ARM microcontroller.  The ARM has just enough time to sample the radio at 2Mbps, looking for a preamble pattern.  If it finds the pattern, it fills the rest of register memory with the remaining bits and then dumps them to the host by USB.  In this manner, every prospective MAC address can be found.  Once the address is known, KeyKeriki places that address in its second radio, an nRF24L01+, which is used to sniff and inject packets.&lt;br /&gt;&lt;br /&gt;A similar solution is used in Michael Ossmann's &lt;a href="http://ubertooth.sourceforge.net/"&gt;Project Ubertooth&lt;/a&gt; sniffer for Bluetooth.  See that project's documentation and Ossmann's Shmoocon 2011 video for a more eloquent explanation of why sniffing without a known SYNC is so hard.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 2: or, Sniffing on the cheap.&lt;/b&gt;&lt;br /&gt;My trick for sniffing promiscuously involves a few illegal register settings and the expectations of background noise.  You can find code for this in the AutoTuner() class of the &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.nrf/"&gt;goodfet.nrf&lt;/a&gt; client.&lt;br /&gt;&lt;br /&gt;First, the length of the address to sniff must be reduced to its absolute minimum.  The datasheet claims that the lowest two bits of register 0x03 are responsible for address width, and that the only valid lengths at 3 bytes (01b), 4 bytes (10b), or 5 bytes (11b).  Setting this value to 00b gives a 2 byte match, but when checksums are disabled, this results in a deluge of false-positive packets that appear out of background noise.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5370000279/" title="nRF Address Width by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5006/5370000279_5deca53cd0.jpg" width="345" height="72" alt="nRF Address Width" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Second, it is necessary to begin receiving before the SYNC field appears, as the Nordic chips drop the address of incoming packets, leaving only the payload.  By looking at the noise returned when the address is at its shortest length, it is clear that background noise includes a lot of 0x00 and 0xFF packets as well as 0xAA and 0x55 packets, which are likely feedback from an internal clock.  What then would happen if the address were to be 0x00AA or 0x0055?&lt;br /&gt;&lt;br /&gt;What happens is that noise activates the radio a bit early, which then syncs to the real preamble, leaving the SYNC field as the beginning of the packet payload!  This is because the preamble and SYNC do not need to be immediately adjacent; rather, the SYNC can be delayed for a few bytes from the preamble in order to allow for longer preambles in noisy environments.  &lt;br /&gt;&lt;br /&gt;As a concrete example, an OpenBeacon packet looks something like the following.  The SYNC field is 0x0102030201, so the packet will be cropped from that point backward.  0xBEEF is all that will be returned to the application, with everything prior to that cropped.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5417524810/" title="nRF24L01+ Promiscuous Mode by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5137/5417524810_cb494ea655.jpg" width="500" height="263" alt="nRF24L01+ Promiscuous Mode" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;By making the address be 0x0055 and disabling checksums, that same packet will sometimes be interpreted as shown on the bottom.  The preamble will be mistaken for a SYNC, causing the real SYNC value to be returned as the beginning of the payload.  In that way, I am able to determine the SYNC/MAC field without any prior knowledge or brute force exploration.&lt;br /&gt;&lt;br /&gt;This does depend upon the preamble being preceded by 0x00, which occurs often in background noise but is not broadcast by the attacker.  So the odds of receiving a packet, while significantly worse than we'd like, are much better than the 1/2^16 you might assume.  In experiments, one in twenty or so real packets arrive while a significant number of false positives also sneak in.&lt;br /&gt;&lt;br /&gt;Recalling that the MAC addresses are three to five bytes long, and that radio noise is rather distinct, it stands to reason that noise can easily by separated from real packets by either manually checksumming to determine packet correctness or simply counting the occurrences of each address and taking the most popular.  You will find an example log of OpenBeacon packets and false positives at &lt;a href="http://pastebin.com/8CbxHzJ9"&gt;http://pastebin.com/8CbxHzJ9&lt;/a&gt;.  Sorting the list reveals that the MAC address 0x0102030201 is the most popular, which is in fact the address used by OpenBeacon tags.&lt;br /&gt;&lt;br /&gt;Rather than rely on packet dumps and sorts, there is an autotune script that identifies network participants and prints their MAC addresses.  Simply run 'goodfet.nrf autotune | tee autotune.txt' and go out for a coffee break while your device is transmitting.  When you come back, you'll find logs like the following, which has identified a nearby OpenBeacon transmitter.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5348416729/" title="goodfet.nrf autotune by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5241/5348416729_fd75b9735b.jpg" width="393" height="157" alt="goodfet.nrf autotune" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As low data-rate devices require significantly more time than high-rate devices to identify, such devices will either require undue amounts of patience or a real &lt;a href="http://www.remote-exploit.org/?page_id=602"&gt;KeyKeriki&lt;/a&gt;.  In the case of a Nike+ foot pod, I'm resorting to using loud hip hop music to trigger the sensor, which is left inside a pair of headphones.  My labmates are not amused, but it is a great way to reveal the radio settings when &lt;a href="http://travisgoodspeed.blogspot.com/2009/03/breaking-802154-aes128-by-syringe.html"&gt;syringe probes&lt;/a&gt; aren't convenient.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 3: or, Sniffing a keyboard effectively.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Having a class to identify channels and MAC addresses is most of the problem, but there are remaining issues.  First, the packets themselves are encrypted, and that cryptography must be broken.&lt;br /&gt;&lt;br /&gt;Fear not!  We won't need to do any fancy math to break this cryptography, as the key is included at least once in every packet.  Moser and Schröder's slides explain that the packet's header is cleartext, while the payload is XOR encrypted with the MAC address.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5354354594/" title="XOR Crypto! by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5002/5354354594_f7bf64f3af.jpg" width="500" height="354" alt="XOR Crypto!" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Applying an XOR to the proper region yields decrypted packets such as the following.  Because these contain USB HID events, key-up HID events quite often include long strings of 0x00 bytes.  When XOR'ed with the key, those zeroes produce the key, so some packets contain the XOR key not just once, but twice!&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5393852890/" title="MSKB5k Traffic by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5176/5393852890_acfc901c73.jpg" width="500" height="199" alt="MSKB5k Traffic" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Finally, the USB HID events need to be deciphered to get key positions.  Mapping a few of these yields meaningful text, with bytes duplicated in the case of retransmissions and omitted in the case of lost packets.  Disabling checksums will allow the dropped packets to be converted to a smaller number of byte errors, while tracking sequence numbers will prevent retransmitted keys from being displayed twice.  Regardless, the results are quite neighborly, as you can make out the sentence typed below in its packet capture.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5416657948/" title="NHBadge Key Sniffer by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5052/5416657948_8fe0b0b4c6.jpg" width="289" height="500" alt="NHBadge Key Sniffer" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 4; or, Reproducing these results.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;All of the code for this article is available in the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET Project's&lt;/a&gt; repository, as part of GoodFETNRF.py and its &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.nrf/"&gt;goodfet.nrf&lt;/a&gt; client script.  The hardware used was an &lt;a href=""&gt;NHBadge12&lt;/a&gt;, although an NHBadge12B or a GoodFET with the SparkFun &lt;a href="http://www.sparkfun.com/products/705"&gt;nRF24L01+ Transceiver Module&lt;/a&gt; will work just as well.&lt;br /&gt;&lt;br /&gt;To identify a nearby Nordic transmitter, run 'goodfet.nrf autotune'.  Keyboards can be identified and sniffed with 'goodfet.nrf sniffmskb', while a known keyboard can be sniffed and decoded by providing its address as an argument, 'goodfet.nrf sniffmskb aa,c10ac074cd,17,09'.  The channel--0x17 in this case--will change for collision avoidance, but channel hopping is slow and resets to the same starting channel.  Identification of the broadcast channel is faster when the receiver is not plugged in, as that causes the keyboard to continuously rebroadcast a keypress for a few seconds.&lt;br /&gt;&lt;br /&gt;All code presently in the repository will be refactored and rewritten, so revert to revision 885 or check the documentation for any changes.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Contrary to prior belief, the nRF24L01+ &lt;i&gt;can&lt;/i&gt; be used to promiscuously sniff compatible radios, allowing for keyboard sniffing without special hardware.  It's also handy for figuring out the lower levels of the otherwise-documented ANT+ protocol, and for reverse engineering vendor-proprietary protocols such as Nike+.&lt;br /&gt;&lt;br /&gt;Additionally, it should be emphasized that the security of the Microsoft keyboards in this family is irreparably broken, and has been since Moser and Schröder published the vulnerability at CanSecWest.  (It's a shame, because the keyboards are quite nicer than most Bluetooth ones, both in pairing delay and in battery life.)  Do not purchase these things unless you want to broadcast every keystroke.&lt;br /&gt;&lt;br /&gt;While I have not yet written code for injecting new keystrokes, such code does exist in the KeyKeriki repository and would not be difficult to port.  Perhaps it would be fun to build stand-alone firmware for the Next Hope badge that sniffs for keyboards, broadcasting Rick Astley lyrics into any that it finds?&lt;br /&gt;&lt;br /&gt;Please, for the love of the gods, use proper cryptography and double-check the security your designs.  Then triple-check them.  There is no excuse for such vulnerable garbage as these keyboards to be sold with neither decent security nor a word of warning.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-7248065449116362673?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/7248065449116362673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=7248065449116362673' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7248065449116362673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7248065449116362673'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html' title='Promiscuity is the nRF24L01+&apos;s Duty'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm6.static.flickr.com/5213/5385189893_898a16ccf2_t.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5213808113536582003</id><published>2011-01-24T09:34:00.001-05:00</published><updated>2011-01-24T09:34:00.176-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='clicker'/><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='imme'/><category scheme='http://www.blogger.com/atom/ns#' term='cc1110'/><title type='text'>Generic CC1110 Sniffing, Shellcode, and iClickers</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5035132843/" title="Chipcon CC1110 Logo by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4086/5035132843_d80ec45ed5.jpg" width="500" height="400" alt="Chipcon CC1110 Logo" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Howdy y'all,&lt;br /&gt;&lt;br /&gt;I haven't the time to write individual posts on these subjects, but I do have plenty of new features for the &lt;a href="http://focus.ti.com/docs/prod/folders/print/cc1110f32.html"&gt;CC1110&lt;/a&gt; that are worth sharing.  Rather than explain how they were written in too much detail, I invite you to read the source code, which is mostly Python and C shellcode.&lt;br /&gt;&lt;br /&gt;In order to follow along with these examples, you will need to have &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/smartrftm-studio.html"&gt;SmartRF Studio&lt;/a&gt; installed to /opt/smatrf7.  While this requirement will go away in a few weeks, the GoodFET client temporarily needs SmartRF Studio for machine documentation about the CC1110.  You can find more details on SmartRF requirements in the &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.cc/"&gt;goodfet.cc&lt;/a&gt; client page.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;(1) Packet sniffing, and other neighborly scripts.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;GoodFETCC now has packet sniffing support for the SimpliciTI protocol used by the Chronos watch.  Not only that, but it implements the protocol well enough to act as an access point for the watch, collecting accelerometer data and deciphering it for the host.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5247787940/" title="GoodFET Simpliciti Sniffing! by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5164/5247787940_daca7e2506.jpg" width="500" height="182" alt="GoodFET Simpliciti Sniffing!" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Run an access point with 'goodfet.cc simpliciti [band]'.  (This command will likely change names soon, as it is a rather ugly hack which only supports the Chronos accelerometer feature.)  The optional parameter should be us, eu, or lf for the American, European, and Low Frequency versions of the watch.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5252697453/" title="GoodFET SimpliciTI Client by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5089/5252697453_cbcd04f222.jpg" width="443" height="500" alt="GoodFET SimpliciTI Client" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Not only protocols intended for the GoodFET, but also others which are coincidentally compatible, are supported.  Thanks to some register settings contributed by &lt;a href="http://www.ossmann.com/mike/"&gt;Mike Ossman&lt;/a&gt;, you can sniff and decipher &lt;a href="http://www.iclicker.com/dnn/"&gt;i&amp;lt;clicker&lt;/a&gt; traffic with 'goodfet.cc iclicker'.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5339425252/" title="goodfet.cc iclicker by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5009/5339425252_ffac652fce.jpg" width="424" height="340" alt="goodfet.cc iclicker" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The i&amp;lt;clicker uses a Xemics &lt;a href="http://www.semtech.com/images/datasheet/xe1203f.pdf"&gt;XE1203F (PDF)&lt;/a&gt; radio chip, shown below.  The XE1203F is nearly as configurable as the CC11xx parts, except that it is limited to 2FSK encoding.  Previously, this protocol could be sniffed with the &lt;a href="http://sourceforge.net/projects/gr-clicker/"&gt;GR-Clicker&lt;/a&gt; project and a USRP, but the highly-versatile CC1110 chip allows this to be done with neither a software defined radio nor a chip identical to that used by the transmitter.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4834814212/" title="iClicker by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4092/4834814212_ec435d2f63.jpg" width="500" height="375" alt="iClicker" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you find it handy to see when a device is broadcasting, you can produce an ASCII-art plot of signal strength with 'goodfet.cc rssi [freq]':&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5247268140/" title="GoodFET CC1110 RSSI Graph by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5245/5247268140_b1f831f59f.jpg" width="257" height="500" alt="GoodFET CC1110 RSSI Graph" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Care to jam another transmitter?  Just like with the &lt;a href="http://travisgoodspeed.blogspot.com/2010/06/hacking-next-hope-badge.html"&gt;Next Hope Badge&lt;/a&gt;'s GoodFET mode, it takes a single command to hold a carrier wave.&lt;br /&gt;'goodfet.cc carrier [freq]'&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5242553766/" title="Chipcon Carrier by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5162/5242553766_649ba3ea64.jpg" width="500" height="375" alt="Chipcon Carrier" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;(2) Shellcode, now for quiche-eaters!&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;At the risk of appearing to facilitate &lt;a href="http://www.pbm.com/~lindahl/real.programmers.html"&gt;quiche-eating&lt;/a&gt;, I'd like to quickly explain the new shellcode interface for placing code fragments on a Chipcon 8051 target, such as the CC1110.&lt;br /&gt;&lt;br /&gt;The Chipcon radios have certain functions which are timing sensitive, chief among these being the rewriting of flash memory and the use of the digital radio core.  If flash memory is not pulsed with the correct timing, mis-writes will occur.  If the radio is read too slowly, bytes will be missed and a buffer underflow will ruin the transaction.  Similarly, a transmission might fail if the single-byte transmission buffer isn't refilled quickly enough.  I've also had trouble, for reasons that I can poorly explain, configuring the crystal oscillator through the debugging interface without shellcode.&lt;br /&gt;&lt;br /&gt;As I described in my &lt;a href="http://travisgoodspeed.blogspot.com/2009/10/cc2430-debug-protocol-first-notes.html"&gt;CC2430 Debugging Notes&lt;/a&gt;, the recommended method of flashing memory is to write a small block of code into XDATA RAM which does the actual write, then to branch to this code, waiting for a HALT (0xA5) opcode to return control to the debugger.  This routine is provided in &lt;a href="http://focus.ti.com/lit/ug/swra124/swra124.pdf"&gt;SWRA124&lt;/a&gt; as machine code with assembly comments, beginning with the fragment shown below.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4019557552/" title="CC2430 Flash Routine by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2739/4019557552_1a502e952d.jpg" width="403" height="174" alt="CC2430 Flash Routine" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;While this is fine and dandy for code that works, it's a bit infuriating to debug code in machine language.  (Is that opcode supposed to be 0xA5 or 0xA6?  Is the length of this instruction correct?  Similar frustration abounds.)  To correct for this, the GoodFET project now has a trunk/shellcode directory in addition to trunk/firmware and trunk/client.  Shellcode is compiled for target microcontrollers, in this case just the CC1110 by SDCC, the Small Device C Compiler.&lt;br /&gt;&lt;br /&gt;For example, this is the code that used to configure the crystal oscillator on the CC1110, a prerequisite for any radio operations:&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5246585381/" title="Chipcon Shellcode by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5126/5246585381_7c235d3c4d.jpg" width="500" height="186" alt="Chipcon Shellcode" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That ugly mess becomes the following little fragment of C.  It is compiled by 'sdcc --code-loc 0xF000 crystal.c' in order to place the code squarely within RAM, which is executable in this 8051 clone's unified memory architecture.  (It's a Harvard chip that acts Von Neumann, or the other way around.)&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5283782164/" title="CC1110 Crystal Shellcode by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5289/5283782164_f661cc724c.jpg" width="314" height="399" alt="CC1110 Crystal Shellcode" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For inputs to these functions, and also for their return values, I find it more convenient to declare arrays at known locations than to read the symbol files to find them.  The syntax for placing an array in XDATA memory at 0xFE00 is 'char __xdata at 0xfe00 packet[256];'.  You can find examples of this in txpacket.c and rxpacket.c in the GoodFET repository.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;(3) Care to join the fun?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There are a number of features remaining to be implemented in shellcode.  Among them in a completed port of Ossmann's &lt;a href="http://ossmann.blogspot.com/2010/03/16-pocket-spectrum-analyzer.html"&gt;$15 Spectrum Analyzer&lt;/a&gt;, which I began in &lt;a href="http://travisgoodspeed.blogspot.com/2010/10/cc1110-instrumentation-with-python.html"&gt;CC1110 Instrumentation in Python&lt;/a&gt; and you can find in the contrib/ directory of the GoodFET repository.  By dropping the GUI interface and replacing it with timing delays, full spectrum scans can be made in decent time without requiring that anything in flash memory be changed.&lt;br /&gt;&lt;br /&gt;Another handy tool would be an OOK sniffer that over-samples, using the infinite-packet-length trick described in the CC1110 datasheet to fill ram with a recording.  Triggering on RSSI allows the beginning of the packet to be reliably timed, with oversampling allowing for correction on all later bits.  I've begun to implement this as 'goodfet.cc sniffook [freq]', but an enterprising neighbor should be able to start sniffing garage door remotes in short order.&lt;br /&gt;&lt;br /&gt;A Morse-code library in combination with an external amplifier would also be neighborly for the licensed amateur bands.  The ability of the microcontroller to quickly return and channel hop might be able to account for, among other things, the Doppler shift experienced in &lt;a href="http://en.wikipedia.org/wiki/EME_%28communications%29"&gt;EME&lt;/a&gt; moon-bounce experiments, without losing backward compatibility with 19th century radio technology.&lt;br /&gt;&lt;br /&gt;As a prize, I offer one ale apiece for GoodFET patches implementing these features.&lt;br /&gt;&lt;br /&gt;Stay neighborly,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5213808113536582003?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5213808113536582003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5213808113536582003' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5213808113536582003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5213808113536582003'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2011/01/generic-cc1110-sniffing-shellcode-and.html' title='Generic CC1110 Sniffing, Shellcode, and iClickers'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4086/5035132843_d80ec45ed5_t.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2613511862985625189</id><published>2010-12-06T02:16:00.006-05:00</published><updated>2010-12-06T02:16:00.068-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='keypad'/><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='brother kh930'/><category scheme='http://www.blogger.com/atom/ns#' term='devcamp10'/><category scheme='http://www.blogger.com/atom/ns#' term='knitting'/><title type='text'>Hacking a Knitting Machine's Keypad</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;in collaboration with &lt;a href="http://fabienne.us/"&gt;Fabienne Serriere&lt;/a&gt; and &lt;a href="http://scherpenisse.net/"&gt;Arjan Scherpenisse&lt;/a&gt;,&lt;br /&gt;at Mediamatic's RFID Devcamp 2010, Amsterdam,&lt;br /&gt;for &lt;a href="http://www.mediamatic.net/page/167514/en"&gt;Multithreaded Banjo Dinosaur Knitting Adventure 2D Extreme&lt;/a&gt;,&lt;br /&gt;with kind thanks to David Carne.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5206596473/" title="Multi-Threaded Banjo Dinosaur Knitting Adventure 2D Extreme by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5047/5206596473_326f3a0f8d.jpg" width="500" height="375" alt="Multi-Threaded Banjo Dinosaur Knitting Adventure 2D Extreme" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks to some extra-neighborly blackmail by Fabienne, I spent last week hacking up a storm in Amsterdam.  By extending the work of &lt;a href="http://www.antitronics.com/wiki/index.php?title=Electroknit_Technical_Information"&gt;Steven Conklin&lt;/a&gt;, &lt;a href="http://ladyada.net/learn/electroknit/"&gt;Limor Fried&lt;/a&gt;, and Becky Stern, we were able to hack a Brother KH930 knitting machine to print high score panes from a custom video game in yarn.  This game was then displayed at Mediamatic for SensorFest, leading all sorts of neighbors to learn that RFID, socializing, and beer can lead to a neighborly time.  Never in my life did I expect to get such an adrenaline rush from knitting, much less from from this newfangled social networking nonsense.&lt;br /&gt;&lt;br /&gt;Conklin's technique for loading new patterns into the machine involves using an FTDI chip to simulate a Tandy PDD1 floppy disk drive, then typing "CE 5 5 1 STEP 1 STEP CE STEP STEP CE 9 0 3 STEP STEP" to load a new pattern set from disk and print pattern 3 of the set.  (551 is the command to read from disk, and patterns held in RAM begin at 900.)  For our exhibit, this sequence was far too complicated to type for every half meter of output, so we hacked the device's keypad for scripting.&lt;br /&gt;&lt;br /&gt;This article describes how a matrix keypad works, how we reverse engineered the specific keypad of the Brother KH930, and how to use an Arduino with a handful of transistors to automate the typing of commands necessary for loading a new pattern from an emulated floppy disk.  It should be applicable to all sorts of keyboards, but for those with serial protocols there might be a simpler method.&lt;br /&gt;&lt;br /&gt;Unfortunately, there won't be room here to describe the first emergency knitting machine purchase in history, our A-Team trip to the far side of Holland in a borrowed van, or the case of Club Mate that we begged from a squatter bar in order to finish the project in the five days allotted.&lt;br /&gt;&lt;br /&gt;&lt;!--Background--&gt;&lt;br /&gt;&lt;br /&gt;A keypad matrix is most often built with switches that connect a row wire to a column wire.  By keeping every column in a high-impedance state with pull-up resistors, then dropping each row low in sequence, the column inputs can be sensed to determine when a button is pressed.  Dave's Hacks' first article on &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-hacking.html"&gt;IM ME Hacking&lt;/a&gt; describes in detail how the keypad of the GirlTech IMME works, and all other implementations seem to function similarly.&lt;br /&gt;&lt;br /&gt;The connections between rows and columns are just switches.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5235653449/" title="KeySchem by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5005/5235653449_ffbf355c62_m.jpg" width="240" height="94" alt="KeySchem" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;While in a perfect world, rows and columns would be arranged exactly as they appear visually, this is rarely efficient to route in copper for more than twelve buttons.  We produced the diagram below by scanning the keyboard membrane, then pushing a button while using the continuity tester to see which row and column wire were connected.  The table at the bottom converts from wire signal names to the Arduino signal names used within the client library.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5231512479/" title="KH930 Keypad Topside by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5082/5231512479_67c3461d19.jpg" width="500" height="278" alt="KH930 Keypad Topside" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--Arduino Hardware--&gt;&lt;br /&gt;&lt;br /&gt;In order to connect rows and columns to a center rail, I used BC547 NPN transistors prototyped on an Arduino shield.  Each has a 1K resistor on the base.  Row transistors have the collector coming from the row signal and the emitter going to the common rail; column transistors are the same, except that the collector and emitter are swapped in order to fit the direction of current.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5232367418/" title="Keymu10 Rows by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5122/5232367418_e1573afc98.jpg" width="276" height="437" alt="Keymu10 Rows" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As each transistor conducts when only when its base is high, the Arduino can press a key by first dropping all outputs low, then raising a row control line (RCx) and a column control line (CCx) high.  Because of debouncing and a limited scan rate, this must be held for a short amount of time before releasing the key.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Such a design fits perfectly well on a prototyping shield, although the transistors are a tight fit.  I recommend first prototyping a single row and column to ensure that the transistors are properly aligned, as current direction might be different on your keypad.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5232385174/" title="Keymu Prototype by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5003/5232385174_ce2c910b47.jpg" width="500" height="333" alt="Keymu Prototype" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For those who prefer to have a board fabbed, here's a proper schematic and layout.  Gerbers and Eagle CAD source files are available in the project's subversion repository.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5232676950/" title="Keymu10 Schematic by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5202/5232676950_6a271b5543.jpg" width="454" height="500" alt="Keymu10 Schematic" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5232367414/" title="Keymu10 Shield by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5241/5232367414_930db7af0b.jpg" width="384" height="500" alt="Keymu10 Shield" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--Software--&gt;&lt;br /&gt;&lt;br /&gt;A more sophisticated software implementation would involve using the Arduino's serial port to communicate with the host, accepting strings in ASCII and translating them to keypresses.  We decided against such a complication because we feared relying on a second long USB cable.  Further, we thought it handy when necessary to be able to run the device stand-alone with a single (reset) button press from the operator signaling that the next pattern should be loaded.&lt;br /&gt;&lt;br /&gt;Full keyboard emulator code is available either by &lt;a href="http://pastebin.com/Zbj2DqiY"&gt;pastebin&lt;/a&gt; or from SVN.  You'll find it in banjo/code/arduino.&lt;br /&gt;&lt;i&gt;svn checkout svn://svn.mediamatic.nl/devcamps/camp10/banjo&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The code works by using simple methods to press a row and column by raising those pin voltages.  Higher level methods allow for such functions as loading a pattern from disk or printing a pattern, each by performing multiple key presses and occasionally inserting a delay.  By placing this within the Arduino code's &lt;i&gt;setup()&lt;/i&gt; function, the pattern is loaded whenever the device is reset.&lt;br /&gt;&lt;br /&gt;New patterns are loaded from the Banjo Dinosaur Knitting Adventure 2D Extreme game by first starting a floppy disk emulator--as per Steve Conklin's technique--then pulsing the DTR line of the arduino in order to cause a reset.  The Perl for that is just a single line,&lt;br /&gt;&lt;i&gt;Device::SerialPort-&amp;gt;new("/dev/ttyACM0")-&amp;gt;pulse_dtr_on(100)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The end result, with a machine typing by itself, looks a little like this,&lt;br /&gt;&lt;object type="application/x-shockwave-flash" width="400" height="300" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt; &lt;param name="flashvars" value="intl_lang=en-us&amp;photo_secret=c65846a38e&amp;photo_id=5235543171"&gt;&lt;/param&gt; &lt;param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"&gt;&lt;/param&gt; &lt;param name="bgcolor" value="#000000"&gt;&lt;/param&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&amp;photo_secret=c65846a38e&amp;photo_id=5235543171" height="300" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;That's all there is to it.  With fourteen transistors and just as many resistors, you can script your knitting machine--or any other keypad device--from a microcontroller without modifying the underlying firmware.&lt;br /&gt;&lt;br /&gt;As a final note, I will give a cookie to the first neighbor who uses this technique to dump all of the power codes from a universal infrared remote control, or to program something long and sophisticated into a graphing calculator that lacks a link port.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5207189466/" title="Banjo Dinosaur by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5163/5207189466_c7aedf8031.jpg" width="500" height="375" alt="Banjo Dinosaur" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5206594273/" title="Arecibo Pattern by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5168/5206594273_fc7b9f3d04.jpg" width="375" height="500" alt="Arecibo Pattern" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5206593399/" title="Intel 4001 Art by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5168/5206593399_614870a1e3.jpg" width="500" height="375" alt="Intel 4001 Art" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5206592435/" title="Multi-Threaded Banjo Dinosaur Knitting Adventure 2D Extreme by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5201/5206592435_c018fd86b3.jpg" width="500" height="375" alt="Multi-Threaded Banjo Dinosaur Knitting Adventure 2D Extreme" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2613511862985625189?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2613511862985625189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2613511862985625189' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2613511862985625189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2613511862985625189'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/12/hacking-knitting-machines-keypad.html' title='Hacking a Knitting Machine&apos;s Keypad'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm6.static.flickr.com/5047/5206596473_326f3a0f8d_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6742001253211832394</id><published>2010-11-01T08:00:00.001-04:00</published><updated>2010-11-01T08:00:08.934-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='zombiegotcha'/><category scheme='http://www.blogger.com/atom/ns#' term='8051'/><category scheme='http://www.blogger.com/atom/ns#' term='imme'/><category scheme='http://www.blogger.com/atom/ns#' term='cc1110'/><category scheme='http://www.blogger.com/atom/ns#' term='27c3'/><title type='text'>Bitmapped Sprites on the GirlTech IMME</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;with sprites by &lt;a href="http://eliskipp.com/blog/"&gt;Eli Skipp&lt;/a&gt;,&lt;br /&gt;extending Dave's &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-lcd-interface-hacked.html"&gt;LCD reversing&lt;/a&gt;,&lt;br /&gt;and with thanks to &lt;a href="http://ossmann.blogspot.com/"&gt;Mike Ossmann&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5008846873/" title="ZombieGotcha by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4130/5008846873_c9244d1bca.jpg" width="500" height="375" alt="ZombieGotcha" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The GirlTech IMME is a fine platform for radio hacking and embedded programming, but the LCD of the device is by no means designed for lightning fast graphics.  In this brief article, I demonstrate the method by which a sprite library can be constructed which abstracts away the less neighborly minutia of the LCD in favor of a row-wise framebuffer that gets flushed to the LCD as appropriate.  This isn't fast enough for a port of Sonic the Hedgehog, but it's certainly sufficient for ZombieGotcha, a network disease simulation game that Eli Skipp and I are prototyping.&lt;br /&gt;&lt;br /&gt;To quickly recap, the GirlTech IMME is a children's toy powered by the &lt;a href="http://focus.ti.com/docs/prod/folders/print/cc1110f32.html"&gt;CC1110F32&lt;/a&gt;, which combines an 8051 microcontroller with a versatile sub-GHz radio.  The toy also includes a text LCD controller and keyboard, making it a delightful platform for embedded systems hacking and prototyping.  Thanks to Dave's article on &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-hacking.html"&gt;attaching a debugger&lt;/a&gt; and &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-lcd-interface-hacked.html"&gt;reversing the LCD&lt;/a&gt;, it is possible to &lt;a href="http://travisgoodspeed.blogspot.com/2010/03/im-me-goodfet-wiring-tutorial.html"&gt;wire a GoodFET&lt;/a&gt; into the IMME, allowing for debugging and reprogramming of the device.&lt;br /&gt;&lt;br /&gt;&lt;!--Framebuffer format.--&gt;&lt;br /&gt;&lt;br /&gt;Since the days of the first raster displays, computers have been drawing images as rows, because that's the way that a television's electron stream is traced along the display.  The IMME draws rows internally, but because it is intended to draw fonts, its rows are eight pixels tall.  For example, the bytes {0x7f, 0x08, 0x08, 0x08, 0x7f, 0x00} are pushed to the LCD in order to draw an uppercase letter H in &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-lcd-interface-hacked.html"&gt;Dave's LCD Demo&lt;/a&gt; for the IMME.  Drawing this on graph paper or rendering it by Python, it becomes clear that 0x7F represents a side of the letter, 0x08 represents the bar, and 0x00 is the space following the letter.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5131629739/" title="IMME Font 'H' by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4112/5131629739_0f9d9e899c.jpg" width="326" height="157" alt="IMME Font 'H'" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Rather than attempting to natively store a framebuffer in the LCD's format, I chose to internally index by row, then to translate during the export of the framebuffer to the LCD.  My primary reason for doing this is to maintain portability of the ZombieGotcha code to custom hardware.  It also simplifies the transcription of sprites from original bitmaps to C structures.&lt;br /&gt;&lt;br /&gt;Having an internal framebuffer is not without cost, however.  The buffer is 132 pixels wide and 64 pixels tall.  Even with bit-packing, this is more than a kilobyte in size, consuming more than a quarter of the CC1110's 4kB of XDATA RAM.  (Programs and sprites are stored in CODE Flash memory, of which there is 32kB, so this limit is not quite so severe as it sounds.)&lt;br /&gt;&lt;br /&gt;&lt;!--Sprite transcription.--&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5017579645/" title="girlpix by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4128/5017579645_f9d43f1a38.jpg" width="288" height="128" alt="girlpix" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My sprite toolchain is begun with bitmap images submitted by the artist.  I cannot stress enough how important it is that your pixel artist understand pixels.  Every sprite must be drawn at native resolution, with proper offsets of each frame and an understanding that the LCD is what it is, regardless of what Photoshop might render.&lt;br /&gt;&lt;br /&gt;From the original bitmap sprites, PNM files are produced that are more easily parsed by Perl.  This format consists of whitespace-delimited words for the format, width, and height of the sprite.  In this case, the sprite consists of three frames, each of them being 24 pixels width and 32 pixels tall.  Other sizes are possible, of course, but it is convenient for bit packing that the width is an even multiple of 8, so that the old pixels needn't be read back in.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5132898054/" title="PNM Format by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1063/5132898054_47c788cf3f.jpg" width="468" height="322" alt="PNM Format" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is then necessary to use an ugly Perl script to convert the sprite from a PNM to a C array of bytes.  Pretty Perl won't work, of course, because such a thing doesn't exist.  My script, &lt;a href="http://perl.pastebin.com/5Mvi6f66"&gt;sprite2c.pl&lt;/a&gt;, takes a 24-bit color PNM file and converts it to a 1-bit map that is byte-packed.  Each of these is included by the preprocessor as a &lt;i&gt;__code unsigned char[]&lt;/i&gt;, with the &lt;i&gt;__code&lt;/i&gt; keyword implying that the object should be stored in Flash rather than RAM.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5132328043/" title="sprit2cl.pl by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1353/5132328043_62aca4439a.jpg" width="500" height="417" alt="sprit2cl.pl" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sprite animations are performed by storing the frame count along with the width and height in the C structure.  Considering the resource constraints of this system, frame counts change very rarely and are stored within the C code.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5133020586/" title="zsprites.c by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1311/5133020586_1f3f2b6072.jpg" width="260" height="304" alt="zsprites.c" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--Frambuffer dumping.--&gt;&lt;br /&gt;&lt;br /&gt;Dumping the frame-buffer to the LCD is as simple as writing every stripe of data to the screen.  Potentially, as an optimization, you could keep track of which stripes have been invalidated across what horizontal range, updating only where necessary.&lt;br /&gt;&lt;br /&gt;Keeping in mind that the LCD is updated as stripes of 8 pixels in height, code such as the following will refresh the entire LCD from the frame-buffer.  Be sure not to erase the LCD between writes, as that would cause unnecessary flickering.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5132964968/" title="Framebuffer Dump by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4023/5132964968_d1bde64ae7.jpg" width="356" height="218" alt="Framebuffer Dump" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The framebuffer elements themselves are grabbed by selecting the pixel index divided by 8, then masking off the selected bit.  The following functions work admirably for this purpose.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5132993398/" title="FBGetSet by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1122/5132993398_0bc41f8367.jpg" width="307" height="145" alt="FBGetSet" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If greater performance is required, a game should certainly be designed with a custom graphics library that optimizes the few things it does most.  Performances can be gained by storing sprites and the frame-buffer natively in the row/stripe format that the LCD expects, simplifying conversion.  Mike Ossmann used the technique of basing most graphics around vertical lines in his &lt;a href="http://ossmann.blogspot.com/2010/03/16-pocket-spectrum-analyzer.html"&gt;spectrum analyzer firmware&lt;/a&gt;, allowing for channels to be redrawned as they are scanned rather than flushed from a frame-buffer.&lt;br /&gt;&lt;br /&gt;As the ZombieGotcha game is largely turn-based and the frame-rate is not a dire concern, I don't expect to optimize the sprite library much beyond what is presented here.&lt;br /&gt;&lt;br /&gt;One major addition will be that of screenshots, as I'd like to produce animated GIFs of game action for the website.  Screenshots can be produced by the method that I outline in &lt;a href="http://travisgoodspeed.blogspot.com/2010/10/cc1110-instrumentation-with-python.html"&gt;CC1110 Instrumentation with Python&lt;/a&gt;, dumping the frame-buffer from XDATA with a GoodFET and writing that to disk.  Alternatively, full-speed screenshots could be dumped by sniffing the LCD's SPI bus using a &lt;a href="http://www.totalphase.com/products/beagle_ism/"&gt;Total Phase Beagle&lt;/a&gt; or other SPI protocol analyzer.&lt;br /&gt;&lt;br /&gt;For those of you with an IMME, Eli and I will be releasing the ZombieGotcha game at the &lt;a href="http://events.ccc.de/category/27c3/"&gt;Twenty-Seventh Chaos Communications Congress&lt;/a&gt; in Berlin this winter.  We'll bring a bed of nails for reflashing IMME units on the spot, as well as GoodFET kits for modifying your IMME to be a development kit.  (The ZombieGotcha will also run on full-custom hardware, but we are maintaining IMME support in parallel.)&lt;br /&gt;&lt;br /&gt;As a final note, a teaser of the ZombieGotcha opening screen can be found &lt;a href="http://pastebin.com/tU3YhejH"&gt;here&lt;/a&gt; in the Intel-Hex format.  I'll give a GoodFET40 kit to the first neighbor who sends me an animated GIF of it and a script to generate the same, either by a debugger or an emulator.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6742001253211832394?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6742001253211832394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6742001253211832394' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6742001253211832394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6742001253211832394'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/11/bitmapped-sprites-on-girltech-imme.html' title='Bitmapped Sprites on the GirlTech IMME'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4130/5008846873_c9244d1bca_t.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2487965268677716779</id><published>2010-10-05T00:10:00.015-04:00</published><updated>2010-10-09T12:56:11.338-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='imme'/><category scheme='http://www.blogger.com/atom/ns#' term='cc1110'/><title type='text'>CC1110 Instrumentation with Python</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning the &lt;a href="http://www.girltech.com/electronics-imMe.aspx"&gt;GirlTech IMME&lt;/a&gt;,&lt;br /&gt;utilizing the &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.cc/"&gt;GoodFET's Chipcon Debugger&lt;/a&gt;&lt;br /&gt;to instrument Michael Ossmann's &lt;a href="http://ossmann.blogspot.com/2010/03/16-pocket-spectrum-analyzer.html"&gt;$16 Pocket Spectrum Analyzer&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5054987346/" title="Kenwood Spectrum, Overlay by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4130/5054987346_a98104bec4.jpg" width="500" height="375" alt="Kenwood Spectrum, Overlay" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Often a neighbor, such as myself, finds himself with a damned useful tool that's missing logging.  Further, when this is a black-box application, it is undeniably inconvenient to patch in logging where no communications method exists.  In this brief article, I will demonstrate how to instrument a Chipcon CC1110 application using Python and a GoodFET with zero bytes of modification to the original firmware image.  My target's source code is available, but the technique applies just as well to black-box firmware.&lt;br /&gt;&lt;br /&gt;Specifically, I want to dump the raw data from Michael Ossmann's &lt;a href="http://ossmann.blogspot.com/2010/03/16-pocket-spectrum-analyzer.html"&gt;$16 Pocket Spectrum Analyzer&lt;/a&gt; in order to demo it on stage at our Toorcon 12 talk, &lt;a href="http://sandiego.toorcon.org/index.php?option=com_content&amp;task=section&amp;id=3&amp;Itemid=9#lineup"&gt;Real Men Carry Pink Pagers&lt;/a&gt;.  I'll assume the reader to be familiar with Mike's article, as well as my article on &lt;a href="http://travisgoodspeed.blogspot.com/2010/03/im-me-goodfet-wiring-tutorial.html"&gt;wiring an IMME&lt;/a&gt; for debugging with a GoodFET.  Readers wishing to play along can order a GoodFET31 for little or no money by following &lt;a href="http://goodfet.sourceforge.net/orders/"&gt;these instructions&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;From the &lt;a href="http://focus.ti.com/docs/prod/folders/print/cc1110f32.html"&gt;datasheet&lt;/a&gt; or Mike's Makefile it can be seen that the external RAM (XDATA, which is called external for historic reasons) section begins at 0xF000.  The only structure at this location is &lt;i&gt;xdata channel_info chan_table[NUM_CHANNELS]&lt;/i&gt;, where NUM_CHANNELS is defined to be 132 and the channel_info struct is eight bytes, defined as &lt;pre&gt;typedef struct {&lt;br /&gt; /* frequency setting */&lt;br /&gt; u8 freq2;&lt;br /&gt; u8 freq1;&lt;br /&gt; u8 freq0;&lt;br /&gt; &lt;br /&gt; /* frequency calibration */&lt;br /&gt; u8 fscal3;&lt;br /&gt; u8 fscal2;&lt;br /&gt; u8 fscal1;&lt;br /&gt;&lt;br /&gt; /* signal strength */&lt;br /&gt; u8 ss;&lt;br /&gt; u8 max;&lt;br /&gt;} channel_info;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The first several entries in this struct might be as follows.  The first of these lines defines the frequency to be 0x22af4b, the frequency calibration to be 0xef2c27, and the signal strength to be 0x41.  The final byte defines the maximum strength, which is zero unless max-highlighting mode is turned on.&lt;pre&gt; 22 af 4b ef 2c 27 41 00&lt;br /&gt; 22 b1 43 ef 2c 27 3e 00&lt;br /&gt; 22 b3 3b ef 2c 27 46 00&lt;br /&gt; 22 b5 33 ef 2c 27 3c 00&lt;br /&gt; 22 b7 2b ef 2c 27 44 00&lt;br /&gt; 22 b9 23 ef 2c 28 3c 00&lt;br /&gt; 22 bb 1b ef 2c 28 42 00&lt;br /&gt; 22 bd 13 ef 2c 28 3f 00&lt;br /&gt; 22 bf 0b ef 2c 28 3d 00&lt;br /&gt; 22 c1 03 ef 2c 28 40 00&lt;br /&gt; 22 c2 fb ef 2c 28 3d 00&lt;br /&gt; 22 c4 f3 ef 2c 28 3e 00&lt;br /&gt; ...&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This information can be extracted by halting and resuming the CPU, just as I did in my article on the &lt;a href="http://travisgoodspeed.blogspot.com/2009/12/prng-vulnerability-of-z-stack-zigbee.html"&gt;PRNG Vulnerability of Z-Stack's ZigBee SEP ECC&lt;/a&gt; implementation.  That is, GoodFETCC.CCpeekdatabyte() is used to grab these bytes from the CC1110's RAM.  The following code dumped the fragment shown above.&lt;pre&gt;#!/usr/bin/env python &lt;br /&gt;&lt;br /&gt;import sys;&lt;br /&gt;&lt;br /&gt;sys.path.append('/Users/travis/svn/goodfet/trunk/client/')&lt;br /&gt;&lt;br /&gt;from GoodFETCC import GoodFETCC;&lt;br /&gt;from intelhex import IntelHex16bit, IntelHex;&lt;br /&gt;import time;&lt;br /&gt;&lt;br /&gt;client=GoodFETCC();&lt;br /&gt;client.serInit();&lt;br /&gt;&lt;br /&gt;client.setup();&lt;br /&gt;client.start();&lt;br /&gt;&lt;br /&gt;bytescount=8*132;&lt;br /&gt;bytestart=0xf000;&lt;br /&gt;&lt;br /&gt;while 1:&lt;br /&gt;    time.sleep(1);&lt;br /&gt;    client.CChaltcpu();&lt;br /&gt;    &lt;br /&gt;    dump="";&lt;br /&gt;    for foo in range(0,bytescount):&lt;br /&gt;        dump=("%s %02x" % (dump,client.CCpeekdatabyte(bytestart+foo)));&lt;br /&gt;        if foo%8==7: dump=dump+"\n";&lt;br /&gt;    print dump;&lt;br /&gt;    sys.stdout.flush();&lt;br /&gt;    client.CCreleasecpu();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To get proper data, it is necessary to add a wake-up delay of a few seconds, so that the table is populated by the first sampling.  Additionally, it is handy to convert the frequency to MHz from its native unit (Hz/396.728515625).  Finally, successive pages should be separated by a time column in order to facilitate graphing.  The result is &lt;a href="http://pastebin.com/gqPS1Qms"&gt;this script&lt;/a&gt;, which can be found in the GoodFET project as "contrib/ccspecantap/specantap.py".&lt;br /&gt;&lt;br /&gt;An example recording can be seen below, as a spectrum recording of a friend's Kenwood FreeTalk UBZ-AL14 FM Transceiver unit.  This is compatible with other family FM radios, and I wanted to know which center frequencies were in use.  In the first image, I've highlighted the noise floor as blue and the peaks as green.  In the second image, the time domain is used to show broadcasts on several channels in sequence, all of which fall into one of the two center frequencies: 925MHz and 935MHz.  The raw data is &lt;a href="http://pastebin.com/90TZD97v"&gt;here&lt;/a&gt;, best viewed with NASA's excellent &lt;a href="http://astrophysics.arc.nasa.gov/~pgazis/viewpoints.htm"&gt;Viewpoints&lt;/a&gt; tool.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5054737006/" title="Kenwood FreeTalk Spectrum by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4151/5054737006_4aec43c176.jpg" width="450" height="346" alt="Kenwood FreeTalk Spectrum" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/5054736856/" title="Kenwood FreeTalk Channels by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4127/5054736856_e0e174d3e3.jpg" width="440" height="346" alt="Kenwood FreeTalk Channels" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Future additions to this project will include integration into the GoodFET radio framework, as well as a 2.4GHz version built around the CC2430 and CC2530.  The performance of the tap can be greatly improved by using block transactions rather than peeking individual bytes, and the view can be re-tuned by poking the configuration IDATA variables, positions of which are described in &lt;a href="http://pastebin.com/HePVmC50"&gt;specan.rst&lt;/a&gt; as produced by the SDCC compiler.&lt;br /&gt;&lt;br /&gt;It's also handy to know that a Chipcon radio will halt if the 0xA5 opcode is executed.  In this manner, patching a single byte of a while() loop can allow the state at every iteration to be dumped.&lt;br /&gt;&lt;br /&gt;This technique of scripted debugging through a programmer can be handy for more than instrumentation.  Unit tests can be run on an assembly line without additional wiring, and--by single-stepping--execution traces of unknown firmware can be generated for assisting in reverse engineering.  Those with enough patience can use this to fuzz test embedded systems for security vulnerabilities.&lt;br /&gt;&lt;br /&gt;For help instrumenting your own Chipcon or MSP430 project, join us in #goodfet on irc.freenode.net or send me an email.  The project has advanced to the point where interesting things can be done from Python alone, and I'd quite like to see what could be done with it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2487965268677716779?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2487965268677716779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2487965268677716779' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2487965268677716779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2487965268677716779'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/10/cc1110-instrumentation-with-python.html' title='CC1110 Instrumentation with Python'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4130/5054987346_a98104bec4_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-998309728874572901</id><published>2010-07-04T17:00:00.000-04:00</published><updated>2010-07-04T17:27:17.912-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='clicker'/><category scheme='http://www.blogger.com/atom/ns#' term='nrf24l01+'/><category scheme='http://www.blogger.com/atom/ns#' term='nrf2401'/><category scheme='http://www.blogger.com/atom/ns#' term='nrf24e1'/><title type='text'>Reversing an RF Clicker</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning the Turning Point &lt;a href="http://www.turningtechnologies.com/audienceresponseproducts/responseoptions/responsecards/responsecardrf/"&gt;ResponseCard RF&lt;/a&gt;,&lt;br /&gt;having FCC ID R4WRCRF01,&lt;br /&gt;patented as &lt;a href="http://www.google.com/patents?vid=USPAT7330716"&gt;USA 7,330,716&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4747156868/" title="Turning Point Clicker by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4079/4747156868_867d3e6c09.jpg" alt="Turning Point Clicker" height="375" width="500" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In this article, I describe in detail the methods by which I have reverse engineered the TurningPoint ResponseCard RF, casually known among students as a "Clicker".  This 2.4GHz radio transceiver is used in undergraduate university classrooms for automated roll-call and in-class quizzing or voting.  By dumping and analyzing its firmware, one can determine the radio protocol necessary to intercept and forge packets, as well as to build a custom base station.  The radio hardware that I have used is a reprogrammed &lt;a href="http://travisgoodspeed.blogspot.com/2010/06/hacking-next-hope-badge.html"&gt;Next HOPE Badge&lt;/a&gt; running the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; firmware.&lt;br /&gt;&lt;br /&gt;A follow-up article will likely describe the writing of replacement firmware, but that can be easily enough discovered by an enterprising reader.  My purpose instead is to provide the information necessary to build compatible products, as well as to teach the technique of reverse engineering these products to find such information when none is available.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Disassembly&lt;/h3&gt;&lt;br /&gt;The Clicker's keypad is attached only with adhesive, and it can be pulled off after lifting an edge with a knife blade.  Beneath the keypad, there are four screws holding the board in place, plus a fifth from the rear of the device.  If you are lucky, these will be small Phillips screws, but the unlucky will find tri-wing "Nintendo" screws.  I was lucky to have one of each type, but those with neither a Phillips-screwed Clicker nor a tri-wing screwdriver can &lt;a href="http://www.dealextreme.com/details.dx/sku.1887"&gt;buy one&lt;/a&gt; or try one of &lt;a href="http://www.mmmonkey.co.uk/console/other/diy-gamebit.htm"&gt;these tricks&lt;/a&gt;.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4759210205/" title="Devil Screws by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4099/4759210205_560c334bbf.jpg" width="500" height="375" alt="Devil Screws"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In either case, it isn't strictly necessary to open your clicker, as test-points for dumping and replacing its firmware are accessible from the battery compartment.  Further, the radio communications are accessible with no hardware access whatsoever.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Hardware&lt;/h3&gt;&lt;br /&gt;The Clicker is built upon a &lt;a href="http://www.nordicsemi.com/index.cfm?obj=product&amp;amp;act=display&amp;amp;pro=79"&gt;Nordic nRF24E1&lt;/a&gt; chip, which combines an 8051 microcontroller with an &lt;a href="http://www.nordicsemi.com/index.cfm?obj=product&amp;amp;act=display&amp;amp;pro=64"&gt;nRF2401&lt;/a&gt; radio transceiver.  Although the two cores have been combined into a single package, the 8051 core speaks to the radio through a few bit-field registers and an internal SPI bus, which is shared with the external SPI bus.&lt;br /&gt;&lt;br /&gt;As the nRF24E1 lacks internal non-volatile storage, a &lt;a href="http://www.datasheetcatalog.org/datasheet/catalystsemiconductor/25C64.pdf"&gt;CAT25C32 (pdf)&lt;/a&gt; SPI EEPROM is used for program and configuration storage.  Within the microcontroller, there is a masked ROM bootloader from 8000h to 81FFh that loads executable code from the EEPROM into executable RAM from 0000h to 0FFFh.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4759210329/" title="Hacked Clicker Board by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4122/4759210329_c79c51be04.jpg" width="375" height="500" alt="Hacked Clicker Board"&gt;&lt;/a&gt;&lt;br /&gt;&lt;h3&gt;Dumping Firmware&lt;/h3&gt;&lt;br /&gt;At the base of the circuit board's primary side, there are test points for the SPI EEPROM.  As the default firmware only uses the SPI bus when buttons are pressed, this EEPROM may be dumped at any point after the device has booted.  The test points are as follows, which should be matched to those of equivalent names in the &lt;a href="http://goodfet.sourceforge.net/apps/spi/"&gt;GoodFET SPI Table&lt;/a&gt;.  They were determined by use of a continuity tester.&lt;table style="width: 120px; height: 160px;" border="1"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;T4&lt;/td&gt;&lt;td&gt;MISO&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;T5&lt;/td&gt;&lt;td&gt;SCK&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;T6&lt;/td&gt;&lt;td&gt;MOSI&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;T3&lt;/td&gt;&lt;td&gt;!CS&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;T1&lt;/td&gt;&lt;td&gt;VCC&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;GND&lt;/td&gt;&lt;td&gt;GND&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;In order to dump the firmware, I quickly wrote a &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; client for the 25C32 using its datasheet.  A read is performed by sending {0x02, AL, AH, 0} as a SPI transaction, with the result coming back as the fourth byte.  Doing it this way with the GoodFET's SPI driver is slower than having C code within the GoodFET dump the whole ROM, but it's fast enough for a dump and takes very little code.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749964096/" title="Quick and Dirty 25C32 Driver by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4135/4749964096_011e7d59c0.jpg" width="483" height="185" alt="Quick and Dirty 25C32 Driver"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;From this point, I dumped the firmware with 'goodfet.spi25c dump image.hex', converted the Intel Hex file to binary, and popped it open in Emacs/hexl.  The result looks something like the following, whose format is described in the nRF24E1 datasheet.  The opening passage is {u8 config, u8 entry offset, u8 blockcount}.  Here {0x0B, 0x07, 0x0B} means that executable code begins at byte 0x07, and that the total image length is 0x0B*256==2,816 bytes.  (Additional space within the SPI ROM is unused and left as 0xFF.)&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4747979687/" title="Clicker ROM by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4123/4747979687_40f4297fc0.jpg" width="350" height="86" alt="Clicker ROM"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To produce an image suitable for a disassembler, I cut the bytes before 0x07 to make an image beginning with {0x02, 0x0A, 0xB7, ...}.  The extra bytes in this region are the serial number and default frequency, but we'll get back to that later.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4756729850/" title="Clicker Dev Kit by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4121/4756729850_b0896e7a4b.jpg" width="500" height="375" alt="Clicker Dev Kit"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Firmware Analysis&lt;/h3&gt;&lt;br /&gt;As the firmware is only three kilobytes, it doesn't take terribly long to reverse engineer.  First, the Special Function Registers (SFR) which are defined on pages 79 and 81 of the nRF24E1 datasheet are fed to the disassembler.&lt;br /&gt;&lt;br /&gt;(I'm using IDA Pro here, but any 8051 disassembler with a decent text editor could suffice.  All of the following function labels are from my imagination, while Special Function Registers (SFRs) come from the nRF24E1 datasheet.)&lt;br /&gt;&lt;br /&gt;For example, "MOV 0xA0, #0x80" is rather opaque, but "MOV RADIO, #0x80" makes it clear that the immediate value 0x80 is being placed into the RADIO register.  Page 89 of the datasheet will then explain that the high bit of the radio register is power control, so this instruction is powering up the radio for use.  Similarly, "SETB RADIO.3" is setting the fourth bit of the RADIO register, which the datasheet describes as raising the CS signal.&lt;br /&gt;&lt;br /&gt;Once the SFR addresses are known, it becomes useful to search for them in order to identify the I/O routines.  In the nRF24E1, the radio is accessed across a SPI bus, so a good first step is to identify the SPI routine.  The function containing this code will always include a MOV involving the SPI_DATA register.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4750053432/" title="SPIRXTX for 8051 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4138/4750053432_611d1cf9da.jpg" width="500" height="331" alt="SPIRXTX for 8051"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Having this, a list of cross-references quickly shows that while few functions call the SPIRXTX function, each calls it many times.  This is because the author has chosen to repeatedly call that function with immediate values, rather than to dump an array of bytes with a for(){} loop.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749434693/" title="Functions calling SPITXRX by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4074/4749434693_c4ae19b109.jpg" width="361" height="500" alt="Functions calling SPITXRX"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;While the disassembler can automatically identify the function entry points in the table above, it is not capable of giving them English names or descriptions.  To understand how this is done, it is necessary to read the datasheets of the SPI devices.&lt;br /&gt;&lt;br /&gt;The SPI EEPROM chip, a CAT25C32, is used by dropping the !CS line then writing an opcode byte followed by its parameters or results.  Opcodes include WREN/WRDI for write protection, RDSR/WRSR for accessing a status register, and READ/WRITE for reading and writing bytes.  A WRITE may only be performed when the external !WP pin is low and the software write protect has been disabled by opcode.  A transaction begins when !CS drops low and ends when it drops high.&lt;br /&gt;&lt;br /&gt;To identify the function which reads a byte from the 25C32, a few things can be safely assumed: (1) The function will begin by dropping some I/O pin (!CS).  (2) The function will then broadcast the READ opcode, 0x03.  (3) It will then broadcast a sixteen bit parameter; that is, DPL followed by DPH.  (4) Finally, it will return the result of a fourth SPIRXTX call.  In pseudocode, that would be something like&lt;br /&gt;&lt;pre&gt;SPIROMPEEK(u16 ADR){&lt;br /&gt;  SPIRXTX(0x03);&lt;br /&gt;  SPIRXTX(ADRL);&lt;br /&gt;  SPIRXTX(ADRH);&lt;br /&gt;  return SPIRXTX();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Sure enough, one of the few functions calling SPIRXTX does exactly this.  The constant pushing and popping of the parameters is a quirk of the compiler, which might possibly allow it to be identified.  From the code below, it is clear that P0.0 is the !CS line of the CAT25C32.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749507983/" title="SPIROMPEEK by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4093/4749507983_f4ee298a0e.jpg" width="159" height="442" alt="SPIROMPEEK"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The SPIROMPOKE function looks similar, except that two transactions are performed.  First the WREN (0x06) opcode is sent to enable writing, then WRITE (0x02) is used to perform the actual write.&lt;br /&gt;&lt;br /&gt;The other SPI operations concern the nRF2401 radio core, which behaves differently from the EEPROM.  Rather than transactions being an opcode followed by parameters, there is only a single SPI register that must be completely written during a transaction.  A second register, selected by the CE line, contains the packets.&lt;br /&gt;&lt;br /&gt;The configuration is set by one big register, sent MSBit first.  If fewer than the needed bytes are sent, the value is right-aligned into the lower bytes of the register.  That is, the last byte sent is always (CHAN&lt;&lt;1)|RXMODE and the second to last always describes the radio configuration.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749548595/" title="nRF2401 Config Register by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4134/4749548595_7c36aafede.jpg" width="500" height="474" alt="nRF2401 Config Register"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Searching around a bit yields the RADIOWRCONFIG function, the tail of which is below.  It can be seen from the code that the 0x1A IRAM byte holds the channel number.  That is, if 0x20 is stored at 0x1A, the radio will be configured to 2,432 MHz.  The other configuration bytes reveal that the MAC addresses are 24 bits, the checksum is 16 bits, and the device broadcasts at maximum power sourced from a 16MHz crystal.  (That the configured crystal is identical to the one on the board is very important.  Some enterprising coders will lie to a chip about its crystal in order to access an unsupported radio frequency.)&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4750232304/" title="Clicker RF Config by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4119/4750232304_a2bcc94ab8.jpg" width="500" height="181" alt="Clicker RF Config"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At this point, it still remains to sniff traffic is to find the target address to which packets are broadcast as well as the frequency.  We'll start with the address, because that's a bit easier.&lt;br /&gt;&lt;br /&gt;The TXPACKET function involves a lot of PUSH and POP instructions, but it otherwise looks very similar to the RADIOWRCONFIG function, in that a series of bytes are written in order with repeated function calls to SPIRXTX.  In pseudocode, this function becomes the following.  From the radio documentation and configuration, it is clear that the first three bytes will be the target MAC address.  From the RADIOWRCONFIG() function, it is equally clear that the three bytes at 0x1B are the receiving MAC address of the unit.  (The parameter of the function happens to be the button press, as can be determined by tracking the keyboard I/O routines or viewing a few packets.)&lt;br /&gt;&lt;pre&gt;void TXPACKET(u8 button){&lt;br /&gt;  RADIOHOP(); //set channel&lt;br /&gt;  &lt;br /&gt;  //Target MAC address&lt;br /&gt;  SPIRXTX(&amp;0x1E);&lt;br /&gt;  SPIRXTX(&amp;0x1F);&lt;br /&gt;  SPIRXTX(&amp;0x20);&lt;br /&gt;  &lt;br /&gt;  //Source MAC address&lt;br /&gt;  SPIRXTX(&amp;0x1B);&lt;br /&gt;  SPIRXTX(&amp;0x1C);&lt;br /&gt;  SPIRXTX(&amp;0x1D);&lt;br /&gt;  &lt;br /&gt;  //Data value&lt;br /&gt;  SPIRXTX(button);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;The radio itself will append a 16-bit CRC; therefore, the full packet then becomes {u24 tmac, u24 smac, u8 button}.&lt;br /&gt;&lt;br /&gt;To determine the value of the target MAC address, just grep the disassembly for "mov" and one of 0x1E, 0x1F, 0x20.  The relevant instructions are as follows, setting the target MAC address to 0x123456.  (In 8051 notation, the first instruction moves the immediate constant #0x12 into byte 0x1E of IRAM.)&lt;pre&gt;mov 0x1E, #0x12&lt;br /&gt;mov 0x1F, #0x34&lt;br /&gt;mov 0x20, #0x56&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As this point, it would be possible to scan each channel for a few seconds, listening for packets sent to that address, but it's classier to find the value by static analysis.  Acting on the hunch that the configuration is held in EEPROM and looking for references to the SPIROMPEEK() function, the READIDFREQ() function can be found.  As can be seen in the fragment below, EEPROM[6] holds the channel number while the MAC address is at EEPROM[3,4,5].&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749663793/" title="Clicker Config by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4093/4749663793_e21e2a4c7c.jpg" width="500" height="304" alt="Clicker Config"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As the EEPROM begins with "0b 07 0b &lt;b&gt;15 79 1b 29&lt;/b&gt;", it's clear that the MAC address of the unit from which it came is 0x15791B and that it is broadcasting on 2400+0x29=2441MHz.  This can be double-checked by the serial number "15791B" being printed on the label.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Implementation&lt;/h3&gt;&lt;br /&gt;Knowing the modulation scheme, target address, and packet contents, it becomes possible to sniff traffic from a Clicker.  This is performed by use of the GoodFET firmware on a Next Hope badge, my &lt;a href="http://travisgoodspeed.blogspot.com/2010/06/hacking-next-hope-badge.html"&gt;prior tutorial&lt;/a&gt; for which describes the process of packet sniffing.&lt;br /&gt;&lt;br /&gt;The NHBadge board contains an &lt;a href="http://www.nordicsemi.com/index.cfm?obj=product&amp;act=display&amp;pro=89"&gt;nRF24L01+&lt;/a&gt; radio, which differs dramatically from the nRF2401 in terms of how it is configured.  Still, the radios are sufficiently compatible.  The following hack of the goodfet.nrf client allows packets to be sniffed from the air with proper checksumming.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749714857/" title="Sniffing TurningPoint Traffic by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4115/4749714857_4017a0df30.jpg" width="499" height="373" alt="Sniffing TurningPoint Traffic"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sure enough, here are some packets of the 5 button being pressed on unit 1F8760.  The keypress is the final byte in ASCII.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4749724547/" title="Clicker Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4093/4749724547_83f3ef94d4.jpg" width="255" height="157" alt="Clicker Sniffing"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Response Codes&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Now that it is clear how to receive and recognize button presses, it becomes necessary to reverse engineer the response codes which might be sent from the access point.  Without hearing a reply of at least an ACK, the Clicker will continue to broadcast each message more than three hundred times.  This takes more than ten seconds, during which all other key presses are ignored.&lt;br /&gt;&lt;br /&gt;The broadcast loop within the MAIN() function would look a little like this in C.&lt;br /&gt;&lt;pre&gt;for(count=0;count&amp;lt; MAXCOUNT &amp;&amp; !reply;count++){&lt;br /&gt;  TXPACKET(button);&lt;br /&gt;  reply=RADIORX();&lt;br /&gt;}&lt;br /&gt;switch(reply){...}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This region is easy enough to find, but there's another command mode.  An easier target is the channel hopping routine, which constantly broadcasts 0x3F while incrementing the channel, sticking with the last one on which a reply of 0x18 was received.  Channels 1 through 83 are attempted; that is, 2,401 MHz to 2,483MHz at 1MHz steps.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4752399709/" title="Clicker SYN/ACK by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4121/4752399709_a0c292105c.jpg" width="395" height="314" alt="Clicker SYN/ACK"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Checking this code within the MAIN() function reveals that its effect is to blink the green LED (P1.1) six times, exiting the broadcast loop.  Other commands include 0x04 (LED Off), 0x06 (LED Green), 0x15 (LED Red), 0x11 (Blink Green), 0x14 (Blink Red), and 0x18 (Blink Green, Channel Lock).  All undefined opcodes set the red LED.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusions&lt;/h3&gt;&lt;br /&gt;By sniffing traffic within a classroom, it is possible to watch votes as they are being cast by students.  Similarly, packets could be broadcast by a reprogrammed Clicker or NHBadge to make a student in virtual attendance, automatically voting with the majority so as to gain perfect attendance and a solid C quiz average.  Where instant feedback is available, this might even allow for a solid A quiz average.  Without taking advantage of the masked-ROM option of the nRF24E1, the code cannot be even slightly protected from extraction and reverse engineering.&lt;br /&gt;&lt;br /&gt;Less adventurous users can jam the network by running 'goodfet.nrf carrier 2441000000' to hold a carrier wave on the channel.  The only attempt at a frequency change is made when pressing the GO button, at which point the new channel can be discovered and similarly jammed.&lt;br /&gt;&lt;br /&gt;Since performing this work, it has come to my attention that a USRP plugin for doing this to the competing 900MHz iClicker product is available as &lt;a href="http://gr-clicker.sourceforge.net/"&gt;http://gr-clicker.sourceforge.net/&lt;/a&gt;.  Additionally, the infrared Clicker units were broken with a little tool called &lt;a href="http://midnightresearch.com/projects/surveysays/"&gt;Survey Says&lt;/a&gt;.  I have ordered more sophisticated Clicker models from CPS and Turning Point, and proper descriptions of them will soon follow.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-998309728874572901?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/998309728874572901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=998309728874572901' title='31 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/998309728874572901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/998309728874572901'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/07/reversing-rf-clicker.html' title='Reversing an RF Clicker'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4079/4747156868_867d3e6c09_t.jpg' height='72' width='72'/><thr:total>31</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7900303584132007813</id><published>2010-06-10T23:12:00.035-04:00</published><updated>2010-10-08T11:30:00.495-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='nrf24l01+'/><category scheme='http://www.blogger.com/atom/ns#' term='openbeacon'/><category scheme='http://www.blogger.com/atom/ns#' term='hope'/><title type='text'>Hacking the Next Hope Badge</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4746123271/" title="NHBadge by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4093/4746123271_7888160588.jpg" width="500" height="375" alt="NHBadge" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In just less than a month, the &lt;a href="http://thenexthope.net/"&gt;Next Hope&lt;/a&gt; conference will bring a few thousand neighbors to Manhattan's Hotel Pennsylvania to share all sorts of neighborly ideas.  The following are some notes that will help enterprising neighbors to hack these badges, which will be running an MSP430 port of the &lt;a href="http://www.openbeacon.org/"&gt;OpenBeacon&lt;/a&gt; firmware.  These badges are active RFID tags which beacon the position of each attendee a few times a second, so that the god damned devil army of lies--by which I mean the Next Hope badge committee--can track each attendee around the Hotel Pennsylvania.  A second part will continue just before the conference begins, but I hope that this will provide sufficient food for thought.&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://amd.hope.net/"&gt;http://amd.hope.net/&lt;/a&gt; for a nice little video explaining the purpose of the project as a whole.  Those who do not wish to broadcast their positions can remove batteries or reprogram them, but to be thorough, they should turn off their &lt;a href="http://www.theregister.co.uk/2010/04/22/gsm_info_disclosure_hack/"&gt;cellular phones&lt;/a&gt; as well.&lt;br /&gt;&lt;br /&gt;A public HTTP API for querying the badge database is defined in the &lt;a href="http://amd.hope.net/openamd_api_1.1.1.html"&gt;OpenAMD API Manual&lt;/a&gt;, and a server should be available for beta testing before the conference begins.  For example, to find the location of user 31337, the client will fetch &lt;i&gt;/api/location?user=31337&lt;/i&gt; then look at the X, Y, and Location fields to determine the users position.  As for this article, I will stick the badge hardware, its design, and all sorts of neighborly and malicious things that may be done with it or to it.  Little mention will be made of the higher levels of the stack, as those are not my specialty.&lt;br /&gt;&lt;br /&gt;Also, in order to keep things fun, I reserve the right to lie about any and all technical details of the badge, its operation, or its security mechanisms.  This document by no means complete, and there are still plenty of secrets to find.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Badge Hardware, Usage&lt;/h3&gt;&lt;br /&gt;The badges themselves are built from an &lt;a href="http://focus.ti.com/docs/prod/folders/print/msp430f2618.html"&gt;MSP430F2618&lt;/a&gt; or &lt;a href="http://focus.ti.com/docs/prod/folders/print/msp430f2418.html"&gt;MSP430F2418&lt;/a&gt; microcontroller, as well as an &lt;a href="http://www.nordicsemi.com/index.cfm?obj=product&amp;act=display&amp;pro=94"&gt;NRF24L01+&lt;/a&gt; 2.4GHz radio.  The MSP430 chips were kindly donated by Texas Instruments, and replace the energy guzzling PIC chips of yesteryear.  Further, they've got a great C compiler and bootloader, so you cannot brick them no matter how bone-headed your replacement firmware might become.&lt;br /&gt;&lt;br /&gt;The back of the badge consists of just a battery clip, but it can optionally be populated with an SSOP28 FT232RL USB to Serial adapter an a mini-USB plug.  This USB port then allows for replacement firmware to be loaded, as well as a high-speed serial link to that firmware.  Kits will be available containing the parts necessary for this, though you should expect them to sell out quickly.&lt;br /&gt;&lt;br /&gt;For the schematic, grab the full-res version of this image.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4721793596/" title="NHBadge 12 Schematic by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1044/4721793596_0124ab7908.jpg" width="478" height="500" alt="NHBadge 12 Schematic" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The layout, for the moment, is private, but you can expect it to be similar to the following cropped image of the prototype.  Badges will come in Blue for attendees, Green for speakers, and Red for goons, with prototypes having a white silkscreen.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4721369041/" title="NHBadge10, Cropped by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1129/4721369041_68c50d3a77.jpg" width="500" height="286" alt="NHBadge10, Cropped" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;GoodFET Firmware&lt;/h3&gt;&lt;br /&gt;When the badges have been flashed with the &lt;a href="http://goodfet.sf.net/"&gt;GoodFET&lt;/a&gt; firmware, a prebuilt radio client is available in the form of &lt;a href="http://goodfet.sourceforge.net/clients/goodfet.nrf/"&gt;goodfet.nrf&lt;/a&gt;.  For example, running 'goodfet.nrf sniffob' will sniff the OpenBeacon protocol, while 'goodfet.nrf carrier 2479000000' will place a carrier wave at 2.479 GHz, jamming any carrier-sensing radios on that frequency.&lt;br /&gt;&lt;br /&gt;The full Python scripting environment of the GoodFET is available to the NRF port, so it is easy to script this usage.  If you'd like to broadcast Morse code by turning the carrier on and off, you can do so without ever touching a C compiler.  The same goes for frequency hopping or packet sniffing, although some architectural limitations of the NRF24L01+ make sniffing difficult without knowing the first three bytes of the destination MAC address to be sniffed.&lt;br /&gt;&lt;br /&gt;This code is already committed to the mainstream GoodFET repository.  Here it is running on Windows XP, sniffing encrypted traffic from a Last Hope badge.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4634725972/" title="GFNRF.EXE by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3405/4634725972_b20d2fb650_o.png" width="671" height="332" alt="GFNRF.EXE" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Radio Configuration Extraction&lt;/h3&gt;&lt;br /&gt;The exact radio channel and addresses will be a surprise for the conference, but there's little harm in my showing you how to extract them from a running firmware image.&lt;br /&gt;&lt;br /&gt;Start with a virgin badge; that is, one which has not been reflashed.  Solder on a USB chip and connector, then perform the following &lt;b&gt;without disconnecting it from power&lt;/b&gt;.  The idea here is to replace the existing MSP430 firmware, then extract the contents of the radio's RAM which is not damaged by a reflashing of the MSP430.  It might help to have already tested an installation of the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; client, as you rebooting the host PC might cause the radio to lose its settings.&lt;br /&gt;&lt;br /&gt;First, reflash the badge with the goodfet firmware by running 'goodfet.bsl --fromweb' in Unix or 'gfbsl.exe -e -p goodfet.hex' in Windows.  Once this is complete, you can dump the radio settings by 'goodfet.nrf info'.  For a Last Hope badge which was dumped in a similar manner, the results were as follows.&lt;pre&gt;air-2% goodfet.nrf info&lt;br /&gt;Encoding GFSK&lt;br /&gt;Freq          2481 MHz&lt;br /&gt;Rate          2000 kbps&lt;br /&gt;PacketLen 16 bytes&lt;br /&gt;MacLen     5 bytes&lt;br /&gt;SMAC  0x424541434f&lt;br /&gt;TMAC  0x0102030201&lt;br /&gt;air-2% &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can get more detail by dumping all registers,&lt;pre&gt;air-2% goodfet.nrf regs&lt;br /&gt;r[0x00]=0x000000000a //          CONFIG&lt;br /&gt;r[0x01]=0x0000000000 //           EN_AA&lt;br /&gt;r[0x02]=0x0000000001 //       EN_RXADDR&lt;br /&gt;r[0x03]=0x0000000003 //        SETUP_AW&lt;br /&gt;r[0x04]=0x0000000003 //       SETUP_RET&lt;br /&gt;r[0x05]=0x0000000051 //           RF_CH&lt;br /&gt;r[0x06]=0x000000000f //        RF_SETUP&lt;br /&gt;r[0x07]=0x000000002e //          STATUS&lt;br /&gt;r[0x08]=0x0000000000 //      OBSERVE_TX&lt;br /&gt;r[0x09]=0x0000000000 //             RPD&lt;br /&gt;r[0x0a]=0x424541434f //      RX_ADDR_P0&lt;br /&gt;r[0x0b]=0xc2c2c2c2c2 //      RX_ADDR_P1&lt;br /&gt;r[0x0c]=0x00000000c3 //      RX_ADDR_P2&lt;br /&gt;r[0x0d]=0x00000000c4 //      RX_ADDR_P3&lt;br /&gt;r[0x0e]=0x00000000c5 //      RX_ADDR_P4&lt;br /&gt;r[0x0f]=0x00000000c6 //      RX_ADDR_P5&lt;br /&gt;r[0x10]=0x0102030201 //         TX_ADDR&lt;br /&gt;r[0x11]=0x0000000010 //        RX_PW_P0&lt;br /&gt;r[0x12]=0x0000000000 //        RX_PW_P1&lt;br /&gt;r[0x13]=0x0000000000 //        RX_PW_P2&lt;br /&gt;r[0x14]=0x0000000000 //        RX_PW_P3&lt;br /&gt;r[0x15]=0x0000000000 //        RX_PW_P4&lt;br /&gt;r[0x16]=0x0000000000 //        RX_PW_P5&lt;br /&gt;r[0x17]=0x0000000011 //     FIFO_STATUS&lt;br /&gt;r[0x18]=0x0000000000 //               ?&lt;br /&gt;r[0x19]=0x0000000000 //               ?&lt;br /&gt;r[0x1a]=0x0000000000 //               ?&lt;br /&gt;r[0x1b]=0x0000000000 //           DYNPD&lt;br /&gt;r[0x1c]=0x0000000000 //               ?&lt;br /&gt;r[0x1d]=0x0000000000 //               ?&lt;br /&gt;r[0x1e]=0x0000000000 //               ?&lt;br /&gt;r[0x1f]=0x0000000000 //               ?&lt;br /&gt;air-2%&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Sniffing traffic with the GoodFET firmware requires only that these same registers be loaded back into the NRF chip, and also that the MAC addresses be swapped.  That is, to sniff Last Hope badge traffic, you will want RX_ADDR_P0 to be 0x0102030201 rather than 0x424541434f.&lt;br /&gt;&lt;br /&gt;To perform this on a badge as prepared above, simply run the following.&lt;pre&gt;air-2% goodfet.nrf poke 0x0a 0x0102030201&lt;br /&gt;Poking 0a to become 0102030201.&lt;br /&gt;Poked to 102030201&lt;br /&gt;air-2% goodfet.nrf sniff&lt;br /&gt;Listening as 0102030201 on 2481 MHz&lt;br /&gt; dd 8f 4a 5b ff 7c bb 76 09 42 a6 ec 61 6f 9a db&lt;br /&gt; 90 bb 2f cd 06 81 e9 36 20 9c 4c 23 b3 10 6c c7&lt;br /&gt; 37 7a 37 c5 93 57 2b 24 6a 9d 9a 8b 3c 52 1c 23&lt;br /&gt; 56 a8 04 f5 a7 ed 26 0b 24 ec 39 9d 10 fb da 76&lt;br /&gt; ba b5 d0 5c 89 4d 1c 63 19 28 a1 9d 35 e6 7f a5&lt;br /&gt; ec 63 5f 60 b8 0f 1c bf 4c e6 af 93 c2 fe 93 ee&lt;br /&gt; ad fc a1 25 42 81 7a a1 28 a8 f5 21 4a 7a 55 af&lt;br /&gt; 79 42 5c 6d 38 ca 46 ab 1b 8c ab 90 ad 47 90 d1&lt;br /&gt; f6 9a 22 0d e4 37 19 b7 75 34 8d 4f f9 9c fd 2a&lt;br /&gt;^C&lt;br /&gt;air-2% &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Key Extraction&lt;/h3&gt;&lt;br /&gt;Concerning cryptography, the badges will have it, but that oughtn't stop you from having some fun.  Badges are XXTEA encrypted, with keys being published after each conference.  A list of old encryption keys can be found at &lt;a href="http://wiki.openbeacon.org/wiki/EncryptionKeys"&gt;http://wiki.openbeacon.org/wiki/EncryptionKeys&lt;/a&gt;, with the key for the above packets being {0x9c43725e,0xad8ec2ab,0x6ebad8db,0xf29c3638}.  Example decryption routines are plentiful within the OpenBeacon source repository.&lt;br /&gt;&lt;br /&gt;If the badges used more sophisticated radio chips, such as the SPI 802.15.4 chips, an AES128 key would be present within the radio to be read out.  Since this isn't the case, the key stays within Flash or RAM of the MSP430 microcontroller.&lt;br /&gt;&lt;br /&gt;Flash extraction requires that an attacker gain access to memory through the serial bootstrap loader (BSL) or through JTAG.  The BSL is protected by a password, one which might or might not be vulnerable to my &lt;a href="http://events.ccc.de/congress/2008/Fahrplan/events/2839.en.html"&gt;timing attack&lt;/a&gt;.  The timing attack is impossible to perform through the FTDI chip, so a second microcontroller must be wired up to the 0.1" serial port header.&lt;br /&gt;&lt;br /&gt;Additionally, it might be possible to extract the contents of Flash through the JTAG port through which these chips are initially programmed.  Unlike the bootloader, there is no password protection, but rather a security fuse which is blown to disable future access.&lt;br /&gt;&lt;br /&gt;RAM is not protected by the serial bootstrap loader, and you can extract it by first erasing the chip by 'goodfet.bsl -e', then dumping the contents of RAM to disk for later perusal.  Somewhere in this mess will be a copy of the XXTEA key, unless I took the time to ensure that is not copied into RAM at startup.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Packet Format&lt;/h3&gt;&lt;br /&gt;Once decrypted, packets look like the following.&lt;br /&gt;&lt;pre&gt; SZ PR FL ST SEQUENCENUM SOURCEIDXXX RESVD CRC16                                &lt;br /&gt; 10 17 00 ff 00 0a 6f a7 ff ff ff ff 00 00 e7 53                                &lt;br /&gt; 10 17 00 ff 00 0a 6f ab ff ff ff ff 00 00 b5 38                                &lt;br /&gt; 10 17 00 aa 00 0a 6f ae ff ff ff ff 00 00 54 79                                &lt;br /&gt; 10 17 00 ff 00 0a 6f b3 ff ff ff ff 00 00 11 ee                                &lt;br /&gt; 10 17 00 ff 00 0a 6f b7 ff ff ff ff 00 00 d0 28                                &lt;br /&gt; 10 17 00 aa 00 0a 6f ba ff ff ff ff 00 00 a2 c4&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Fields in order are Size, Protocol, Flags, Strength, Sequence, Serial Number, Reserved, and a CRC16 checksum.  The 8-bit Flags field indicates the bits of a capacitive multi-touch sensor, while the Reserved field has been co-opted for a secret project of mine.  The Source ID is the badge's serial number, which can be found on a sticker that is present on the badge.&lt;br /&gt;&lt;br /&gt;The sequence number is incremented for each packet while the last few bits of it determine the broadcast strength.  In this example, the badge is rather far from the reader, so all 00 and 55 strength packets are lost, while some AA and FF packets get through.  FF being stronger, more of its packets go through.  Comparing packet loss rates allows the aggregation server to determine badge positions.&lt;br /&gt;&lt;br /&gt;The received signal strength, RSSI, of each packet is not used in this calculation because it is rather primitive in the NRF24L01+, being only a single bit wide.  Competing chips, such as the CC2420, would allow this but only at a significant increase in unit cost.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Breakouts&lt;/h3&gt;&lt;br /&gt;To facilitate badge hacking, there are four breakout headers, all of which have standard 0.1" spacing.&lt;br /&gt;&lt;br /&gt;The first is a 14-pin MSP430 JTAG connector, the same used by the MSP430 FET UIF and the GoodFET.&lt;br /&gt;&lt;br /&gt;The second is a 6-pin BSL header, in the style of FTDI breakout boards from Sparkfun.  This has not been tested, and you had damned well better only use it at 3.3 volts.&lt;br /&gt;&lt;br /&gt;The third is a 7-pin breakout connector for the NRF24L01+ radio and SPI bus.  You might use it to add an additional SPI chip, such as a second radio or an LCD.  The pins are (1) GND, (2) CE, (3) !CS, (4) SCK, (5) MOSI, (6) MISO, and (7) !IRQ.  The !IRQ signal is only asserted by the NRF when configured to do so, so it might be coopted to act as a !CS pin for a second SPI device.&lt;br /&gt;&lt;br /&gt;The fourth and final header is an 8-pin breakout of Port 3 of the MSP430 microcontroller.  By default, it is used as a capacitive touch sensor, but it might also be used for any sort of I/O expansion.  In addition to GPIO, some hardware accelerated ports are available on this pins.  I'll leave you to the datasheet to figure them out.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Compatible Hardware&lt;/h3&gt;&lt;br /&gt;The &lt;a href="http://thisisant.com/"&gt;ANT&lt;/a&gt; wireless protocol can be implemented with the NRF24L01+ of this badge, though technical details on exactly how to do it are rather difficult to find.  I'd be much obliged if some neighbors brought ANT equipment to the conference for the rest of us to play with.&lt;br /&gt;&lt;br /&gt;Sparkfun offers a number of &lt;a href="http://www.sparkfun.com/commerce/advanced_search_result.php?keywords=nrf24l01&amp;x=0&amp;y=0&amp;search_section=products"&gt;NRF24L01&lt;/a&gt; modules, my favorite of which is a &lt;a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8602"&gt;Key Fob Remote&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Stay Tuned&lt;/h3&gt;&lt;br /&gt;These details should help you to spend more time hacking, and less time researching, during the conference.  A special prize will be given for the most original badge modification, with heavy credit going toward those of high technical caliber.  There are also some secrets to be found within the badges, so best to bring b&lt;br /&gt;&lt;br /&gt;I will be presenting this and a several more tricks as a lecture during the conference, entitled "Building and Breaking the Next Hope Badge" at 22h00 on Saturday, July 17th in the Tesla room.  There will also be a panel presentation entitled "The OpenAMD Project" at 18h00 on Friday, July 16th in the Lovelace room.  Both rooms are on the 18th floor.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-7900303584132007813?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/7900303584132007813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=7900303584132007813' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7900303584132007813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7900303584132007813'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/06/hacking-next-hope-badge.html' title='Hacking the Next Hope Badge'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4093/4746123271_7888160588_t.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-4200692190555673194</id><published>2010-04-26T15:13:00.010-04:00</published><updated>2010-04-27T01:37:35.086-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ptx'/><category scheme='http://www.blogger.com/atom/ns#' term='nvidia'/><category scheme='http://www.blogger.com/atom/ns#' term='cuda'/><title type='text'>CUDA PTX Extraction</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning CUDA 3.x on Darwin&lt;br /&gt;as the first of several CUDA articles.&lt;br /&gt;&lt;br /&gt;The following are some brief introductory notes on dumping PTX kernels from modern CUDA applications, as well as techniques for embedding them within new applications.  One or two copies of every shader are stored as ASCII strings within each CUDA executable by default.  With a little ingenuity, the contents of this article and a decent machine with a G80 card should provide a decent start in reverse engineering general-purpose GPU applications.&lt;br /&gt;&lt;br /&gt;Nvidia's CUDA framework for GPU computing uses a portable meta-assembly language, PTX (&lt;a href="http://developer.download.nvidia.com/compute/cuda/3_0/toolkit/docs/ptx_isa_2.0.pdf"&gt;ptx_isa_2.0.pdf&lt;/a&gt;), to facilitate translation between multiple GPU devices.  In this manner, they can escape the backward compatibility issues that hold most modern CPU architectures to a single instruction set.  PTX vaguely resembled the underlying machine code, but it lacks features which would tie it to any particular GPU.  In this brief article, I present a trivial method for extracting PTX assembly from CUDA applications, as well as some pointers for merging that code into new applications.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Dumping&lt;/h3&gt;&lt;br /&gt;The screenshot below shows a fragment of &lt;i&gt;libcublas.dylib&lt;/i&gt; from CUDA 3.0 in Snow Leopard being edited in Emacs.  Following the dozens of assembler directives are individual VM opcodes.  (This contains Basic Linear Algebra Subprograms.  As this comes from Fortran, not C, the code is a bit weird.)  By default, CUDA will compile inline code in a language similar to C into PTX assembly, then include the PTX assembly string verbatim into the resulting executable or library.  User comments are not preserved, but compiler comments are introduced and names are unaltered.  Except where hand-written, the compiler will always be nvopencc.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4555853142/" title="CUDA PTX Extraction by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3551/4555853142_23491d9ec6_o.png" width="498" height="275" alt="CUDA PTX Extraction" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The nvopencc compiler has a number of quirks when writing PTX:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Every line that is not a label is tabbed in at least once.&lt;/li&gt;&lt;li&gt;The first directive is .version, the second is .target.&lt;/li&gt;&lt;li&gt;Registers are declared in groups.&lt;/li&gt;&lt;li&gt;Names are preserved, with C++ mangling.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Further,&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Every PTX script ends with a null (0x00) byte.&lt;/li&gt;&lt;li&gt;While they can be big, no PTX script is larger than two megabytes.&lt;/li&gt;&lt;li&gt;PTX scripts come in pairs, one for sm_20 and another for sm_10.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;To dump the PTX code from a binary, Mach-O executable, just scan the input for long strings, printing everything starting with "\t.version".  In my own setup, I have an &lt;a href="http://pastebin.com/xuVsKBf4"&gt;ugly C program&lt;/a&gt; that prints these, passing them off to the unix &lt;i&gt;split&lt;/i&gt; command for separation into multiple PTX files.&lt;br /&gt;&lt;br /&gt;The 312 PTX scripts from CUBLAS are mostly small, with only nine of them having source in excess of a megabyte but none being larger than two megabytes.  Thus, you'll need a rather long string buffer.  Additionally, it is handy to purge the buffer when no fragment of a PTX executable is found and whenever a null byte is encountered.  You can find the PTX from the vectorAdd example at &lt;a href="http://pastebin.com/nqKqKhNc"&gt;http://pastebin.com/nqKqKhNc&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Applications can be compiled without PTX inclusion, using machine-language CUBIN files instead.  This has the disadvantage of not being forward-compatible, and thanks to Wladimir J. van der Laan's &lt;a href="http://wiki.github.com/laanwj/decuda/"&gt;Decuda&lt;/a&gt; project, it isn't much more difficult to read.&lt;br /&gt;&lt;br /&gt;To try this out yourself, first build a dumping script based upon the CUDA examples and libraries.  Once you have that, try downloading a few of the more advanced demos.  The  &lt;a href="http://www.nvidia.com/content/graphicsplus/us/download.asp"&gt;Nvidia Graphics Plus&lt;/a&gt; demos might be a good target, as would any game advertising CUDA support.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;PTX JIT&lt;/h3&gt;&lt;br /&gt;Having dumped a PTX script, it is handy to link it back into an existing project.  For this, you will want to use the matrixMulDynlinkJIT or ptxjit examples that come with the CUDA development kit.  These projects use the &lt;i&gt;cuModuleLoadDataEx()&lt;/i&gt; method to link a PTX script from a string, then &lt;i&gt;cuModuleGetFunction()&lt;/i&gt; to grab a CUfunction pointer to any function.&lt;br /&gt;&lt;br /&gt;Conveniently, the PTX scripts include symbol names, but as with any complex compiler, these have been somewhat mangled.  In the &lt;a href="http://pastebin.com/nqKqKhNc"&gt;addVector&lt;/a&gt; example, the entry point hask been mangled to _Z6VecAddPKfS0_Pfi for both sm_10 and sm_20.  It is this function name, and not the simpler VecAdd, that must be passed to &lt;i&gt;cuModuleGetFunction()&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;This is the code that the ptxjit example uses to load a kernel named _Z8myKernelPi kernel contained within the myPtx[] character array.  Looking at the string itself, which is defined within ptxjit.h, it can be seen that the code was rather hastily dumped by a method similar to the one I describe above.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4556441221/" title="PTX JIT by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3650/4556441221_35b7223c69_o.png" width="479" height="298" alt="PTX JIT" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4557112022/" title="myPtx from PTXJIT by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4067/4557112022_bfaa6f2397_o.png" width="287" height="170" alt="myPtx from PTXJIT" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Caveats&lt;/h3&gt;&lt;br /&gt;GPU programming is sufficiently confusing when source code is available that the lifting of code oughtn't be a concern.  Generally only small fragments are executed within the GPU, with the majority of development time being spent debugging those fragments and twisting them for different physical optimizations.&lt;br /&gt;&lt;br /&gt;Daniel Reynaud's talk on &lt;a href="http://indefinitestudies.files.wordpress.com/2008/12/gpgpu_slides1.pdf"&gt;GPU Powered Malware&lt;/a&gt; at Ruxcon 2008 proposed that GPU programs might be useful for malware URL generation.  It goes without saying that sophisticated malware will do better than to include an unencoded ASCII string.  Pre-assembled bytecode can be provided directly to the card, avoiding the inclusion of a PTX string.  While some of Reynaud's points are less relevant now that CUDA has debugging and bytecode emulation, the core of his argument that GPU packers will become important is still valid.  For starters, it is possible use a pegged memory segment to have GPU code rewrite host X86 code on the fly without a context switch!&lt;br /&gt;&lt;br /&gt;Expect some follow-up articles on the neighborly things that can be done once your hands are inside the beast that is CUDA.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-4200692190555673194?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/4200692190555673194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=4200692190555673194' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4200692190555673194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4200692190555673194'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/04/cuda-ptx-extraction.html' title='CUDA PTX Extraction'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-925085275586085216</id><published>2010-03-24T06:39:00.002-04:00</published><updated>2010-03-24T06:44:41.782-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ember'/><category scheme='http://www.blogger.com/atom/ns#' term='zstack'/><category scheme='http://www.blogger.com/atom/ns#' term='smartgrid'/><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='ami'/><category scheme='http://www.blogger.com/atom/ns#' term='errata'/><title type='text'>Smartgrid Skunkworks</title><content type='html'>Dearest engineers and hackers, and also their management,&lt;br /&gt;&lt;br /&gt;Recent vulnerabilities found in smart meters and HAN devices have shown a number of weaknesses in the engineering practices used to build these devices and their constituent components.  A vulnerability in a chip or library is fixed slowly, and it is a very rare event that the meter and thermostat vendors affected by the vulnerability are notified by their suppliers.  Because of this, vulnerabilities are spreading downward through the supply chain, and the engineers of smart grid devices are left uninformed.&lt;br /&gt;&lt;br /&gt;While those utilities that actively investigate security have a considerable amount of bargaining power with their immediate suppliers, the rest of the supply chain has no similar leverage to compel security notifications.  Chip and library vendors are failing to notify the meter vendors that depend upon their components.  Even when the meter vendors are notified directly of vulnerabilities, thermostat and other HAN vendors can have no realistic expectation of such a privilege.&lt;br /&gt;&lt;br /&gt;Despite having found many vulnerabilities in microcontrollers and LPAN radio chips, I have never seen one single security issue mentioned in the errata sheets of these devices.  It has been a year since I first reported to Texas Instruments that the RAM of their Chipcon 8051 core is exposed to an attacker, but there's not one scrap of documentation from the firm to its customers suggesting that they make the simple patch of moving the key variables to Flash memory.  The example ZigBee stack for the chip is still vulnerable to this attack, even after recent patches!  A year later, exactly two debugger commands are all that are required to extract keys from nearly every ZigBee SEP device with a Chipcon radio, and no one knows to patch their code!  (Do not be smug if you are an Ember customer.  The EM2xx chips are unpatchably vulnerable to debugger key extraction, and there is no mention of this in the chip's errata sheet either.)&lt;br /&gt;&lt;br /&gt;As chip and library vendors have failed to document the publicly known vulnerabilities in their products, and as they have often been unable or unwilling to repair them, the most expedient remedy to this problem is a separate line of communication.  At least one point of reference must exist for the engineers trying to build these products.&lt;br /&gt;&lt;br /&gt;For these reasons, I have created a skunkworks mailing list for the announcement and discussion of smart grid vulnerabilities, particularly but not exclusively those in AMI equipment.  This is to be a list for engineering discussion, by engineers and security researchers.  Anonymous posts and lurking are welcome, but politics and committee items are not.&lt;br /&gt;&lt;br /&gt;For this reason, I especially request that those firms which care about security ask--or perhaps even require--their engineering staff to subscribe.  This list is the appropriate place to post questions concerning the secure use of a particular radio chip, fragment of code, or anything else which is too low level or vendor-specific to be mentioned in standards.&lt;br /&gt;&lt;br /&gt;If your firm is unwilling to allow its engineers to post, please at least compel them to follow the posts of others.  In saying nothing, they will still learn how to make more secure products along with all sorts of fascinating gossip about your competitors.  Your firm has every right to keep its mouth shut, but keeping its ears shut is a betrayal of each and every one of your customers.&lt;br /&gt;&lt;br /&gt;To kickstart this mailing list, I will make it my first site of public disclosure for smart grid vulnerabilities over the coming months.  The subscription link is below, and I invite you to join me in preventing smart grid vulnerabilities before they are created.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://groups.google.com/group/smartgrid-skunkworks"&gt;http://groups.google.com/group/smartgrid-skunkworks&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thank you kindly,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;Belt Buckle Engineer&lt;br /&gt;Security Hobbyist&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-925085275586085216?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/925085275586085216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=925085275586085216' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/925085275586085216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/925085275586085216'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/03/smartgrid-skunkworks.html' title='Smartgrid Skunkworks'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-8883722612591163969</id><published>2010-03-09T21:11:00.002-05:00</published><updated>2011-09-04T10:30:17.929-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='imme'/><category scheme='http://www.blogger.com/atom/ns#' term='cc1110'/><title type='text'>IM ME GoodFET Wiring Tutorial</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning the Girltech IM ME,&lt;br /&gt;with a million thanks to &lt;a href="http://daveshacks.blogspot.com/"&gt;Dave&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WARNING: Reflashing the CC1110 while batteries are low will permanently lock the chip.  Either be damned sure to use fresh batteries or leave the batteries out and power the IMME from your GoodFET.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Howdy y'all,&lt;br /&gt;&lt;br /&gt;This brief tutorial describes the process of reflashing the &lt;a href="http://www.girltech.com/electronics-imMe.aspx"&gt;Girltech IM ME&lt;/a&gt; with custom firmware, so that it may be used as a development platform for the &lt;a href="http://focus.ti.com/docs/prod/folders/print/cc1110f32.html"&gt;Chipcon CC1110&lt;/a&gt; sub-GHz ISM System-on-Chip.  I assume the reader to have an assembled &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; with recent firmware, but other programmers may of course be substituted.&lt;br /&gt;&lt;br /&gt;You should also read Dave's &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-hacking.html"&gt;first article&lt;/a&gt; on IM ME hacking, as it describes his method for reprogramming the device.  All the pinouts below were taken from his articles, as well as the keyboard and LCD information that he was so neighborly as to publish.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Wiring&lt;/h3&gt;&lt;br /&gt;First, you'll need to purchase an IM ME, which can be had for $20 USD on a few toy sites while it remains in stock.  You'll also need an assembled &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; and basic electronics tools.&lt;br /&gt;&lt;br /&gt;The testpoints used for programming the IM ME are located behind the batteries in the rear compartment of the device.  Ideally, a bed of nails should be used to clip into it, but failing that, just solder on to the Debug Data (DD), Debug Clock (DC), Reset (!RST), and GND pins.  Run these to the GoodFET's 14-pin header as shown below.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4322361457/" title="Testpoints by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4041/4322361457_5279ec0d1c_m.jpg" alt="Testpoints" height="180" width="240" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4323095748/" title="Exposed Testpoints by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2720/4323095748_a68b41993e_m.jpg" alt="Exposed Testpoints" height="180" width="240" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;From left to right on the IM ME, the pins are !RST, DD, DC, +2.5V, and Ground.  Because the GoodFET is a low-voltage device, there's no need for the resistor dividers in Dave's article.  Use &lt;i&gt;EITHER&lt;/i&gt; the GoodFET &lt;i&gt;OR&lt;/i&gt; the batteries for VCC, but not both.&lt;br /&gt;&lt;table style="width: 180px; height: 210px;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Pin&lt;/th&gt;&lt;th&gt;&lt;br /&gt;&lt;/th&gt;&lt;th&gt;Name&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DD&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Vcc&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;Vcc&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RST&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DC&lt;/td&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;GND&lt;/td&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;14&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Flashing&lt;/h3&gt;&lt;br /&gt;Once you have the IM ME wired up, you can check its model number and status by running `goodfet.cc status'.  This will tell you that the chip is locked, so making a backup of its firmware is non-trivial.  If you continue from here, the IM ME will no longer function as an instant messenger.&lt;br /&gt;&lt;br /&gt;Erase the chip by 'goodfet.cc erase' then dump an image of RAM as 'goodfet.cc dumpdata immeram.hex' to see if anything neighborly can be found inside.&lt;br /&gt;&lt;br /&gt;You now have a blank IM ME, with the LCD most likely showing the last gasping breaths of its firmware.  To flash a new firmware image, just grab its ihex file and run 'goodfet.cc flash foo.hex'.&lt;br /&gt;&lt;br /&gt;I've placed a few example binaries in the repository of an operating system that I've started for the IM ME called GoodME.  To flash &lt;a href="http://daveshacks.blogspot.com/2010/01/im-me-lcd-interface-hacked.html"&gt;Dave's LCD Test&lt;/a&gt;, run the following commands.&lt;br /&gt;&lt;i&gt;svn co https://goodfet.svn.sourceforge.net/svnroot/goodme&lt;br /&gt;goodfet.cc flash goodme/bins/dave-lcdtest.hex&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;For a more functional demo, try &lt;i&gt;bins/term-morse824mhz.hex&lt;/i&gt;, an ugly hack of an operating system for the IM ME with a Morse code transmitter and random number generator demo.  In the Radio demo, holding any of the letter buttons broadcasts on 824MHz.  The PRNG demo, shown below, demonstrates the repetition of strings withing the psuedo-random number generator and counts the number of bytes between them.  This is sometimes used for &lt;a href="http://travisgoodspeed.blogspot.com/2009/12/prng-vulnerability-of-z-stack-zigbee.html"&gt;key material&lt;/a&gt;.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4323097176/" title="CC RNG Test by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4063/4323097176_11d1d5a8b0_m.jpg" width="240" height="180" alt="CC RNG Test" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Custom Development&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://sdcc.sourceforge.net/"&gt;SDCC&lt;/a&gt; compiler is in the package repositories of most civilized operating systems.  You might need a more recent version for the cc1110.h header, though building this compiler is a thousand times simpler than GCC.  Compiling an example is as simple as &lt;i&gt;sdcc foo.c; packihx &amp;lt;foo.ihx &amp;gt;foo.hex&lt;/i&gt;, which will produce a suitable Intel Hex file for flashing.  The 8051 memory model makes specifying a chip model unnecessary, a handy deviation from those of us with a thousand MSP430 linking scripts.&lt;br /&gt;&lt;br /&gt;Within the GoodME repository, you'll find my bastard child of an operating system at /branches/rough/.  It was used to make the term-morse824mhz.hex, and its keyboard, font, and LCD drivers are ripe for organ transplants.  /trunk/ ought to someday contain a proper operating system for the device, but for now, I haven't the time to complete it.&lt;br /&gt;&lt;br /&gt;Have fun, and build something neighborly,&lt;br /&gt;--Travis&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-8883722612591163969?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/8883722612591163969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=8883722612591163969' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/8883722612591163969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/8883722612591163969'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/03/im-me-goodfet-wiring-tutorial.html' title='IM ME GoodFET Wiring Tutorial'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4041/4322361457_5279ec0d1c_t.jpg' height='72' width='72'/><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1279427795202646719</id><published>2010-02-21T19:12:00.022-05:00</published><updated>2010-02-26T15:38:21.037-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='zigbee'/><category scheme='http://www.blogger.com/atom/ns#' term='cc1110'/><title type='text'>XML of SmartRF Studio 7</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/smartrftm-studio.html"&gt;TI SmartRF Studio 7&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For those who have not personally suffered the experience, choosing radio register values is an absolute pain.  In this brief article, I will demonstrate a method for extracting settings in bulk from SmartRF 7 Studio for use in other projects.&lt;br /&gt;&lt;br /&gt;Suppose that a program should configure a CC1110 to operate on a particular frequency, in a particular encoding, etc.  The code will like the following, which is from the CC1110 examples.  This will generate a carrier wave near 823 MHz, as the 2.433GHz FREQ[] value is outside of the allowed range.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4387813979/" title="Chipcon Settings by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4024/4387813979_333a64a769_o.png" width="493" height="510" alt="Chipcon Settings" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To choose a different center frequency, the engineer is expected to either find the register's definition within the datasheet or use SmartRF Studio, a screenshot of which is below.  The software is a  Windows application for communicating with a radio through a serial port.  It also allows an engineer to load preconfigured profiles for certain types of modulation, such as IEEE 802.15.4 or SimpliciTI.  Once loaded, the settings may be tweaked and loaded into a packet-sniffer firmware for debugging projects.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4342534270/" title="Chipcon Range Limits by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4046/4342534270_f1422f8014.jpg" width="500" height="239" alt="Chipcon Range Limits" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The screenshot above, from SmartRF 6, can provide a decent idea of how infuriating the software might become.  For product development, the register settings are to be copied and pasted into opaque source files.  It can instill the same sort of anger as an uncooperative web form, even after the old Visual Studio 6 libraries have been located to make it work under Wine.&lt;br /&gt;&lt;br /&gt;SmartRF 7--at Beta 0.9.1 as of this writing--is a new client under active development, one which seems to have been rewritten from scratch or at least significantly refactored.  The old Win32 GUI has been replaced with QT4, making a future Linux or Mac port possible.  Most importantly of all, however, is that the default configurations, as well as register explanations, are stored as XML.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4387852455/" title="SmartRF 7 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4010/4387852455_2250576d18.jpg" width="500" height="341" alt="SmartRF 7" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The screenshot above shows how default configurations are chosen for the target radio.  Users can select an example, then change any of the settings they like.  These configurations are further abstracted into an "Easy Mode" which hides all the messy minutia of radio, abstracting use to standards and channel numbers.&lt;br /&gt;&lt;br /&gt;These configuration settings are to be found as XML in the &lt;i&gt;config/xml/&lt;/i&gt; directory, organized by chip and presentation.  The following is an example of one such configuration file for the CC1110.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4387864423/" title="SmartRF 7 XML by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4064/4387864423_4c6eea664e_o.png" width="463" height="407" alt="SmartRF 7 XML" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Patching these configurations allows for the easy addition of new standards.  For example, I added support for my Tennessee Belt Buckle radio by adding a new stanza to &lt;i&gt;easymode_settings.xml&lt;/i&gt;.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4388633156/" title="SmartRF Belt Buckle by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2713/4388633156_b3aae46c25_o.png" width="222" height="185" alt="SmartRF Belt Buckle" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The register definitions and their bitfields are also defined in XML.  The following from &lt;i&gt;register_definition.xml&lt;/i&gt; for the CC1110 described the FREQ2 register's meaning.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4388651918/" title="SmartRF 7 XML Register Def by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4059/4388651918_fc7439e990_o.png" width="550" height="335" alt="SmartRF 7 XML Register Def" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Printing SDCC special-function register definitions, such as those found in &lt;i&gt;cc1110.h&lt;/i&gt;, is as easy as a bit of Python magic,&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#!/usr/bin/python&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# Simple script for dumping Chipcon register definitions to SDCC header.&lt;/font&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# Only intended as a rough example.&lt;/font&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# by Travis Goodspeed, Engineer of Superior Belt Buckles&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;import&lt;/strong&gt; &lt;font color="#2040a0"&gt;xml&lt;/font&gt;.&lt;font color="#2040a0"&gt;dom&lt;/font&gt;.&lt;font color="#2040a0"&gt;minidom&lt;/font&gt;&lt;br /&gt;&lt;font color="#2040a0"&gt;def&lt;/font&gt; &lt;font color="#2040a0"&gt;get_dom&lt;/font&gt;&lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="#2040a0"&gt;chip&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;cc1110&amp;quot;&lt;/font&gt;,&lt;font color="#2040a0"&gt;doc&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;register_definition.xml&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;    &lt;font color="#2040a0"&gt;fn&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;/opt/smartrf7/config/xml/%s/%s&amp;quot;&lt;/font&gt; &lt;font color="4444FF"&gt;%&lt;/font&gt; &lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="#2040a0"&gt;chip&lt;/font&gt;,&lt;font color="#2040a0"&gt;doc&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;    &lt;strong&gt;return&lt;/strong&gt; &lt;font color="#2040a0"&gt;xml&lt;/font&gt;.&lt;font color="#2040a0"&gt;dom&lt;/font&gt;.&lt;font color="#2040a0"&gt;minidom&lt;/font&gt;.&lt;font color="#2040a0"&gt;parse&lt;/font&gt;&lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="#2040a0"&gt;fn&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#2040a0"&gt;dom&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#2040a0"&gt;get_dom&lt;/font&gt;&lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;for&lt;/strong&gt; &lt;font color="#2040a0"&gt;e&lt;/font&gt; &lt;strong&gt;in&lt;/strong&gt; &lt;font color="#2040a0"&gt;dom&lt;/font&gt;.&lt;font color="#2040a0"&gt;getElementsByTagName&lt;/font&gt;&lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;registerdefinition&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;    &lt;strong&gt;for&lt;/strong&gt; &lt;font color="#2040a0"&gt;f&lt;/font&gt; &lt;strong&gt;in&lt;/strong&gt; &lt;font color="#2040a0"&gt;e&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;        &lt;strong&gt;if&lt;/strong&gt; &lt;font color="#2040a0"&gt;f&lt;/font&gt;.&lt;font color="#2040a0"&gt;localName&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;DeviceName&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;            &lt;strong&gt;print&lt;/strong&gt; &lt;font color="#008000"&gt;&amp;quot;// %s=%s&amp;quot;&lt;/font&gt; &lt;font color="4444FF"&gt;%&lt;/font&gt; &lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="#2040a0"&gt;f&lt;/font&gt;.&lt;font color="#2040a0"&gt;localName&lt;/font&gt;,&lt;font color="#2040a0"&gt;f&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;[&lt;/font&gt;&lt;font color="#FF0000"&gt;0&lt;/font&gt;&lt;font color="4444FF"&gt;]&lt;/font&gt;.&lt;font color="#2040a0"&gt;nodeValue&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;        &lt;strong&gt;elif&lt;/strong&gt; &lt;font color="#2040a0"&gt;f&lt;/font&gt;.&lt;font color="#2040a0"&gt;localName&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;Register&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;            &lt;font color="#2040a0"&gt;name&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;unknownreg&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;            &lt;font color="#2040a0"&gt;address&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;0xdead&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;            &lt;font color="#2040a0"&gt;description&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;            &lt;strong&gt;for&lt;/strong&gt; &lt;font color="#2040a0"&gt;g&lt;/font&gt; &lt;strong&gt;in&lt;/strong&gt; &lt;font color="#2040a0"&gt;f&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;                &lt;strong&gt;if&lt;/strong&gt; &lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;localName&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;Name&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;                    &lt;font color="#2040a0"&gt;name&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;[&lt;/font&gt;&lt;font color="#FF0000"&gt;0&lt;/font&gt;&lt;font color="4444FF"&gt;]&lt;/font&gt;.&lt;font color="#2040a0"&gt;nodeValue&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;                &lt;strong&gt;elif&lt;/strong&gt; &lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;localName&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;Address&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;                    &lt;font color="#2040a0"&gt;address&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;[&lt;/font&gt;&lt;font color="#FF0000"&gt;0&lt;/font&gt;&lt;font color="4444FF"&gt;]&lt;/font&gt;.&lt;font color="#2040a0"&gt;nodeValue&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;                &lt;strong&gt;elif&lt;/strong&gt; &lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;localName&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;Description&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;                    &lt;strong&gt;if&lt;/strong&gt; &lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;:&lt;/font&gt;&lt;br /&gt;                        &lt;font color="#2040a0"&gt;description&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#2040a0"&gt;g&lt;/font&gt;.&lt;font color="#2040a0"&gt;childNodes&lt;/font&gt;&lt;font color="4444FF"&gt;[&lt;/font&gt;&lt;font color="#FF0000"&gt;0&lt;/font&gt;&lt;font color="4444FF"&gt;]&lt;/font&gt;.&lt;font color="#2040a0"&gt;nodeValue&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;            &lt;strong&gt;print&lt;/strong&gt; &lt;font color="#008000"&gt;&amp;quot;SFRX(%10s, %s); /* %50s */&amp;quot;&lt;/font&gt; &lt;font color="4444FF"&gt;%&lt;/font&gt; &lt;font color="4444FF"&gt;(&lt;/font&gt;&lt;font color="#2040a0"&gt;name&lt;/font&gt;,&lt;font color="#2040a0"&gt;address&lt;/font&gt;, &lt;font color="#2040a0"&gt;description&lt;/font&gt;&lt;font color="4444FF"&gt;)&lt;/font&gt;&lt;font color="4444FF"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;These configuration files should allow for new Chipcon radio applications and development tools to be written in short order.  Please contact me if you would be so kind as to write a complete Python class for querying this data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1279427795202646719?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1279427795202646719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1279427795202646719' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1279427795202646719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1279427795202646719'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/02/xml-of-smartrf-studio-7.html' title='XML of SmartRF Studio 7'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4046/4342534270_f1422f8014_t.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5513593362823151290</id><published>2010-02-05T05:35:00.004-05:00</published><updated>2010-02-05T05:46:32.098-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='info'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>Call for Info Flash</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;continuing a discussion of &lt;a href="http://travisgoodspeed.blogspot.com/2009/10/msp430-info-flash.html"&gt;MSP430 Info Flash&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Neighborly MSP430 developers, please do me a favor and email me the contents of memory from 0x1000 to 0x1100 of every MSP430F2xx device that you can.  I'm trying to reverse engineer the exact distributions of the CALBC1_16MHZ and CALDCO_16MHZ values in order to build a UART library that operates without Info Flash.  The &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; does this well enough, but I still get the occasional bug report when a device is slightly out of range.  I can reduce the default to baud rate or try similar tricks to get around this, but I want to know exactly which values are safe.&lt;br /&gt;&lt;br /&gt;If your GoodFET can be programmed by goodfet.bsl but does not respond after programming, try the info flash images available in /contrib/infos/ to see if any of them work.&lt;br /&gt;&lt;pre&gt;air% goodfet.bsl -e -p 2618-002.txt;\&lt;br /&gt;goodfet.bsl -p ../../trunk/firmware/goodfet.hex   &lt;br /&gt;MSP430 Bootstrap Loader Version: 1.39-goodfet-8&lt;br /&gt;Mass Erase...&lt;br /&gt;Transmit default password ...&lt;br /&gt;Invoking BSL...&lt;br /&gt;Transmit default password ...&lt;br /&gt;Current bootstrap loader version: 2.13 (Device ID: f26f)&lt;br /&gt;Program ...&lt;br /&gt;256 bytes programmed.&lt;br /&gt;MSP430 Bootstrap Loader Version: 1.39-goodfet-8&lt;br /&gt;Invoking BSL...&lt;br /&gt;Transmit default password ...&lt;br /&gt;Current bootstrap loader version: 2.13 (Device ID: f26f)&lt;br /&gt;Program ...&lt;br /&gt;10596 bytes programmed.&lt;br /&gt;air% goodfet.monitor peek 1000 100A&lt;br /&gt;1000 55aa&lt;br /&gt;1002 3fff&lt;br /&gt;1004 abcd&lt;br /&gt;1006 55aa&lt;br /&gt;1008 1234&lt;br /&gt;air%&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Previously programmed GoodFETs have info flash wiped during programming, but if yours has never been programmed, you can dump the info with&lt;br /&gt;&lt;pre&gt;goodfet.bsl --dumpinfo &amp;gt;info.txt&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5513593362823151290?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5513593362823151290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5513593362823151290' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5513593362823151290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5513593362823151290'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/02/call-for-info-flash.html' title='Call for Info Flash'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-874243080820877835</id><published>2010-01-25T14:00:00.001-05:00</published><updated>2010-01-25T14:35:14.501-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2530'/><category scheme='http://www.blogger.com/atom/ns#' term='zstack'/><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='zigbee'/><title type='text'>ZStack PRNG Fixed</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt&lt;br /&gt;concerning versions 2.2.2 and 2.3.0 of TI &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/z-stack.html"&gt;Z-Stack&lt;/a&gt;&lt;br /&gt;and a fix of the &lt;a href="http://travisgoodspeed.blogspot.com/2009/12/prng-vulnerability-of-z-stack-zigbee.html"&gt;ZigBee Smart Energy Profile ECC vulnerability&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Texas Instruments has released version 2.3.0 of &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/z-stack.html"&gt;Z-Stack&lt;/a&gt;, their ZigBee stack for the TI/Chipcon CC2530, MSP430, and CC430 chips.  The new version adds a variety of new features, but chief among them is a fix to the random number generator which used to be utterly insufficient for cryptographic use.  Technical details on the vulnerability were first revealed publicly in &lt;a href="http://travisgoodspeed.blogspot.com/2009/12/prng-vulnerability-of-z-stack-zigbee.html"&gt;my last article&lt;/a&gt;. (Nate Lawson's translation is &lt;a href="http://rdist.root.org/2010/01/11/smart-meter-crypto-flaw-worse-than-thought/"&gt;here&lt;/a&gt;.)&lt;br /&gt;&lt;br /&gt;Source code for the new generator is not included, but rather references as a Security Service Provider (SSP).  Since 2.2.3, they have extended the SSP API to include &lt;i&gt;SSP_GetTrueRandAES()&lt;/i&gt; for generating random numbers by an AES key.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4293077271/" title="ZStack 2.3.0-1.40 TrueRand Functions by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2726/4293077271_4bf43a34ff_o.png" width="447" height="145" alt="ZStack 2.3.0-1.40 TrueRand Functions" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is then called in &lt;i&gt;zclGeneral_KeyEstablishment_GetRandom()&lt;/i&gt;, which in previous versions used the 16-bit LFSR.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4291169557/" title="ZStack 2.3.0-1.4.0 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2750/4291169557_f2e0a4189a_o.png" width="642" height="401" alt="ZStack 2.3.0-1.4.0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Authors of firmware for ZigBee Smart Energy devices that have used this code should patch their source code and issue firmware upgrades as quickly as possible.  Those with independent crypto implementations should check to ensure that they have not made similar mistakes.  Programmers should also note that &lt;br /&gt;&lt;br /&gt;Electric utilities with equipment using the MSP430 or Chipcon CC2530 should contact their vendors for such updates.  Unlike Windows and Linux, there's no easy way to perform an upgrade of a fragment of microcontroller firmware to which you haven't got the source.&lt;br /&gt;&lt;br /&gt;This fix only applies to the remote recovery of keys by PRNG attacks; local key extraction is still possible by the methods that I outlined in &lt;a href="http://travisgoodspeed.blogspot.com/2009/08/extracting-keys-from-soc-zigbee-chips.html"&gt;Extracting Keys from Second Generation ZigBee Chips&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-874243080820877835?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/874243080820877835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=874243080820877835' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/874243080820877835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/874243080820877835'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2010/01/zstack-prng-fixed.html' title='ZStack PRNG Fixed'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2666848984816065330</id><published>2010-01-09T10:32:00.001-05:00</published><updated>2010-01-14T10:07:01.519-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='zstack'/><category scheme='http://www.blogger.com/atom/ns#' term='chipcon'/><category scheme='http://www.blogger.com/atom/ns#' term='zigbee'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='ecc'/><title type='text'>PRNG Vulnerability of Z-Stack ZigBee SEP ECC</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;with neighborly thanks to Nick DePetrillo,&lt;br /&gt;concerning version 2.2.2-1.30 of TI &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/z-stack.html"&gt;Z-Stack&lt;/a&gt;&lt;br /&gt;and a ZigBee Smart Energy Profile ECC vulnerability.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4142923916/" title="Not Quite Random by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2544/4142923916_92b6bcd62d_o.png" width="425" height="87" alt="Not Quite Random" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In past articles, I've presented a variety of local attacks against microcontrollers and ZigBee radios.  While I maintain that local vulnerabilities are still very relevant to ZigBee devices, this article presents a remotely exploitable vulnerability in the way that random keys are generated by TI's Z-Stack ZCL implementation of the ZigBee Cluster Library.  Randomly generated numbers--those fed into the Certicom ECC crypto library--are predictable, repeated in one of two 32kB cycles.  Details follow, with links to source code and a complete list of random numbers.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Dumping Random Bytes&lt;/h3&gt;&lt;br /&gt;I dumped byte sequences from the CC2430 using the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; to debug a live chip.  The chip runs a program which populates IRAM with PRNG bytes, then halts with a soft breakpoint (Opcode 0xA5) for the debugger to grab all sampled values.  The main loop looks something like this:&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4209687695/" title="Chipcon RNG Dumper by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2751/4209687695_b1e24c2042_o.png" width="321" height="428" alt="Chipcon RNG Dumper" /&gt;&lt;/a&gt;&lt;br /&gt;The firmware was compiled with the Small Device C Compiler, flashed by the GoodFET.  A quick Python script then used the GoodFET library to debug the target, dumping random values through the same interface that programmed the chip.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4210466906/" title="Chipcon Byte Dumper by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4007/4210466906_1b7c7f7450_o.png" width="390" height="284" alt="Chipcon Byte Dumper" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Short PRNG Period&lt;/h3&gt;&lt;br /&gt;Page 18 of the &lt;a href="/Users/travis/svn/doodles/chipcon/cc2530.pdf"&gt;CC2530 Datasheet&lt;/a&gt; describes the random number generator peripheral, which is shared by all other 8051-based ZigBee SoC devices in the series.&lt;br /&gt;&lt;i&gt;The &lt;b&gt;random-number generator&lt;/b&gt; uses a 16-bit LFSR to generate pseudorandom numbers, which can be read by the CPU or used directly by the command strobe processor. The random numbers can, e.g., be used to generate random keys used for security. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The state of this RNG is initialized in the hardware abstraction library by feeding 32 bytes from the ADCTSTH special function register into RNDH register.  Bytes read from ADCTSTH are physically random, but poorly distributed.  RNDH and RNDL are the High and Low bytes of a 16-bit CRC Linear Feedback Shift Register, the state of which can be advanced by writing to RNDH or overwritten by writing to RNDL.  In between reading or writing from RND, the state is advanced by setting the fourth bit of ADCCON1.  Detailed descriptions of these registers can also be found within the datasheet.&lt;br /&gt;&lt;br /&gt;CC2430 examples randomize the seed by mixing 32 values into the RNG,&lt;br /&gt;&lt;pre&gt;for(i=0;i&amp;lt;32;i++){&lt;br /&gt;    RNDH=ADCTSTH;&lt;br /&gt;    ADCCON1|=0x04;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Because these numbers are not evenly distributed, Z-Stack prefers to sample just the least significant bit of the RF random number generator sixteen times, then write them in directly as the state without mixing them.  Further, it checks to ensure that the state is not a dead-end, substituting another if it is.  This method is also advocated within the CC2530 programming guides.&lt;br /&gt;&lt;pre&gt;for(i=0; i&amp;lt;16; i++)&lt;br /&gt;      rndSeed = (rndSeed &amp;lt;&amp;lt; 1) | (RFRND &amp;amp; 0x01);&lt;br /&gt;if (rndSeed == 0x0000 || rndSeed == 0x0380)&lt;br /&gt;      rndSeed = 0xBABE;&lt;br /&gt;RNDL = rndSeed &amp;amp; 0xFF;&lt;br /&gt;RNDL = rndSeed &amp;gt;&amp;gt; 8;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Once the RNG has been seeded, it has an initially random 16-bit state.  From then on, however, it produces random bytes in a predictable sequence.  Only the starting point is random, as ADCTSTH is never used for future reseeding.  As shown in the screenshot above, if the sequence "7c e1 e8 4e f4 87" is observed, the probability of the next bytes being "62 49 56 fe 80 00 60" is 100 percent.  Further, because the domain is so small, it can be exhaustively searched for keys in little time.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4142923916/" title="Not Quite Random by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2544/4142923916_92b6bcd62d_o.png" width="425" height="87" alt="Not Quite Random" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Code for dumping these values through the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; debugger can be found by svn, along with a complete dump of the PRNG sequence.&lt;br /&gt;svn co https://goodfet.svn.sourceforge.net/svnroot/goodfet/contrib/ccrandtest&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Seed Values&lt;/h3&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4142689541/" title="Seed Histogram by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2731/4142689541_7a3ef5c14f.jpg" width="500" height="383" alt="Seed Histogram" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The plot above shows the histogram of radio ADCTSTL values used to seed the PRNG.  These are far from random, but when sampled slowly enough, their least significant bit is probably good enough for key generation.  There are, however, two things of interest with this.&lt;br /&gt;&lt;br /&gt;First, if the crypto library is used infrequently, it would make sense to use this source of entropy instead of the inadequately random PRNG output.  There would be a cost in power consumption, as ADCTSTL is only random while the radio is operating, but the resulting increase to security is necessary.&lt;br /&gt;&lt;br /&gt;Second, if the peaks on the histogram come from a measurement of the radio, it might be possible to generate a radio signal that forces even the least significant bit to be a predictable value.  Steps such as AES whitening should be taken to avoid such an attack.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;ZigBee SEP, ECC&lt;/h3&gt;&lt;br /&gt;A less than perfect random number generator is not much of an issue when symmetric keys are pre-shared, but because pre-shared keys are vulnerable to local attacks, the &lt;a href="http://www.zigbee.org/Markets/ZigBeeSmartEnergy/tabid/224/Default.aspx"&gt;ZigBee Smart Energy&lt;/a&gt; profile recommends the use of session keys signed by elliptic curve cryptography.  See the USAF paper &lt;a href="http://portal.acm.org/citation.cfm?id=1359033"&gt;Cryptanalysis of an elliptic curve cryptosystem for wireless sensor networks&lt;/a&gt; for a prior break of ECC with a poor RNG.&lt;br /&gt;&lt;br /&gt;As will be shown in the next section, Chipcon's ZStack makes use of poorly random PRNG data as key material, allowing for a key domain of only 16 bits.  This is small enough to be exhaustively searched, either by a PC or by a "Chinese Lottery" of previously compromised wireless sensors.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;ZStack Usage&lt;/h3&gt;&lt;br /&gt;&lt;a href="http://focus.ti.com/docs/toolsw/folders/print/z-stack.html"&gt;ZStack&lt;/a&gt; 2.2.2-1.30 for the CC2530 makes use of the PRNG to implement the Smart Energy Profile's asymmetric cryptography.  The Windows installer works perfectly under Wine, leaving ZStack installed to an awkward directory.  I symlink it to /opt/zstack for convenience.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4155768502/" title="CC2530 in Wine by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2715/4155768502_76f42fa07c.jpg" width="500" height="375" alt="CC2530 in Wine" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once installed, the following Functions are of interest.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;mac_mcu.c&lt;/b&gt; contains &lt;i&gt;macMcuRandomByte()&lt;/i&gt; and &lt;i&gt;macMcuRandomWord()&lt;/i&gt;.  As the two are largely the same, take the former for an example.  First the PRNG is clocked, then the high byte is sampled.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4236266158/" title="ZStack macMcuRandomByte() by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2699/4236266158_54a2522561_o.png" width="376" height="127" alt="ZStack macMcuRandomByte()" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;zcl_key_establish.c&lt;/b&gt; is used to generate keys by the ZigBee Cluster Library specification, available for free by form from &lt;a href="http://www.zigbee.org/ZigBeeClusterLibrary/tabid/314/Default.aspx"&gt;ZigBee.org&lt;/a&gt;.  The code fragment below takes the low bytes of &lt;i&gt;macMcuRandomWord()&lt;/i&gt;, redefined as &lt;i&gt;osal_rand()&lt;/i&gt;, to populate a session key before signature.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4235520885/" title="ZCL KeyEstablishment GetRandom by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2758/4235520885_7aa48dfbd4_o.png" width="545" height="208" alt="ZCL KeyEstablishment GetRandom" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The ultimate function for ECC key generation is &lt;i&gt;ZSE_ECCGenerateKey()&lt;/i&gt;, which is defined in &lt;b&gt;eccapi.h&lt;/b&gt; but whose source is missing.  Reading &lt;b&gt;ecc.r51&lt;/b&gt; yields a few filenames as part of stored compiler warnings.  The developer's filename was "C:\SVN-ZStack-2.2.0\Components\stack\sec\eccapi.c", but it is only a stand-in for the Certicom &lt;a href="http://www.certicom.com/zigbee/zigbee.php"&gt;Security Builder MCE&lt;/a&gt; library that is not shipped with the development kit.  In any case, the vulnerability here lies in ZStack and not in Security Builder.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusions&lt;/h3&gt;&lt;br /&gt;This article has shown that the Chipcon ZStack library, as of version 2.2.2-1.30 for CC2530, uses an insufficiently random PRNG for cryptographic signatures and session keys.  PRNG data repeat every 32,767 samples, and there are at most 16 bits of entropy in any key.  Searching the entire key space ought to be possible in very little time.  Contrary to the CC2530's documentation, these random numbers must &lt;b&gt;not&lt;/b&gt; be used to generate random keys used for security. &lt;br /&gt;&lt;br /&gt;All users of this library, particularly those using it for Smart Grid devices and other industrial applications, are recommended to re-implement &lt;i&gt;macMcuRandomWord()&lt;/i&gt; and to ensure that nothing requiring cryptographic security operates from the PRNG alone.  Users of other libraries for the Chipcon devices should ensure that those libraries are not using the PRNG data.&lt;br /&gt;&lt;br /&gt;Competing devices and libraries should also be checked for similar vulnerabilities, as well as commercial products such as Smart Meters that might have forked the ZStack code or followed the datasheet's recommendation of using the PRNG for key generation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2666848984816065330?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2666848984816065330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2666848984816065330' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2666848984816065330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2666848984816065330'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/12/prng-vulnerability-of-z-stack-zigbee.html' title='PRNG Vulnerability of Z-Stack ZigBee SEP ECC'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2731/4142689541_7a3ef5c14f_t.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-61420047646475828</id><published>2009-11-02T08:00:00.000-05:00</published><updated>2009-11-02T08:02:58.441-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430 bsl timing'/><category scheme='http://www.blogger.com/atom/ns#' term='scada'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2530'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2430'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430static'/><category scheme='http://www.blogger.com/atom/ns#' term='ami'/><category scheme='http://www.blogger.com/atom/ns#' term='802.15.4'/><category scheme='http://www.blogger.com/atom/ns#' term='em250'/><title type='text'>S4 Paper</title><content type='html'>Howdy Y'all,&lt;br /&gt;&lt;br /&gt;A paper of mine from S4/Miami, &lt;a href="http://digitalbond.com/s4papers/2009/enernex/low-level-design-vulnerabilities-in-wireless-control-systems-hardware/"&gt;Low-Level Design Vulnerabilties in Wireless Control Systems Hardware&lt;/a&gt;, has recently been made publicly available by Digital Bond.  Coauthored with Brad Singletary and Darren Highfill, it provides a detailed survey of vulnerabilities that might be found in the hardware and firmware of AMI Smart Meters and similar equipment.&lt;br /&gt;&lt;br /&gt;Please note that the paper, written late last year, is now outdated in two respects.  First, the self-propagating worm presented hypothetically in Section 3.1 is no longer hypothetical.  Mike Davis has &lt;a href="http://www.blackhat.com/presentations/bh-usa-09/MDAVIS/BHUSA09-Davis-AMI-SLIDES.pdf"&gt;written one&lt;/a&gt;.  Second, the System-on-Chip Zigbee devices advocated in the conclusion of Section 4.1 are not secure, as I have since demonstrated in &lt;a href="http://www.blackhat.com/presentations/bh-usa-09/GOODSPEED/BHUSA09-Goodspeed-ZigbeeChips-PAPER.pdf"&gt;Extracting Keys from Second Generation Zigbee Chips&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-61420047646475828?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/61420047646475828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=61420047646475828' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/61420047646475828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/61420047646475828'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/11/s4-paper.html' title='S4 Paper'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-8870895114186674975</id><published>2009-10-28T21:37:00.004-04:00</published><updated>2009-11-11T10:27:15.196-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='bsl'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430f2xx'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='CALDCO'/><title type='text'>MSP430 Info Flash</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;The following is a description of the MSP430F2xx Info Flash, as well as my ugly--yet reliable--hack for initializing the DCO of MSP430F2xx chips after my use of the Serial Bootstrap Loader (BSL) has destroyed the contents of that flash on the GoodFET.  This ought to be of use to anyone who wishes to make an MSP430 design without a crystal, as well as for anyone who has accidentally erased info flash.&lt;br /&gt;&lt;br /&gt;The mask-ROM bootstrap loader, BSL, of the MSP430 chips is damned handy, despite some &lt;a href="http://frob.us/slides/goodspeed_25c3_bslc.pdf"&gt;security concerns&lt;/a&gt;.  It allows you to very quickly program a chip by the same USB/serial converter that you use to interface it with a computer, without any of the hassles of having to flash a bootloader onto the chip.  In this article, I describe the way in which the MSP430F2xx flash can be accidentally corrupted by the bootloader, as well as a method for repairing that damage by backing up the info flash while the password is left as the default.&lt;br /&gt;&lt;br /&gt;The MSP430F2xx family has another dandy feature, that clock configuration values need not be calibrated to an external clock, such as the 32KHz crystal of the older &lt;a href="http://goodfet.sourceforget.net/"&gt;GoodFET&lt;/a&gt; models.  Instead, configuration data is calculated at the factory and placed into info1 flash, a region of 256 bytes at 0x1000.  Using this, code that would be rather complicated can become trivially simple.&lt;br /&gt;&lt;br /&gt;The code that configures the clock is configured on the GoodFET with MSP430F1xx chips is too complicated for me to include here.  By contrast, on the MSP430F2xx chips, it becomes just&lt;br /&gt;&lt;pre&gt;void msp430_init_dco() {&lt;br /&gt;  BCSCTL1 = CALBC1_16MHZ;&lt;br /&gt;  DCOCTL = CALDCO_16MHZ;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The security model of the BSL is a bit confusing.  Upon connecting, you are required to present a password before reading, writing, or doing anything else that might affect the security of the device.  You are, however, allowed to erase all of flash memory--including the info flash--to 0xFFFF.  As this is traditionally the first command that you send upon connecting to a device, you will wipe all of the configuration data of a chip in programming it.  Finding this problem is hellish, because the exact same code will work if programmed by JTAG and you quite often have not got JTAG handly if you intend to program everything by the BSL.&lt;br /&gt;&lt;br /&gt;As part of the GoodFET project, I've forked TinyOS's tos-bsl client to add support for the MSP430F2xx.  I've also implemented a "--dumpinfo" command for dumping info flash to a TI Text file.  This file can be reflashed after the chip has been erased to restore its factory settings.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;petite%  goodfet.bsl --dumpinfo          &lt;br /&gt;MSP430 Bootstrap Loader Version: 1.39-goodfet-8&lt;br /&gt;Use -h for help&lt;br /&gt;Transmit default password ...&lt;br /&gt;@1000&lt;br /&gt;aa 55 ff 3f cd ab aa 55 34 12 ff ff aa 55&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff b4 85 fe 16&lt;br /&gt;ff ff ff ff ff ff ff ff ff ff ff ff ff ff&lt;br /&gt;ff ff ff ff ff ff ff ff 08 10 00 80 01 00&lt;br /&gt;62 7f b2 0b e8 0d 98 7f 01 07 56 08 fe 08&lt;br /&gt;ff ff ff ff ff ff ff ff 01 08 7f 8f 85 8e&lt;br /&gt;74 8d c2 86 &lt;br /&gt;q&lt;br /&gt;&lt;br /&gt;petite%&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This output is in the TI Text format, which is easily converted to Intel-hex, but is a hell of a lot easier to write.  Piping it into a file allows me to restore the contents of flash after erasure, and also to extract the configuration values which are used on this chip.  Because the chips are similar physically, it turns out that the calibration values for one are often sufficient to program another.  So by observing the model number (in big endian at 0x0FF0), I can guess in the absence of calibration values.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;//! Initialize the MSP430 clock.&lt;br /&gt;void msp430_init_dco() {&lt;br /&gt;  if(CALBC1_16MHZ!=0xFF){&lt;br /&gt;    //Clear DCL for BCL12&lt;br /&gt;    DCOCTL = 0x00;&lt;br /&gt;    //Info is intact, use it.&lt;br /&gt;    BCSCTL1 = CALBC1_16MHZ;&lt;br /&gt;    DCOCTL = CALDCO_16MHZ;&lt;br /&gt;  }else{&lt;br /&gt;    //Info is missing, guess at a good value.&lt;br /&gt;    BCSCTL1 = 0x8f;   //CALBC1_16MHZ at 0x10f9&lt;br /&gt;    DCOCTL = 0x7f;    //CALDCO_16MHZ at 0x10f8&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When I find the time, I intend to test a large quantity MSP430 chips to determine the exact tolerances of manufacturing, the variances of CALBC1_16MHZ and CALDCO_16MHZ, and the probability that a given unit will so drastically differ from these values that serial communications become impossible.  For now, I've found that the hardwired values above seem to work for all recently acquired MSP430F2274, MSP430F2254, and MSP430F2618 microcontrollers when using the hardware UART at 115,200 bits per second.  Further, the GoodFET firmware does not require a crystal when running on these chips.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-8870895114186674975?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/8870895114186674975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=8870895114186674975' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/8870895114186674975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/8870895114186674975'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/10/msp430-info-flash.html' title='MSP430 Info Flash'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-376190113596188192</id><published>2009-10-17T08:00:00.000-04:00</published><updated>2009-10-17T11:30:41.129-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cc2530'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2430'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>CC2430 Debug Protocol, First Notes</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;with thanks to &lt;a href="http://www.pkuhar.com/blog/"&gt;Peter Kuhar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3649435324/" title="CC2430 Node by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3408/3649435324_3e4591ae33.jpg" width="480" height="320" alt="CC2430 Node" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The following are my notes on the debugging mechanism of the &lt;a href="http://focus.ti.com/docs/prod/folders/print/cc2430.html"&gt;CC2430&lt;/a&gt; and other chips (such as the &lt;a href="http://focus.ti.com/docs/prod/folders/print/cc2530.html"&gt;CC2530&lt;/a&gt;) from Chipcon using an 8051 core.  These notes do not apply to the upcoming &lt;a href="http://www.ti.com/corp/docs/landing/cc430/index.htm"&gt;CC430&lt;/a&gt;.  As most of this was written before I implemented the protocol, plenty of errata are likely to exist.&lt;br /&gt;&lt;br /&gt;These notes are intended for those who wish to understand how the device is programmed, not for those who merely want a device programmer.  See &lt;a href="http://sourceforge.net/projects/ccflasher/"&gt;CCFlasher&lt;/a&gt; or the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; for that.&lt;br /&gt;&lt;br /&gt;Be sure to have a copy of &lt;a href="http://focus.ti.com/lit/ug/swra124/swra124.pdf"&gt;SWRA124&lt;/a&gt;, which is the official documentation for this protocol.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concerning pins&lt;/b&gt;, there are three related to debugging.  Debug Data (DATA) is a synchronous, bidirectional data line.  Debug Clock (DCLK) is its clock, but its edges also control when commands are interpreted, and it is crucial to initializing the chip's debugging unit.  The third pin, !RST, puts the chip into a reset state when pulled low, but is also used to start the chip with the debugger enabled.  The clock idles low, while !RST idles high.  Data is posted during the rising edge, sampled during the falling edge.  As there is no equivalent of the SPI !SS pin, it is necessary to dead-reckon commands; a command of incorrect length will cause unneighborly consequences.&lt;br /&gt;&lt;br /&gt;To initialize the debugger, pull !RST low while sending two clock pulses on DCLK.  It will look something like this,&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3613783011/" title="CC2430 Debug Initialization by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3586/3613783011_5b7a26e3bc_m.jpg" width="240" height="180" alt="CC2430 Debug Initialization" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The command byte 0x34 looks something like this,&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3621006352/" title="CC2430 Data by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3362/3621006352_820fffec23_m.jpg" width="240" height="180" alt="CC2430 Data" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concerning commands&lt;/b&gt;, once the debugger has been initialized, the chip will accept a command byte, optionally followed by up to three additional parameter bytes.  It will then reply with at least one byte, which might be discarded.  Some commands reply with two bytes rather than one.&lt;br /&gt;&lt;br /&gt;A command byte is composed of 8 bits.  Bits 1 and 0--the least significant--contain the number of data bytes following the command.  Bit 2 is labeled "return input byte to host", but it doesn't appear to be observed regularly by the documented examples.  The remaining five bits specify the command itself.&lt;br /&gt;&lt;br /&gt;Only twelve commands are described in the documentation, but either 16 or 32 commands are possible, depending upon whether the MSBit is variable or fixed to 0 as a sort of start bit.&lt;br /&gt;&lt;br /&gt;These commands were chosen to be easy to implement in hardware.  They include CHIP_ERASE, RD_CONFIG, WR_CONFIG, HALT, RESUME, GET_PC, and DEBUG_INSTR.  There are no primitive commands for peeking or poking memory, nor for managing flash.  Instead, macro commands are built up by using DEBUG_INSTR.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concerning command execution&lt;/b&gt;, it is clear from the documentation that a command with no parameters begins to execute at the instant of the eighth falling debug clock edge.  Multi-byte commands likely execute on multiple clock edges, each being the last falling edge of an instruction.&lt;br /&gt;&lt;br /&gt;In any case, to debug a command, you simply send DEBUG_INSTR (0x54) summed with the length of the instruction, up to 3 bytes, then read a single byte reply.  So to execute "NOP", send {0x55, 0x00}.  Except for a jump, this will not affect the program counter.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concerning memory access&lt;/b&gt;, there are no debugging commands to read or write memory.  Instead, DEBUG_INSTR (0x54) is used to do the same.  For example, to fetch from Data memory, first debug {0x90, AH, AL} to move the address into the data pointer.  Then debug {0xE0, 0, 0} to MOVX from the data pointer into A.  The 0's aren't part of the instruction, but they are necessary to give the device time to fetch the target of the pointer.&lt;br /&gt;&lt;br /&gt;The is the code that fetches a byte from Data memory,&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4019525072/" title="cc_peekdatabyte by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2421/4019525072_15bbb192d1_o.png" width="345" height="206" alt="cc_peekdatabyte" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concerning the writing of Flash&lt;/b&gt;, it is necessary to load a RAM buffer, then to copy that buffer into Flash by use of a short assembly script.  Flash may only be erased in 2kB pages, and it may only be written as 32-bit words.  The code that performs this is found on page 11 of SWRA124, and you'll find it in Data memory if you look hard enough after a programmer that doesn't cover its tracks.&lt;br /&gt;&lt;br /&gt;You will find this code in the GoodFET source.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4019557552/" title="CC2430 Flash Routine by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2739/4019557552_7b4ae11af0_o.png" width="403" height="174" alt="CC2430 Flash Routine" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You will find the same code in RAM after programming.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/4018795415/" title="CC2430 Flash Routine by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2728/4018795415_3fe6b4b9ff_o.png" width="313" height="301" alt="CC2430 Flash Routine" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Concerning the protection of Code memory&lt;/b&gt;, there is a lock bit in a hidden page of Flash memory.  By setting the lowest configuration bit (by WR_CONFIG), the lowest 2kB of flash memory will be mapped to a special information region.  Clearing the least significant bit of the first byte will lock the chip, causing it to refuse debugging after a full-power reset.  Access to debugging instructions can only be regained after executing a CHIP_ERASE, which erases all of Flash memory.&lt;br /&gt;&lt;br /&gt;At Black Hat USA in August of 2009, I presented a paper entitled &lt;a href="http://www.blackhat.com/presentations/bh-usa-09/GOODSPEED/BHUSA09-Goodspeed-ZigbeeChips-PAPER.pdf"&gt;Extracting Keys from Second Generation Zigbee Chips&lt;/a&gt;.  The vulnerability, demonstrated in the image below, is that Data memory is not cleared along with Flash memory during a CHIP_ERASE.  By booting a wireless sensor, then erasing it, then dumping RAM, the attacker can find any keys which are stored within the unit.  This works even for constant keys, as 8051 compilers will copy them into RAM in order to make C pointers consistent.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3712891994/" title="CC2430 Vulnerability Test by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3452/3712891994_48676e2500_o.png" width="494" height="371" alt="CC2430 Vulnerability Test" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In implementing a debugger, it's also necessary to watch out for a minor bug.  Upon connecting, be sure to DEBUG_INSTR a NOP so as to have the lock bit checked.  Failure to do so might cause the lock bit to be misrepresented when checking the device's status.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In conclusion&lt;/b&gt;, the protocol is blessedly simple and the 16 pages of documentation are quite complete when supplemented with the CC2430 datasheet.  I hope that these notes might allow you to implement the protocol with less of a headache than I have.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-376190113596188192?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/376190113596188192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=376190113596188192' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/376190113596188192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/376190113596188192'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/10/cc2430-debug-protocol-first-notes.html' title='CC2430 Debug Protocol, First Notes'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3408/3649435324_3e4591ae33_t.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3781774655367767081</id><published>2009-10-03T18:54:00.007-04:00</published><updated>2009-10-04T19:06:13.888-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shipping'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>GoodFET30 Boards by Mail</title><content type='html'>Howdy y'all,&lt;br /&gt;&lt;br /&gt;As anyone who has taken up my offer of a free GoodFET board can tell you, I've been terribly slow at shipping the things.  Not only did I only send them while I was in stock, but I also had to have ample quantities of stamps and envelopes.  Further, the envelopes were often lost in the mail do to my miscalculating postage (42¢≠44¢) or failing to properly pad each board.  Add my travel schedule to the mix, and it was not uncommon for a neighbor to wait more than a month for his board to arrive.&lt;br /&gt;&lt;br /&gt;To remedy this situation, I've arranged for blank boards to be shipped from Tennessee.  Presently, the new &lt;a href="http://goodfet.sourceforge.net/hardware/goodfet30/"&gt;GoodFET30&lt;/a&gt; boards are in stock, and I'll order more panels as soon as these run out.  To order one, just send a few bucks by Paypal to &amp;lt;sixtysixav at hotmail.com&amp;gt; along with a mailing address and a note that you'd like a GoodFET30.  If you're broke or religiously opposed to Paypal, just send a neighborly request to my address below and I'll see that a free board goes your way.&lt;br /&gt;&lt;br /&gt;Assembled units are coming, but don't expect them to be available before the new year.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;N.B., do not forget to include your mailing address when ordering.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Thank you kindly,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3975358550/" title="GoodFET30 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2469/3975358550_4f009db96f_m.jpg" width="240" height="161" alt="GoodFET30" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3781774655367767081?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3781774655367767081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3781774655367767081' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3781774655367767081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3781774655367767081'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/10/goodfet30-boards-by-mail.html' title='GoodFET30 Boards by Mail'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2469/3975358550_4f009db96f_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1952265304992966647</id><published>2009-09-13T11:11:00.005-04:00</published><updated>2009-09-15T21:31:27.383-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>GoodFET Firmware Distribution</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;Until recently, the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; firmware was available only by source code through subversion.  While I still expect all GoodFET users to be familiar with C, Unix, Subversion, and other such things, it is a bit much to ask each user to build the MSP430 cross compiler just to use the device.  To that end, I'm implementing an automated testing server and firmware distribution system.  The latest firmware images are now available by HTTP, free for any client to download and test.  This article describes an early incarnation of this system.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;To test each target&lt;/b&gt;, I've begun to fill a server in Philadelphia with GoodFET boards.  Ideally, I'd like one of each GoodFET model matched to one of each target, but that collection has not yet been completed.  In this screenshot below, the Chipcon and SPI Flash targets are being tested.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3916110518/" title="GoodFET Testing Server by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2466/3916110518_9bd563b3cc_o.png" width="574" height="265" alt="GoodFET Testing Server" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If the output contains anything different, the diff will show this and require manual intervention before an update may be published.  These differences might be caused by a failed test, or they might be caused by a minor change, such as the amount of reported RAM consumption in the following screenshot.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3915411939/" title="Failing GoodFET Test by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2542/3915411939_06e5563a63_o.png" width="406" height="363" alt="Failing GoodFET Test" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;To distribute these files&lt;/b&gt;, the Makefile in /packaging/ checks out a fresh copy of the code from subversion, builds and installs it to all attached boards, runs every available test case, and compares the results.  If--any only if--all test cases match, the resulting intel hex files will be uploaded to &lt;a href="http://goodfet.sourceforge.net/dist/"&gt;http://goodfet.sourceforge.net/dist/&lt;/a&gt;.  Clients may fetch these to update the targets, and I've added the "goodfet.bsl" client--a fork of tos-bsl-- to facilitate this upgrades.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3916592744/" title="goodfet.bsl by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2625/3916592744_4781641880_o.png" width="505" height="322" alt="goodfet.bsl" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Loadable modules will come next, along with some substantial changes to the GoodFET packet format that will allow for much larger blocks.  I also hope to soon revamp MSP430 JTAG support, with support for quickly flashing 1xx and 5xx devices, as well as support for MSP430X (1xx and 4xx) devices.&lt;br /&gt;&lt;br /&gt;As a final note, be sure to update your clients as well as your firmware.  The packet format changes and other alterations might break compatibility of the new firmware with the old clients.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1952265304992966647?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1952265304992966647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1952265304992966647' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1952265304992966647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1952265304992966647'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/09/goodfet-firmware-distribution.html' title='GoodFET Firmware Distribution'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7413648580307592731</id><published>2009-09-04T16:20:00.003-04:00</published><updated>2009-09-04T16:41:28.593-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>State of the GoodFET</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3878397351/" title="GoodFET20 in Black by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2505/3878397351_d32eb3d293.jpg" width="500" height="375" alt="GoodFET20 in Black" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I shipped the last of the American GoodFET20 requests today.  Please contact me if yours hasn't arrived.  Orders to Europe will be sent next week, while I'm in Paris, Besançon, and Stockholm.&lt;br /&gt;&lt;br /&gt;I'm now using the &lt;a href="http://focus.ti.com/docs/prod/folders/print/msp430f2618.html"&gt;MSP430F2618&lt;/a&gt; for GoodFET development, as it will run at 16MHz without a crystal.  There are some bit errors on a few of these boards, owing to the accidental erasure of Info Flash by the bootloader.  Until rebroadcasts are implemented, continue to construct your boards with the 1612 or 1611.  The upcoming &lt;a href="http://goodfet.sourceforge.net/hardware/goodfet30/"&gt;GoodFET30&lt;/a&gt; will migrate the project entirely to the 2xx series, breaking compatibility with TI's firmware.&lt;br /&gt;&lt;br /&gt;The Python clients are presently being refactored at the same time as the command structure is combined.  Please contact me if you are interested in building a client for C# or Cocoa that will be easier to distribute.&lt;br /&gt;&lt;br /&gt;Thanks to a generous EVK donation, MSP430X2 support is underway, which will allow such chips as the &lt;a href="http://focus.ti.com/docs/prod/folders/print/msp430f5438.html"&gt;MSP430F5438&lt;/a&gt; and the CC430 Zigbee SoC devices to be programmed.  I've got the basics working, and full support for writing Flash memory ought to be ready rather soon.&lt;br /&gt;&lt;br /&gt;I'm considering a plugin architecture that loads new modules into RAM, a GoodFET iPhone attachment, and all sorts of other crazy things.  Comment with any feature requests below.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-7413648580307592731?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/7413648580307592731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=7413648580307592731' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7413648580307592731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7413648580307592731'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/09/state-of-goodfet.html' title='State of the GoodFET'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2505/3878397351_d32eb3d293_t.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3617948057326628894</id><published>2009-08-20T07:31:00.018-04:00</published><updated>2009-08-20T10:38:38.748-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='stack depth'/><title type='text'>The GoodFET's MSP430 Stack Depth</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;Today I'm stranded in Munich and unable to walk, so I thought it neighborly to measure the stack depth of the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt;'s firmware in order to determine the minimal microcontroller necessary, reducing the material cost of each unit.  This article ought to help those who wish to do the same.&lt;br /&gt;&lt;br /&gt;The MSP430F1612 ($15 to $11) that I presently use is rather expensive, and a smaller, cheaper chip will likely suffice.  While I don't expect the code to fit in the MSP430F2013 ($3 to $1.50), it's not unreasonable to assume that something like the MSP430F2274 ($5 to $3) would be a good choice.&lt;br /&gt;&lt;br /&gt;To determine whether the Flash is sufficient is easy, as I can measure that by the size of the output image.  &lt;i&gt;make install&lt;/i&gt; reveals this to be 7566 bytes as of r79, which will comfortably fit in the MSP430F2254 (16KB) and 2274 (32KB) and doesn't come close to filling the 1612's 55KB of Flash.&lt;br /&gt;&lt;br /&gt;Determining RAM usage is much more difficult, and likely better to be done in actual use than in simulation or by static analysis.  I'm implementing this by adding two new commands to the &lt;a href="http://goodfet.sourceforge.net/apps/monitor/"&gt;Monitor&lt;/a&gt; application.  The first, RAM_PATTERN (0x90), fills all of RAM with 0xBEEF, suiciding and resetting at the end.  The second, RAM_DEPTH (0x91), measures how large this block of memory is.  By running the first, then running several test cases, then running the second, I can accurately measure RAM usage, estimating the minimum required chip for the GoodFET firmware.  RAM_PATTERN cannot simple be run at start because the GoodFET restarts each time a client connects.&lt;br /&gt;&lt;br /&gt;RAM_PATTERN must know the entry point of the application in order to reset, as well as the start and end addresses of RAM.  No care need be taken to avoid damaging the stack or global variables, as a reboot will obliterate and repopulate them anyways.&lt;br /&gt;&lt;br /&gt;Looking at the linker script (trunk/firmware/ldscripts/161x.x), it can be seen that the RAM region is defined by &lt;i&gt;data (rwx): ORIGIN = 0x1100, LENGTH = 0x1400&lt;/i&gt;, so it extends from 0x1100 to 0x2500.  RAM_PATTERN simply writes 0xBEEF over this region, then calls asm("br &amp;0xfffe") to reboot.  Don't forget your pointer arithmetic: ++ on a pointer increments by the word size (2), not the integer address (1).&lt;br /&gt;&lt;br /&gt;In any case, once these functions are working, it's a simple matter to measure RAM usage.  As we know that 0x1400 bytes are available, we can fill with the pattern, then restart, then run code, and compare the number of available bytes.  By the following log, you can see that 0x12b2 bytes are unused by the GoodFET firmware even after running the Chipcon test cases, or that 0x1400-0x12b2=0x14E=334 bytes of RAM are necessary.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;petite% goodfet.monitor ramfill&lt;br /&gt;petite% goodfet.monitor ramdepth&lt;br /&gt;0x12c4 RAM bytes free.&lt;br /&gt;petite% goodfet.monitor test    &lt;br /&gt;Performing monitor self-test.&lt;br /&gt;Self-test complete.&lt;br /&gt;petite% goodfet.cc test &gt;&gt;/dev/null&lt;br /&gt;petite% goodfet.monitor ramdepth   &lt;br /&gt;0x12b2 RAM bytes free.&lt;br /&gt;petite%&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Rounding that 334 byte measurement up a bit, it still ought to fit in the MSP430F2254's 512 bytes of RAM, with a pin-compatible upgrade available for the 2274 with 1 kilobyte of RAM.  For comparison, the present hardware has 5K of RAM with the MSP430F1612 and 10K with the 1611.&lt;br /&gt;&lt;br /&gt;Note that this lean behavior is only possible because the GoodFET's firmware is very flat and uses no dynamically allocated buffers.  I will be running some more tests, and if they turn out to my liking, there's a good bet that the MSP430F2274 will be the basis of the GoodFET30.&lt;br /&gt;&lt;br /&gt;Firmware compatibility between the two chips will require more creativity than the present scheme of a wacky linker script, as they are of different families.  Seeing as how plenty of memory is left over, I could write firmware which identifies its host system and configures the I/O ports so as to run on either system from a single image.  I don't think that I will do this, as incompatibilities in the I/O port choices would require complication of all I/O routines that could better be handled by preprocessor directives.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3617948057326628894?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3617948057326628894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3617948057326628894' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3617948057326628894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3617948057326628894'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/08/goodfets-msp430-stack-depth.html' title='The GoodFET&apos;s MSP430 Stack Depth'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5848920331795955327</id><published>2009-08-19T05:08:00.003-04:00</published><updated>2009-08-19T06:09:07.852-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bsl'/><category scheme='http://www.blogger.com/atom/ns#' term='woot'/><category scheme='http://www.blogger.com/atom/ns#' term='usenix'/><category scheme='http://www.blogger.com/atom/ns#' term='source'/><category scheme='http://www.blogger.com/atom/ns#' term='half-blind'/><title type='text'>Half-Blind Attacks, Source Barcelona</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;At the &lt;a href="http://www.usenix.org/event/woot09/"&gt;Third Usenix Workshop on Offensive Technologies&lt;/a&gt;, I presented &lt;a href="http://www.usenix.org/event/woot09/tech/full_papers/goodspeed.pdf"&gt;Half-Blind Attacks: Mask ROM Bootloaders Are Dangerous&lt;/a&gt; with &lt;a href="http://planete.inrialpes.fr/~francill/"&gt;Aurélien Francillon&lt;/a&gt;.  This paper describes the use of a stack overflow exploit to return into a random piece of flash memory, which often enough will elevate privileges before returning into the bootloader.&lt;br /&gt;&lt;br /&gt;I'll be presenting the security-conference equivalent of this paper as a lecture at &lt;a href="http://www.sourceconference.com/index.php/source-barcelona-2009"&gt;Source Barcelona&lt;/a&gt; on September 21 or 22, along with something new.  I will bring both the demonstration hardware and plenty of &lt;a href="http://goodfet.sourceforget.net/"&gt;GoodFET&lt;/a&gt; boards.&lt;br /&gt;&lt;br /&gt;--Travis&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5848920331795955327?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5848920331795955327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5848920331795955327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5848920331795955327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5848920331795955327'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/08/half-blind-attacks-source-barcelona.html' title='Half-Blind Attacks, Source Barcelona'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-386655964236093560</id><published>2009-08-06T18:56:00.007-04:00</published><updated>2009-08-06T20:34:41.125-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='em260'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2530'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2430'/><category scheme='http://www.blogger.com/atom/ns#' term='em250'/><title type='text'>Extracting Keys from SoC Zigbee Chips</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;Last week, at Black Hat Briefings, I presented a short paper entitled &lt;a href="http://frob.us/slides/goodspeed_bh09.pdf"&gt;Extracting Keys from Second Generation Zigbee Chips&lt;/a&gt;.  Though brief, the paper is vitally important reading for anyone shipping a product with chips from Chipcon and Ember.  The paper includes a method by which keys may be extracted from these chips, as well as a software method for defending Chipcon devices against the attack.  All EM2xx chips are vulnerable, as are all of the 8051-based Chipcon radios, such as the CC2530.  This is not the same as my attack against &lt;a href="http://travisgoodspeed.blogspot.com/2009/03/breaking-802154-aes128-by-syringe.html"&gt;first generation, discrete radios&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3712891994/" title="CC2430 Vulnerability Test by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3452/3712891994_48676e2500_o.png" width="494" height="371" alt="CC2430 Vulnerability Test" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-386655964236093560?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/386655964236093560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=386655964236093560' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/386655964236093560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/386655964236093560'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/08/extracting-keys-from-soc-zigbee-chips.html' title='Extracting Keys from SoC Zigbee Chips'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5557527071126857418</id><published>2009-07-08T09:12:00.004-04:00</published><updated>2009-07-08T09:28:18.439-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><category scheme='http://www.blogger.com/atom/ns#' term='workshop'/><title type='text'>GoodFET HHV, Neighborcon Vegas, Taipei</title><content type='html'>Howdy neighbors,&lt;br /&gt;&lt;br /&gt;I'll be bringing plenty of spare GoodFET boards to vegas, perhaps something new as well.  If you'd like to build one in the Hardware Hacking Village, please bring the parts from the &lt;a href="http://goodfet.sourceforge.net/hardware/goodfet11/"&gt;GoodFET11 BOM&lt;/a&gt;, with perhaps some extras to share.  I've given away all of my assembled GoodFET boards, save the one I use for development, so don't expect to have any fun without soldering.&lt;br /&gt;&lt;br /&gt;The Neighborcon Vegas CFP will come out soon.  Neighborliness will be abounding &lt;i&gt;during&lt;/i&gt; Black Hat Briefings for all those that need a break from the crowd or cannot afford the ticket.  A shuttle should run regularly from Caesar's, and we'll have all sorts of neighborly workshops and competitions.  The official announcement is being delayed to keep the crowd manageable, but it will definitely be happening.&lt;br /&gt;&lt;br /&gt;I am in Taipei, R.O.C. for the next two weeks.  Email me if you'd like to meet up for drinks, especially if you speak Chinese and can help me navigate the local electronics market.&lt;br /&gt;&lt;br /&gt;New technical articles are coming soon, covering the debugging protocols of the MSP430 and Chipcon 8051 chips.  MSP430X, MSP430X2, and others will follow as GoodFET support solidifies.  Also some fixes for security vulnerabilities that I will be announcing at my Black Hat talk.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5557527071126857418?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5557527071126857418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5557527071126857418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5557527071126857418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5557527071126857418'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/07/goodfet-hhv-neighborcon-vegas-taipei.html' title='GoodFET HHV, Neighborcon Vegas, Taipei'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-866359777020197090</id><published>2009-06-19T21:11:00.017-04:00</published><updated>2010-03-07T20:53:28.112-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>GoodFET MSP430 Tutorial</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;N.B., that this is quite outdated.  See the &lt;a href="http://goodfet.sourceforge.net/tutorial/"&gt;GoodFET Tutorial&lt;/a&gt; for a more recent description.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3644116789/" title="GoodFET and OldFET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3649/3644116789_2567129e6f_m.jpg" width="240" height="180" alt="GoodFET and OldFET" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is a quick tutorial for using the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; to program an MSP430.  This should work for all classic MSP430 chips which support 4-wire JTAG, but it will not yet work with SpyBiWire or MSP430X2 chips, such as the MSP430F5xx and CC430.  As these instructions will likely become dated very quickly, expect some surprises.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Prerequisites&lt;/h3&gt;&lt;br /&gt;You will need a GoodFET board, complete with the clock crystal.  Your workstation should have Python, Subversion, &lt;a href="http://mspgcc.sourceforge.net/"&gt;MSPGCC&lt;/a&gt;, and msp430-bsl installed.  I assume below that you are using some form of Unix, but the software ought to be compatible with Cygwin.  Those who are unfamiliar with Cygwin should wait for a GUI client that I'll release later this year.&lt;br /&gt;&lt;br /&gt;If you are familiar with SMD soldering, email or catch me at a conference for a gratis board of the most recent revision.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Subversion Checkout&lt;/h3&gt;&lt;br /&gt;Grab the entire project by running "svn co https://goodfet.svn.sourceforge.net/svnroot/goodfet".  Future updates may be grabbed by "svn update".&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Clients&lt;/h3&gt;&lt;br /&gt;CD to "goodfet/trunk/client" and run "sudo make link".  This will link the client scripts to /usr/local/bin/, keeping the originals in the subversion directory to be easily updated.  At this point, you can call up the "goodfet.msp430" command's usage by running it without parameters.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3648873465/" title="GoodFET Usage by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3387/3648873465_209fe1100c_o.png" width="412" height="160" alt="GoodFET Usage" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Firmware&lt;/h3&gt;&lt;br /&gt;Change your directory to "goodfet/trunk/firmware", then run "make" to compile a firmware image.  If there are errors, check your MSPGCC installation.  Once compilation succeeds, run "make install" to load the firmware into the GoodFET device.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Dumping an Image&lt;/h3&gt;&lt;br /&gt;The "goodfet.msp430" script is a stand-in until I get around to writing a proper client.  To dump a target's firmware, the usage is "/usr/local/bin/goodfet.msp430 dump $foo.hex [0x$start 0x$stop]".  To dump the BSL, which resides in the region [0xC00,0xFFF],&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3642108667/" title="BSL Dump by GoodFET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3386/3642108667_2fd403084e_o.png" width="403" height="257" alt="BSL Dump by GoodFET" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As I collect BSL images, it would be neighborly of you to send the bsl.hex file my way.  Dump with no range will dump all memory above 0x200, which is to say all memory that may be safely read without side effects.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Erasing a Chip&lt;/h3&gt;&lt;br /&gt;The "erase" verb will mass erase all memory except for the DCO configuration.  An erase is automatically performed prior to a flash.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Flashing an Image&lt;/h3&gt;&lt;br /&gt;The "flash" verb of this client will flash an image to the target board.  Every address evenly divisible by 0x100 is printed as a sort of progress meter,&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3649300147/" title="GoodFET Succeeding Write by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3354/3649300147_c4c91db8dc_o.png" width="311" height="89" alt="GoodFET Succeeding Write" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Each word is validated as it is written, making it easy to identify when writes go bad.  In the photo below, words were miswritten from 0x2500 to 0x2508, but later words were written properly.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3650104982/" title="GoodFET Write Errors by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3415/3650104982_4034dac00b_o.png" width="311" height="167" alt="GoodFET Write Errors" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That's all, folks.  Expect a slew of firmware updates for the GoodFET over the next few weeks, and perhaps a GUI client of some sort.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-866359777020197090?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/866359777020197090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=866359777020197090' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/866359777020197090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/866359777020197090'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/06/goodfet-msp430-tutorial.html' title='GoodFET MSP430 Tutorial'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3649/3644116789_2567129e6f_t.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2953560071562443083</id><published>2009-06-13T16:10:00.000-04:00</published><updated>2009-06-13T16:22:08.633-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hno3'/><category scheme='http://www.blogger.com/atom/ns#' term='decapped'/><category scheme='http://www.blogger.com/atom/ns#' term='chemistry'/><title type='text'>Cold, Labless HNO3 Decapping Procedure</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;with thanks to Brooke Hill&lt;br /&gt;&lt;br /&gt;The following are instructions and matching photos for removing the packaging of microchips without a proper chemical laboratory.  Neither a hot plate nor a fume hood is required, and the only chemicals necessary are fuming nitric acid and acetone.  The result is a bare die, with bonding wires.  The bonding wires may then be removed and the die photographed using microscope.&lt;br /&gt;&lt;br /&gt;The same as any author of a lay chemistry article, I must caution you to be very careful with the procedure that I describe.  If you've no prior experience with chemistry, purchase an introductory book and study the safety instructions thoroughly.  Nitric acid in these concentrations is nasty stuff, even when cold.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Materials&lt;/h3&gt;&lt;br /&gt;You will need two small vials with wax-paper seals, high-purity HNO3, acetone, tweezers, and a few pipettes.  A fume hood is not required, as the reaction will be performed at room temperature.  Safety glasses are recommended.&lt;br /&gt;&lt;br /&gt;Surface mount chips are preferred for this method, as they have considerably less packaging to dissolve.  I chose the CC2430, CC2431, and EM250 chips because they were handy, but also because I don't yet have die photographs of them.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3612320550/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3631/3612320550_49f21295af_m.jpg" width="240" height="180" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Procedure&lt;/h3&gt;&lt;br /&gt;Begin by dropping the chips to be decapped into a vial.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3611508091/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2429/3611508091_b24988e6dc_m.jpg" width="240" height="180" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then add nitric acid to cover the chips, plus a bit more.  This will react slowly, rather than violently, but for safety's sake be damned sure never to look down any sort of glassware when mixing in a new reactant.  You will see the reaction as small bubbles that come from the chip casing as it dissolves.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3612324022/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3646/3612324022_6e39e9b87c_m.jpg" width="240" height="180" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This will slowly turn the nitric acid from yellow to a dark green.  Agitate it occasionally to ensure that all of the plastic gets a chance to break away.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3611511515/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3652/3611511515_e65665c857_m.jpg" width="240" height="165" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Leave the mixture overnight, allowing the plastic sludge to settle to the bottom of the vial.  The liquid above it is still-potent nitric acid, which may be skimmed off with a pipette.  Save this in a second bottle for future use, but do not reintroduce it to your bottle of clean acid.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3614599512/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3596/3614599512_b00e71c68b_m.jpg" width="240" height="180" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At this point, you've got a vial which contains a lot of plastic gunk and very little liquid.  Flush it with water to remove the soluble gunk, then dump the remainder into a shot glass for sorting with tweezers.  (Pick the chips up by their bonding wires, as you might scratch the surface.)&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3617043581/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3396/3617043581_f83aa8eab6.jpg" width="375" height="500" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3623137522/" title="Labless Decapping by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3403/3623137522_00d48c1a78.jpg" width="500" height="375" alt="Labless Decapping" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Result&lt;/h3&gt;&lt;br /&gt;Once decapped, each die should be cleaned in acetone.  For microscope photography, the bonding wires ought to also be plucked by tweezers.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3425687578/" title="MSP430F2013 Die Extraction by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3395/3622258915_bf27665867_m.jpg" width="240" height="165" alt="MSP430F2013 Die Extraction" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2953560071562443083?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2953560071562443083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2953560071562443083' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2953560071562443083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2953560071562443083'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/06/cold-labless-hno3-decapping-procedure.html' title='Cold, Labless HNO3 Decapping Procedure'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3631/3612320550_49f21295af_t.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-264248781091850733</id><published>2009-06-05T09:36:00.022-04:00</published><updated>2009-06-21T22:35:26.348-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spi'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>SPI Client Tutorial for the GoodFET</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3598111926/" title="GoodFET SPI by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2426/3598111926_13103365de.jpg" width="500" height="375" alt="GoodFET SPI" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I've just confirmed that SPI support is functional on the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt;, but I've done so with my ugly-as-sin Python client.  I'd much rather that neighborly souls write their own clients for this device.  The following article describes the protocol by which this is done, as well as some snippets of the GoodFET firmware.  The present code should be sufficient to write an AVR programmer, an interface for &lt;a href="http://focus.ti.com/analog/docs/rfifcomponentshome.tsp?familyId=367&amp;contentType=4"&gt;Chipcon radios&lt;/a&gt;, and all sorts of other neighborly things.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus"&gt;SPI&lt;/a&gt; is a synchronous, full-duplex serial protocol, which is an uptown way of saying that it has a clock and that bits are simultaneously transmitted and received.  Whenever you transmit a byte, you are actually exchanging values of a register.  Instead of start and stop bits, clocks are synchronized by the falling of the !SS (Slave Select) line, and then they remain synchronized by counting bits.  Data is transmitted MSB-first, received LSB-first.&lt;br /&gt;&lt;br /&gt;The GoodFET attaches by a USB serial port, one which is also used for programming.  As the DTR, Data Terminal Ready, line is connected to the !RST pin of the GoodFET's microcontroller, you will find that the GoodFET turns off when you connect to it with Minicom or Hyperterminal, then turns back on when you disconnect!  To remedy this, you must drop the DTR line low by using ioctl() in Posix C or your language's equivalent.  This will boot the GoodFET, beginning a session.&lt;br /&gt;&lt;br /&gt;The session itself will begin at &lt;strike&gt;9600&lt;/strike&gt; 115200 8/N/1&lt;strike&gt;, although faster speeds will be supported in the near future&lt;/strike&gt;.  When you drop the line low, you will receive the three bytes {0x00, 0x7F, 0x00}.  This is a GoodFET packet, and like all packets it follows the same, simple form.  The first byte indicates the application, 0x00 being the Monitor.  The other application that we will use is 0x01, SPI.  The second byte is a verb, with all bytes less than 0x80 being generic verbs and all bytes higher being application-specific verbs.  0x7F means "OK" in every application.  Other verbs include READ (0x00), WRITE (0x01), SETUP (0x10), and NOK (0x7E).  A complete list of generic verbs is available in the &lt;a href="http://goodfet.sourceforge.net/manual/"&gt;Manual&lt;/a&gt;.  The third byte, 0x00, indicates the number of data bytes that follow.&lt;br /&gt;&lt;br /&gt;The GoodFET's protocol is transaction based, with every transaction after the first being begun by the host.  It is recommended that your transmit function also automatically receive this reply.  Further, any verb may have data attached.  While the OK verb of the Monitor might never include data, your client had better accept whatever data it chooses to send your way.&lt;br /&gt;&lt;br /&gt;Inside of the GoodFET, an application is merely a handler.  All application present in the firmware are active simultaneously, and where it doesn't cause problems you may mix and match them.  For example, you might wish to use the Monitor to manage the Test pin manually in order to implement an AVR programmer.&lt;br /&gt;&lt;br /&gt;In any case, you can implement an SPI library through the GoodFET with only a few verbs.  A sample session with commentary follows.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Transaction&lt;/h3&gt;&lt;br /&gt;First, the host adjusts to 9600 8/N/1, then the device announces its presence.&lt;br /&gt;D: {0x00 (Monitor), 0x7F (OK), 0x00 (0 bytes)}&lt;br /&gt;&lt;br /&gt;The host calls the SETUP verb of the SPI application to configure the I/O pins.&lt;br /&gt;H: {0x01 (SPI), 0x10 (SETUP), 0x00 (0 bytes)}&lt;br /&gt;D: {0x01 (SPI), 0x10 (SETUP), 0x00 (0 bytes)}&lt;br /&gt;&lt;br /&gt;At this point, the I/O pins are now properly configured.  Pins 1, 2, 5, and 7 are now MISO, MOSI, !SS, and SCK.  As the READ and WRITE verbs are interchangeable for SPI, the host may use either.  If nothing is connected, the MISO pin's pullup resistor will ensure that the reply is always 0xFF.&lt;br /&gt;H: {0x01 (SPI), 0x00 (READ), 0x01 (1 byte), 0xDE}&lt;br /&gt;D: {0x01 (SPI), 0x00 (READ), 0x01 (1 byte), 0xFF}&lt;br /&gt;H: {0x01 (SPI), 0x01 (WRITE), 0x01 (1 byte), 0xAD}&lt;br /&gt;D: {0x01 (SPI), 0x01 (WRITE), 0x01 (1 byte), 0xFF}&lt;br /&gt;&lt;br /&gt;If pins 1 (MISO) and 3 (MOSI) are bridged, the output (MOSI) will feed right back into the input (MISO), causing the output value to be returned.&lt;br /&gt;H: {0x01 (SPI), 0x01 (WRITE), 0x01 (1 byte), 0x80}&lt;br /&gt;D: {0x01 (SPI), 0x01 (WRITE), 0x01 (1 byte), 0x80}&lt;br /&gt;&lt;br /&gt;If multiple SPI devices are chained together, such as in a gang programmer, data may be shifted through one into the other.  To do this, make a ring with each MISO line connected to the next's MOSI, then perform a transaction of as many bytes as you have devices.  This will cause !SS (Slave Select) to drop low, then all bytes will be shifted, then !SS will rise high to indicate the end of the transaction.  The same is appropriate for registers in multiples of 8 bits, such as a 16 bit device.  The first byte in the reply is the first byte to be received, so when ganging devices the bytes of the reply will need to have their order swapped.&lt;br /&gt;H: {0x01 (SPI), 0x01 (WRITE), 0x02 (2 bytes), 0xDE, 0xAD}&lt;br /&gt;D: {0x01 (SPI), 0x01 (WRITE), 0x02 (2 bytes), 0xBE, 0xEF}&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Ideas&lt;/h3&gt;&lt;br /&gt;A programmer/dumper for SPI EEPROMs could be written in short order, as could a command console for various Zigbee radio modules.  The present application only supports SPI's master mode, but slave and sniffing support will be added at a later date.&lt;br /&gt;&lt;br /&gt;A separate tutorial on extending the firmware will be available soon.  If you'd like to get a head start, fork spi.c to make an I2C adapter.  Email or catch me at a conference for a free board.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-264248781091850733?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/264248781091850733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=264248781091850733' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/264248781091850733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/264248781091850733'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/06/spi-client-tutorial-for-goodfet.html' title='SPI Client Tutorial for the GoodFET'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2426/3598111926_13103365de_t.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7174663812563976795</id><published>2009-05-29T06:11:00.004-04:00</published><updated>2009-05-29T22:25:13.538-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>GoodFET11 Released</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3574993035/" title="GoodFET12 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2460/3574993035_9f01b1bfa3.jpg" alt="GoodFET12" width="500" height="375" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://goodfet.sourceforge.net/hardware/goodfet11/"&gt;GoodFET11&lt;/a&gt; boards have arrived for &lt;a href="http://www.hardhack.org/"&gt;HardHack&lt;/a&gt; in Berlin, where they were assembled earlier today.  It was quite neighborly to see that intelligent people with steady hands, but no prior practice, had little trouble assembling the GoodFET's surface mount components.&lt;br /&gt;&lt;br /&gt;GoodFET firmware ought to be functional in the next week or two, with I2C and the Chipcon debugging protocol as the first targets.  Please contact me if you are interested in writing a client application in Python or another unix scripting language.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-7174663812563976795?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/7174663812563976795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=7174663812563976795' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7174663812563976795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7174663812563976795'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/goodfet11-released.html' title='GoodFET11 Released'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2460/3574993035_9f01b1bfa3_t.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-561841489343076169</id><published>2009-05-22T12:21:00.004-04:00</published><updated>2009-05-29T05:51:33.757-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='em260'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2530'/><category scheme='http://www.blogger.com/atom/ns#' term='cc2430'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><category scheme='http://www.blogger.com/atom/ns#' term='em250'/><title type='text'>Black Hat '09, Defcon 17</title><content type='html'>Howdy y'all,&lt;br /&gt;&lt;br /&gt;I'll be taking a trip to Vegas this summer for &lt;a href="http://blackhat.com/html/bh-usa-09/bh-usa-09-speakers.html#Goodspeed"&gt;Black Hat&lt;/a&gt; and &lt;a href="http://defcon.org/html/defcon-17/dc-17-speakers.html#Goodspeed"&gt;Defcon&lt;/a&gt;.  Abstracts below are as submitted to the conferences, and there will be a tool released, of the extra-neighborly sort, at Black Hat.  I also expect to do some hands-on stuff at Defcon's hardware hacking village.&lt;br /&gt;&lt;br /&gt;For Defcon,&lt;br /&gt;&lt;a href="http://defcon.org/html/defcon-17/dc-17-speakers.html#Goodspeed"&gt;Locally Exploiting Wireless Sensors&lt;/a&gt;&lt;br /&gt;Wireless sensors are often built with a microcontroller and a radio chip, connected only by a SPI bus. The radio, not the MCU, is responsible for symmetrical cryptography of each packet. When the key is loaded, it is sent as cleartext over the SPI bus, and an attacker with local access can steal the key using a few syringe probes and readily available hardware. This attack and other local attacks against wireless sensor networks will be presented in detail, including a live demo of an AES128 key being extracted from an operational network. Following the conclusion of the lecture, audience members will be brought onstage to perform the attack themselves on various pieces of example hardware.&lt;br /&gt;&lt;br /&gt;For Black Hat,&lt;br /&gt;&lt;a href="http://blackhat.com/html/bh-usa-09/bh-usa-09-speakers.html#Goodspeed"&gt;A 16 bit Rootkit and Second Generation Zigbee Chips&lt;/a&gt;&lt;br /&gt;This lecture in two parts presents first a self-replicating rootkit for wireless sensors, then continues with recent research into the security of second generation Zigbee radio chips such as the CC2430/2431 and the EM250.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-561841489343076169?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/561841489343076169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=561841489343076169' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/561841489343076169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/561841489343076169'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/black-hat-09-defcon-17.html' title='Black Hat &apos;09, Defcon 17'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6848710031057579985</id><published>2009-05-19T10:51:00.004-04:00</published><updated>2009-05-19T11:10:50.943-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='disassembly'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly language'/><title type='text'>MSP430 Challenge of May 2009</title><content type='html'>Howdy neighbors,&lt;br /&gt;&lt;br /&gt;The following image is a piece of disassembled code that was compiled for the MSP430F1611.  The code is found in many programs, but in this one it is accidentally vestigial as a result of a compiler bug.  Please comment as to (1) which compiler generated the code, (2) what the code was intended to do, and (3) why the code is vestigial in the example, but might not be in another program.  Translations to C or psuedocode and commented write-ups are also nice.  The &lt;a href="http://focus.ti.com/lit/ug/slau049f/slau049f.pdf"&gt;MSP430F1xx Family Guide&lt;/a&gt; might be handy if you're unfamiliar with the architecture.&lt;br /&gt;&lt;br /&gt;I'll send a &lt;a href="http://goodfet.sf.net/"&gt;GoodFET&lt;/a&gt; board to the most insightful commentator, but as I send those boards out to anyone who asks, you're really only commenting for the neighborliness of it all.  If I get enough replies, I'll post one of these each month.&lt;br /&gt;&lt;br /&gt;Also, I saw a lot of good work on last month's &lt;a href="http://travisgoodspeed.blogspot.com/2009/04/notacon-masked-rom-challenge.html"&gt;Masked ROM Challenge&lt;/a&gt; while I was a Cleveland, but next to nothing has been sent my way.  If you made significant progress, such as semi-automated extraction of the bits, please email me.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3546164142/" title="Disassembly Challenge by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3338/3546164142_5bd4873a42_o.png" width="417" height="282" alt="Disassembly Challenge" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6848710031057579985?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6848710031057579985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6848710031057579985' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6848710031057579985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6848710031057579985'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/msp430-challenge-of-may-2009.html' title='MSP430 Challenge of May 2009'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2967505767305179743</id><published>2009-05-19T00:08:00.006-04:00</published><updated>2009-05-20T08:44:14.035-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><category scheme='http://www.blogger.com/atom/ns#' term='phneutral'/><category scheme='http://www.blogger.com/atom/ns#' term='berlin'/><category scheme='http://www.blogger.com/atom/ns#' term='hardhack'/><title type='text'>HardHack and PH Neutral, Berlin</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3422184782/" title="Last Night in Knoxville by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3616/3422184782_c8da86e67e_m.jpg" width="240" height="180" alt="Last Night in Knoxville" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;On April Fool's day, I jumped into my car and left Knoxville to wander the world in search of neighborliness.  Now I find myself in Berlin, finishing up some projects and living on döner.&lt;br /&gt;&lt;br /&gt;At the end of this month, I'll be giving a workshop at &lt;a href="http://hardhack.org/"&gt;HardHack&lt;/a&gt; on Friday 29 May on the &lt;a href="http://goodfet.sourceforge.net/"&gt;GoodFET&lt;/a&gt; project.  No slideshow, no projector, just a good old fashioned, informal sermon on the design as we build a few USB JTAG adapters then program them.  Sign-ups for the workshop are &lt;a href="http://hardhack.mixxt.org/networks/events/show_event.6296"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The GoodFET is self-programmable by USB, so upgrading firmware requires no additional hardware.  As this is surface-mount, you'll need to have a steady hand and good eyesight.  I've ordered parts and boards for the GoodFET11, with the GoodFET10 as a backup if the boards don't arrive in time.&lt;br /&gt;&lt;br /&gt;On Saturday 30 May at 15h00, I'll be presenting at &lt;a href="http://ph-neutral.darklab.org/talks.html"&gt;PH Neutral&lt;/a&gt;.  Everything about the talk is a surprise, except that it involves embedded systems.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2967505767305179743?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2967505767305179743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2967505767305179743' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2967505767305179743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2967505767305179743'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/hardhack-and-ph-neutral-berlin.html' title='HardHack and PH Neutral, Berlin'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3616/3422184782_c8da86e67e_t.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2678741368487294292</id><published>2009-05-15T08:22:00.005-04:00</published><updated>2009-05-15T08:36:57.661-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430rf2500'/><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='usb'/><category scheme='http://www.blogger.com/atom/ns#' term='hid'/><title type='text'>Microchip Zena Reversed</title><content type='html'>Howdy y'all,&lt;br /&gt;&lt;br /&gt;Neighbor Joshua Wright has &lt;a href="http://www.willhackforsushi.com/?p=198"&gt;reverse engineered the Microchip Zena Zigbee sniffer&lt;/a&gt;'s USB protocol, allowing packets to be dumped and channels to be hopped from Linux.  Kismet support is the next step.&lt;br /&gt;&lt;br /&gt;The EZ430RF2500 uses similar tricks in Windows with its HID driver, making Linux support quite difficult.  If you have a Windows machine and are interested in doing the same to the RF2500 kit, please send an email my way, with a carbon copy to Josh.&lt;br /&gt;&lt;br /&gt;--Travis&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2678741368487294292?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2678741368487294292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2678741368487294292' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2678741368487294292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2678741368487294292'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/microchip-zena-reversed.html' title='Microchip Zena Reversed'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-9127246981064023349</id><published>2009-05-13T11:07:00.000-04:00</published><updated>2009-05-13T11:08:26.625-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430fet'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><title type='text'>FET Firmware from MSP430.DLL</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;The firmware of the MSP430 FET is distributed for purposes of upgrades within MSP430.dll.  In this brief article, I'll describe its location and a method for extraction.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Firmware as Regions&lt;/h3&gt;&lt;br /&gt;All of these examples will use &lt;a href="http://www.soft-switch.org/downloads/mspgcc/MSP430.dll"&gt;MSP430.dll&lt;/a&gt; with the following checksum.  My previous FET articles have used a firmware image from the last revision of libMSP430.so, so addresses and code fragments will differ slightly.&lt;br /&gt;f0685a0eca0545dfc542530afff8159f&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3527022210/" title="MSP430 FET IVT in MSP430.dll by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3409/3527022210_102ca8b4ed.jpg" width="500" height="281" alt="MSP430 FET IVT in MSP430.dll" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A bit of quick searching reveals that the firmware of the MSP430 FET is contained within MSP430.dll as little-endian words at these addresses.&lt;br /&gt;Bootloader code at offset of 0x1BFE8, region [0xF800,0xFFE0).&lt;br /&gt;Application code at offset of 0x1EB38, region [0x2500,0xF7E0).&lt;br /&gt;IVT at offset of 0x1BDBC, region [0xFFE0,0xFFFF].&lt;br /&gt;&lt;br /&gt;That is, to recover the bootloader, copy 32 bytes (0x10000-0xFFE0=0x20) from the DLL at (0x1BDBC+0xFFE0=0x2BD9C) offset to the target MSP430 image at 0xFFE0.&lt;br /&gt;&lt;br /&gt;Below are memory maps of my first attempt at extraction and an old EZ430 FET.  It's clear that a lot of junk has been included by accident, which is why tabular entries, rather than regions should be used.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3526955172/" title="MSP430FET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3384/3526955172_be1f7d7237_o.png" width="256" height="256" alt="MSP430FET" /&gt;&lt;/a&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2784281680/" title="EZ430U Memory Map by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3098/2784281680_336d49da97_o.png" width="256" height="256" alt="EZ430U Memory Map" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In addition to the large segments, there are also a few scattered bytes that form the lower IVT.  (See &lt;a href="http://travisgoodspeed.blogspot.com/2008/08/repurposing-ti-ez430u-part-3.html"&gt;Repurposing the TI EZ430U, Part 3&lt;/a&gt; for an explanation of why there are two Interrupt Vector Tables.)  Because the lower IVT is sparse, only those words which are not 0xFFFF are included.  For example, the lower RESET vector--which, incidentally, is never read by the bootloader, in which the lower RESET is hard-coded--resides at 0xF7FE and points to 0x2502.&lt;br /&gt;&lt;br /&gt;Searching MSP430.DLL for the interrupt vector, "02 25", yields a few results, one of which is "&lt;b&gt;fe f7&lt;/b&gt; d9 02 &lt;b&gt;02 25&lt;/b&gt;".  That's quite clearly an entry in a table of some sort.  Searching around it yields a few more entries.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Firmware as a Table&lt;/h3&gt;&lt;br /&gt;By this point is should be clear that while it might be possible to extract the different fragments of the firmware manually, it would by much nicer to dump the whole damned thing as a table.  This can be done.&lt;br /&gt;&lt;br /&gt;Each entry is of the form {adr, len, data} where adr is the 16-bit address of the fragment within the firmware image, len is the length of the data in 16-bit words, and data is a collection of 16-bit words as little-endian.  Following one entry is another, ending with an invalid address.  (Anything less than 0x200 is I/O, anything less than 0x2500 is not flash.)  Adding 4+(len&lt;&lt;1) to an entry's pointer gives the next entry.&lt;br /&gt;&lt;br /&gt;Using this technique and finding an initial entry point of 0x21036, I generated a dump that produces the following image (left) as compared to the previous attempt (right).&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3527772087/" title="MSP430.dll FET Firmware by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2338/3527772087_f6e23a16a6_o.png" width="256" height="256" alt="MSP430.dll FET Firmware" /&gt;&lt;/a&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3526955172/" title="MSP430FET by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3384/3526955172_be1f7d7237_o.png" width="256" height="256" alt="MSP430FET" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The new attempt contains everything important, including a few bytes which were missed in the first attempt.  It also lacks all of the vestigial bytes that got roped in by the previous method.  Further, as each binary is defined by a single entry point, it shouldn't be terribly difficult to search for the entry point in order to generically dump any version of the library.&lt;br /&gt;&lt;br /&gt;This cleanliness is confirmed by the callgraph below, which properly shows no function calls between the bootloader (right) and the application (left).  (Branches are not graphed.)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3528582802/" title="MSP430.dll FET Firmware by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2084/3528582802_5eac1123b0.jpg" width="346" height="500" alt="MSP430.dll FET Firmware" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Code&lt;/h3&gt;&lt;br /&gt;The MSP430 Flash Emulation Tool's firmware is available for free download in MSP430.DLL, and anyone wishing to experiment with it need only download the library and extract the code.&lt;br /&gt;&lt;br /&gt;A hastily written extraction utility can be found by subversion.  A screenshot follows.&lt;br /&gt;svn co https://goodfet.svn.sourceforge.net/svnroot/goodfet/contrib/fetextract&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3527866995/" title="FET Firmware Extraction by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2360/3527866995_08f4afdb42_o.png" width="494" height="553" alt="FET Firmware Extraction" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-9127246981064023349?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/9127246981064023349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=9127246981064023349' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/9127246981064023349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/9127246981064023349'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/fet-firmware-from-msp430dll.html' title='FET Firmware from MSP430.DLL'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3409/3527022210_102ca8b4ed_t.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-4240864753278135703</id><published>2009-05-09T15:53:00.002-04:00</published><updated>2009-05-12T17:51:46.223-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rs232'/><category scheme='http://www.blogger.com/atom/ns#' term='uart'/><title type='text'>UART Sniffing Notes</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;concerning a collaboration with Reilly Grant.&lt;br /&gt;&lt;br /&gt;The following are some brief notes on asynchronous serial traffic, how to decipher it, and how to identify a baud rate when a scope is unavailable.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;RS232, TTL UART Waveforms&lt;/h3&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3270674733/" title="Smart Card ATR by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3480/3270674733_eb7e2a67b9_m.jpg" width="240" height="180" alt="RS232 Serial" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3270672677/" title="Smart Card ATR by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3303/3270672677_56caeecc5b_m.jpg" width="240" height="180" alt="TTL Serial" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Of the two waveforms above, the first is RS232 and the second is TTL-level serial.  They are on opposite sides of a MAX232 level-converter, and the images have been scaled to show the same point in the transmission, which is inverted and amplified by the MAX232.  Here, the TTL line is +5V for a 1 and 0V for a 0.  The RS232 line is -10V for a 0 and +10V for a 1.&lt;br /&gt;&lt;br /&gt;In decoding serial traffic, it is important to recognize that the least significant bit is transmitted first, and that it is preceded by a start bit of 0.  Following the most significant bit will be an optional parity bit and stop bit of 1.  Thus, 0xEE would be&lt;br /&gt;111111110&lt;b&gt;01110111&lt;/b&gt;1111111&lt;br /&gt;where the bold portion is the data byte and the surrounding ones are the idle state.  For practice, draw arbitrary bytes on paper, both as RS232 and as TTL-level.  Further, note that the exact end of the byte is not immediately clear, and can only be found by matching timing from the starting 0 bit.&lt;br /&gt;&lt;br /&gt;Here is a photograph of a few bytes.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3271490816/" title="Smart Card ATR by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3527/3271490816_c126d5f819_m.jpg" width="240" height="180" alt="Smart Card ATR" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Double Timing&lt;/h3&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3270679121/" title="ATR Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3360/3270679121_16a7908d72_m.jpg" width="240" height="180" alt="Sniffing at the wrong rate." /&gt;&lt;/a&gt;&lt;br /&gt;When decoding serial traffic, it is crucially important to do so at the proper rate.  It is for this reason that the standard baud rates have been decided upon.  The traffic above was received at roughly, but not quite exactly, twice its baud rate.  Note--by clicking the image for a better view--how common bytes of 0xFF and 0x00 are, as well as how rare a byte containing just a single 1 or 0 in isolation is.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Close Timing&lt;/h3&gt;&lt;br /&gt;Once sniffing traffic on the proper order of magnitude, it is often the case that a smart card reader will not be using exactly the same timing.  As timing is synchronized not to a clock, but to a start bit, the less significant bits will be correct with errors being found in the more significant bits.  For example, "0x3B 0x02" might be mistakenly read as "0x9B 0x82" if the transmission is being sniffed at a slower rate than the actual.  This is because the stop bits are being misinterpreted as most-significant bits.  (10,400 baud being sniffed at 9600 baud, in this case.)&lt;br /&gt;&lt;br /&gt;To determine the next guess from an incorrect read without a scope, draw the misinterpreted byte and the correct byte of graph paper, comparing them.  Shown below are 0x3B and 0x9B, click on the image for annotations.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3515848741/" title="Bytes by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3337/3515848741_d071edc953_m.jpg" width="240" height="71" alt="Bytes" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, Unix was not designed with odd baud rates in mind, and the Linux solution isn't terribly elegant either.  In short, you must configure the port to run at 38,400 baud and override that baud rate with a manually chosen clock divider.  For details, see the setserial documentation, looking at the spd_cust option.  Further complicated matters, spd_cust doesn't seem to work with the FTDI usb/serial chip.  If you can get the chip to work at an odd rate, please post a comment with details.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Automation&lt;/h3&gt;&lt;br /&gt;Automatically identifying the baud rate isn't terribly hard for a microcontroller, which can watch traffic to measure the bit width and adjust its reception appropriately.  At some point, I'll write firmware for the MSP430 to do just that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-4240864753278135703?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/4240864753278135703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=4240864753278135703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4240864753278135703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4240864753278135703'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/05/uart-sniffing-notes.html' title='UART Sniffing Notes'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3480/3270674733_eb7e2a67b9_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1908511177577329167</id><published>2009-04-30T19:00:00.000-04:00</published><updated>2009-04-30T19:26:19.442-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430fet'/><category scheme='http://www.blogger.com/atom/ns#' term='ez430'/><category scheme='http://www.blogger.com/atom/ns#' term='goodfet'/><title type='text'>Improving the MSP430 FET</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3440547140/" title="GOODFET10 by Travis Goodspeed, on Flickr"&gt;&lt;img style="width: 395px; height: 297px;" src="http://farm4.static.flickr.com/3402/3440547140_93110cc816.jpg" alt="GOODFET10" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To celebrate 4/30 day, I am happy to announce my own variant of the MSP430 FET debugger.  My variant is compatible with a patched version of the original firmware, but my goal is to eventually have open firmware as well.&lt;br /&gt;&lt;br /&gt;For an overview of the internal functioning of the original FET, see my three part series on &lt;a href="http://travisgoodspeed.blogspot.com/2008/05/repurposing-ti-ez430u-part-1.html"&gt;Repurposing the EZ430&lt;/a&gt;, or torrent my 25C3 lecture on the same topic.&lt;br /&gt;&lt;br /&gt;For the purposes of this discussion, a FET is any Flash Emulation Tool containing an MSP430F1612, including the FET UIF and EZ430 debuggers.  The parallel-port FET operates differently and is outside the bounds of this discussion.&lt;br /&gt;&lt;br /&gt;To follow along with this discussion, be sure to print the FET schematics from the relevant TI application notes.  The FET UIF's schematic can be found on page 64 of &lt;a href="http://www.google.com/search?q=slau138"&gt;SLAU138K&lt;/a&gt;.  Version 1.0 of the EZ430U can found on page 12 of &lt;a href="http://www.google.com/search?q=slau176"&gt;SLAU176B&lt;/a&gt;, while Version 2.0 can be found on page 13 of &lt;a href="http://www.google.com/search?q=slau227"&gt;SLAU227B&lt;/a&gt;.  As I've likely made a few mistakes in the write-up, please kindly inform me of them.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;FT232 for TUSB3410&lt;/h2&gt;&lt;br /&gt;All present FETs use the &lt;a href="http://focus.ti.com/docs/prod/folders/print/tusb3410.html"&gt;TUSB3410&lt;/a&gt; usb to serial converter.  Support for this chip is a pain in Linux, with kernel module requirements varying often.  It's so bad that I keep a script in my private svn repository for fixing support as quickly as possible, and despite the recent appearance of open FET clients, using them on an obscure operating system is impossible without kernel support.&lt;br /&gt;&lt;br /&gt;Internally, the '3410 is an 8051 microcontroller with a USB 2.0 Full Speed (12Mb/s) peripheral and a single UART.  The traditional FET and most other devices use this chip with its default usb/serial firmware, but the second-generation EZ430 firmware uses various tricks to make a second, bit-banged, asynchronous serial port to the debugging target.  On Windows, this leads to reliability issues, and on Linux, this leads to utter incompatibility.  The '3410 also requires several external components, complicated the design and making hand soldering less feasible.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.ftdichip.com/Products/FT232R.htm"&gt;FT232R&lt;/a&gt; from FTDI is a perfect replacement.  It is available in an SSOP28 package for easy soldering, every operating system on Earth supports it, and its only external components are decoupling capacitors.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Bootstrap Loader&lt;/h2&gt;&lt;br /&gt;The MSP430 Bootstrap Loader (BSL) and I have had some good times together.  While I still consider it to be a security risk for locked devices, it's damned handy for an unlocked board such as the FET.  Likely for historical reasons, the BSL runs on P1.1 and P2.2, rather than the hardware UART pins.  It also requires a special reset sequence, in which the RTS and DTS serial lines are connected to the RST and TCK pins.&lt;br /&gt;&lt;br /&gt;Early revisions of the FET did not connect the BSL I/O pins, making the software bootloader that I describe in my articles on the EZ430 necessary.  (The FET and first-generation EZ430 share a flash bootloader, while the second-generation EZ430 has a different, larger bootloader.)  While later hardware revisions of the UIF connect the BSL pins, I've not seen the masked-ROM BSL used in practice.  My design supports the BSL, preventing bricking and allowing for TI's firmware and open firmware to be exchanged at a whim.&lt;br /&gt;&lt;br /&gt;To program the board by BSL, use tos-bsl with the --invert-reset and --invert-test switches.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;MSP430F1612/1611&lt;/h2&gt;&lt;br /&gt;The MSP430F1612 was chosen for compatibility with the original FET.  It has 55K of flash and 5K of RAM.  Alternately, the MSP430F1611 with an identical footprint might be used for applications which require additional RAM but are willing to use less flash, at the expense of compatibility with the original chip.  (MSP430 firmware grows upward from the bottom of flash memory, making it easy to port code from a device with less flash to a device with more, but difficult to port in the opposite direction.)&lt;br /&gt;&lt;br /&gt;All custom firmware should be compiled to run in the intersection of memory of the two chips.  In that way, most applications will run on either chip, with only those that need more stack depth requiring the 1611 and only those requiring more flash memory requiring the 1612.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Crystals&lt;/h2&gt;&lt;br /&gt;The MSP430 supports both high-speed and low-speed crystals, with the low-speed crystal's frequency being multiplied.  Stable timing is not necessary for synchronous protocols such as JTAG or Spy-Bi-Wire, but only for asynchronous serial communication.  While the EZ430 and FET firmwares both demand high-frequency crystals for absurdly high serial baud rates, I expect to reduce the data rate and source an external low-frequency crystal to reduce the parts count.&lt;br /&gt;&lt;br /&gt;It is also possible to use bit-banged serial, or to call bit-banging serial routines from the bootloader (BSL) ROM.  The BSL's code is particularly elegant because it resyncs the timing with the 0x80 SYN byte.  This byte in 8/E/1 (8 bits, Event parity, 1 stop bit) appears as 8 marks surrounded by spaces, so rather than being read it is measured.  The measured width is right shifted three times to get a bit's width, then once more for a half-bit.  This measurement is used to bit-bang one transaction, then a new measurement is made for the next transaction.  In this manner, even without a crystal, the BSL is able to perform fast, reliable serial communication in spite of clock drift.  By calling this code--which is already resident in each chip--crystal-free operation is possible.&lt;br /&gt;&lt;br /&gt;A high-frequency crystal is required to run unpatched variants of TI's firmware, but I've decided against including one in the design at this stage.  Perhaps this will change in the future.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;I/O Pins&lt;/h2&gt;&lt;br /&gt;The first four pins of P5 are used as JTAG and SBW I/O.  Starting with P5.0 and continuing to P5.3, they are TMS, TDI, TDO, and TCK.  I've chosen to omit the FET UIF's optical isolation in favor of the EZ430's simpler protection, which consists of 47K pull up resistors and 100R current-limiting resistors.  Unlike the EZ430, which only support spy-bi-wire, my design has a full 14-pin JTAG connector.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Firmware, Old&lt;/h2&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2784281680/" title="EZ430U Memory Map by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3098/2784281680_336d49da97_o.png" alt="EZ430U Memory Map" width="256" height="256" /&gt;&lt;/a&gt;&lt;br /&gt;The above image is the firmware of an EZ430U FET, generated by &lt;a href="http://msp430static.sourceforge.net/"&gt;msp430static&lt;/a&gt;.  0x0000 is the bottom left corner, 0xFF00 the top left, and 0xFFFF the top right.  Blue represents the target of an immediate pointer, black is empty flash memory, red is potentially executable code, and grey is information which is certainly not executable.&lt;br /&gt;&lt;br /&gt;The image is composed of two parts.  The upper red region is a bootloader which is used to reflash the chip, while the lower region does the actual work.  As compilers ship with firmware upgrades, it is not necessary to distribute any copyrighted code.  A replacement bootloader could accept a firmware upgrade, then patch it, while retaining software compatibility.  More information on the bootloader can be found in &lt;a href="http://travisgoodspeed.blogspot.com/2008/08/repurposing-ti-ez430u-part-3.html"&gt;Part 3&lt;/a&gt; of my series on repurposing the TI EZ430U.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Firmware, New&lt;/h2&gt;&lt;br /&gt;Ideally, replacement firmware will be written for various applications, beyond MSP430 debugging.  The same hardware could program competing microcontrollers, serial eeproms, FPGAs, and all sort of other things in the same way that the Hackaday Bus Pirate does.&lt;br /&gt;&lt;br /&gt;So far as replacement firmware for debugging MSP430 chips goes, documentation is slim.  Enough of the JTAG protocol has been documented to implement programming, but the setting of hardware breakpoints and other advanced features are not described by any public documentation.  Custom firmware is not yet functional, but that ought to change in the near future.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Second Serial&lt;/h2&gt;&lt;br /&gt;The red board variants of the EZ430, those shipping with the RF kits, use drastically different firmware to facilitate a second serial port that connects to the target board.  This breaks Linux compatibility, requiring firmware of both the MSP430 and the CAT24 EEPROM of the board to be downgraded.&lt;br /&gt;&lt;br /&gt;To support low voltage serial communications, I brought out the second UART of the board's MSP430 to test points.  This might also be used for timing attacks or similar things.  Series and pull-up resistors would be nice on these lines, but they were omitted in the first design.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Availability&lt;/h2&gt;&lt;br /&gt;I've ordered a panel of the first revision, GOODFET10, and I'll send a board to anyone who is willing to assemble the device and help construct its firmware.  Schematics, gerbers, and construction details have been posted to &lt;a href="http://goodfet.sourceforge.net/"&gt;http://goodfet.sourceforge.net/&lt;/a&gt;, and "hello world" firmware has already been committed to the subversion repository.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1908511177577329167?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1908511177577329167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1908511177577329167' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1908511177577329167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1908511177577329167'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/03/improving-msp430-fet.html' title='Improving the MSP430 FET'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3402/3440547140_93110cc816_t.jpg' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-169713547135322993</id><published>2009-04-17T14:21:00.003-04:00</published><updated>2009-04-17T14:37:46.355-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bsl'/><category scheme='http://www.blogger.com/atom/ns#' term='notacon'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Notacon Masked ROM Challenge</title><content type='html'>Here at Notacon 6 in Cleveland, I'm having a competition involving the decoding of the MSP430F22x4's masked BSL ROM.  The ROM, pictured below, begins with "0c06; 0c1e; 3fff; 40b2; a540; 012c; 90b2; ffde;" and ends with (in reverse order) "62b1; 0401; 0102; 0000; 0000; 0000; 4040; 27f2; ffff; ffff; ffff; ffff;".&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3426617899/" title="MSP430F2274 BSL ROM by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3370/3426617899_e95fbafdc3.jpg" width="500" height="357" alt="MSP430F2274 BSL ROM" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Begin by downloading the high resolution version of the image, then marking it like so.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3425845978/" title="BSL ROM, Marked by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3416/3425845978_77299bf3cf.jpg" width="500" height="375" alt="BSL ROM, Marked" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The first person to bring me a method for converting addresses to physical locations and back will win a Hack-A-Day Bus Pirate kit.  A second kit will be given to the first person to bring me a script for generating correct bits from a binary (or Intel Hex) dump of the ROM.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3226260823/" title="Bus Pirate by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3452/3226260823_7b1f5dd6da.jpg" width="500" height="375" alt="Bus Pirate" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hints will be given during my lecture, "Fun with the MSP430", Saturday at noon.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-169713547135322993?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/169713547135322993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=169713547135322993' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/169713547135322993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/169713547135322993'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/04/notacon-masked-rom-challenge.html' title='Notacon Masked ROM Challenge'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3370/3426617899_e95fbafdc3_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5319967172342575757</id><published>2009-03-27T16:04:00.004-04:00</published><updated>2009-03-27T16:42:48.665-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430fet'/><category scheme='http://www.blogger.com/atom/ns#' term='ez430'/><title type='text'>An Open GDBProxy!</title><content type='html'>Howdy everybody,&lt;br /&gt;&lt;br /&gt;Rob Spanton and Tom Bennellick have recently released &lt;a href="http://xgoat.com/wp/2009/03/25/fetproxy-an-open-source-replacement-for-msp430-gdbproxy/"&gt;fetproxy&lt;/a&gt;, an open-source replacement for gdbproxy.  They reverse engineered the protocol the week before I did, and their implementation--unlike mine--acts as a replacement for gdbproxy.  They also managed to get approval from Texas Instruments, which is quite neighborly indeed.&lt;br /&gt;&lt;br /&gt;I'll be closing up my &lt;a href="http://msp430fet.sourceforge.net/"&gt;msp430fet&lt;/a&gt; project, which was only intended as a stop-gap until Rob and Tom were able to make their release.  The final state will be a standalone C client for programming; I won't be adding support for debugging.&lt;br /&gt;&lt;br /&gt;--Travis&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5319967172342575757?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5319967172342575757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5319967172342575757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5319967172342575757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5319967172342575757'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/03/open-gdbproxy.html' title='An Open GDBProxy!'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-4431726227315458052</id><published>2009-03-15T00:29:00.003-04:00</published><updated>2009-03-15T01:11:27.094-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='802.15.4'/><title type='text'>Breaking 802.15.4 AES128 by Syringe</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;I'm working on a pair of hands-on Zigbee hacking workshops.  The first, which I've submitted with &lt;a href="http://planete.inrialpes.fr/~francill/"&gt;Aurélien Francillon&lt;/a&gt; to &lt;a href="http://toorcamp.org/"&gt;ToorCamp&lt;/a&gt; involves the writing of advanced stack overflow attacks for the MSP430 and AVR microcontrollers.  The second, which I've submitted to &lt;a href="http://defcon.org/"&gt;Defcon 17&lt;/a&gt;, involves a number of hands-on hardware attacks against Zigbee nodes.  Both include the sniffing of AES128 keys from a CC2420 Zigbee radio, a procedure that I demonstrated informally at &lt;a href="http://www.sourceconference.com/"&gt;Source Boston&lt;/a&gt; and describe below.&lt;br /&gt;&lt;br /&gt;The CC2420 is a popular Zigbee/802.15.4 radio, and it is found in many wireless sensor development kits.  We'll be attacking its hardware-accelerated AES128 implementation, by taking advantage of the fact that keys must be loaded over the SPI bus.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3351124394/" title="Zigbee Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3649/3351124394_7c2a2a9685.jpg" width="500" height="375" alt="Zigbee Sniffing" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the photograph above, I've tapped one of three &lt;a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus"&gt;SPI&lt;/a&gt; pins of the CC2420 radio chip on a Telos B using a hypodermic syringe.  SPI consists of four pins: SCL, MOSI, MISO, and !SS.  SCL, the Serial Clock, is output from the master to synchronize communication with the slave.  MOSI and MISO are data lins, Master Out Slave In and Master In Slave Out.  !SS or Slave Select is an inverted line that indicates the selection of a particular slave chip.  Here, we'll only be tapping SCLK and one of the data lines, as two syringes are much easier to hold that four.  Ground is shared by USB, so it isn't critical that we tap it.&lt;br /&gt;&lt;br /&gt;As seen on my portable scope below, the tapped pin is the SCL, the data clock.  The clock stands out because it idles low, and because all pulses in a batch are of regular width.  Unlike a system clock, the clock only cycles when data is being transported.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3350299275/" title="Zigbee Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3624/3350299275_183087a0ca.jpg" width="500" height="375" alt="Zigbee Sniffing" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The remaining two pins, in the group of three, are data.  As shown on the scope image below, SPI data lines idle high, and bits are measures on edges of the clock.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3350299075/" title="Zigbee Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3629/3350299075_ddf00609be.jpg" width="500" height="375" alt="Zigbee Sniffing" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now that the clock and data lines have been found, it is necessary to sniff the traffic using a bus adapter.  Until SPI-sniffing firmware for the &lt;a href="http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/"&gt;Hackaday Bus Pirate&lt;/a&gt; becomes available, I will continue to use the &lt;a href="http://www.totalphase.com/products/beagle_ism/"&gt;Total Phase Beagle I2C/SPI Protocol Analyzer&lt;/a&gt;.  A screenshot of the Total Phase client follows.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3354972429/" title="CC2420 Sniffing by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3644/3354972429_a6d143bd59.jpg" width="500" height="273" alt="CC2420 Sniffing" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;All that remains to identify the key in use, or anything else sent over the bus, is to read the log.  I will likely release scripts for doing so at Defcon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-4431726227315458052?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/4431726227315458052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=4431726227315458052' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4431726227315458052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4431726227315458052'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/03/breaking-802154-aes128-by-syringe.html' title='Breaking 802.15.4 AES128 by Syringe'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3649/3351124394_7c2a2a9685_t.jpg' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6191014654988422833</id><published>2009-03-04T13:31:00.002-05:00</published><updated>2009-03-04T13:34:24.311-05:00</updated><title type='text'>NeighborCon</title><content type='html'>Howdy y'all,&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.neighborcon.org/"&gt;NeighborCon&lt;/a&gt; announcement is up, for Knoxville's most neighborly hacker conference.  There's also talk of a trip to Dollywood after the conference has concluded.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6191014654988422833?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6191014654988422833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6191014654988422833' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6191014654988422833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6191014654988422833'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/03/neighborcon.html' title='NeighborCon'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5513146345421604008</id><published>2009-03-03T05:29:00.004-05:00</published><updated>2009-03-05T15:23:19.033-05:00</updated><title type='text'>New Business Card</title><content type='html'>Howdy Neighbors,&lt;br /&gt;&lt;br /&gt;I've just received a few prototypes of my new business card, which also happens to be a 1.8V/3.3V smart card emulator.  (Most readers default to 5V, just to make life difficult.)  The final revision will be compatible with all three voltages, and I expect to order boards in quantity by the end of next month.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3325603952/" title="GoodCard10 Business Card by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3652/3325603952_25fa9d175e.jpg" width="500" height="375" alt="GoodCard10 Business Card" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;&lt;br /&gt;Postscript:&lt;br /&gt;Just to be perfectly clear, these are not intended for TV piracy and they are not for sale.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5513146345421604008?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5513146345421604008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5513146345421604008' title='34 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5513146345421604008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5513146345421604008'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/03/new-business-card.html' title='New Business Card'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3652/3325603952_25fa9d175e_t.jpg' height='72' width='72'/><thr:total>34</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7421680509249007972</id><published>2009-02-23T11:20:00.006-05:00</published><updated>2009-02-23T21:05:31.369-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>SOURCE Boston and Notacon</title><content type='html'>Howdy Y'all,&lt;br /&gt;&lt;br /&gt;The next stops of my tour will be &lt;a href="http://www.sourceconference.com/"&gt;SOURCE Boston&lt;/a&gt; in March and &lt;a href="http://www.notacon.org/"&gt;Notacon&lt;/a&gt; in April.  In between, I might swing by &lt;a href="http://www.carolinacon.org/"&gt;Carolinacon&lt;/a&gt;, though I won't be speaking.&lt;br /&gt;&lt;br /&gt;My &lt;a href="http://www.sourceconference.com/"&gt;SOURCE Boston&lt;/a&gt; lecture, Wireless Sensors as an Asset and a Liability, is my first attempt at a business lecture, albeit one that repeatedly leans on technical depth for credibility.  First, I will explain exactly why this technology is too valuable to ignore.  Entire industries will be revolutionized by it, and any firm refusing to use the technology will find itself at a significant competitive disadvantage.  That being done, I'll continue by demonstrating just how easy it is to subvert this technology, using a few items from my bag of tricks that haven't made it into other conferences.&lt;br /&gt;&lt;br /&gt;My &lt;a href="http://www.notacon.org/"&gt;Notacon&lt;/a&gt; lecture, Building Things with the MSP430, is also a departure from my previous topics, in that I won't mention security.  Instead, I'll provide some helpful tips on how to build &lt;a href="http://www.tnbelt.com/"&gt;belt buckles&lt;/a&gt;, toys, and other other neighborly things.  Attend if you're new to electronic design or the MSP430 microcontroller, or if you're sick of security and want to be a belt buckle engineer.&lt;br /&gt;&lt;br /&gt;As always, email me if you'd like to meet at either conference.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-7421680509249007972?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/7421680509249007972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=7421680509249007972' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7421680509249007972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/7421680509249007972'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/02/source-boston-and-notacon.html' title='SOURCE Boston and Notacon'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6874742502072006543</id><published>2009-01-14T08:00:00.000-05:00</published><updated>2009-01-14T08:11:06.382-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Shmoocon and Black Hat, DC</title><content type='html'>Howdy y'all,&lt;br /&gt;&lt;br /&gt;I'll be presenting two new lectures in DC next month.  The first, at &lt;a href="http://shmoocon.org/presentations-all.html"&gt;Shmoocon&lt;/a&gt;, is on the construction of wireless sensors.  Beginning with a product idea, Josh Gourneau and I will step you through the design of a modern sensor node's hardware and software.  Then we walk you through the design of a brand new node: hardware design, fabrication, porting an operating system, writing an application, maintaining power efficiency, and proper use of the radio.  Who knows, we might even make radio version of our neighborly &lt;a href="http://www.tnbelt.com/"&gt;Party Mode Belt Buckle&lt;/a&gt;?&lt;br /&gt;&lt;br /&gt;At Shmoocon, be sure to catch &lt;a href="http://shmoocon.org/presentations-all.html#shelf"&gt;Off the Shelf Security - Meeting Crime with an Open Source Mind&lt;/a&gt;, which immediately follows my talk in the same room.&lt;br /&gt;&lt;br /&gt;My second lecture, at &lt;a href="http://www.blackhat.com/html/bh-dc-09/bh-dc-09-speakers.html#Goodspeed"&gt;Black Hat DC&lt;/a&gt;, will describe the reverse engineering and exploitation of wireless sensors.  You will learn how to take a wireless sensor apart, reverse engineer its firmware, sniff the various buses it contains, craft an embedded stack overflow, and some interesting techniques with radio jamming.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6874742502072006543?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6874742502072006543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6874742502072006543' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6874742502072006543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6874742502072006543'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/01/shmoocon-and-black-hat-dc.html' title='Shmoocon and Black Hat, DC'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6722037630798900877</id><published>2009-01-03T17:11:00.010-05:00</published><updated>2009-02-16T15:59:58.811-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430fet'/><title type='text'>Implementing the MSP430 FET Protocol</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;continuing &lt;a href="http://travisgoodspeed.blogspot.com/2008/12/sniffing-msp430-fet-protocol.html"&gt;initial observations&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Following a comment posted to the prior article, I discovered that, as suggested, the PPP FCS-16 checksum is the one used for communicated with the FET.  Searching MSP430.dll for the initial bytes of the checksumming table which is presented on Section C.2 of &lt;a href="http://www.ietf.org/rfc/rfc1662.txt"&gt;RFC1662&lt;/a&gt;, yields the following table,&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3163462525/" title="CRC16 Function from MSP430.dll by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm2.static.flickr.com/1164/3163462525_a3e0be395e_o.png" width="521" height="114" alt="CRC16 Function from MSP430.dll" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The 16-bit entries from the table appear as little endian, so {0x1189, 0x2312} becomes {0x89, 0x11, 0x12, 0x23}.  Running a quick test with the RFC's FCS-16 code yields a proper checksum, with which messages can be signed.&lt;br /&gt;&lt;br /&gt;The result of this is an open source too, &lt;a href="https://sourceforge.net/projects/msp430fet/"&gt;MSP430FET&lt;/a&gt;, for programming chips with the MSP430 FET tools.  The present version can read and write memory, but it is limited to spy-bi-wire and is unable to erase memory.  Expect those features, and a website, in a later revision.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;svn co https://msp430fet.svn.sourceforge.net/svnroot/msp430fet/trunk msp430fet&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6722037630798900877?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6722037630798900877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6722037630798900877' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6722037630798900877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6722037630798900877'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2009/01/implementing-msp430-fet-protocol.html' title='Implementing the MSP430 FET Protocol'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5851828567567328303</id><published>2008-12-30T21:09:00.024-05:00</published><updated>2009-03-27T16:04:20.609-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430fet'/><title type='text'>Sniffing the MSP430 FET Protocol</title><content type='html'>by Travis Goodspeed &amp;lt;travis at radiantmachines.com&amp;gt;&lt;br /&gt;regarding his independent recreation of &lt;strike&gt;anonymous,&lt;/strike&gt; &lt;a href="http://xgoat.com/wp/2008/12/31/msp430-gdbproxy-replacement-implemented/"&gt;&lt;strike&gt;unpublished&lt;/strike&gt;&lt;/a&gt; by other neighborly fellows.  &lt;b&gt;update:&lt;/b&gt; see &lt;a href="http://xgoat.com/wp/2009/03/25/fetproxy-an-open-source-replacement-for-msp430-gdbproxy/"&gt;here&lt;/a&gt; for the original implementation.&lt;br /&gt;&lt;br /&gt;As the MSP430's gdbproxy relies upon closed-source libraries, which are not available for platforms other that Windows and i386 Linux, it would be valuable to generate an open-source alternative.  Further, these closed libraries do not allow the debugging of all MSP430's.  As reverse engineering the protocol by code review would be prohibitively complicated, grabbing serial traffic is an effective alternative.  The following method allows for the dumping of serial frames for later analysis.&lt;br /&gt;&lt;br /&gt;It is also a worthy goal to reverse engineer the proprietary aspects of TI's JTAG standard, but that is not the subject of this article.  Here I will only investigate the protocol between a workstation and the MSP430 JTAG tool.&lt;br /&gt;&lt;br /&gt;The simplest means of doing so is by using LD_PRELOAD to proxy--and print--calls to the write() and read() methods.  To do so, I authored &lt;a href="http://frob.us/downloads/serspy-2008-12-31.tar.bz2"&gt;serspy&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Serspy works by proxying each call to the read() and write() system calls.  For example, to trap the write() command,&lt;br /&gt;&lt;br /&gt;&lt;pre width="80"&gt;//trap the write command&lt;br /&gt;&lt;strong&gt;&lt;font color="#4169E1"&gt;&lt;a name="ssize_t"&gt;&lt;/a&gt;static ssize_t (*_write)(int fd, const void *buf, size_t count)&lt;/font&gt;&lt;/strong&gt;=0;&lt;br /&gt;&lt;strong&gt;&lt;font color="#4169E1"&gt;&lt;a name="write"&gt;&lt;/a&gt;int write(int fd, const void *buf, size_t count)&lt;/font&gt;&lt;/strong&gt;{&lt;br /&gt;  int num;&lt;br /&gt;  &lt;br /&gt;  //This grabs a pointer to the original function.&lt;br /&gt;  &lt;font color="#4169E1"&gt;if&lt;/font&gt;(!_write)&lt;br /&gt;    _write=(ssize_t (*) (int fd, const void *buf, size_t count)) dlsym(RTLD_NEXT,&lt;font color="#666666"&gt;"write"&lt;/font&gt;);&lt;br /&gt;  &lt;br /&gt;  //Now really write.&lt;br /&gt;  num=_write(fd,buf,count);&lt;br /&gt;  &lt;br /&gt;  //And log it.&lt;br /&gt;  logdataw(fd,buf,count);&lt;br /&gt;  &lt;font color="#4169E1"&gt;return&lt;/font&gt; num;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The code above is a replacement for the write() function which uses dlsym() to request a pointer to the original write() function, to which it forwards the call before logging it.  As msp430-gdbproxy doesn't link against libdl and it is a 32-bit application, LD_PRELOAD must be set to ``./serspy.so:/usr/lib32/libdl.so''.  Further, serspy.so itself must be compiled with the -m32 switch on 64-bit workstations.&lt;br /&gt;&lt;br /&gt;Consider an example transaction, such as&lt;br /&gt;&lt;pre&gt;W  7e 01 01 16 07 7e&lt;br /&gt;R  0c 00&lt;br /&gt;R  01 02 00 00 01 00 50 9e 98 00 67 4b&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Writes (W) from the workstation begin and end with 0x7e, which never appears within the request.  An encoding method of some sort is used to remove them.  Reads (R) from the FET device begin with a 16-bit, little endian length.  Following this length are the bytes themselves.&lt;br /&gt;&lt;br /&gt;Consider also the following Writes, all of which are fetches for memory.&lt;br /&gt;&lt;pre&gt;x/h 0x0200&lt;br /&gt;7e 0d 02 02 00 00 02 00 00 02 00 00 00 b0 17 7e&lt;br /&gt;x/h 0xfc00&lt;br /&gt;7e 0d 02 02 00 00 fc 00 00 02 00 00 00 c0 06 7e&lt;br /&gt;x/h 0xfc02&lt;br /&gt;7e 0d 02 02 00 02 fc 00 00 02 00 00 00 af 0d 7e&lt;/pre&gt;&lt;br /&gt;All addresses are found intact as little endian: "00 02" for 0x200, "00 fc" for 0xfc00, and "02 fc" for 0xfc02.  That won't be true for bytes which contain illicit characters, as I'll demonstrate later.  Also note that the final two bytes of each message vary drastically; these are most likely a checksum of some sort.&lt;br /&gt;&lt;br /&gt;Regarding the checksum, there are two common possibilities.  The first is a CRC16 checksum, while the latter is the XOR of all transmitted bytes.  The MSP430's serial bootstrap loader uses the latter method, but it is easy to rule out here.  As the examples above for fetching 0xfc00 and 0xfc02 differ by only one bit apart from the checksum, yet the checksums show no resemblance, this checksumming function must be more complicated.  A solution to the checksumming problem will be presented in a later article.&lt;br /&gt;&lt;br /&gt;Illicit characters are dealt with by escaping.  Consider the following queries,&lt;br /&gt;&lt;pre&gt;x/h 0xeeee&lt;br /&gt;7e 0d 02 02 00 ee ee 00 00 02 00 00 00 5c ac 7e&lt;br /&gt;x/h 0xee7e&lt;br /&gt;7e 0d 02 02 00 7d 5e ee 00 00 02 00 00 00 c6 3c 7e&lt;br /&gt;x/h 0xee7d&lt;br /&gt;7e 0d 02 02 00 7d 5d ee 00 00 02 00 00 00 16 b6 7e&lt;br /&gt;x/h 0xee7f&lt;br /&gt;7e 0d 02 02 00 7f ee 00 00 02 00 00 00 79 bd 7e&lt;br /&gt;x/h 0xee7c&lt;br /&gt;7e 0d 02 02 00 7c ee 00 00 02 00 00 00 a9 37 7e&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;From this it can be seen that 0x7d is the escape character, and that 0x7d and 0x7e are the characters to be escaped.  Each is escaped by following 0x7d with either 0x5e or 0x5d, taking the lesser nybble.&lt;br /&gt;&lt;br /&gt;Performing a few more queries exposes the length field of the memory read, as queries for 2, 1, and 4 bytes yield&lt;br /&gt;&lt;pre&gt;x/h 0xeeee&lt;br /&gt;7e 0d 02 02 00 ee ee 00 00 02 00 00 00 5c ac 7e&lt;br /&gt;x/b 0xeeee&lt;br /&gt;7e 0d 02 02 00 ee ee 00 00 01 00 00 00 91 89 7e&lt;br /&gt;x/w 0xeeee&lt;br /&gt;7e 0d 02 02 00 ee ee 00 00 04 00 00 00 c6 e7 7e&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The first byte after the frame-start is 0xd, which is also the first byte of the response.  Taking this further, a command/response code can be discovered, which is the first byte of both the encapsulated request and the response.  In the follwoing case, an examine query has the code 0x0d while the set query has a code of 0x0e.&lt;br /&gt;&lt;pre&gt;set *0xffd0=0xdead&lt;br /&gt;W  7e 0e 04 01 00 d0 ff 00 00 02 00 00 00 ad de 49 6e 7e&lt;br /&gt;R  06 00&lt;br /&gt;R  0e 00 00 00 9c 52&lt;br /&gt;x/h 0xffd0&lt;br /&gt;W  7e 0d 02 02 00 e0 ff 00 00 02 00 00 00 4d b6 7e&lt;br /&gt;R  0c 00&lt;br /&gt;R  0d 03 00 00 02 00 00 00 ff ff 03 b8&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strike&gt;This series will be continued once the checksumming routine has been reimplemented, at which point a custom client may be written.&lt;/strike&gt;&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://travisgoodspeed.blogspot.com/2009/01/implementing-msp430-fet-protocol.html"&gt;this post&lt;/a&gt; for details on my implementation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5851828567567328303?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5851828567567328303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5851828567567328303' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5851828567567328303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5851828567567328303'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/12/sniffing-msp430-fet-protocol.html' title='Sniffing the MSP430 FET Protocol'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-349242442801854488</id><published>2008-11-25T15:22:00.002-05:00</published><updated>2008-11-25T15:58:48.753-05:00</updated><title type='text'>25C3 Workshop</title><content type='html'>I'll be giving a &lt;a href="http://events.ccc.de/congress/2008/wiki/Workshops"&gt;workshop&lt;/a&gt; on Repurposing the TI EZ430U at the 25th Chaos Communications Congress, Berlin.  It will be on Day 3 (2008-12-29 Mon) from 16h00 to 18h00.&lt;br /&gt;&lt;br /&gt;There's no charge for the workshop beyond conference admission, but please attend the lecture and bring an &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/ez430-f2013.html"&gt;EZ430&lt;/a&gt; with you if at all possible.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;--Travis&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-349242442801854488?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/349242442801854488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=349242442801854488' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/349242442801854488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/349242442801854488'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/11/25c3-workshop.html' title='25C3 Workshop'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3720904391382212946</id><published>2008-11-19T17:41:00.002-05:00</published><updated>2008-11-19T17:43:25.403-05:00</updated><title type='text'>Radiant Machines</title><content type='html'>I've started a site, &lt;a href="http://radiantmachines.com/"&gt;http://radiantmachines.com/&lt;/a&gt; to showcase my collaborations with Josh Gourneau.  The first is a &lt;a href="http://www.radiantmachines.com/?page_id=9"&gt;belt buckle&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;--Travis&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3720904391382212946?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3720904391382212946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3720904391382212946' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3720904391382212946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3720904391382212946'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/11/radiant-machines.html' title='Radiant Machines'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1578291045659258044</id><published>2008-11-14T17:19:00.009-05:00</published><updated>2008-11-14T17:40:02.747-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430 bsl timing'/><category scheme='http://www.blogger.com/atom/ns#' term='ez430'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430static'/><title type='text'>Speaking at 25C3</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/3028184661/" title="BSLCracker 3.0 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3055/3028184661_74f15fcba1_m.jpg" width="240" height="180" alt="BSLCracker 3.0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At the 25th Chaos Communications Congress in Berlin this December, I'll be presenting some new research in the security of the MSP430's serial bootstrap loader (BSL) as well as a nice little lecture/workshop combo on reverse-engineering the &lt;a href="http://focus.ti.com/docs/toolsw/folders/print/ez430-f2013.html"&gt;TI EZ430&lt;/a&gt; development tool.&lt;br /&gt;&lt;br /&gt;I intend to travel through France and England, returning in late January for &lt;a href="http://travisgoodspeed.blogspot.com/2008/11/speaking-at-s4-in-miami.html"&gt;S4, Miami&lt;/a&gt;.  Please email me if you'd like to meet.&lt;br /&gt;&lt;br /&gt;Cracking the MSP430 BSL&lt;br /&gt;Day 1 (2008-12-27), 20h30 (8:30 pm) in Saal 3.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The Texas Instruments MSP430 low-power microcontroller is used in many medical, industrial, and consumer devices.  When its JTAG fuse is blown, the device's firmware is kept private only a serial bootstrap loader (BSL), certain revisions of which are vulnerable to a side-channel timing analysis attack.  This talk continues that from Black Hat USA by describing the speaker's adventures in creating a hardware device for exploiting this vulnerability.&lt;br /&gt;&lt;br /&gt;While the previous part focused on the discovery of the timing vulnerability and its origin, this lecture will focus on the exploitation.  Topics include a brief review of the vulnerability itself, PCB design and fabrication, the malicious stretching of timing in a bit-banged serial port, observation of timing differences on the order of a microsecond, and the hell of debugging such a device.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Repurposing the TI EZ430U&lt;br /&gt;Lecture: Day 3 (2008-12-29), 12h45 (pm) in Saal 3&lt;br /&gt;Workshop: Not yet scheduled.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;USB devices are sometimes composed of little more than a microcontroller and a USB device controller. This lecture describes how to reprogram one such device, greatly expanding its potential.&lt;br /&gt;&lt;br /&gt;At only twenty dollars, the Texas Instruments EZ430U is a bargain of an in-circuit debugger for the MSP430 microcontroller.  The board itself is composed of little more than an MSP430 and a USB to Serial controller. The board's JTAG fuse is unblown, and full schematics are included in public documentation. This lecture will discuss the use of the EZ430U, not as a debugging tool, but as a development platform in and of itself.  Topics will include the writing of replacement firmware, analysis of the default firmware, reprogramming the USB to Serial controller, and potential target applications.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;--&lt;br /&gt;Travis Goodspeed&lt;br /&gt;&amp;lt;travis at radiantmachines.com&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1578291045659258044?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1578291045659258044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1578291045659258044' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1578291045659258044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1578291045659258044'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/11/speaking-at-25c3.html' title='Speaking at 25C3'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3055/3028184661_74f15fcba1_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-4553574760578409956</id><published>2008-11-04T12:05:00.007-05:00</published><updated>2008-11-05T14:38:19.555-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mica'/><category scheme='http://www.blogger.com/atom/ns#' term='avr'/><category scheme='http://www.blogger.com/atom/ns#' term='tinyos'/><title type='text'>MicaZ Code Injection</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://planete.inrialpes.fr/~francill/"&gt;Aurélien Francillon&lt;/a&gt; and Claude Castelluccia of France's INRIA recently demonstrated at &lt;a href="http://www.sigsac.org/ccs/CCS2008/accept.html"&gt;CCS2008&lt;/a&gt; a &lt;a href="http://planete.inrialpes.fr/~francill/Papers/Code_Injection_Harvard_francillon_ccs08.pdf"&gt;code-injection attack that reflashes Mica wireless sensors&lt;/a&gt;.  This is more difficult than my TelosB attack because the MicaZ uses a Harvard-architecture CPU, one that is incapable of directly executing RAM.  The authors use meta-gadgets, collections of executable code found already within the device, to copy the payload into executable flash memory.  It's about damned time that someone authored a practical implementation for those things, and the paper is well worth reading.&lt;br /&gt;&lt;br /&gt;If you quickly glance over the paper, you might miss the best part, which is not that the authors used meta-gadgets but exactly &lt;i&gt;how&lt;/i&gt; they found the meta-gadgets.  See the seventh page of their paper, the section entitled `Automating the meta-gadget implementation', for details of a modified CPU simulator that constructs meta-gadgets automatically from a given firmware image.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-4553574760578409956?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/4553574760578409956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=4553574760578409956' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4553574760578409956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4553574760578409956'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/11/micaz-code-injection.html' title='MicaZ Code Injection'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6656058626340594242</id><published>2008-11-02T03:17:00.001-05:00</published><updated>2008-11-03T00:06:07.495-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scada'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><category scheme='http://www.blogger.com/atom/ns#' term='802.15.4'/><title type='text'>Speaking at S4 in Miami</title><content type='html'>&lt;a href="http://www.digitalbond.com/index.php/s4-2009/"&gt;&lt;img src="http://frob.us/images/s4_logo.jpg"/&gt;&lt;/a&gt;&lt;br /&gt;On Thursday, January 22nd, I'll be presenting at Digital Bond’s &lt;a href="http://www.digitalbond.com/index.php/s4-2009/"&gt;SCADA Security Scientific Symposium (S4)&lt;/a&gt; a paper authored with Brad Singletary and Darren Highfill of &lt;a href="http://www.enernex.com/"&gt;Enernex&lt;/a&gt; on the topic of Low-Level Design Vulnerabilities in Wireless Control Systems Hardware.  As 802.15.4 sensors and similar hardware are subject to theft by an attacker, we demonstrate several practical attacks that we've been cooking up for the past year.  We include plenty of schematic diagrams, logic analyzer recordings, oscilloscope photographs, and code fragments to keep things interesting.  Attendance is strictly limited to fifty-five, and registration is expected to sell-out this year.&lt;br /&gt;&lt;br /&gt;Please email me if you'd like to meet up while I'm in town.  As always, I'll bring some of my equipment for a show and tell.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6656058626340594242?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6656058626340594242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6656058626340594242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6656058626340594242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6656058626340594242'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/11/speaking-at-s4-in-miami.html' title='Speaking at S4 in Miami'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-561776110685327051</id><published>2008-10-28T00:03:00.007-04:00</published><updated>2008-10-28T00:47:02.732-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><title type='text'>The MSP430F2254 is a 2274.</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2980648032/" title="MSP430F2254, a 2274 in Disguise by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3295/2980648032_821591ecab.jpg" width="333" height="500" alt="MSP430F2254, a 2274 in Disguise" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A few weeks back, I ran out of &lt;a href="http://focus.ti.com/docs/prod/folders/print/msp430f2274.html"&gt;MSP430F2274&lt;/a&gt; chips and used the pin-compatible 2254 for a few of my BSLCracker boards.  After connecting a FET to program the first of them, I found that GDB mistook it for a 2274.  The chip ID of a 2254, beginning at 0xFF0 and continuing as big-endian quartets, is "F2274".  The photograph above, taken by Brooke Hill, confirms that the die of the MSP430F2254 is that of a 2274.&lt;br /&gt;&lt;br /&gt;What method is used by TI to downgrade a '74 to a '54, and is it reversible?  Please email me if you can shed any light on the matter.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-561776110685327051?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/561776110685327051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=561776110685327051' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/561776110685327051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/561776110685327051'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/10/msp430f2254-is-2274.html' title='The MSP430F2254 is a 2274.'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3295/2980648032_821591ecab_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2970830265343011958</id><published>2008-09-29T18:51:00.003-04:00</published><updated>2008-09-29T19:24:49.468-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bsl'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430 bsl timing'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Speaking at PumpCon 2008 in Philly</title><content type='html'>Howdy Y'all,&lt;br /&gt;&lt;br /&gt;I'll be driving to Philadelphia on Friday, October 24th to speak at this year's &lt;a href="http://www.pumpcon.org/2008talks.html"&gt;PumpCon&lt;/a&gt;.  This lecture continues that of Black Hat USA, focusing on the exploitation--rather than the origin--of timing vulnerabilities that I've found in certain revisions of the MSP430's serial bootstrap loader.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2970830265343011958?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2970830265343011958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2970830265343011958' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2970830265343011958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2970830265343011958'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/09/speaking-at-pumpcon-2008-in-philly.html' title='Speaking at PumpCon 2008 in Philly'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3728832439800422060</id><published>2008-09-15T07:26:00.000-04:00</published><updated>2008-09-15T08:31:00.994-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ez430'/><category scheme='http://www.blogger.com/atom/ns#' term='msp430static'/><title type='text'>Repurposing the TI EZ430U, Part 3</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;of Southern Appalachia&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2845314764/" title="Shattered EZ430T2013 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3230/2845314764_2393540110_m.jpg" width="240" height="180" alt="Shattered EZ430T2013" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://travisgoodspeed.blogspot.com/2008/05/repurposing-ti-ez430u-part-1.html"&gt;first installment&lt;/a&gt; of this series described a method of accessing the EZ430's MSP430 firmware by way of JTAG, while the &lt;a href="http://travisgoodspeed.blogspot.com/2008/07/repurposing-ti-ez430u-part-2.html"&gt;second installment&lt;/a&gt; took a detour to discuss the TUSB3410 usb controller of the board.  This third installment is concerned with the analysis of the green EZ430U firmware; that is to say, it is concerned with the firmware of the six-pin EZ430f2013 kit, which might differ from the four-pin EZ430f2013 kit and drastically differs from the red EZ430rf2500 kit.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 1&lt;/b&gt;, wherein we make general, even visual observations regarding the organization of firmware, as well as the locations of important objects.&lt;br /&gt;&lt;br /&gt;Observe the following memory map, which was generated by the .memmap.gd.xview macro of &lt;a href="http://msp430static.sourceforge.net/"&gt;msp430static&lt;/a&gt;.&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2784281680/"&gt;&lt;img src="http://msp430static.sourceforge.net/ss/memmap.big.png"/&gt;&lt;/a&gt;&lt;br /&gt;In an m4s memory map, the X axis represent the less-significant byte while the Y axis represents the more significant byte.  0xFF00 would be the top left, and 0xFFFF would be the top right.  As the interrupt vector table (IVT) of the MSP430f1612 ranges from 0xFFE0 to 0xFFFF, it appears as a green band in the upper right of the image.  Entries within it all point to the upper red band, with addresses varying from 0xfb78 to 0xfdb0, in regular increments of 4.  The only exception to this rule is the RESET vector at 0xfffe, which points to 0xfdaa.&lt;br /&gt;&lt;br /&gt;Why such an arrangement?  Each of these regularly-spaced interrupt handlers is a branch to a lower interrupt handler.  The blue line that you see at the top of the black expanse is a second IVT, entries of which are called from above.  0xffe0, the DMA vector, point to a branch to &amp;amp;0xf7e0, which is to say that address which is contained within 0xf7e0.  Similarly, 0xffe2 points to a branch to 0xf7e2.  In fact, every interrupt except for RESET points to nothing but a branch to its equivalent in the table that begins 0xf7e0.&lt;br /&gt;&lt;br /&gt;It should be clear, then, that not one but two programs reside in this image.  The first-stage firmware, which rests at the top of memory, performs its own initialization when the chip is reset, but differs all interrupt handling to the lower firmware, which grows from the beginning of flash to 0xf7e0.  It shouldn't be hard to instruct a compiler to build a second-stage firmware compatible with the first-stage, but it would be imprudent to spring into such a task without at least a casual analysis of the first stage.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 2&lt;/b&gt;, wherein we examine the first-stage firmware in depth.&lt;br /&gt;&lt;br /&gt;The first-stage firmware is a bootloader which resides from 0xf800 to 0xffff in flash memory of an MSP430F1612.  A quick search with MSP430static--which I'll refer to as 'm4s' for the sake of brevity--reveals that 30 functions have been found in this area.  Fifteen of these, those in the range [0xfb78,0xfbb0], are merely branches to interrupt handlers in lower memory.  The interrupt handler is a function which I'll call init() that resides at 0xfdaa, calling a config() function at 0xf828 to set registers to their proper values.  The only call made by config() is to delay() at 0xf812 that uses nested loops to implement a timing delay.&lt;br /&gt;&lt;br /&gt;I/O is performed by putbyte() and getbyte() functions at 0xfbc6 and 0xfbd2 respectively.  These use USART0 in UART mode.  This port is configured, as are many other peripherals, in the previously mentioned config() function.&lt;br /&gt;&lt;br /&gt;As the purpose of this series of articles is to describe the process for writing a complete replacement firmware, I should mention that such information is to be found within this stage.  Port 3 is especially important, as it is tied into both UARTS and I2C.  As you'll recall from the early articles of this series, the TUSB3410 refuses to load with ports in the default configuration.  By matching the configuration of the original firmware, we ought to be able to get something going.&lt;br /&gt;&lt;br /&gt;To that end, Port 3 is configured as follows within the config() function.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;f88e: bis.b #48, &amp;P3SEL&lt;br /&gt;f894: bis.b #16, &amp;P3OUT&lt;br /&gt;f89a: bis.b #16, &amp;P3DIR&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Clocks and such must also be reconfigured, but I come bearing good news!  There's an easier way, in that by relocating the IVT or reconfiguring your compiler, you can generate a custom second stage firmware without rewriting the first stage.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 3&lt;/b&gt;, wherein we examine the second-stage firmware in brief.&lt;br /&gt;&lt;br /&gt;By comparison to the simple, neighborly firmware of the preceding section, the second stage firmware is gigantic and multi-tasking, with a rats-nest of function calls to a few key functions.  Although it serves little immediate value, I'll cover second stage as an example of a few analysis techniques.&lt;br /&gt;&lt;br /&gt;Which function calls are most popular, and what do they do?  The .calls.top10 macro results in the following:&lt;pre&gt;163     4c3e    4c3e&lt;br /&gt;151     4f54    4f54&lt;br /&gt;142     4b6a    4b6a&lt;br /&gt;29      4eca    4eca&lt;br /&gt;28      6100    6100&lt;br /&gt;27      2ba2    2ba2&lt;br /&gt;24      8d0e    8d0e&lt;br /&gt;24      a784    a784&lt;br /&gt;20      5f4c    5f4c&lt;br /&gt;17      756e    756e&lt;/pre&gt;&lt;br /&gt;Note the sharp dropoff after the third.  In a multi-tasking application, such as a TinyOS wireless sensor node, it would be logical to assume these to be mutex locks.  In a JTAG adapter, however, it is much more likely that these serve an I/O purpose.  Sure enough, all three are I/O related with 0x4f54 performing I/O through function calls and the other two doing it directly.&lt;br /&gt;&lt;br /&gt;As I am not concerned with reverse-engineering the TI's proprietary debugging protocol, but rather only with making software capable of running on the EZ430 programmer, I'll delve no further into the second-stage firmware.  Remember only the following: (1) That the IVT of the second-stage code resides at 0xf7e0, (2) that all else remains unchanged.&lt;br /&gt;&lt;br /&gt;The question then becomes one of relocating the IVT, which may be accomplished either by altering linker scripts or by rewriting the firmware image before flashing it to the device.  We shall begin with the prior method.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 4&lt;/b&gt;, wherein we rewrite the linker scripts of two popular compilers so as to generate our own second-stage code for this fine platform.&lt;br /&gt;&lt;br /&gt;Moving the IVT is accomplished in GCC by forking msp430x1612.x to ez430u.x, then changing line 8 to the following:&lt;pre&gt;vectors (rw) : ORIGIN = 0xf7e0, LENGTH = 0x20&lt;/pre&gt;Call GCC with the -T switch followed by your forked linker script, and the output will direct to the proper address.  Use msp430-objdump to verify the address in your output.  For further details, consult my article on &lt;a href="http://travisgoodspeed.blogspot.com/2008/09/retargetting-mspgcc-linker.html"&gt;Retargetting the MSPGCC Linker&lt;/a&gt;.  In the case of the IAR compiler, the IVT range is defined near the end of &lt;i&gt;lnk430F1612.xcl&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Please note that, for no reason that I can fathom, the RESET vector of the second-stage IVT has been hard-coded to be 0x2502 in some places.  You must set the .text section to begin at 0x2502, or the reset will land in the middle of a two-word instruction.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 5&lt;/b&gt;, wherein your author makes a shameless plug his upcoming appearance at the tenth annual &lt;a href="http://sandiego.toorcon.org/content/section/5/7/"&gt;Toorcon San Diego&lt;/a&gt; but provides little else of substance.&lt;br /&gt;&lt;br /&gt;A fourth installment of this series will wrap up the replacement MSP430 code, concluding with a complete and commented `hello world' example for GCC.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3728832439800422060?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3728832439800422060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3728832439800422060' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3728832439800422060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3728832439800422060'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/08/repurposing-ti-ez430u-part-3.html' title='Repurposing the TI EZ430U, Part 3'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3230/2845314764_2393540110_t.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6444452378135809374</id><published>2008-09-08T23:46:00.026-04:00</published><updated>2008-09-09T00:39:33.437-04:00</updated><title type='text'>Errata from Black Hat USA 2008</title><content type='html'>&lt;img src="http://frob.us/~travis/public/blog/images/bsl/flow1101a.png" alt="MSP430F1101A control flow diagram" /&gt;&lt;br /&gt;&lt;br /&gt;There exist two errata, one trivial and one substantial, in my Black Hat presentation.&lt;br /&gt;&lt;br /&gt;First, Vcc of the 2013 chip in the schematic diagram should be connected to Vcc of the JTAG/SBW connector, not Vext as is shown in the schematic.  I had to score and solder those in my prototype, but I forgot to update the slides.  (The new unit uses the MSP430F2274, regardless.)&lt;br /&gt;&lt;br /&gt;Second, and much more substantially, memory &lt;i&gt;is&lt;/i&gt; erased by default on reception of an incorrect password &lt;i&gt;unless&lt;/i&gt; BSLKEY is set to 0x0000 on BSL version 2.0+.  See page 11 of SLAA089D for details.  You will find the code responsible at 0xD66 within the password comparison routine of the MSP430FG4618 Rev. G BSL, version 2.12, wherein BSLKEY is located at 0xFFBE.  This makes these devices invulnerable by default, unless protection is explicitly disabled by the programmer.&lt;br /&gt;&lt;br /&gt;The MSP430F1101A and other chips using BSL versions beneath 1.60 are vulnerable by default.&lt;br /&gt;&lt;br /&gt;The next revision of my board will incorporate power glitching attacks, which might potentially prevent the 4618 from erasing its memory on a bad password or allow entry into a disabled BSL.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6444452378135809374?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6444452378135809374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6444452378135809374' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6444452378135809374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6444452378135809374'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/09/errata-from-black-hat-usa-2008.html' title='Errata from Black Hat USA 2008'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1584876967193872971</id><published>2008-09-06T18:27:00.035-04:00</published><updated>2008-09-07T01:04:49.776-04:00</updated><title type='text'>Retargetting the MSPGCC Linker</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2803171517/" title="BSLCracker 2.0 by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3041/2803171517_5bd5922d47_m.jpg" alt="BSLCracker 2.0" height="220" width="240" /&gt;&lt;/a&gt;&lt;br /&gt;In this article, I describe the use and modification of GCC linker scripts.  In particular, I emphasize their use within MSPGCC to add support for an additional target chip, the MSP430F2274.  This technique allows the generation of executables for chips which are presently unsupported by MSPGCC, as well as the creation of executables that are intended to work with a custom bootloader.&lt;br /&gt;&lt;br /&gt;Until recently, I had been using IAR's compiler for development of the BSL Password Cracker, which was the subject of my &lt;a href="http://www.blackhat.com/html/bh-usa-08/bh-usa-08-speakers.html#Goodspeed"&gt;Black Hat USA&lt;/a&gt; talk.  IAR makes a great compiler, but the proprietary UBROF object format prevented me from exporting debugging symbols to GDB.  My requests to the company for a copy of the specification have thus-far yielded nothing.&lt;br /&gt;&lt;br /&gt;In switching to MSPGCC, I found myself unable to compile executables for the MSP430F2274 around which I had already based the second major revision of my board.  In this article, I will describe a simple method for extending the MSPGCC linker to support a new chip by modifying the definition of one that's presently supported.  The same technique is also handy for building an image to be compatible with a custom bootloader, as I'll describe in the next installment of my series on reprogramming the &lt;a href="http://travisgoodspeed.blogspot.com/search/label/ez430"&gt;TI EZ430U&lt;/a&gt; with custom firmware.&lt;br /&gt;&lt;br /&gt;Under the hood, a compiler is built of many separate applications.  The first stage is a preprocessor which evaluates macros such as the &lt;i&gt;#include&lt;/i&gt; directive.  After that, the compiler stage translates preprocessed C into assembly language.  A third stage, the assembler, converts assembly language into object files, which are complete except for labels that have been left empty for later insertion.  A fourth stage, the linker, combines one or more object files into an executable firmware image.  In the case of the MSP430, this image is a complete kernel, which does not rely upon a surrounding kernel or dynamic libraries.&lt;br /&gt;&lt;br /&gt;As objects enter the linker, they are not quite complete machine code.  This is because, prior to linking, it is impossible to know the entry address of any function.  They are quite likely to be re-arranged, with unused functions stripped out entirely.&lt;br /&gt;&lt;br /&gt;Also unknown prior to linking is the location of various system boundaries, such as the range of memory which is mapped to Flash ROM, that range which is mapped to RAM, and various ranges of lesser importance.  Embedded compilers use linking scripts to specify these regions.&lt;br /&gt;&lt;br /&gt;IAR's linker, xlink, scripts in the &lt;i&gt;config/&lt;/i&gt; subdirectory of each target, &lt;i&gt;/opt/iar430/config&lt;/i&gt; on my machine but more likely &lt;i&gt;C:/Program Files/IAR Systems/Embedded Workbench 5.0/430/config&lt;/i&gt; in Windows.  Observe the code memory region of &lt;i&gt;lnk430F2274.xcl&lt;/i&gt; as an example:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;// -------------------&lt;br /&gt;// Code&lt;br /&gt;// -------------------&lt;br /&gt;&lt;br /&gt;-Z(CODE)CSTART,ISR_CODE=8000-FFDD&lt;br /&gt;-P(CODE)CODE=8000-FFDD&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The regions themselves are helpfully described in English comments at the top of the file, giving those too lazy to read the datasheets a helping hand.  It's also rather nice that these are standard command-line arguments to xlink.&lt;br /&gt;&lt;br /&gt;GCC's linker, ld, uses a different format.  Regions are described not as beginning and ending absolute addresses, but rather as an absolute beginning address and a length.  The corresponding line in my 2274 script is&lt;br /&gt;&lt;i&gt;text (rx) : ORIGIN = 0x8000, LENGTH = 0x7fe0&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The first step in retargetting the linker is to adjust the rest of the lines in the MEMORY stanza to values that work.  That is nearly all the work that you must do, but converting memory regions is not quite all that you'll have to contend with.  In using an MSP430F1612 script as a starting point, I initially overlooked the following line.&lt;br /&gt;&lt;i&gt;PROVIDE (__stack = 0x2500) ;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;That line initializes the stack pointer (r1) to be 0x2500.  Nothing is mapped to this address, and the entire region reads each byte as 0x5321.  As GCC places globals at the bottom of memory, setting this value to the top of memory, which is to say 0x5fe, results in a functional stack.&lt;br /&gt;&lt;br /&gt;You can find my first attempt at an MSP430F2274 linker script &lt;a href="http://pastebin.com/f215b215a"&gt;here&lt;/a&gt;.  It works for me, but it comes with the usual warranty, by which I mean none.  Place it in the working directory and add &lt;i&gt;-T foo.x&lt;/i&gt; to your linking gcc line.&lt;br /&gt;&lt;br /&gt;In the near future, I intend to add a linker-script importer for &lt;a href="http://msp430static.sourceforge.net/"&gt;msp430static&lt;/a&gt; to give context to different regions of memory.  Support will exist for GCC and IAR formats, and a standalone mode will allow translation between formats.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1584876967193872971?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1584876967193872971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1584876967193872971' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1584876967193872971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1584876967193872971'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/09/retargetting-mspgcc-linker.html' title='Retargetting the MSPGCC Linker'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3041/2803171517_5bd5922d47_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1594461718967490779</id><published>2008-09-02T12:41:00.005-04:00</published><updated>2008-09-02T14:56:41.349-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ToorCon'/><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Speaking at Toorcon 10 in San Diego</title><content type='html'>&lt;a href="http://sandiego.toorcon.org/"&gt;&lt;img src="http://frob.us/~travis/public/blog/images/toorcon/toorconx.png" /&gt;&lt;/a&gt;&lt;br /&gt;I'll be giving a 75-minute &lt;a href="http://sandiego.toorcon.org/content/section/5/7/"&gt;Deep Knowledge Seminar&lt;/a&gt; at Toorcon X in San Diego on Friday, September 26th regarding my efforts to repurpose the &lt;a href="http://travisgoodspeed.blogspot.com/search/label/ez430"&gt;TI EZ430U&lt;/a&gt; in-circuit debugger.  This seminar will cover both of the presently published articles, as well as details on writing custom replacement firmware that will be published as a third (and perhaps fourth) installment.  More generally, it will provide a thorough introduction to the reverse engineering of microcontroller-based USB peripheral boards.&lt;br /&gt;&lt;br /&gt;Note that the seminars are not included with general conference admission.  Seminar registration is $750 until September 12th, $950 at the door.&lt;br /&gt;&lt;br /&gt;Please email me if you'd like to meet up.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1594461718967490779?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1594461718967490779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1594461718967490779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1594461718967490779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1594461718967490779'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/09/speaking-at-toorcon-10-in-san-diego.html' title='Speaking at Toorcon 10 in San Diego'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3435322432187729446</id><published>2008-09-01T19:08:00.009-04:00</published><updated>2008-09-01T20:45:05.084-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='decapped'/><title type='text'>Temporarily Paralyzing the MSP430 Memory Bus</title><content type='html'>&lt;div style="padding: 3px; text-align: left;"&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2818750855/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3261/2818750855_a8b0dc77bf.jpg" style="border: 2px solid rgb(0, 0, 0); width: 395px; height: 298px;" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="margin-top: 0px;font-size:0;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I've been playing lately with the use of light to induce temporary faults within a decapped MSP430F1101A.  The chip, pictured above, was decapped by Chris of &lt;a href="http://www.flylogic.net/blog/"&gt;Flylogic Engineering&lt;/a&gt;.  Lacking a convenient source of UV with which to begin erasing flash memory, I tried the flash from my digital camera.  What luck!&lt;br /&gt;&lt;img src="http://frob.us/~travis/public/blog/images/decap/BEEFtoFFFF.png"/&gt;&lt;br /&gt;&lt;br /&gt;Although it appears that flash memory has been reset, that is not in fact the case.  The memory bus is paralyzed, with all reads returning 0xFFFF.  This includes Flash, RAM, and ROM regions.  After a while, this effect dissipates and memory returns to normal.&lt;br /&gt;&lt;br /&gt;I'll soon begin to experiment with different wavelengths, durations, and polarizations of light.  Please email me if you've any advice to offer.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;--Travis&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3435322432187729446?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3435322432187729446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3435322432187729446' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3435322432187729446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3435322432187729446'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/09/decapped-msp430f1101a.html' title='Temporarily Paralyzing the MSP430 Memory Bus'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3261/2818750855_a8b0dc77bf_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3156139894348575566</id><published>2008-08-16T17:44:00.003-04:00</published><updated>2008-08-24T15:37:15.263-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Post-Vegas</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/tags/flylogic/"&gt;&lt;img src="http://travis.frob.us/~travis/public/blog/images/flylogic/probeneedle.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Black Hat and Defcon were both a blast. My Black Hat &lt;a href="http://travis.frob.us/~travis/public/blog/pdf/blackhat08_goodspeed.pdf"&gt;slides&lt;/a&gt; and &lt;a href="http://travis.frob.us/~travis/public/blog/pdf/blackhat08_goodspeed_paper.pdf"&gt;paper&lt;/a&gt; are available.  See &lt;a href="http://frob.us/projects/voyage/"&gt;here&lt;/a&gt; for the book of which I spoke at Defcon.&lt;br /&gt;&lt;br /&gt;Chris Tarnovsky of &lt;a href="http://www.flylogic.net/"&gt;Flylogic Engineering&lt;/a&gt; let me photograph a run-through of the workshop that he later gave at Defcon.  I've been locked out of my Flickr account, but you'll find most of those photos tagged with &lt;a href="http://www.flickr.com/photos/travisgoodspeed/tags/flylogic/"&gt;flylogic&lt;/a&gt;.  I'll post the others if and when I recall my password.&lt;br /&gt;&lt;br /&gt;It'll take me a while to send all the emails that I've promised.  Please email me first if you have the time.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;--Travis&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3156139894348575566?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3156139894348575566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3156139894348575566' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3156139894348575566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3156139894348575566'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/08/post-vegas.html' title='Post-Vegas'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-3568605438581185865</id><published>2008-08-04T23:05:00.004-04:00</published><updated>2008-08-04T23:53:08.327-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Vegas or Bust!  Three talks in three days.</title><content type='html'>Howdy y'all,&lt;br /&gt;&lt;br /&gt;I'm leaving Knoxville for Las Vegas in eight hours.  I'll be speaking Thursday, Friday, and Saturday.  Three talks, on three different topics.&lt;br /&gt;&lt;br /&gt;Thursday/13h30 at Palace 1 in the Hardware track of Black Hat, I'll be speaking at Black Hat USA regarding a &lt;a href="http://www.blackhat.com/html/bh-usa-08/bh-usa-08-speakers.html#Goodspeed"&gt;timing vulnerability of the MSP430FG4618's serial bootstrap loader&lt;/a&gt;.  This is just after the lunch break.  Come early to get a good seat, then keep it for talks by Karsten Nohl and Chris Tarnovsky.&lt;br /&gt;&lt;br /&gt;Friday/16h00, I'll be speaking at Defcon 16 in the Breakout room regarding not my own work, but the historic work of Paul Courbis and Sébastien Lalande.  In 1990, they published «Voyage au centre de la HP28C/S» detailing the initial reverse engineering of the Hewlett Packard 28 graphing calculator.  For the past year, I've been &lt;a href="http://defcon.org/html/defcon-16/dc-16-speakers.html#Goodspeed"&gt;translating it as a hobby&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Saturday/18h00, I'll be giving a Defcon &lt;a href="https://forum.defcon.org/showthread.php?t=9593"&gt;Skytalk&lt;/a&gt; on the topic of reverse-engineering an 802.15.4/Zigbee wireless sensor node using &lt;a href="http://msp430static.sf.net/"&gt;msp430static&lt;/a&gt;.  This is a revision of my talk from &lt;a href="http://www.thelasthope.org/"&gt;Last Hope&lt;/a&gt;, with new content to reflect my Black Hat talk.  I was added to the line-up at the last minute, so you won't find this in the conference booklet or the poster.&lt;br /&gt;&lt;br /&gt;Please email me at the address below if you'd like to meet up.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-3568605438581185865?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/3568605438581185865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=3568605438581185865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3568605438581185865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/3568605438581185865'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/08/vegas-or-bust-three-talks-in-three-days.html' title='Vegas or Bust!  Three talks in three days.'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2725048992600123179</id><published>2008-07-28T15:21:00.002-04:00</published><updated>2008-07-28T17:44:34.162-04:00</updated><title type='text'>Last Hope recap, slides</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;at the Extreme Measurement Communications Center&lt;br /&gt;of the &lt;a href="http://ornl.gov"&gt;Oak Ridge National Laboratory&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Despite sleep deprivation and the longest drive of my life, I had a blast at the &lt;a href="http://www.thelasthope.org/"&gt;Last HOPE&lt;/a&gt; conference this past weekend.&lt;br /&gt;&lt;br /&gt;You'll find the slides for my scheduled (Friday) talk at &lt;a href="http://frob.us/~travis/public/blog/pdf/lasthope_goodspeed.pdf"&gt;lasthope_goodspeed.pdf&lt;/a&gt;.  Saturday's talk was a rerun from &lt;a href="http://frob.us/~travis/public/blog/pdf/goodspeed_tidc08.pdf"&gt;TIDC 08&lt;/a&gt;; thanks to Marco and Kevin Figueroa for getting me a projector on such short notice.  Sunday's workshop was unrehearsed, and I apologize for not taking screenshots.&lt;br /&gt;&lt;br /&gt;You'll find me next week at &lt;a href="http://www.blackhat.com/html/bh-usa-08/bh-usa-08-speakers.html#Goodspeed"&gt;Black Hat 2008&lt;/a&gt; and &lt;a href="http://defcon.org/html/defcon-16/dc-16-speakers.html#Goodspeed"&gt;Defcon 16&lt;/a&gt; in Vegas.  In addition to my scheduled talks, I expect to give at least one unscheduled lecture or workshop during Defcon.  Email me for details.&lt;br /&gt;&lt;br /&gt;--Travis&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2725048992600123179?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2725048992600123179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2725048992600123179' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2725048992600123179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2725048992600123179'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/07/last-hope-recap-slides.html' title='Last Hope recap, slides'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5413626750368612883</id><published>2008-07-04T12:09:00.003-04:00</published><updated>2011-01-22T12:35:49.926-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tusb3410'/><category scheme='http://www.blogger.com/atom/ns#' term='ez430'/><category scheme='http://www.blogger.com/atom/ns#' term='eeprom'/><category scheme='http://www.blogger.com/atom/ns#' term='i2c'/><title type='text'>Repurposing the TI EZ430U, Part 2</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;at the Extreme Measurement Communications Center&lt;br /&gt;of the &lt;a href="http://ornl.gov"&gt;Oak Ridge National Laboratory&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2637246820/" title="EZ430 24c32 EEPROM Tap by Travis Goodspeed, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3033/2637246820_005fe3339c.jpg" width="500" height="479" alt="EZ430 24c32 EEPROM Tap" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 1&lt;/b&gt;, wherein topics of discussion are enumerated and datasheets cited.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://travisgoodspeed.blogspot.com/2008/05/repurposing-ti-ez430u-part-1.html"&gt;first installment&lt;/a&gt; of this series described a method of accessing the EZ430's MSP430 firmware by way of JTAG.  That's dandy, but the MSP430 isn't the only microprocessor on the board!  This installment will focus on the firmware and reprogramming of the &lt;a href="http://focus.ti.com/docs/prod/folders/print/tusb3410.html"&gt;TUSB3410&lt;/a&gt; USB to serial chip, which contains an 8052 microprocessor core.&lt;br /&gt;&lt;br /&gt;Section 11 of &lt;a href="http://google.com/search?q=SLLS519"&gt;SLLS519&lt;/a&gt; describes the boot sequence of the TUSB3410.  In brief, an I2C EEPROM is used if such a chip is present and it contains an image with the proper signatures.  Firmware may also be loaded over USB, in which case the EEPROM is either absent or provides only such minutia as the device ID.&lt;br /&gt;&lt;br /&gt;The EEPROM on the Revision 2.0 boards--those with six pins for the target device--is the &lt;a href="http://www.catsemi.com/products/CAT24C32.asp"&gt;CAT24C32&lt;/a&gt; by Catalyst Semiconductor.  Revision 1.1 used the smaller &lt;a href="http://www.catsemi.com/products/CAT24C16.asp"&gt;CAT24C16&lt;/a&gt; chip, presumably because that revision had no need for such complicated software.  (See Part 1 for details.)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 2&lt;/b&gt;, wherein firmware is forcefully extracted by use of hypodermic syringe and our heroes contemplate an intriguing fragment of a schematic diagram.&lt;br /&gt;&lt;br /&gt;The 24C32 chip, like all I2C devices, uses two lines for communication.  These are SDA and SCL.  Addressing lines, allowing for multiple units of the same chip to reside on a board, are unused and tied to ground.  Thus, the chip looks something like the following schematic.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://travis.frob.us/~travis/public/blog/images/ez430_jtag/ez430u_eeprom.png" alt="24c32 schematic"/&gt;&lt;br /&gt;&lt;br /&gt;To read the chip, it is necessary to have an I2C host adapter, such as the &lt;a href="http://www.totalphase.com/products/aardvark_i2cspi/"&gt;Total Phase Aardvark&lt;/a&gt;.  So as to avoid soldering headers to the chip, I attached two of my &lt;a href="http://travisgoodspeed.blogspot.com/2008/06/syringe-logic-probe-revision-2.html"&gt;syringe logic probes&lt;/a&gt; to the Aardvark's SDA and SCL lines.  Power was shared through USB, negating the need to tie it into the target board.  I tapped an unlabeled via near R23 for SDA and tapped SCL directly on a leg of the EEPROM.  I2C's multi-master feature allows this to be done without disabled anything in the board.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 3&lt;/b&gt;, wherein our heroes--having extracted the firmware of the 24C32 of the EZ430U--conspire to similarly free the firmware of an I2C EEPROM of a much finer vintage.&lt;br /&gt;&lt;br /&gt;Dumping firmware from similar chips on the green EZ430U and a USB-FET gave samples for comparison.  The contents of the green board and the FET were nearly identical, differing only by a few bytes.  They are also significantly smaller than the red firmware, even though the FET contains a larger EEPROM.  Unused bytes are padded as 0xFF.&lt;br /&gt;&lt;br /&gt;The most common complaint regarding the EZ430-RF series is that, unlike the original EZ430, there exist no Linux drivers for the board.  By reflashing the firmware of both the MSP430 and the 24C32 chips, a red EZ430 can be reverted to the green firmware, making it compatible with Linux.&lt;br /&gt;&lt;br /&gt;For those without access to an I2C programmer, it is worth noting that the MSP430 of this board is tied to the 24C32 EEPROM.  It is possible to write an MSP430 firmware image that, upon booting, does nothing but reprogram the TUSB3410's ROM.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Section 4&lt;/b&gt;, wherein your esteemed author prematurely concludes this article of the series.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://travisgoodspeed.blogspot.com/2008/08/repurposing-ti-ez430u-part-3.html"&gt;third installment&lt;/a&gt; contains instructions for compiling new firmware for the EZ430 by retargetting GCC and manually linking in the USB bootloader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5413626750368612883?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5413626750368612883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5413626750368612883' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5413626750368612883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5413626750368612883'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/07/repurposing-ti-ez430u-part-2.html' title='Repurposing the TI EZ430U, Part 2'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3033/2637246820_005fe3339c_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-4387208717027937963</id><published>2008-06-19T13:53:00.000-04:00</published><updated>2008-06-19T16:28:27.379-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Speaking at Last Hope</title><content type='html'>I'll be speaking at Last Hope in Manhattan next month.  My abstract follows.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;i&gt;Introduction to MCU Firmware Analysis and Modification with MSP430static&lt;/i&gt;&lt;/strong&gt;&lt;br /&gt;&lt;i&gt;The Texas Instruments MSP430 is a low-power, 16-bit microcontroller which is rapidly gaining in popularity in the embedded world. MSP430static is a tool for reverse engineering the MSP430's firmware. Following a quick tour under the hood of this tool, this lecture will demonstrate how to analyze, modify, and reflash a black-box firmware image.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.thelasthope.org/"&gt;&lt;img src="http://www.thelasthope.org/300_250_gravestone2.gif" width="300" height="250" alt="The Last HOPE" title="The Last HOPE"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-4387208717027937963?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/4387208717027937963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=4387208717027937963' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4387208717027937963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/4387208717027937963'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/06/speaking-at-last-hope.html' title='Speaking at Last Hope'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-2749649946110282186</id><published>2008-06-16T13:43:00.001-04:00</published><updated>2008-08-01T18:17:46.246-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='msp430'/><category scheme='http://www.blogger.com/atom/ns#' term='bsl'/><title type='text'>MSP430 BSL Passwords: Brute Force Estimates and Defenses</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;at the Extreme Measurement Communications Center&lt;br /&gt;of the &lt;a href="http://ornl.gov"&gt;Oak Ridge National Laboratory&lt;/a&gt;&lt;br /&gt;regarding the work of&lt;br /&gt;Alexander Becher, Zinaida Benenson, and Maximillian Dornseif&lt;br /&gt;with minor additions and comments.&lt;br /&gt;&lt;br /&gt;The MSP430 microcontroller uses its 256-bit interrupt vector table (IVT) as a password for its serial bootstrap loader (BSL), which can remain activated despite a blown JTAG fuse.  As code confidentiality then depends upon the BSL password, this article will make some preliminary observations as to the difficulty of guessing the password.  It doesn't attempt to be terribly thorough, precise, or academic.  Rather, consider this to be a few `back of the napkin' notes on breaking the password.  Further, the scope of this article is limited to the brute forcing of passwords.  Alternatives to brute forcing will not be discussed here.&lt;br /&gt;&lt;br /&gt;A good starting point would be [1] &lt;a href="http://www.springerlink.com/content/1001v40487t55q82/"&gt;Tampering with Motes: Real World Physical Attacks on Wireless Sensor Networks&lt;/a&gt;.  It's an excellent paper, but be sure to get the 15-page version; the 4-page variant is no substitute.  This article will begin by recapping their estimate of the BSL password strength, and it will conclude with the source code of a Perl script mentioned--but not included--in that paper.&lt;br /&gt;&lt;br /&gt;The issue at hand is that the MSP430 reuses its interrupt vector table (IVT) as a password.  Thus, while the password is technically 256 bits in length, many of those bits are either fixed or predictable.  Further, as the BSL allows for direct memory access to the device, it might be used to compromise keys where the firmware is known.&lt;br /&gt;&lt;br /&gt;Becher et all attempted to determine the minimum keyspace, which is to say the number of bits out of 256 which are truly unpredictable in a rather small program.  Beginning with 256 bits in an array of sixteen 16-bit interrupt handler function pointers, their reasoning follows:  (1) As all MSP430 instructions must be even-aligned, every valid interrupt handler must have a least-significant bit of 0.  Therefore, the space is reduced to 16*15=240 bits.  (2) As the reset vector always points to the beginning of flash memory, the space is further reduced to 15*15=225 bits.  (3) All unused interrupts point to the same address.  As a worst case would have at least four distinct handlers, the keyspace will be reduced to no less than 4*15=60 bits by this observation.  (4) As code is placed in a contiguous region of memory, a smaller program would have less are in which to place interrupt handlers.  Supposing the program uses only 2^11=2kb of flash memory, the key domain is reduced to only 4*10=40 bits.&lt;br /&gt;&lt;br /&gt;Note that as the intent is to come up with a reasonable minimum, claims (3) and (4) above refer only to a reasonable minimum of program security.  An average, complicated ZigBee application might well have many more bits of randomness.  They then measured that the speed of a brute forcing algorithm is 12 passwords/second at 9600 baud, 31p/s at 38,400 baud, and 83p/s at 38,400 baud with a modified client.  They state a theoretical limit at 38,400 baud of 150p/s.  Rounding off to 2^7=128 passwords per second, they conclude that brute forcing would be limited to 2^(40-7-1)=2^32 seconds, which is roughly equal to 128 years.&lt;br /&gt;&lt;br /&gt;I'd like to briefly consider how brute forcing might be sped up beyond their estimates, even if such a speed-up is not of sufficient magnitude to make unassisted brute-forcing of the BSL feasible.&lt;br /&gt;&lt;br /&gt;While the most recent revisions of the BSL require a password for changing the baud rate, V1.60 and V1.61 have no such requirement[2].  When using this command, the BSL client sends three bytes: D1, D2, and D3.  D3 is what we would expect: 0x00 for 9600 baud, 0x01 for 19200 baud, and 0x02 for 38400 baud.  D1 and D2, however, are much more interesting.  They are written directly to the clock module control registers!  (DCOCTL and BCSCTL1 on F1xx/F2xx; SCFI0/SCFI1 on F4xx.)  These two registers control the frequency of the device, and they may be set to anything the device supports, which is in excess of the 4.2Mhz required for 38400 baud.  Further, bytes are read by bit-banging, which is calibrated by the 0x80 synchronization character.  By sending 0x80 too quickly and setting the microcontroller to 8 or 16mhz, it should be possible to brute force at a much faster rate.  2^9 passwords is a reasonable rough estimate; a bit more might be possible.  32 years is still too slow to be practical, but perhaps with possession of another revision of the target firmware image this speed-up might be valuable.&lt;br /&gt;&lt;br /&gt;Suppose that you wish to maximize the security of the BSL password on your MSP430-based device, and you don't want to disable the BSL entirely.  Becher's solution from [1] is a Perl script which replaces each interrupt pointer in the IVT with a pointer to another address, which contains a branch to the original address.  At the cost of a few extra cycles on each interrupt, it can considerably increase the difficulty of brute-forcing a password.  Most importantly, by separately randomizing the vectors of every device you ship, it is possible to defend against an attacker who has a copy of the firmware but does not have internally held keys of a device from reading those keys through the BSL.&lt;br /&gt;&lt;br /&gt;In August at &lt;a href="http://www.blackhat.com/html/bh-usa-08/bh-usa-08-speakers.html#Goodspeed"&gt;Black Hat USA 2008&lt;/a&gt;, I'll be presenting a timing attack which makes it possible to break some revisions of the BSL in short order.&lt;br /&gt;&lt;br /&gt;[1] &lt;a href="http://www.springerlink.com/content/1001v40487t55q82/"&gt;Tampering with Motes: Real World Physical Attacks on Wireless Sensor Networks&lt;/a&gt;&lt;br /&gt;[2] &lt;a href="http://www.google.com/search?q=slaa089"&gt;SLAA089: Features of the MSP430 BSL&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#!/usr/pkg/bin/perl&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;use&lt;/strong&gt; warnings;&lt;br /&gt;&lt;strong&gt;use&lt;/strong&gt; strict;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# Use with Intel Hex files for Texas Instruments MSP430 microcontrollers.&lt;br /&gt;# Replace ALL interrupt vectors with addresses generated randomly.&lt;br /&gt;# Store jump instructions to the original interrupt handlers there.&lt;br /&gt;&lt;br /&gt;# Written by Alexander Becher &amp;lt;alex@cyathus.de&amp;gt;, 2005.&lt;br /&gt;# Use freely.&lt;br /&gt;&lt;br /&gt;# $start and $end define the address range into which new vectors will point.&lt;br /&gt;&lt;br /&gt;# The start address will be updated by the Ihex reading code below.&lt;br /&gt;# It must be correctly aligned.&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$start&lt;/font&gt; = 0x4000;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# This is where the interrupt table starts. Addresses &amp;gt;= $end will not be used!&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$end&lt;/font&gt;         = 0xffe0;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$align&lt;/font&gt;       = 2;            &lt;font color="#444444"&gt;# code addresses on MSP430 must be even&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;%used&lt;/font&gt;;   &lt;font color="#444444"&gt;# will contain used memory regions&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt;;   &lt;font color="#444444"&gt;# stores the original interrupt vector table&lt;br /&gt;&lt;br /&gt;# Read an Intel hex file. With much help from BFD.&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;while&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&amp;lt;&amp;gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$len&lt;/font&gt;, &lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$data&lt;/font&gt;, &lt;font color="#2040a0"&gt;$checksum&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;      = &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="b000d0"&gt;/^:([[:xdigit:]]{2})([[:xdigit:]]{4})00([[:xdigit:]]*)([[:xdigit:]]{2})\cM?$/&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;## Does not work? What did I do wrong??&lt;br /&gt;#     if (m/^:   # colon&lt;br /&gt;#           ([[:xdigit:]]{2}) # data length&lt;br /&gt;#           ([[:xdigit:]]{4}) # address&lt;br /&gt;#           00   # record type&lt;br /&gt;#           ([[:xdigit:]]*) # data&lt;br /&gt;#           ([[:xdigit:]]{2}) # checksum&lt;br /&gt;#           \cM?$/x  # CRLF&lt;br /&gt;#        ) {&lt;br /&gt;&lt;br /&gt;    &lt;/font&gt;&lt;strong&gt;if&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;!&lt;font color="a52a2a"&gt;&lt;strong&gt;defined&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; || &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt; &lt;strong&gt;ne&lt;/strong&gt; &lt;font color="#008000"&gt;&amp;quot;FFE0&amp;quot;&lt;/font&gt; &amp;amp;&amp;amp; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; &lt;strong&gt;ne&lt;/strong&gt; &lt;font color="#008000"&gt;&amp;quot;FFF0&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# update start of unused address region&lt;br /&gt; # assume ascending order of addresses&lt;br /&gt; # (i.e. it is not the case that there is a line in the hex file&lt;br /&gt; #  which contains code for address 0x4242 which is followed by a&lt;br /&gt; #  line which contains code for address 0x2323)&lt;br /&gt;&lt;br /&gt; # assume all data first, then interrupts, then trailing stuff&lt;br /&gt; &lt;/font&gt;&lt;strong&gt;if&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;defined&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; &amp;amp;&amp;amp; &lt;font color="a52a2a"&gt;&lt;strong&gt;defined&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$len&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;     &lt;font color="#2040a0"&gt;$start&lt;/font&gt; = align&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;hex&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; + &lt;font color="#2040a0"&gt;$len&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt; &lt;strong&gt;next&lt;/strong&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;    &lt;font color="#444444"&gt;# If we reach this point, we are reading the first or the second&lt;br /&gt;    # line of the interrupt vector table.&lt;br /&gt;&lt;br /&gt;    # Attention: MSP430 is little endian!&lt;br /&gt;    &lt;/font&gt;&lt;strong&gt;while&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$data&lt;/font&gt; =~&lt;font color="b000d0"&gt; /([[:xdigit:]]{2})([[:xdigit:]]{2})/g&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;     &lt;font color="a52a2a"&gt;&lt;strong&gt;push&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt;, &lt;font color="a52a2a"&gt;&lt;strong&gt;hex&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;&lt;font color="#2040a0"&gt;$2&lt;/font&gt;&lt;font color="#2040a0"&gt;$1&lt;/font&gt;&amp;quot;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;    &lt;font color="#444444"&gt;# If this is the second line, do The Real Work[tm].&lt;br /&gt;    &lt;/font&gt;&lt;strong&gt;if&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt; &amp;amp;&amp;amp; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; &lt;strong&gt;eq&lt;/strong&gt; &lt;font color="#008000"&gt;&amp;quot;FFF0&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; replace_interrupts&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#&lt;br /&gt;# Why this program exists ;-&amp;gt;&lt;br /&gt;#&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; replace_interrupts&lt;/font&gt; {&lt;/strong&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; = &lt;font color="#2040a0"&gt;@_&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;foreach&lt;/strong&gt; &lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# Create a branch instruction to the original address of the handler&lt;br /&gt; &lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$instr&lt;/font&gt; = br&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# Get a new, unused address, using key material&lt;br /&gt; &lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$new_addr&lt;/font&gt; = new_addr&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;length&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$instr&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# write a branch instruction there, mark appropriate addresses as used.&lt;br /&gt; &lt;/font&gt;code&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$new_addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$instr&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# point interrupt vector to new address (use Perl's loop aliasing)&lt;br /&gt; &lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt; = &lt;font color="#2040a0"&gt;$new_addr&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;    &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt; ihex&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;0xFFE0, &lt;font color="a52a2a"&gt;&lt;strong&gt;map&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt; rep_16bit_le&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;@interrupts&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#&lt;br /&gt;# Returns a new random unused address suitable for putting code of&lt;br /&gt;# $length bytes there. Return value will be aligned.&lt;br /&gt;#&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; new_addr&lt;/font&gt; {&lt;/strong&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$length&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; = &lt;font color="#2040a0"&gt;@_&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$diff&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;font color="#2040a0"&gt;$diff&lt;/font&gt; = &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$end&lt;/font&gt; - &lt;font color="#2040a0"&gt;$start&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; / &lt;font color="#2040a0"&gt;$align&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;font color="#444444"&gt;# create a new random address until an unused region of the desired&lt;br /&gt;    # length is found&lt;br /&gt;    &lt;/font&gt;&lt;strong&gt;do&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;        &lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$n&lt;/font&gt; = &lt;font color="a52a2a"&gt;&lt;strong&gt;int&lt;/strong&gt;&lt;/font&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;rand&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$diff&lt;/font&gt;;&lt;br /&gt; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; = &lt;font color="#2040a0"&gt;$start&lt;/font&gt; + &lt;font color="#2040a0"&gt;$n&lt;/font&gt; * &lt;font color="#2040a0"&gt;$align&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; &lt;strong&gt;while&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;grep&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$_&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;map&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt; isused&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;+&lt;font color="#2040a0"&gt;$_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;0..&lt;font color="#2040a0"&gt;$length&lt;/font&gt;-1&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#444444"&gt;# Woohoo, Perl's list processing rocks. ;-&amp;gt; The above was a crude&lt;br /&gt;    # form of &amp;quot;Is any address in the region [$addr, $addr+$length) used?&amp;quot;.&lt;br /&gt;&lt;br /&gt;    &lt;/font&gt;&lt;strong&gt;return&lt;/strong&gt; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; isused&lt;/font&gt; {&lt;/strong&gt; &lt;font color="#2040a0"&gt;$used&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;shift&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; mark_used&lt;/font&gt; {&lt;/strong&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$len&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; = &lt;font color="#2040a0"&gt;@_&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;foreach&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt; .. &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; + &lt;font color="#2040a0"&gt;$len&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="#2040a0"&gt;$used&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; = 1;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#&lt;br /&gt;# Place $code at $addr (which must be aligned). Outputs an ihex line&lt;br /&gt;# which says just that, and marks the memory area as used.&lt;br /&gt;#&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; code&lt;/font&gt; {&lt;/strong&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$code&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; = &lt;font color="#2040a0"&gt;@_&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$l&lt;/font&gt; = &lt;font color="a52a2a"&gt;&lt;strong&gt;length&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$code&lt;/font&gt;;&lt;br /&gt;    mark_used&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$l&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt; ihex&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$code&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# MSP 430 branch instruction&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; br&lt;/font&gt; {&lt;/strong&gt;  &lt;font color="#008000"&gt;&amp;quot;&lt;font color="#77dd77"&gt;\x&lt;/font&gt;30&lt;font color="#77dd77"&gt;\x&lt;/font&gt;40&amp;quot;&lt;/font&gt; . rep_16bit_le&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# 16 bit little endian representation&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; rep_16bit_le&lt;/font&gt; {&lt;/strong&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;pack&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;v&amp;quot;&lt;/font&gt;, &lt;font color="#2040a0"&gt;@_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# ihex($addr, @data)&lt;br /&gt;# write an ihex line, saying that $addr contains bytes @data&lt;br /&gt;# @data should contain &amp;quot;\xXX&amp;quot; binary data&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; ihex&lt;/font&gt; {&lt;/strong&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;@data&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; = &lt;font color="#2040a0"&gt;@_&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;font color="#2040a0"&gt;@data&lt;/font&gt; = &lt;font color="a52a2a"&gt;&lt;strong&gt;split&lt;/strong&gt;&lt;/font&gt;&lt;font color="b000d0"&gt; //&lt;/font&gt;, &lt;font color="a52a2a"&gt;&lt;strong&gt;join&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;&amp;quot;&lt;/font&gt;, &lt;font color="#2040a0"&gt;@data&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$type&lt;/font&gt; = 0;  &lt;font color="#444444"&gt;# data&lt;br /&gt;&lt;br /&gt;    &lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$ret&lt;/font&gt; = &lt;font color="#008000"&gt;&amp;quot;&amp;quot;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;while&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@data&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;@bytes&lt;/font&gt; = &lt;font color="#2040a0"&gt;@data&lt;/font&gt; &amp;gt;= 16 ? &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;splice&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;@data&lt;/font&gt;, 0, 16&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; : &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;splice&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;@data&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$c&lt;/font&gt; = &lt;font color="#2040a0"&gt;@bytes&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# XXX pack?&lt;br /&gt; &lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$data&lt;/font&gt; = &lt;font color="a52a2a"&gt;&lt;strong&gt;join&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;&amp;quot;&lt;/font&gt;, &lt;font color="a52a2a"&gt;&lt;strong&gt;map&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;sprintf&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;&lt;font color="#2040a0"&gt;%02&lt;/font&gt;X&amp;quot;&lt;/font&gt;, &lt;font color="a52a2a"&gt;&lt;strong&gt;ord&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;$_&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt; &lt;font color="#2040a0"&gt;@bytes&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;font color="#444444"&gt;# checksum computation from GNU binutils bfd/ihex.c&lt;br /&gt; &lt;/font&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$checksum&lt;/font&gt; = &lt;font color="#2040a0"&gt;$c&lt;/font&gt; + &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; + &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$addr&lt;/font&gt; &amp;gt;&amp;gt; 8&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; + &lt;font color="#2040a0"&gt;$type&lt;/font&gt;;&lt;br /&gt; &lt;strong&gt;foreach&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;@bytes&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;     &lt;font color="#2040a0"&gt;$checksum&lt;/font&gt; += &lt;font color="a52a2a"&gt;&lt;strong&gt;ord&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="#2040a0"&gt;$checksum&lt;/font&gt; = &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;- &lt;font color="#2040a0"&gt;$checksum&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &amp;amp; 0xff;&lt;br /&gt;&lt;br /&gt; &lt;font color="#2040a0"&gt;$ret&lt;/font&gt; .= &lt;font color="a52a2a"&gt;&lt;strong&gt;sprintf&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;:&lt;font color="#2040a0"&gt;%02&lt;/font&gt;X&lt;font color="#2040a0"&gt;%04&lt;/font&gt;X&lt;font color="#2040a0"&gt;%02&lt;/font&gt;X&lt;font color="#2040a0"&gt;%s&lt;/font&gt;&lt;font color="#2040a0"&gt;%02&lt;/font&gt;X&lt;font color="#77dd77"&gt;\c&lt;/font&gt;M&lt;font color="#77dd77"&gt;\c&lt;/font&gt;J&amp;quot;&lt;/font&gt;,&lt;br /&gt;   &lt;font color="#2040a0"&gt;$c&lt;/font&gt;, &lt;font color="#2040a0"&gt;$addr&lt;/font&gt;, &lt;font color="#2040a0"&gt;$type&lt;/font&gt;, &lt;font color="#2040a0"&gt;$data&lt;/font&gt;, &lt;font color="#2040a0"&gt;$checksum&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt; &lt;font color="#2040a0"&gt;$addr&lt;/font&gt; += 16;  &lt;font color="#444444"&gt;# wrong for last iteration, but irrelevant then&lt;br /&gt;    &lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;    &lt;strong&gt;return&lt;/strong&gt; &lt;font color="#2040a0"&gt;$ret&lt;/font&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;# round up to the nearest multiple of $align&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;sub&lt;font color="ff0000"&gt; align&lt;/font&gt; {&lt;/strong&gt;&lt;br /&gt;    &lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$n&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; = &lt;font color="#2040a0"&gt;@_&lt;/font&gt;;&lt;br /&gt;    &lt;strong&gt;if&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$n&lt;/font&gt; &lt;font color="#2040a0"&gt;% &lt;/font&gt;&lt;font color="#2040a0"&gt;$align&lt;/font&gt; != 0&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="#2040a0"&gt;$n&lt;/font&gt; += &lt;font color="#2040a0"&gt;$align&lt;/font&gt; - &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$n&lt;/font&gt; &lt;font color="#2040a0"&gt;% &lt;/font&gt;&lt;font color="#2040a0"&gt;$align&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;    &lt;strong&gt;return&lt;/strong&gt; &lt;font color="#2040a0"&gt;$n&lt;/font&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-2749649946110282186?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/2749649946110282186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=2749649946110282186' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2749649946110282186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/2749649946110282186'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/06/msp430-bsl-passwords-brute-force.html' title='MSP430 BSL Passwords: Brute Force Estimates and Defenses'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-107344004592267476</id><published>2008-06-15T14:17:00.001-04:00</published><updated>2008-07-05T16:25:11.995-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arts-n-crafts'/><title type='text'>Syringe Logic Probe, Revision 2</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/2579197942/"&gt;&lt;img src="http://travis.frob.us/~travis/public/blog/images/syringe/syringe2.jpg"&gt;&lt;/a&gt;&lt;br /&gt;While my &lt;a href="http://travisgoodspeed.blogspot.com/2008/05/syringe-logic-probe.html"&gt;original probe&lt;/a&gt; is damned useful, it was a bit of a rushed job.  Since then, I've found uncoated silver jewelry wire whose diameter is just a hair smaller than the inner diameter of the needle, allowing me to force it in for an electrical connection.  More importantly, as I no longer solder to the outside of the needle, I can restore the safety cap and save my fingers from getting nicked.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-107344004592267476?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/107344004592267476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=107344004592267476' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/107344004592267476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/107344004592267476'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/06/syringe-logic-probe-revision-2.html' title='Syringe Logic Probe, Revision 2'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-5803742509910704475</id><published>2008-06-13T14:27:00.000-04:00</published><updated>2008-06-14T18:41:42.999-04:00</updated><title type='text'>Spring Cleaning</title><content type='html'>&lt;a href="http://www.flickr.com/photos/travisgoodspeed/sets/72157605609587908/"&gt;&lt;img style="width: 382px; height: 287px;" src="http://travis.frob.us/%7Etravis/public/blog/images/microbox/microbox.jpg" alt="microbox contents" /&gt;&lt;/a&gt;&lt;br /&gt;I just received &lt;a href="http://microblog.routed.net/2008/06/04/2008-spring-cleaning-part-two/"&gt;Nick Chernyy's Microbox&lt;/a&gt; as part of &lt;a href="http://tgimboej.org/"&gt;The Great Internet Migratory Box of Electronic Junk&lt;/a&gt; project.&lt;br /&gt;&lt;br /&gt;I took the 8051 board, the 2x16 LCD, and a MAX232 level-converter chip.  I then removed a healthy number of packing peanuts, swapped one of the microcontroller cases for a smaller one, and added the following:&lt;ul&gt;&lt;li&gt;Two PICs.&lt;/li&gt;&lt;li&gt;Three MSP430F2012 DIPs.&lt;/li&gt;&lt;li&gt;A 4G iPod, sans hard disk&lt;/li&gt;&lt;li&gt;Two &lt;a href="http://focus.ti.com/analog/docs/enggresdetail.tsp?familyId=367&amp;amp;genContentId=15380"&gt;TI CC1100&lt;/a&gt; radio boards.&lt;/li&gt;&lt;li&gt;A board of ZIF sockets for PIC programming.&lt;/li&gt;&lt;/ul&gt;As is tradition, I'll be sending the box to someone on the &lt;a href="http://tgimboej.org/Box_Requests"&gt;Box Requests&lt;/a&gt; page within the next week or so.&lt;br /&gt;&lt;br /&gt;--Travis&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-5803742509910704475?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/5803742509910704475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=5803742509910704475' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5803742509910704475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/5803742509910704475'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/06/spring-cleaning.html' title='Spring Cleaning'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-1644051220895096816</id><published>2008-06-02T18:45:00.000-04:00</published><updated>2008-06-02T21:03:54.846-04:00</updated><title type='text'>CopyWench, a File Format for Publicly Discussing Undistributable Material</title><content type='html'>by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;at the Extreme Measurement Communications Center&lt;br /&gt;of the &lt;a href="http://ornl.gov"&gt;Oak Ridge National Laboratory&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Suppose that an author has written a document describing the reverse engineering of ROM image, and he wishes to publish his work.  Further, let us suppose that the author is an honest and law-abiding citizen of a nation with intellectual property laws that prevent him from distributing software copyrighted by another.  He cannot distribute his work in its entirety, as his work will cite numerous lines of the original.  In this short article, I will discuss a format for a utility which--much like diff--allows an author to distribute only his changes to a document.  Unlike diff, my format will not include so much as a single line of the original.&lt;br /&gt;&lt;br /&gt;First, suppose this to be our secret file.  It is from Wikipedia's &lt;a href="http://en.wikipedia.org/wiki/BASIC_programming_language"&gt;BASIC&lt;/a&gt; article.  We'll call it secret.txt:&lt;pre&gt;10 INPUT "What is your name: ", U$&lt;br /&gt;20 PRINT "Hello "; U$&lt;br /&gt;30 INPUT "How many stars do you want: ", N&lt;br /&gt;40 S$ = ""&lt;br /&gt;50 FOR I = 1 TO N&lt;br /&gt;60 S$ = S$ + "*"&lt;br /&gt;70 NEXT I&lt;br /&gt;80 PRINT S$&lt;br /&gt;90 INPUT "Do you want more stars? ", A$&lt;br /&gt;100 IF LEN(A$) = 0 THEN 90&lt;br /&gt;110 A$ = LEFT$(A$, 1)&lt;br /&gt;120 IF A$ = "Y" OR A$ = "y" THEN 30&lt;br /&gt;130 PRINT "Goodbye ";U$&lt;br /&gt;140 END&lt;/pre&gt;Each line of secret.txt has a one-way MD5 hash, which is what will be published in lieu of the line itself.  To someone who does not have the secret file, 12b9bdf57db1a1c9e4fb2fb1b35e9c41 means nothing.  But to someone who does have the file, it's rather easy to find that the hash belongs to line 10 above.&lt;br /&gt;&lt;br /&gt;Suppose this to be our private commentary:&lt;pre&gt;Commentary of a BASIC program.&lt;br /&gt;by John Doe.&lt;br /&gt;&lt;br /&gt;10 INPUT "What is your name: ", U$&lt;br /&gt;My name is John!&lt;br /&gt;20 PRINT "Hello "; U$&lt;br /&gt;Hello to you, too!&lt;br /&gt;30 INPUT "How many stars do you want: ", N&lt;br /&gt;Tons of stars!&lt;br /&gt;40 S$ = ""&lt;br /&gt;50 FOR I = 1 TO N&lt;br /&gt;60 S$ = S$ + "*"&lt;br /&gt;70 NEXT I&lt;br /&gt;80 PRINT S$&lt;br /&gt;90 INPUT "Do you want more stars? ", A$&lt;br /&gt;Always.&lt;br /&gt;100 IF LEN(A$) = 0 THEN 90&lt;br /&gt;110 A$ = LEFT$(A$, 1)&lt;br /&gt;120 IF A$ = "Y" OR A$ = "y" THEN 30&lt;br /&gt;130 PRINT "Goodbye ";U$&lt;br /&gt;Adieu.&lt;br /&gt;140 END&lt;/pre&gt;By replacing every secret line--that is to say every line which is found in secret.txt--with a one-way hash of the original, we will arrive with something like the following, which is free of copyrighted material.&lt;pre&gt;Commentary of a BASIC program.&lt;br /&gt;by John Doe.&lt;br /&gt;&lt;br /&gt;COPYWENCH 12b9bdf57db1a1c9e4fb2fb1b35e9c41&lt;br /&gt;My name is John!&lt;br /&gt;COPYWENCH 8a80ddc83dc0592951d29151d62487a4&lt;br /&gt;Hello to you, too!&lt;br /&gt;COPYWENCH cbbf650ae187427f3cd74a58a7b0edf4&lt;br /&gt;Tons of stars!&lt;br /&gt;COPYWENCH f842a481f76099503c63c611dc84784e&lt;br /&gt;COPYWENCH 9376ab1f0bed02260134dc9d6b723433&lt;br /&gt;COPYWENCH 5cbb0ef3dbb1b75c047b278b3480fa46&lt;br /&gt;COPYWENCH 95cfeba9a3004c3e6b2db6ce3222341b&lt;br /&gt;COPYWENCH 402c331f990b99054568e72315e5e01b&lt;br /&gt;COPYWENCH f8ee49bfcd41e6a43266105e65964247&lt;br /&gt;Always.&lt;br /&gt;COPYWENCH 24407c853d6df83fecd3074dc44e5ef5&lt;br /&gt;COPYWENCH cc67be8c43810e63859ae75abaf7b1c2&lt;br /&gt;COPYWENCH 36c25fd5bf40b1a5a0ef8d68af1580c7&lt;br /&gt;COPYWENCH 80a1d74d3d5b1321fe3805a6d6f6011c&lt;br /&gt;Adieu.&lt;br /&gt;COPYWENCH 811061ce8478b3e56543e103ccd52c67&lt;/pre&gt;The following algorithm will translate between public and private files:&lt;ol&gt;&lt;li&gt;For each line of secret.txt:&lt;ol&gt;&lt;li&gt;Place a hash of the line in an associative array.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;Then for each line of the input file,&lt;ol&gt;&lt;li&gt;If the line begins with COPYWENCH, print the line matching the checksum of the second word.&lt;/li&gt;&lt;li&gt;Else if the line exists in the associative array, print "COPYWENCH" followed by a space and the line's hash.&lt;/li&gt;&lt;li&gt;Else print the input line.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;I recommend this file format, which I've named the CopyWench format, because it is terribly easy to implement.  A few minutes in any scripting language will result in a working implementation.&lt;br /&gt;&lt;br /&gt;A sample implementation follows.  As all implementations ought to be licensed so as to be distributable with the documents with which they are intended to be used, this one is in the public domain.  Do with it as you will.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;#CopyWench 0.1&lt;br /&gt;#Authored for the Public Domain&lt;br /&gt;#by Travis Goodspeed &amp;lt;travis at utk.edu&amp;gt;&lt;br /&gt;&lt;br /&gt;#Either Digest::MD5 or Digest::Perl::MD5 is needed.&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;BEGIN&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;    &lt;strong&gt;eval&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;strong&gt;require&lt;/strong&gt; Digest::MD5;&lt;br /&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;import&lt;/strong&gt;&lt;/font&gt; Digest::MD5 &lt;font color="#008000"&gt;'md5_hex'&lt;/font&gt;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;strong&gt;if&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$@&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt; &lt;font color="#444444"&gt;# no Digest::MD5&lt;br /&gt; &lt;/font&gt;&lt;strong&gt;require&lt;/strong&gt; Digest::Perl::MD5;&lt;br /&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;import&lt;/strong&gt;&lt;/font&gt; Digest::Perl::MD5 &lt;font color="#008000"&gt;'md5_hex'&lt;/font&gt;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;             &lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;if&lt;/strong&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$#&lt;/font&gt;ARGV!=0&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;Usage: &lt;font color="#2040a0"&gt;$0&lt;/font&gt; secret.txt &amp;lt;input.txt &amp;gt;output.txt&lt;br /&gt;Where secret.txt is the secret being written about.&lt;font color="#77dd77"&gt;\n&lt;/font&gt;&amp;quot;&lt;/font&gt;;&lt;br /&gt;    &lt;strong&gt;exit&lt;/strong&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;$secret&lt;/font&gt;=&lt;font color="#2040a0"&gt;$ARGV&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/font&gt;0&lt;font color="4444FF"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="#2040a0"&gt;%lines&lt;/font&gt;;&lt;br /&gt;&lt;strong&gt;my&lt;/strong&gt; &lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$line&lt;/font&gt;,&lt;font color="#2040a0"&gt;$hash&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;open&lt;/strong&gt;&lt;/font&gt; SECRET, &lt;font color="#008000"&gt;&amp;quot;&amp;lt;&lt;font color="#2040a0"&gt;$secret&lt;/font&gt;&amp;quot;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#Build an associative array of secret lines.&lt;br /&gt;&lt;/font&gt;&lt;strong&gt;while&lt;/strong&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&amp;lt;SECRET&amp;gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="a52a2a"&gt;&lt;strong&gt;chomp&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#2040a0"&gt;$line&lt;/font&gt;=&lt;font color="#2040a0"&gt;$_&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#2040a0"&gt;$hash&lt;/font&gt;=md5_hex&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$line&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#444444"&gt;#print &amp;quot;$hash $line\n&amp;quot;;&lt;br /&gt;    &lt;/font&gt;&lt;font color="#2040a0"&gt;$lines&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$hash&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;=&lt;font color="#2040a0"&gt;$line&lt;/font&gt;;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="a52a2a"&gt;&lt;strong&gt;close&lt;/strong&gt;&lt;/font&gt; SECRET;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;while&lt;/strong&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&amp;lt;STDIN&amp;gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="a52a2a"&gt;&lt;strong&gt;chomp&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$_&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#2040a0"&gt;$line&lt;/font&gt;=&lt;font color="#2040a0"&gt;$_&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#2040a0"&gt;$hash&lt;/font&gt;=md5_hex&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$line&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;;&lt;br /&gt;    &lt;strong&gt;if&lt;/strong&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$lines&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$hash&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;COPYWENCH &lt;font color="#2040a0"&gt;$hash&lt;/font&gt;&lt;font color="#77dd77"&gt;\n&lt;/font&gt;&amp;quot;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;strong&gt;elsif&lt;/strong&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;&lt;font color="#2040a0"&gt;$line&lt;/font&gt;=~&lt;font color="b000d0"&gt;m/\bCOPYWENCH ([0-9a-f]+)/&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;&lt;font color="#2040a0"&gt;$lines&lt;/font&gt;{&lt;font color="#2040a0"&gt;$1&lt;/font&gt;}&lt;font color="#77dd77"&gt;\n&lt;/font&gt;&amp;quot;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;strong&gt;else&lt;/strong&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt; &lt;font color="a52a2a"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;&lt;font color="#2040a0"&gt;$line&lt;/font&gt;&lt;font color="#77dd77"&gt;\n&lt;/font&gt;&amp;quot;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-1644051220895096816?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/1644051220895096816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=1644051220895096816' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1644051220895096816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/1644051220895096816'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/06/copywench-file-format-for-publicly.html' title='CopyWench, a File Format for Publicly Discussing Undistributable Material'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-6390799447877596074</id><published>2008-05-29T17:08:00.000-04:00</published><updated>2008-07-04T21:38:49.405-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='speaking'/><title type='text'>Speaking at Defcon 16</title><content type='html'>After Black Hat, I'll be speaking at Defcon 16 regarding an entirely different subject.  The &lt;a href="http://defcon.org/html/defcon-16/dc-16-speakers.html#Goodspeed"&gt;abstract&lt;/a&gt; follows.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;In 1990, a wire-bound book was published in Paris by the title of «Voyage au centre de la HP28 c/s». It presents a very thorough account of the inner workings of the Hewlett Packard 28 series of graphing calculators. Designed before the days of prepackaged microprocessors, the series uses the Saturn architecture, which HP designed in-house. This architecture is very different from today's homogeneous RISC chips, with registers of 1, 4, 12, 16, 20, and 64 bits in width. The fundamental unit of addressing is the nibble, rather than the byte. Floats are represented as binary-coded decimal, and a fundamental object in the operating system is an algebraic expression.&lt;br /&gt;&lt;br /&gt;This architecture is still used, albeit in emulation, in the modern HP50g. With this talk, I intend to call attention to a fascinating, professional, and well-documented feat of reverse engineering. Using little more than their ingenuity and an Apple ][e, Paul Courbis and Sebastien Lalande reverse engineered a black box calculator into a real computer, one which became user-programmable in machine language as a result. More than that, they documented the hack in such exquisite detail that their book is not just a fascinating read, but also veritable holy scripture for anyone trying to write custom software for this machine.&lt;br /&gt;&lt;br /&gt;Expect a thorough review, in English, of the contents of the book. This is not a sales pitch; electronic copies of both the translation and the original are free to all interested readers. Topics include the datatypes of the computer algebra system, hacking an upgrade into the memory bus, bootstrapping an assembler, writing in machine language by tables, and adding an I/O port for software backups.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;If you'd like a copy of the book in advance, grab the original French from the site of &lt;a href="http://www.courbis.fr/"&gt;Paul Courbis&lt;/a&gt; or email me for a rough draft of the English translation.&lt;br /&gt;&lt;br /&gt;--Travis Goodspeed&lt;br /&gt;&amp;lt;travis at utk.edu&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3638505461399232379-6390799447877596074?l=travisgoodspeed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://travisgoodspeed.blogspot.com/feeds/6390799447877596074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3638505461399232379&amp;postID=6390799447877596074' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6390799447877596074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3638505461399232379/posts/default/6390799447877596074'/><link rel='alternate' type='text/html' href='http://travisgoodspeed.blogspot.com/2008/05/speaking-at-defcon-16.html' title='Speaking at Defcon 16'/><author><name>Travis Goodspeed</name><uri>http://www.blogger.com/profile/09826896758948270949</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_OYfpeQbN9I0/SKdWz6tDN0I/AAAAAAAAAAY/rdx3wLFWvPE/S220/goodspeed.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3638505461399232379.post-7032851404400132807</id><published>2008-05-18T15:00:00.00
