<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>root labs rdist</title>
	<atom:link href="http://rdist.root.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://rdist.root.org</link>
	<description>Embedded security, crypto, software protection</description>
	<lastBuildDate>Fri, 12 Mar 2010 15:00:52 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='rdist.root.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/fcb2feb6139c174a88b8d38cc361a647?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>root labs rdist</title>
		<link>http://rdist.root.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rdist.root.org/osd.xml" title="root labs rdist" />
	<atom:link rel='hub' href='http://rdist.root.org/?pushpress=hub'/>
		<item>
		<title>Why digital logic is different than analog</title>
		<link>http://rdist.root.org/2010/03/12/why-digital-logic-is-different-than-analog/</link>
		<comments>http://rdist.root.org/2010/03/12/why-digital-logic-is-different-than-analog/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 15:00:52 +0000</pubDate>
		<dc:creator>Nate Lawson</dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://rdist.wordpress.com/?p=205</guid>
		<description><![CDATA[I occasionally come across a concept that, while obvious to those who know it, isn&#8217;t as widely spread as it should be. One such question is, &#8220;What is the difference between analog and digital logic?&#8221; There are a lot of people that know the answer in an abstract way, but the real distinction is both [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=205&subd=rdist&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I occasionally come across a concept that, while obvious to those who know it, isn&#8217;t as widely spread as it should be. One such question is, &#8220;What is the difference between analog and digital logic?&#8221; There are a lot of people that know the answer in an abstract way, but the real distinction is both simple and sublime.</p>
<p>The abstract answer is that an analog signal is continuous while a digital signal is discrete, ones and zeros. When people think of analog technology, a common example is cassette tape, hissing and popping, compared to the relative clarity of a CD or MP3. The common sense reason given why the digital version sounds better is because the ones and zeros are conceptually perfect, matching the original recording. Also, copies are perfect as well because the ones and zeros can be exactly duplicated.</p>
<p>However, this explanation begins to break down when you consider it closely. Due to the <a href="http://en.wikipedia.org/wiki/Quantization_%28signal_processing%29">quantization problem</a>, each digital representation (sample) of the waveform at a moment in time is inexact because you can always divide it into smaller and smaller parts. So an analog signal at one point in time is more perfect than its digital sample. Also, the lower the sampling rate, the greater the error due to <a href="http://en.wikipedia.org/wiki/Aliasing">aliasing</a>. This is because a discrete sampling method cannot capture changes in the waveform that occur between samples. Thus, an ideal analog signal is always more accurate than its digital representation.</p>
<p>Going even deeper, there is no such thing as a purely digital signal. When expressed in terms of voltage, a one might be 5V and a zero, 0V. But no actual circuit can make an instantaneous transition from 0 to 5V or back. There&#8217;s always some small amount of time where the voltage is rising or falling. In really high-speed circuits or over longer distances, a signal can be both a one and a zero at different points on the wire. This is what engineers mean when they say a circuit has to be modeled as a <a href="http://en.wikipedia.org/wiki/Transmission_line">transmission line</a>. So even digital circuits are actually analog underneath. Digital is really just another way of imposing meaning on an analog circuit.</p>
<p>If analog is better, why do we even have digital? The answer is twofold: noise and dynamic range. Noise is always present in a signal. If restricted to a narrow frequency or time band, noise can often be filtered. However, there is always a danger of throwing out useful data along with the noise, especially both are if in a similar frequency range. Here is an example of a signal with easily-filtered noise &#8212; their frequencies and amplitudes are quite different.</p>
<p><a href="http://rdist.files.wordpress.com/2010/03/sinerand1.png"><img class="aligncenter size-medium wp-image-529" title="sinerand1" src="http://rdist.files.wordpress.com/2010/03/sinerand1.png?w=300&#038;h=187" alt="" width="300" height="187" /></a><br />
Dynamic range is the difference between the lowest and highest signal level. A system can&#8217;t have an infinite voltage, so there is always some limit to the highest value an analog signal can represent. In contrast, a digital signal can represent arbitrary ranges just by adding more bits (32 bits not enough range? Try 64!)</p>
<p><a href="http://rdist.files.wordpress.com/2010/03/sine1.png"><img class="aligncenter size-medium wp-image-530" title="sine1" src="http://rdist.files.wordpress.com/2010/03/sine1.png?w=300&#038;h=187" alt="" width="300" height="187" /></a><br />
In the next post, we&#8217;ll examine noise in more detail to understand the main difference between digital and analog logic.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rdist.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rdist.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rdist.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rdist.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rdist.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rdist.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rdist.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rdist.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rdist.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rdist.wordpress.com/205/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=205&subd=rdist&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://rdist.root.org/2010/03/12/why-digital-logic-is-different-than-analog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c01d70ede8af2f696f36d3f89b8be1?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">rdist</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/03/sinerand1.png?w=300" medium="image">
			<media:title type="html">sinerand1</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/03/sine1.png?w=300" medium="image">
			<media:title type="html">sine1</media:title>
		</media:content>
	</item>
		<item>
		<title>Attacking RSA exponentiation with fault injection</title>
		<link>http://rdist.root.org/2010/03/08/attacking-rsa-exponentiation-with-fault-injection/</link>
		<comments>http://rdist.root.org/2010/03/08/attacking-rsa-exponentiation-with-fault-injection/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 18:25:07 +0000</pubDate>
		<dc:creator>Nate Lawson</dc:creator>
				<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Protocols]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://rdist.root.org/?p=526</guid>
		<description><![CDATA[A new paper, &#8220;Fault-Based Attack of RSA Authentication&#8221; (pdf) by Pellegrini et al, is making the rounds. The general idea is that an attacker can disrupt an RSA private key operation to cause an invalid signature to be returned, then use that result to extract the private key. If you&#8217;re new to fault injection attacks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=526&subd=rdist&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>A new paper, &#8220;Fault-Based Attack of RSA Authentication&#8221; (<a href="http://www.eecs.umich.edu/~valeria/research/publications/DATE10RSA.pdf">pdf</a>) by Pellegrini et al, is making the <a href="http://www.theregister.co.uk/2010/03/04/severe_openssl_vulnerability/">rounds</a>. The general idea is that an attacker can disrupt an RSA private key operation to cause an invalid signature to be returned, then use that result to extract the private key. If you&#8217;re new to fault injection attacks on RSA, I previously wrote an <a href="http://rdist.root.org/2008/03/10/advances-in-rsa-fault-attacks/">intro that should help</a>.</p>
<p>The main concept to grasp is that public key crypto is brittle. In the case of RSA&#8217;s CRT operation, a single bit error in one multiplication result is enough to fully compromise your private key. We&#8217;ve <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.7407">known this</a> since 1997. The solution is simple: validate every signature with the public key before returning it to the caller.</p>
<p>The authors noticed something curious. OpenSSL does verify signatures it generates before returning them, but if it detects a problem, it does not just return an error. It then tries again using a different exponentiation process, and then returns that signature <em>without validating it</em>.</p>
<p>Think about this for a moment. What conditions could cause an RSA private key operation to compute an invalid answer? An innocent possibility is cosmic radiation, bad RAM, etc. In this case, all computations should be considered unreliable and any retried operation should be checked very carefully. The other and more likely possibility is that the system is under attack by someone with physical proximity. In this case, OpenSSL should generate a very obvious log message and the operation should not be retried. If it is, the result should be checked very carefully.</p>
<p>For whatever reason, the OpenSSL programmers decided to retry with fixed-window exponentiation and trust that since there were no published fault attacks for it, they didn&#8217;t have to validate its result. This is a foolhardy attitude &#8212; not something you want to see in your crypto library. There had been many other fault injection attacks against various components or implementation approaches for RSA, <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.108.989">including right-to-left exponentiation</a>. There was no reason to consider left-to-right exponentiation invulnerable to this kind of attack.</p>
<p>Fixed-window exponentiation is a form of <a href="http://en.wikipedia.org/wiki/Exponentiation_by_squaring#Sliding_Window_Method">sliding  window exponentiation</a>. This is just a table-based optimization,  where a window (say, 3 bits wide) is moved across the exponent,  computing the final result incrementally. While this may be resistant to some timing attacks (but not <a href="http://rdist.root.org/2009/12/30/side-channel-attacks-on-cryptographic-software/">cache timing or branch prediction attacks</a>), there is nothing that would prevent fault injection attacks.</p>
<p>Indeed, it turns out to be vulnerable. The authors generate a few thousand signatures with single bit-flips in some window of the signature. Then they compare the faulty signatures to a correct signature over the same message. They compute the value for that portion of the private exponent since there are only 2<sup>w</sup> possibilities for that location if <em>w</em> is the window size in bits. This is repeated until enough of the private key is known.</p>
<p>The method they used to create the faulty signatures was a bit artificial. They built a SPARC system on an FPGA running Linux and OpenSSL. They then decreased the power supply voltage until multiplies started to fail. Since multiplication logic is a relatively long chain, it is often one of the first things to fail. However, a more interesting hardware result would be to attempt this kind of attack on an actual server because FPGAs work differently than ASICs. It might require careful targeting of the right power pins on the CPU. Since power pins are numerous in modern systems, this may be more effective than only modulating the system power supply.</p>
<p>This was a nice attack but nothing earth-shattering. The only thing I was floored by (yet again), was the willingness of crypto implementers to perform unsafe operations in the face of an almost certain attack. Shame on OpenSSL.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rdist.wordpress.com/526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rdist.wordpress.com/526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rdist.wordpress.com/526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rdist.wordpress.com/526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rdist.wordpress.com/526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rdist.wordpress.com/526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rdist.wordpress.com/526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rdist.wordpress.com/526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rdist.wordpress.com/526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rdist.wordpress.com/526/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=526&subd=rdist&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://rdist.root.org/2010/03/08/attacking-rsa-exponentiation-with-fault-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c01d70ede8af2f696f36d3f89b8be1?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">rdist</media:title>
		</media:content>
	</item>
		<item>
		<title>Next Baysec: March 2 at Kate O&#8217;Briens</title>
		<link>http://rdist.root.org/2010/02/22/next-baysec-march-2-at-kate-obriens/</link>
		<comments>http://rdist.root.org/2010/02/22/next-baysec-march-2-at-kate-obriens/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 22:38:25 +0000</pubDate>
		<dc:creator>Nate Lawson</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://rdist.root.org/?p=522</guid>
		<description><![CDATA[The next Baysec meeting is Tuesday March 2nd at Kate O’Briens. Come out and  meet fellow security people from all over the Bay Area. As always, this  is not a sponsored meeting, there is no agenda or speakers, and no RSVP is needed.
See you Tuesday, March 2, 7-11 pm. We’ll be towards the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=522&subd=rdist&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The next Baysec meeting is Tuesday March 2nd at Kate O’Briens. Come out and  meet fellow security people from all over the Bay Area. As always, this  is not a sponsored meeting, there is no agenda or speakers, and no RSVP is needed.</p>
<p>See you Tuesday, March 2, 7-11 pm. We’ll be towards the back.</p>
<p><a href="http://www.kateobriens.com/map.cfm">Kate O’Briens</a><br />
579 Howard St. @ 2nd, San Francisco<br />
(415) 882-7240</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rdist.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rdist.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rdist.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rdist.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rdist.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rdist.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rdist.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rdist.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rdist.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rdist.wordpress.com/522/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=522&subd=rdist&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://rdist.root.org/2010/02/22/next-baysec-march-2-at-kate-obriens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c01d70ede8af2f696f36d3f89b8be1?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">rdist</media:title>
		</media:content>
	</item>
		<item>
		<title>Reverse-engineering a smart meter</title>
		<link>http://rdist.root.org/2010/02/15/reverse-engineering-a-smart-meter/</link>
		<comments>http://rdist.root.org/2010/02/15/reverse-engineering-a-smart-meter/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 15:00:13 +0000</pubDate>
		<dc:creator>Nate Lawson</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[RFID]]></category>
		<category><![CDATA[Reverse engineering]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://rdist.root.org/?p=511</guid>
		<description><![CDATA[In 2008, a nice man from PG&#38;E came out to work on my house. He installed a new body for the gas meter and said someone would come by later to install the electronics module to make it a &#8220;smart meter&#8220;. Since I work with security for embedded systems, this didn&#8217;t sound very exciting. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=511&subd=rdist&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In 2008, a nice man from PG&amp;E came out to work on my house. He installed a new body for the gas meter and said someone would come by later to install the electronics module to make it a &#8220;<a href="http://www.pge.com/smartmeter/">smart meter</a>&#8220;. Since I work with <a href="http://www.rootlabs.com/">security for embedded systems</a>, this didn&#8217;t sound very exciting. I read up on smart meters and found they not only broadcast billing information (something I consider only a small privacy risk) but also <a href="http://www.nytimes.com/2009/12/14/us/14meters.html">provide remote control</a>. A software bug, typo at the control center, or hacker could potentially turn off my power and gas. But how vulnerable was I actually?</p>
<p><a href="http://rdist.files.wordpress.com/2010/02/smartmeter_overview.jpg"><img class="aligncenter size-medium wp-image-514" title="smartmeter_overview" src="http://rdist.files.wordpress.com/2010/02/smartmeter_overview.jpg?w=229&#038;h=300" alt="" width="229" height="300" /></a><br />
I decided to look into how smart meters work. Since the electronics module never was installed, I called up various parts supply houses to try to buy one. They were quite suspicious, requesting company background info and letterhead before deciding if they could send an evaluation sample. Even though this was long before IOActive <a href="http://www.cnn.com/2009/TECH/03/20/smartgrid.vulnerability/">outed smart meter flaws to CNN</a>, they had obviously gotten the message that these weren&#8217;t just ordinary valves or pipes.</p>
<p>Power, gas, and water meters have a long history of tampering attacks. People have drilled into them, shorted them out, <a href="http://www.phrack.com/issues.html?issue=44&amp;id=3#article">slowed them down</a>, and <a href="http://www.bartbeck.com/page132.html">rewired them to run backwards</a>. I don&#8217;t think I need to mention that doing those kinds of things is extremely dangerous and illegal. This history is probably why the parts supplier wasn&#8217;t eager to sell any smart meter boards to the public.</p>
<p>There&#8217;s always an easier way. By analyzing the vendor&#8217;s website, I guessed that they use the same radio module across product lines and other markets wouldn&#8217;t be so paranoid. Sure enough, the radio module for a water meter made by the same vendor was available on Ebay for $30. It arrived a few days later.</p>
<p>The case was hard plastic to prevent water damage. I used a bright light and careful tapping to be sure I wasn&#8217;t going to cut into anything with the Dremel. I cut a small window to see inside and identified where else to cut. I could see some of the radio circuitry and the battery connector.</p>
<p><a href="http://rdist.files.wordpress.com/2010/02/smartmeter1.jpg"><img class="aligncenter size-medium wp-image-515" title="smartmeter1" src="http://rdist.files.wordpress.com/2010/02/smartmeter1.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a><br />
After more cutting, it appeared that the battery was held against the board by the case and had spring-loaded contacts (see above). This would probably zeroize the device&#8217;s memory if it was cut open by someone trying to cheat the system. I applied hot glue to hold the contacts to the board and then cut away the rest of the enclosure.</p>
<p><a href="http://rdist.files.wordpress.com/2010/02/smartmeter3.jpg"><img class="aligncenter size-medium wp-image-517" title="smartmeter3" src="http://rdist.files.wordpress.com/2010/02/smartmeter3.jpg?w=300&#038;h=282" alt="" width="300" height="282" /></a><br />
Inside, the board had a standard <a href="http://en.wikipedia.org/wiki/TI_MSP430">MSP430F148</a> microcontroller and a metal cage with the radio circuitry underneath. I was in luck. I had previously obtained all the tools for working with the MSP430 in the <a href="http://rdist.root.org/2008/08/07/fastrak-talk-summary-and-slides/">Fastrak transponder</a>. These CPUs are popular in the RFID world because they are very low power. I used the <a href="http://focus.ti.com/mcu/docs/mcuprodoverview.tsp?sectionId=95&amp;tabId=140&amp;familyId=342">datasheet</a> to identify the <a href="http://en.wikipedia.org/wiki/Joint_Test_Action_Group">JTAG</a> pinouts on this particular model and found the vendor even provided handy pads for them.</p>
<p><a href="http://rdist.files.wordpress.com/2010/02/smartmeter2.jpg"><img class="aligncenter size-medium wp-image-516" title="smartmeter2" src="http://rdist.files.wordpress.com/2010/02/smartmeter2.jpg?w=225&#038;h=300" alt="" width="225" height="300" /></a><br />
Since the pads matched the standard 0.1&#8243; header spacing, I soldered a section of header directly to the board. For the ground pin, I ran a small wire to an appropriate location found with my multimeter. Then I added more hot glue to stabilize the header. I connected the JTAG cable to <a href="http://www.olimex.com/dev/msp-jtag-tiny.html">my programmer</a>. The moment of truth was at hand &#8212; was the lock bit set?</p>
<p><a href="http://rdist.files.wordpress.com/2010/02/smartmeter4.jpg"><img class="aligncenter size-medium wp-image-518" title="smartmeter4" src="http://rdist.files.wordpress.com/2010/02/smartmeter4.jpg?w=290&#038;h=300" alt="" width="290" height="300" /></a><br />
Not surprisingly (if you read about the <a href="http://rdist.root.org/2008/08/07/fastrak-talk-summary-and-slides/">Fastrak project</a>), the lock bit was not set and I was able to dump the firmware. I loaded it into the <a href="http://www.hex-rays.com/idapro/">IDA Pro</a> disassembler via the <a href="http://www.root.org/~nate/reveng/ida_msp430_v12.ZIP">MSP430 CPU plugin</a>. The remainder of the work would be to trace the board&#8217;s IO pins to identify how the microcontroller interfaced with the radio and look for protocol handling routines in the firmware to find crypto or other security flaws.</p>
<p>I haven&#8217;t had time to complete the firmware analysis yet. Given the basic crypto flaws in other smart meter firmware (such as <a href="http://travisgoodspeed.blogspot.com/">Travis Goodspeed</a> finding a PRNG whose design was <a href="http://rdist.root.org/2010/01/11/smart-meter-crypto-flaw-worse-than-thought/">probably drawn in crayon</a>), I expect there would be other stomach-churning findings in this one. Not even taking rudimentary measures such as setting the lock bit does not bode well for its security.</p>
<p>I am not against the concept of smart meters. The remote reading feature could save a lot of money and dog bites with relatively minimal privacy exposure, even if the crypto was weak. I would be fine if power companies offered an opt-in remote control feature in exchange for lower rates. Perhaps this feature could be limited to cutting a house&#8217;s power to 2000 watts or something.</p>
<p>However, something as important as turning off power completely should require a truck roll. A person driving a truck will not turn off the mayor&#8217;s power or hundreds of houses at once without asking questions. A computer will. Remote control should not be a mandatory feature bundled with remote reading.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rdist.wordpress.com/511/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rdist.wordpress.com/511/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rdist.wordpress.com/511/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rdist.wordpress.com/511/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rdist.wordpress.com/511/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rdist.wordpress.com/511/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rdist.wordpress.com/511/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rdist.wordpress.com/511/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rdist.wordpress.com/511/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rdist.wordpress.com/511/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=511&subd=rdist&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://rdist.root.org/2010/02/15/reverse-engineering-a-smart-meter/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c01d70ede8af2f696f36d3f89b8be1?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">rdist</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/02/smartmeter_overview.jpg?w=229" medium="image">
			<media:title type="html">smartmeter_overview</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/02/smartmeter1.jpg?w=300" medium="image">
			<media:title type="html">smartmeter1</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/02/smartmeter3.jpg?w=300" medium="image">
			<media:title type="html">smartmeter3</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/02/smartmeter2.jpg?w=225" medium="image">
			<media:title type="html">smartmeter2</media:title>
		</media:content>

		<media:content url="http://rdist.files.wordpress.com/2010/02/smartmeter4.jpg?w=290" medium="image">
			<media:title type="html">smartmeter4</media:title>
		</media:content>
	</item>
		<item>
		<title>PS3 hypervisor exploit reproduced</title>
		<link>http://rdist.root.org/2010/02/08/ps3-hypervisor-exploit-reproduced/</link>
		<comments>http://rdist.root.org/2010/02/08/ps3-hypervisor-exploit-reproduced/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 18:03:53 +0000</pubDate>
		<dc:creator>Nate Lawson</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software protection]]></category>

		<guid isPermaLink="false">http://rdist.root.org/?p=509</guid>
		<description><![CDATA[There&#8217;s a nice series of articles by xorloser on reproducing the recent PS3 hypervisor hack. He used a microcontroller to send the glitch and improved the software exploit to work on multiple firmware revisions. Here&#8217;s a picture of his final setup.
It remains to be seen what security measures Sony has taken to address a hypervisor [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=509&subd=rdist&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a nice series of articles by <a href="http://xorloser.com/">xorloser</a> on reproducing the recent <a href="http://rdist.root.org/2010/01/27/how-the-ps3-hypervisor-was-hacked">PS3 hypervisor hack</a>. He <a href="http://xorloser.com/?p=175">used a microcontroller</a> to send the glitch and <a href="http://xorloser.com/?p=162">improved the software exploit</a> to work on multiple firmware revisions. Here&#8217;s a <a href="http://xorloser.com/?p=214">picture</a> of his final setup.</p>
<p>It remains to be seen what security measures Sony has taken to address a hypervisor compromise. One countermeasure would be to lock down the OtherOS environment, since the attack depends on the ability to manipulate low-level OS memory structures. They could be using a simpler hypervisor than the GameOS side (say, one that just prevents access to the GPU). Perhaps the SPEs have a disable bit that turns off the hardware decryption unit, and the hypervisor does this before booting OtherOS.</p>
<p>Beyond this, they may not be using a single global key that is shared amongst all SPEs. <a href="http://en.wikipedia.org/wiki/Broadcast_encryption">Broadcast encryption schemes</a> have long been used in the pay TV industry to allow fine-grained revocation of keys that have leaked. They work by embedding a subset of keys from a matrix or tree in each device. If the keys leak, they can be excluded from subsequent software releases. This requires attackers to keep extracting keys and discarding the devices as they are revoked.</p>
<p>Also, it&#8217;s possible there are software protection measures in place. For example, the SPE could request hashes of regions of the calling hypervisor and use this to detect patching. This results in a cat-and-mouse game where firmware updates (or even individual games) use different methods of detecting attackers. Meanwhile, attackers would try to come up with new ways to avoid these countermeasures. This has <a href="http://freakbits.com/was-microsoft-right-to-ban-pirates-from-xbox-live-1112">already been happening</a> in the Xbox 360 world, as well as with nearly every other game console before now.</p>
<p>We’ll have to wait and see if Sony used this kind of defense-in-depth and planned for this eventuality or built a really tall wall with nothing more behind it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rdist.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rdist.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rdist.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rdist.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rdist.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rdist.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rdist.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rdist.wordpress.com/509/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rdist.wordpress.com/509/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rdist.wordpress.com/509/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=509&subd=rdist&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://rdist.root.org/2010/02/08/ps3-hypervisor-exploit-reproduced/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c01d70ede8af2f696f36d3f89b8be1?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">rdist</media:title>
		</media:content>
	</item>
		<item>
		<title>How the PS3 hypervisor was hacked</title>
		<link>http://rdist.root.org/2010/01/27/how-the-ps3-hypervisor-was-hacked/</link>
		<comments>http://rdist.root.org/2010/01/27/how-the-ps3-hypervisor-was-hacked/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 09:59:31 +0000</pubDate>
		<dc:creator>Nate Lawson</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software protection]]></category>

		<guid isPermaLink="false">http://rdist.root.org/?p=503</guid>
		<description><![CDATA[George Hotz, previously known as an iPhone hacker, announced that he hacked the Playstation 3 and then provided exploit details. Various articles have been written about this but none of them appear to have analyzed the actual code. Because of the various conflicting reports, here is some more analysis to help understand the exploit.
The PS3, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=503&subd=rdist&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://iphonejtag.blogspot.com/">George Hotz</a>, previously known as an <a href="http://theiphonewiki.com/">iPhone hacker</a>, announced that he <a href="http://geohotps3.blogspot.com/2010/01/hello-hypervisor-im-geohot.html">hacked the Playstation 3</a> and then provided <a href="http://geohotps3.blogspot.com/2010/01/heres-your-silver-platter.html">exploit details</a>. Various articles have been written about this but none of them appear to have analyzed the actual code. Because of the various conflicting reports, here is some more analysis to help understand the exploit.</p>
<p>The PS3, like the Xbox360, depends on a hypervisor for security enforcement. Unlike the 360, the PS3 allows users to run ordinary Linux if they wish, but it still runs under management by the hypervisor. The hypervisor does not allow the Linux kernel to access various devices, such as the GPU. If a way was found to compromise the hypervisor, direct access to the hardware is possible, and other less privileged code could be monitored and controlled by the attacker.</p>
<p>Hacking the hypervisor is <a href="http://www.edepot.com/playstation3.html#PS3_Security">not the only step</a> required to run pirated games. Each game has an encryption key stored in an area of the disc called <a href="http://en.wikipedia.org/wiki/ROM_Mark">ROM Mark</a>. The drive firmware reads this key and supplies it to the hypervisor to use to decrypt the game during loading. The hypervisor would need to be subverted to reveal this key for each game. Another approach would be to compromise the Blu-ray drive firmware or skip extracting the keys and just slave the decryption code in order to decrypt each game. After this, any software protection measures in the game would need to be disabled. It is unknown what self-protection measures might be lurking beneath the encryption of a given game. Some authors might trust in the encryption alone, others might implement something like <a href="http://en.wikipedia.org/wiki/SecuROM">SecuROM</a>.</p>
<p>The hypervisor code runs on both the main CPU (PPE) and one of its seven Cell coprocessors (SPE). The SPE thread seems to be launched in isolation mode, where access to its private code and data memory is blocked, even from the hypervisor.  The root hardware keys used to decrypt the bootloader and then hypervisor are present only in the hardware, possibly through the use of <a href="http://en.wikipedia.org/wiki/EFUSE">eFUSE</a>s. This could also mean that each Cell processor has some unique keys, and decryption does not depend on a single global root key (unlike <a href="http://www.eurogamer.net/articles/digitalfoundry-ps3hacked-article">some articles</a> that claim there is a single, global root key).</p>
<p>George&#8217;s hack compromises the hypervisor after booting Linux via the &#8220;OtherOS&#8221; feature. He has used the exploit to add arbitrary read/write RAM access functions and dump the hypervisor. Access to lv1 is a necessary first step in order to mount other attacks against the drive firmware or games.</p>
<p>His approach is clever and is known as a &#8220;<a href="http://rdist.root.org/2007/05/07/glitch-attacks-revealed/">glitching attack</a>&#8220;. This kind of hardware attack involves sending a carefully-timed voltage pulse in order to cause the hardware to misbehave in some useful way. It has <a href="http://rdist.root.org/2007/05/07/glitch-attacks-revealed/">long been used</a> by smart card hackers to unlock cards. Typically, hackers would time the pulse to target a loop termination condition, causing a loop to continue forever and dump contents of the secret ROM to an accessible bus. The clock line is often glitched but some data lines are also a useful target. The pulse timing does not always have to be precise since hardware is designed to tolerate some out-of-spec conditions and the attack can usually be repeated many times until it succeeds.</p>
<p>George connected an FPGA to a single line on his PS3&#8217;s memory bus. He programmed the chip with very simple logic: send a 40 ns pulse via the output pin when triggered by a pushbutton. This can be done with a few lines of Verilog. While the length of the pulse is relatively short (but still about 100 memory clock cycles of the PS3), the triggering is extremely imprecise. However, he used software to setup the RAM to give a higher likelihood of success than it would first appear.</p>
<p>His goal was to compromise the hashed page table (HTAB) in order to get read/write access to the main segment, which maps all memory including the hypervisor. The exploit is a Linux kernel module that calls various system calls in the hypervisor dealing with memory management. It allocates, deallocates, and then tries to use the deallocated memory as the HTAB for a virtual segment. If the glitch successfully desynchronizes the hypervisor from the actual state of the RAM, it will allow the attacker to overwrite the active HTAB and thus control access to any memory region. Let&#8217;s break this down some more.</p>
<p>The first step is to allocate a buffer. The exploit then requests that the hypervisor create lots of duplicate HTAB mappings pointing to this buffer. Any one of these mappings can be used to read or write to the buffer, which is fine since the kernel owns it. In Unix terms, think of these as multiple file handles to a single temporary file. Any file handle can be closed, but as long as one open file handle remains, the file&#8217;s data can still be accessed.</p>
<p>The next step is to deallocate the buffer without first releasing all the mappings to it. This is ok since the hypervisor will go through and destroy each mapping before it returns. Immediately after calling lv1_release_memory(), the exploit prints a message for the user to press the glitching trigger button. Because there are so many HTAB mappings to this buffer, the user has a decent chance of triggering the glitch while the hypervisor is deallocating a mapping. The glitch probably prevents one or more of the hypervisor&#8217;s write cycles from hitting memory. These writes were intended to deallocate each mapping, but if they fail, the mapping remains intact.</p>
<p>At this point, the hypervisor has an HTAB with one or more read/write mappings pointing to a buffer it has deallocated. Thus, the kernel no longer owns that buffer and supposedly cannot write to it. However, the kernel still has one or more valid mappings pointing to the buffer and can actually modify its contents. But this is not yet useful since it&#8217;s just empty memory.</p>
<p>The exploit then creates a virtual segment and checks to see if the associated HTAB is located in a region spanning the freed buffer&#8217;s address. If not, it keeps creating virtual segments until one does. Now, the user has the ability to write directly to this HTAB instead of the hypervisor having exclusive control of it. The exploit writes some HTAB entries that will give it full access to the main segment, which maps all of memory. Once the hypervisor switches to this virtual segment, the attacker now controls all of memory and thus the hypervisor itself. The exploit installs two syscalls that give direct read/write access to any memory address, then returns back to the kernel.</p>
<p>It is quite possible someone will package this attack into a modchip since the glitch, while somewhat narrow, does not need to be very precisely timed. With a microcontroller and a little analog circuitry for the pulse, this could be quite reliable. However, it is more likely that a software bug will be found after reverse-engineering the dumped hypervisor and that is what will be deployed for use by the masses.</p>
<p>Sony appears to have done a great job with the security of the PS3. It all hangs together well, with no obvious weak points. However, the low level access given to guest OS kernels means that any bug in the hypervisor is likely to be accessible to attacker code due to the broad API it offers. One simple fix would be to read back the state of each mapping after changing it. If the write failed for some reason, the hypervisor would see this and halt.</p>
<p>It will be interesting to see how Sony responds with future updates to prevent this kind of attack.</p>
<p>[Edit: corrected the description of virtual segment allocation based on a comment by geohot.]</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rdist.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rdist.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rdist.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rdist.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rdist.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rdist.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rdist.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rdist.wordpress.com/503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rdist.wordpress.com/503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rdist.wordpress.com/503/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rdist.root.org&blog=893473&post=503&subd=rdist&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://rdist.root.org/2010/01/27/how-the-ps3-hypervisor-was-hacked/feed/</wfw:commentRss>
		<slash:comments>99</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c01d70ede8af2f696f36d3f89b8be1?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">rdist</media:title>
		</media:content>
	</item>
	</channel>
</rss>