<?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>deadhacker.com</title>
	<atom:link href="http://deadhacker.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://deadhacker.com</link>
	<description>research repository of cyphunk://nathan.fain</description>
	<lastBuildDate>Mon, 10 May 2010 15:48:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='deadhacker.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/64b59878717e00c39f632d8307a5e59f?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>deadhacker.com</title>
		<link>http://deadhacker.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://deadhacker.com/osd.xml" title="deadhacker.com" />
	<atom:link rel='hub' href='http://deadhacker.com/?pushpress=hub'/>
		<item>
		<title>Bincrowd communal reverse engineering framwork</title>
		<link>http://deadhacker.com/2010/03/25/bincrowd-communal-reverse-engineering-framwork/</link>
		<comments>http://deadhacker.com/2010/03/25/bincrowd-communal-reverse-engineering-framwork/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 21:03:28 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://deadhacker.com/?p=242</guid>
		<description><![CDATA[Update: link to Halvar &#38; SP at Zynamics post and slides from CanSecWest Bincrowd, a project I had the pleasure of contributing to, has been released by Zynamics. Bincrowd simplifies the collaborative option in reverse engineering and brings it en masse. Any function a user has ever submitted documentation for can be found quickly in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=242&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><em>Update: link to Halvar &amp; SP at Zynamics <a href="http://blog.zynamics.com/2010/03/25/shareing-is-caring-announcing-the-free-bincrowd-community-server/">post and slides</a> from CanSecWest</em></p>
<p><a href="http://bincrowd.zynamics.com"></p>
<div id="attachment_255" class="wp-caption alignright" style="width: 310px"><a href="http://blog.zynamics.com/2010/03/25/shareing-is-caring-announcing-the-free-bincrowd-community-server/"><img class="size-medium wp-image-255" title="ShaREing is caring" src="http://cyphunk.files.wordpress.com/2010/03/picture-3.png?w=300&#038;h=224" alt="" width="300" height="224" /></a><p class="wp-caption-text">From Zynamics BinCrowd presentation</p></div>
<p>Bincrowd</a>, a project I had the pleasure of contributing to, has been released by <a href="http://zynamics.com">Zynamics</a>. Bincrowd simplifies the collaborative option in reverse engineering and brings it en masse. Any function a user has ever submitted documentation for can be found quickly in your target. It also introduces greater flexibility and reliability by adding additional signature methods for functions. Further, server access and clients for various disassemblers are free (ida client <a href="http://github.com/zynamics/bincrowd-plugin-ida">here</a>).</p>
<div><span id="more-242"></span></div>
<p>To fully understand how this could create an evolutionary step for software reverse engineering (RE) lets walk look at a typical RE session. You open your target in your favorite disassembler and find it<br />
has several hundred functions. If you are lucky you will have a signature database that matches the OS version, library versions and compiler version your target was built with.  This will let you find the system calls quickly, fiddling down the undocumented code you need to RE to a hundred or so functions. Once you have reverse engineered a function that is missing a signature you could create one for it but until now it has been difficult to share this with others. With Bincrowd you can share this information quickly for team based RE efforts or just for posterity sake.  If 10 years from now someone runs into similar code somewhere else this information becomes useful. Further, Bincrowd goes further by adding more flexible signature routines to the mix. Signatures often used today are based on the raw bytes of a compiled function. The added signatures in Bincrowd are based on the flow of the function instead. The flexibility this introduces means you might find details and signatures for functions that were compiled with a different version compiler, different version of libraries, different compiler and libraries entirely, different hardware architectures or even different OS&#8217;s. Research from Zynamics has been the ground breaking in this field.</p>
<p>My efforts on Bincrowd were supported by <a href="http://recurity-labs.com">Recurity-Labs</a>. Both Recurity-Labs and Zynamics are great companies to work with.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=242&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2010/03/25/bincrowd-communal-reverse-engineering-framwork/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2010/03/picture-3.png?w=300" medium="image">
			<media:title type="html">ShaREing is caring</media:title>
		</media:content>
	</item>
		<item>
		<title>JTAG Enumeration</title>
		<link>http://deadhacker.com/2010/02/03/jtag-enumeration/</link>
		<comments>http://deadhacker.com/2010/02/03/jtag-enumeration/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 13:10:34 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://deadhacker.com/?p=201</guid>
		<description><![CDATA[Update: added section with references to all the OSS jtag tools I know of. Can be of assistance when debugging or adding features. JTAGenum is an open source Arduino based hardware platform I built last year with three primary goals: [1. Given a large set of pins on a device determine which are JTAG lines 2. Enumerate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=201&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><em>Update: added section with references to all the OSS jtag tools I know of. Can be of assistance when debugging or adding features.</em></p>
<p><a href="http://github.com/cyphunk/JTAGenum">JTAGenum</a> is an open source Arduino based hardware platform I built last year with three primary goals: [1. Given a large set of pins on a device determine which are JTAG lines 2. Enumerate the Instruction Register to find undocumented functionality 3. be easy to build and apply] The development of a device has various distinct stages handled by different people/companies that each assume the other has properly secured their part. The security of devices often rely on <a title="hiding things">obfuscation</a> which makes it dificult for any part of the chain to evaluate the security of the whole. This is a problem that JTAGenum helps address.<img title="More..." src="http://cyphunk.wordpress.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /> This was built for personal research and while working on various projects at <a href="http://recurity-labs.com/">Recurity Labs</a>. Please feel free to <a href="mailto:cyphunk@gmail.com">contact me</a> with any questions, problems, targets or updates. I would be more than happy to share credit.<img title="More..." src="http://cyphunk.wordpress.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
<p>Related work: There are two other tools for finding JTAG pins: <a href="http://www.c3a.de/wiki/index.php/JTAG_Finder">JTAGScan</a> presented by Benedikt Heinz (hunz) at <a href="http://ph-neutral.org/">ph-neutral</a> which inspired <a href="http://lekernel.net/blog/?p=319">Arduinull</a> by Sébastien Bourdeauducq (lekernel). JTAGenum is most similar to the latter with the added feature of finding undocumented functionality. Felix Domke (tmbinc) recently gave a lecture on enumarating undocumented JTAG instructions and anyone considering using JTAGenum would do well to check his <a href="http://events.ccc.de/congress/2009/Fahrplan/attachments/1435_JTAG.pdf">paper</a>(<a href="http://cyphunk.files.wordpress.com/2010/02/blackbox-jtag-reverse-engineering-tmbinc.pdf">cache</a>)/<a href="http://mirror.fem-net.de/CCC/26C3/mp4/26c3-3670-en-blackbox_jtag_reverse_engineering.mp4">lecture</a> from the <a href="http://events.ccc.de/congress/2009/wiki/Welcome">26c3</a>.</p>
<h1>About JTAG</h1>
<p><a title="Joint Test Action Group">JTAG</a> is a common hardware debugging interface. It is used throughout the development chain of a device. Layout designers and board manufactures that employ <a href="http://en.wikipedia.org/wiki/SMT_placement_equipment">pick-and-place</a> machines will use JTAG to test interconnectivity of components. <a title="Application-specific integrated circuit">ASIC</a> designers use it to test the internal state of the chips they build. Software developers often use it to load firmware onto the device and to debug software.</p>
<p>For a varity of reasons JTAG is often left in the final product. As such each stage of the development chain will attempt to <a title="hide">obfuscate</a> its existence or functionality. ASIC manufactures often build in added functionality (such as logic analysis tools) and avoid mentioning both extended and often basic functionality from their final documentation. Layout designers might remove JTAG pins from the board, spread their contacts throughout on the board, remove contacts and hide JTAG lines on inner layers of the board. As mentioned before, this can make it difficult for any one part of the development chain to evaluate the security of the device as a whole. If you are unfamiliar with the inner workings of JTAG skip to the <em>A bit more about JTAG</em> section for the basics.</p>
<h1><strong>Hardware</strong></h1>
<p>To use JTAGenum you need an arduino compatible microcontroller. <a href="http://arduino.cc/en/Main/Software">Arduino</a> is a simple development enviornment (IDE) for various microcontrollers. At the moment AVR and PIC variants are available and can be purchased anywhere from $10 to $50. JTAGenum has been tested on the official Arduino <a href="http://arduino.cc/en/Main/ArduinoBoardDuemilanove">Duemilanove</a>, Arduino Mega (see <a href="http://hackerspace.be/JTAG_pinout_detector">hackerspace.be </a>modifications), <a href="http://www.moderndevice.com/products/rbbb-kit">RBBB</a> clone and <a href="http://www.pjrc.com/teensy/index.html">Teensy++</a>. When picking your microcontroller platform consider two issues: 1. How many pins do you want to check on your target. 2. what voltage level does your target device require.  Concerning voltage most Arduinos work at 5 volts. Some are switchable but even those that are not can be modified. For example revision 1.0 of the Teensy++ with over 30 pins of i/o can be modified by hand to operate at 3.3 volts. I show where to cut lines and install a voltage regulator <a href="http://www.flickr.com/photos/deadhacker/4152517331/">over here</a> (<em>Update: Teensy++ version 2.0 has a spot on the pcb to install a 3.3v regulator</em>). For voltages other than 3.3v and 5v there are a <a href="http://chiphacker.com/questions/622/bi-directional-step-up-and-step-down-3-3v-5-etc">variety of solutions</a> that depend on if you need uni-directional or bi-directional support on your i/o lines.</p>
<p>When connecting the microcontroller to the pins of your target one thing to be aware of is possible cross-talk between wires. I&#8217;ve been using a patch cable from Amontec that has a lot of cross talk.  JTAGenum has a mode that helps check for this which I will get into more detail later.</p>
<h1>Usage</h1>
<p><a href="http://github.com/cyphunk/JTAGenum">Download the JTAGenum code</a> and open it in the Arduino IDE. The following needs to be changed in the code depending on your microcontroller:</p>
<ul>
<li>pins[] define which pins on the microcontroller are being used to connect to the target</li>
<li>pinname[] is a convenient way to map the pins to names which correspond to the names of pins on your target</li>
<li>IR_LEN defines the length of the JTAG instruction register. If you change this you should also add &#8217;0&#8242;s to each of the coresponding IR_** instruction definitions. You can find the IR_LEN in the documentation for your target. If you cannot find it just guess. (10 is the current value, 8 is also common)</li>
</ul>
<p>Upload the sketch to your microcontroller and open the serial console with a baud of 115200.  Sending a &#8216;h&#8217; to the console will print usage information that describes each function. Each function is enacted by sending the defined one character code:</p>
<h3>v &gt; verbose</h3>
<p>Toggles verbose output. At times verbose might present too much information or without it too little.</p>
<h3>l &gt; loopback check</h3>
<p>Find loopback pairs that will generate false-positives for other tests. After running you should remove any loopback pairs from your pins[]/pinnames[]. Looback pairs are found by sending a predetermined pattern[] to all possible pins while checking all pins for matching output.  Because the JTAG clock (TCK) and state (TMS) pins are NOT being stimulated the input/output pairs where the pattern is found represent loopbacks. NOTE: you should probably run this once with and without internal pull-up resistors set (&#8216;r&#8217;) to avoid problems of cross-talk which is discussed in detail later.</p>
<h3>s &gt; scan</h3>
<p>This routine is used to check all possible pins and find JTAG  clock, state, input and output pins lines (TCK,TMS,TDI,TDO). This is done by setting the JTAG state (TMS) into Shift_IR mode and then sending pattern[] to TDI and checking for it on TDO while clocking TCK. This check is run for every possible pin combination and it is important that you remove loopback pins before running. While this scan is meant to determine all of the JTAG pins required it is possible that the  TMS pin found is incorrect.  This depends on if the target uses the bypass register by default (described later). If an IDCODE register is present then bypass mode is not the default and you can assume that the pin this scan defines as TMS is correct.  Otherwise, only the TCK, TDI and TDO pins can be determined.  NOTE: run with pull-ups on (&#8216;r&#8217;) as any cross-talk might result in false-positives.</p>
<h3>y &gt; brute force IR search</h3>
<p>This will set the instruction register (IR) to all possible values and check the output. This can be used to find undocumented instructions and examine their results via the data register (DR). To run this scan you should have already determined the 4 JTAG pins and define pins[] as such: [0]=TCK [1]=TMS [2]=TDO [3]=TDI.  NOTE: run with pull-ups on (&#8216;r&#8217;) as any cross-talk might result in false-positives.</p>
<h3>x &gt; boundary scan</h3>
<p>This will return the state of all the pins on the target.  Actually it is not just the pins but the contents of the scan/sample register. This should be a rather large register and is defined in the code by SCAN_LEN+100. You can check your targets documentation and specify this or just leave it as a large number (currently 1800). To run this scan you should have already determined the 4 JTAG pins and define pins[] as such: [0]=TCK [1]=TMS [2]=TDO [3]=TDI.  NOTE: run with pull-ups on (&#8216;r&#8217;) as any cross-talk might result in false-positives.</p>
<h3>i &gt; idcode scan</h3>
<p>The JTAG standards specify that if an idcode register is present it should be set as the default data register (DR) and attached to output (TDO) by default. Meaning, regardless of the state of the JTAG chip (set with TMS line) and regardless of input being sent to the chip (TDI) by clocking the chip (TCK) it should return the contents of the idcode to the output (TDO). Hence, this routine iterates through all possible TCK,TDO pairs of pins, CLK&#8217;ing each bit along the way, and prints the output when there is any change (we assume an idcode will not be all 0&#8242;s or 1&#8242;s). You should examine the documentation of your target(s) to see if the idcode matches. NOTE: run with pull-ups on (&#8216;r&#8217;) as any cross-talk might result in false-positives.</p>
<h3>b &gt; shift_bypass</h3>
<p>Broken atm (need to add TCK enumeration). The JTAG standards specify that if and idcode register is NOT present on the chip then the bypass register (length of 1) should be the default DR. Essentially this means what is sent to the input (TDI) should come out on the output (TDI) with a one clock delay (TCK). It is important that you remove loopbacks before running this test otherwise the loopback pins will look like valid JTAG lines. NOTE: run with pull-ups on (&#8216;r&#8217;) as any cross-talk might result in false-positives.</p>
<h3>r &gt; set pull-up resistors &amp; cross-talk</h3>
<p>If like me the cables you use to connect between JTAGenum to your targets are flimsy or uninsulated you might run into issues of cross-talk whereby when one pin is transmitting a nearby pin picks up the transmission even though they are not connected. To avoid this you can turn on the internal pull-up resistors which will force the pin to a default state. If for some reason you continue to have sporadic issues run the following in sequence to check if the problem is the cable, target or other:</p>
<dl>
<dd>
<ol>
<li>Disconnect the cables between your target and JTAGenum. Disconnected them entirely from JTAGenum as well.</li>
<li>Run a loopback check (&#8216;l&#8217;) with pull-ups off. In this state the pins are in open mode and might fluctuate.  You&#8217;ll notice that as you move the microcontroller around, turn lights on and off or move other devices close to or away from it that the results change.</li>
<li>Turn on pull-ups (&#8216;r&#8217;) and run the test again. The results should now be consistent. If they aren&#8217;t, then let me know.</li>
<li>Now attach your cables to JTAGenum but not the target.  Run steps 2 and 3 again. Step 2 will give you a feel for how much inconsistency the cable may add. If the loopback check results in actual pattern matches then your cable has cross-talk. Step 3 should still result in a consistent state of either all high (1&#8242;s) or all low (0&#8242;s) and if it doesn&#8217;t then your cross-talk issues are such that all JTAGenum tests are going to be buggy at best. Feel free to give me an <a href="mailto:cyphunk@gmail.com">email</a>and I will happily try to help solve the problem.</li>
</ol>
</dd>
</dl>
<h1>Code references</h1>
<p>Examining code of various jtag scanning derivitives is probably the best way to modify JTAGenum however you want or when wanting to cross reference JTAG logic to debug a problem.</p>
<ul>
<li><a href="http://www.c3a.de/wiki/index.php/JTAG_Finder">JTAG Finder</a> &#8211; the microcontroller provides a pin protocol/interface to a C client running on the PC which does the actual scanning logic. This was one of the first (if not the) JTAG scanner.  It trades simplicty of code and protocol for efficiency and speed.</li>
<li><a href="http://nsa.unaligned.org/jrev.php">JRev</a> &#8211; Not meant for scanning pins to find JTAG. It does however implement some logic not in any of the JTAG scanners mentioned here.  In paticular, support for chain mapping, IR length detection and perhaps others I&#8217;m missing.</li>
<li><a href="lekernel.net/blog/?p=319">Arduinull</a> &#8211; The first simplified scanner running all in the microcontroller.</li>
<li><a href="http://hackerspace.be/JTAG_pinout_detector">JTAG pinout detector</a> &#8211; a port of Arduinull and JTAGenum for the Arduino Mega board.</li>
</ul>
<p>Additionally <a href="http://github.com/jal2/JTAGenum">Jal2</a> and <a href="http://new.hackerspace.be/JTAG_pinout_detector">Zoobab</a> have written their branches of JTAGenum.  I will try to merge their features to the JTAGenum branch as quickly as possible but if you run into problems or for general curiosity you can check their code.</p>
<ul></ul>
<h1>A bit more about JTAG</h1>
<p><a href="http://de.wikipedia.org/w/index.php?title=Datei:JTAG_Register.svg"><img class="alignright" style="background-color:#999;" title="JTAG Registers" src="http://cyphunk.files.wordpress.com/2010/02/500px-jtag_register-svg.png?w=300&#038;h=272" alt="" width="300" height="272" /></a></p>
<p>Basic understanding of how JTAG works will be helpful when using JTAGenum. There are 4 lines/pins: TDO=output, TDI=input, TCK=clock, TMS=state machine control.  Say you want to read the ID of the chip. First you would send the IDCODE instruction to the instruction register (IR). The JTAG controller then places the actual id code value of the chip in a data register which you could then read out. You would think that it would be enough to have one input line going to the IR and one output coming from the DR but JTAG also supports writing to the DR. As apposed to adding another input line specific to the DR instead JTAG works by moving the input and output lines between IR and DR. The TMS line is used to switch TDI/TDO to IR when you want to place an instruction and back to DR when you want to read or write data. With all operations, be it state change (TMS) reading (TDI) or writing (TDO), the clock line must be cycled once (TCK) for every bit or change. This was a brutal and drastic simplification but with that understood reading the Usage section should be comprehensible.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=201&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2010/02/03/jtag-enumeration/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
<enclosure url="http://mirror.fem-net.de/CCC/26C3/mp4/26c3-3670-en-blackbox_jtag_reverse_engineering.mp4" length="665186076" type="video/mp4" />
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>

		<media:content url="http://cyphunk.wordpress.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" medium="image">
			<media:title type="html">More...</media:title>
		</media:content>

		<media:content url="http://cyphunk.wordpress.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" medium="image">
			<media:title type="html">More...</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2010/02/500px-jtag_register-svg.png?w=300" medium="image">
			<media:title type="html">JTAG Registers</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow for hardware security analysis</title>
		<link>http://deadhacker.com/2009/11/08/workflow-for-hardware-security-analysis/</link>
		<comments>http://deadhacker.com/2009/11/08/workflow-for-hardware-security-analysis/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 18:37:07 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://deadhacker.com/?p=122</guid>
		<description><![CDATA[My workflow for threat weighted hardware analsysis or research has changed with time. Slight uniformaty has found its way into my routine which is helpful for cross referencing knowledge between projects. With the curse of multitasking projects a constant this also reduces the time required to switch between projects or pickup on an old project. I&#8217;d [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=122&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>My workflow for threat weighted hardware analsysis or research has changed with time. Slight uniformaty has found its way into my routine which is helpful for cross referencing knowledge between projects. With the curse of multitasking projects a constant this also reduces the time required to switch between projects or pickup on an old project. I&#8217;d like to share this with those that might have interest or comments for improvement. The organizational steps tend to reflect the actual structure I use for filing resources and data i gather. Note: this is for target/threat weighted research or analysis. This structure will probably not apply when the goal is weighted differently.</p>
<p>First, the directory structure:</p>
<ul>
<li>Attacks (segmented by attack class with logs on attempts and all information needed to replicate)</li>
<li>Logs (all non-attack specific notes and logs)</li>
<li>Photos</li>
<li>References (datasheets, application notes, documentation)</li>
<li>Reports (information used to document or report findings)</li>
<li>Tools (software, schematics, non-attack specific custom built tools)</li>
</ul>
<p><strong>Workflow:</strong></p>
<ol>
<li>Objectives<br />
This isn&#8217;t represented as a directory but instead typically the first note sheet I start to write and store in the Logs directory. An objective comes from either a client or research goals. With clients this might come in the form of their general concern or attack vectors. For research this is often in the form of low hanging fruit (objective milestones).</li>
<li>References<br />
Build an overview of the device by determining the function and relation between components. Meaning, find all the datasheets or application notes you can, store them here and read them. I typically have a separate note sheet with very short summarization of this information which I store in the Logs directory.</li>
<li>Targets<br />
Again, not a directory. When I find a pin cluster I will test all the electrical characteristics (resistance to GND, voltage levels at different states, etc). I make note of these either on note sheets or visual notations and I store both in the Logs directory. electrical_10pinheader.txt, electrical_4pinpad.txt, electrical_3statebusctrl.txt, network_TCPIPstates.txt, firmware_interestingSymbols.txt, etc. This becomes extremely useful information not just for the current project but for cross referencing in future projects.</li>
<li>Attacks<br />
Make a sub directory for every class of attack (jtag, serial, i2c, spi, firmware, network, etc). If and when we have to build specific tools or record results, all of it will be here. In this case, for notes I store them with each attack, not in the Logs directory.</li>
<li>Reports<br />
When an attack is note worthy, be it a success or not, I will copy the relevent photos, notations, to this directory so that writing reports or documenting the work at the end is easier.</li>
</ol>
<p>Additional repositories that are useful:</p>
<ul>
<li>Photos<br />
Take photos of everything. This is essential for documentation.</li>
<li>Tools<br />
If I have to download software libraries, tools or schematics for building software or hardware tools I will store the originals here. If I write wind up writing custom code for e a specific attack ill store it in its attack directory (with dependencies here). Otherwise if it is a custom made tool used across many attacks I will store it here as well. Some of the tools I find useful eventually find their way into the <a href="http://github.com/cyphunk/sectk/">sectk github</a>.</li>
<li>Logs<br />
All Notes or logs that do not relate to a specific attack go here. Such as general network captures, logic analysis logs, electrical testing notations, etc. At times I will go off on a general hunch that has no clear attack, target or objective and I will store the logs in a subdirectory. Also, any time I am working with software or a terminal (console) I keep a screen log (<em>man screen</em>) of the work and store and label these here as &#8220;screen_weekN_dayN.log&#8221;. I have one or two logs for every day while I am working on the project which gives me a very low level point to return to if I need to find something later that I might have forgotten to document. To retain absolute continuity of these logs I always append to the log for each day and when the log needs to be included in a directory for a specific attack I will copy it to that directory, retaining the original here.</li>
</ul>
<p>Idealy all information should be digestable by one person. Verbose notes and documentation are essential for tracking down methods and pecularities later but ultimately you want to be able to quickly document the essentials either to pass on others, share with the community or include in a report to your client. I haven&#8217;t found a good medium between detail and summary in an active way so what I tend to do with my notes is repeat prior knowledge required to replicate findings, even if the information was already noted earlier in the same note sheet. The result is that when going back over notes one would start at the very end of the note sheet and work their way back up. Often times I will make note of this at the top of the sheet when I feel I have reached a closure point for the thread.</p>
<p>These are simple basic suggestions that are absolutely unexciting but often helpful. My experiance has been mostly with embedded analysis but this field can quickly forge into software level reverse engineering so this structure can be applied to some degree there as well. I would be elated if anyone has constructive suggestions or would like to contribute link or comment on their own workflow.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=122&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2009/11/08/workflow-for-hardware-security-analysis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>Targeting the Panasonic HVX200 HD camera</title>
		<link>http://deadhacker.com/2009/07/26/targeting-the-panasonic-hvx200-hd-camera/</link>
		<comments>http://deadhacker.com/2009/07/26/targeting-the-panasonic-hvx200-hd-camera/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 16:34:49 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Embedded Linux]]></category>
		<category><![CDATA[hvx 200]]></category>

		<guid isPermaLink="false">http://deadhacker.com/?p=95</guid>
		<description><![CDATA[Update Mar.2010: Deti has found a way modify the image enough to start a &#8220;service&#8221; menu. See his thread, he explains this and much more (german thread) This is a semi-professional HD video camera that sells for $4000-5000. Regardless if you have this camera or not the methods discussed herein should encourage you to pull [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=95&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_110" class="wp-caption alignright" style="width: 310px"><a href="http://cyphunk.files.wordpress.com/2009/07/2305925267_9627890770.jpg"><img class="size-full wp-image-110 " title="Panasonic HVX200" src="http://cyphunk.files.wordpress.com/2009/07/2305925267_96278907701.jpg?w=300&#038;h=225" alt="photo by Clint McManaman" width="300" height="225" /></a><p class="wp-caption-text">photo by Clint McManaman</p></div>
<p><em>Update Mar.2010: Deti has found a way modify the image enough to start a &#8220;service&#8221; menu. See his thread, he explains this and <a href="http://forum.slashcam.de/spa-mit-der-ag-hpx301e-vp409232.html">much more</a> (german thread)</em></p>
<p>This is a semi-professional HD video camera that sells for $4000-5000. Regardless if you have this camera or not the methods discussed herein should encourage you to pull apart any device you have.  Even with such a large pricetag the <del datetime="2009-12-22T22:37:28+00:00">hardware and</del> software of the device are rather comprehendable, in some cases laughably so. In such cases I&#8217;m not laughing at Panasonic but rather at myself for thinking that this would be more complicated.  That is the objective of this tutorial, to help the reader realize that, if nothing else, the initial stage of diving in is easy and fun.</p>
<p>The camera is popular with indipendent producers but has its areas that could be improved. The camera runs a Montavista Linux operating system ontop a SuperH SH4 subtype SH7751 CPU.  Storing of HD video is done using &#8220;Panasonic P2&#8243; cards. These appear to be PCMCIA cards with flash chips and a RAID controller which greatly increase data writing speeds.  There are many improvements that a homebrew system could bring to this camera. As an example of some low hanging fruit: Adding support for offloading video from the P2 card in the camera to an external disk using either a usb or firewire controller. While there are many other modifications that come to mind this would let someone use a single P2 card to record endless ammounts of video instead of paying for a mountain of P2 cards at $500 and $600 a pop. Another would be dissection of the P2 card and replacement of the flash chips of a cheap 4GB card to increase the size to 64GB?</p>
<h1><strong>INDEX</strong></h1>
<ol>
<li><strong>Obtaining Firmware</strong></li>
<li><strong>Firmware Dissection</strong></li>
<li><strong>Hardware Overview</strong></li>
<li><strong>Target List Assessment</strong></li>
<li><strong>Obtaining Debug Console</strong></li>
<li><strong>Developing Software For Camera</strong></li>
<li><strong>Modifying Firmware</strong></li>
<li><strong>&#8230;</strong></li>
</ol>
<p><strong> </strong></p>
<ul>
<li>Modification wishlist</li>
</ul>
<p>Future updates will be placed in this document. The index above provides a map for where I think research is heading.</p>
<h1>1. Obtaining Firmware</h1>
<p>There are a few routes to obtain the firmware, in order of difficulty: <strong>1. obtain a manufacturers firmware update</strong> and hope that it contains a system image, 2. use the debug mechanism and ports (Serial, Network and TFTP, JTAG?) to download the running system image from internal FLASH, 3. desolder the FLASH or ROM memory chips found inside the target and dump the contents with a compatible memory programmer.  In the case of the <strong>Panasonic HVX200 the firmware updates contain an entire image of the system</strong> and can be <a href="https://eww.pavc.panasonic.co.jp/pro-av/support/desk/e/download.htm#p2driver">obtained from the Panasonic website</a> (<a href="http://panasonic.sixbullets.net/#firmware">ref2</a>). <strong>Important</strong>: the version I am working with is  <a href="https://eww.pavc.panasonic.co.jp/pro-av/support/cs/csregistp2m/soft/vsi4598g.zip">v4.06-00-0.00</a> (aka version &#8220;vsi4598g&#8221;) which can be downloaded <a href="https://eww.pavc.panasonic.co.jp/pro-av/support/cs/csregistp2m/soft/vsi4598g.zip">directly from panasonic</a> or found in the <a href="http://cypherpoet.com/files/HVX_reversing">project working directory</a>.</p>
<h3>1.1. Decompressing Firmware Updates</h3>
<p><em>Update: </em>A shorter method for decompessing is&#8230; just untar and unzip the update file with &#8220;tar -zxvf &lt;updatefile&gt;&#8221;. I will retain the old direction because it&#8217;s useful knowledge for other projects/targets you might run into.</p>
<p>The firmware update is compressed. I use a program called STUNS which searches the file attempting to decompress any block of data using various compression routines. The developers website has since gone offline but I&#8217;ve placed a copy with the source code and compiled version for windows in the <a href="http://cypherpoet.com/files/HVX_reversing">project working directory</a>. Execute the program on the compressed firmware. Upon completion you will find directories created for each type of compression and inside are thousands of files for each block it attempted to decompress.  The largest block is the winner.  In the case of the HVX it the firmware is compressed with the deflate compression routine. I&#8217;ve placed a copy of the uncompressed version in the <a href="http://cypherpoet.com/files/HVX_reversing">project working directory</a>.  Even in this state you can already open the file in a Hex editor or run it through `strings` to find a wealth of information.</p>
<h1>2. Firmware Dissection</h1>
<h3>2.1. Basic Examination of Strings</h3>
<p>Looking at the strings of the decompressed firmware it should stand out that this is a Linux system and that the image contains several filesystems. Before pulling the file systems out lets just look at the strings to see what we can determine.</p>
<blockquote>
<pre>SH IPL+g version 0.9, Copyright (C) 2000 Free Software Foundation, Inc.</pre>
</blockquote>
<p>This is the bootloader. &#8220;It is an Initial Program Loader(IPL) of many SH-based systems booting Linux kernel. It functions as gdb-stub to provide the way to communicate with GNU gdb debugger. Also, it acts as a BIOS of the system.&#8221; (<a href="http://www.aandd.co.jp/dvhome/linuxsh/doc/sh-ipl+g_sequence_E.txt">ref1</a>, <a href="http://wiki.richliu.com/index.php/Recommand_Linux_Boot_Loader">ref2</a>)</p>
<blockquote>
<pre># CONFIG_CPU_SUBTYPE_SH7300 is not set
# CONFIG_CPU_SUBTYPE_SH7707 is not set
# CONFIG_CPU_SUBTYPE_SH7708 is not set
# CONFIG_CPU_SUBTYPE_SH7709 is not set
# CONFIG_CPU_SUBTYPE_SH7750 is not set
CONFIG_CPU_SUBTYPE_SH7751=y
# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
# CONFIG_CPU_SH3 is not set
CONFIG_CPU_SH4=y
CONFIG_CPU_LITTLE_ENDIAN=y
# CONFIG_P2PF_K200 is not set
CONFIG_P2PF_K230=y
# CONFIG_P2PF_K250 is not set
CONFIG_P2PF_HW_VERSION=2
CONFIG_MEMORY_START=08000000
CONFIG_MEMORY_SIZE=04000000
CONFIG_MEMORY_SET=y</pre>
</blockquote>
<p>This is part of  the configuration file for compiling a Linux kernel. It shows us that the CPU is a <a href="http://en.wikipedia.org/wiki/SuperH">SuperH</a> SH4 subtype SH7751. This family of CPUs are also used with Sega gamesystems and some PayTV Set Top Boxes.</p>
<blockquote>
<pre>Linux version 2.4.20_mvl31-ms7751rse01-sh_sh4_le (root@rx7)
(gcc version 3.3.1 (MontaVista 3.3.1-7.0.42.0600552 2006-04-30))
#13 Thu Mar 22 19:28:14 JST 2007</pre>
</blockquote>
<p>We are running a 2.4.20 kernel compiled with gcc version 3.3.1.  We also see the version of MontaVista linux being used.  These details are important because if we ever want to compile our own software for this system we will need to setup, at a minimum, an enviornment that includes the Linux 2.4.20 headers, the version of glibc being used in this MontaVista version and a gcc 3.3.1 <a href="http://wiki.debian.org/SH4/CrossToolchain">crosscompiler</a> for SH4 platforms (or <a href="http://kegel.com/crosstool/crosstool-0.43/buildlogs/">crosstoll</a>.)</p>
<blockquote>
<pre>description=NetChip 2280 USB Peripheral Controller</pre>
</blockquote>
<p>This is part of the net2280.o kernel module and indicates the USB driver.  This already gives some promise to obtaining our objective of supporting an external USB disk. Though we would still need to find USB host drivers somewhere.  It is so important to determine which drivers are already available because if we have to add and compile our own drivers we will likely need more than just the Linux headers, glibc and compatible gcc version.  We would perhaps need the entire MontaVista development kit so that we could both compile the driver and add support to the kernel for the driver, meaning perhaps we even have to recompile the entire kernel.  Yuk.</p>
<blockquote>
<pre>7791c147ef8f33e7c9844d20992e4fd8  netboot-1st.binary
9004619ae34aad3bbbc7cca53e3b7444  netboot1.binary
21910d91dcbae05a0688acce08ef86df  netboot2.binary
e0be87ce4e9c70deddb828a17f931488  vmlinux.bin
cedfadc76e06cca69602424d3a277a39  rootfs.image
b21555e3f845831d455d9f679277ac57  home.image
e9a74405904af1544bdfe5cb1363858b  vmlinux-vup.bin
f5fcfa007950817cca499da3ae13bf53  ramdisk.gz
c003003dc8b8abbb3e3c11367530d454  vup.sh
51ffed17a3b940c6ad5b7ca727a8d259  vup2.sh
df7e7b23160729e90add6b437db2b278  tx.bin
f1d3ff8443297732862df21dc4e57262  txvups.bin
a54f0041a9e15b050f25c463f1db7449  txvupe.bin
d9a885fc28e4f61d3268fea6ccb7be09  txvup.sh</pre>
</blockquote>
<p>This appears at the very end of the uncompressed firmware image and indicates the various parts of the image.  We also find tons of scripts in in the file but it would be nice to map these to their filenames.</p>
<h3>2.2. Mounting Firmware Filesystem</h3>
<p>There are a few images/filesystems contained internally in the uncompressed firmware. I made a lucky guess that these were CramFS images. If this was not the case, to determine what type of filesystem for the internal image we would use a program that attempts to match &#8220;magic&#8221; strings (mime/type, magic/type databases) to search over the file looking for matches.  At the moment I do not remember the name for such a program but contact me if you need this for other projects.</p>
<p>Confirmation of a CramFS image came in the form of these strings found in the firmware image:</p>
<p><img class="aligncenter size-full wp-image-97" style="display:block;margin-left:auto;margin-right:auto;border:0 initial initial;" title="HVX200_RomFS_hex" src="http://cyphunk.files.wordpress.com/2009/07/picture-1.png?w=516&#038;h=111" alt="HVX200_RomFS_hex" width="516" height="111" /></p>
<div>The 4 bytes (in reverse endianness) at <em>00632600</em> also indicate a CramFS filesystem as proven by the Linux <em>cramfs_fs.h</em> header file:</div>
<div>
<blockquote>
<pre>/*
 * Superblock information at the beginning of the FS.
 */
struct cramfs_super {
	u32 magic;			/* 0x28cd3d45 - random number */
	u32 size;			/* length in bytes */
	u32 flags;			/* feature flags */
	u32 future;			/* reserved for future use */
	u8 signature[16];		/* "Compressed ROMFS" */
	struct cramfs_info fsid;	/* unique filesystem info */
	u8 name[16];			/* user-defined name */
	struct cramfs_inode root;	/* root inode data */
};</pre>
</blockquote>
<p>There are two such superblocks found in the image file.  We can use either the tool `<em><a href="http://sourceforge.net/projects/cramfs/">cramfsck</a> -x &lt;dir&gt; &lt;imagefile&gt;</em>` or `<em><a href="http://www.koders.com/c/fidAA1A6F75B15365FBEF2827C14931D480B932AD82.aspx">uncramfs</a></em>` (<a href="http://www.bitsum.com/firmware_mod_kit.htm">ref2</a>) to extract the files.  I recommend cramfsck but uncramfs also works and compiles better on OSX, which is my current workstation. To use either, in your hex editor of choice select all of the bytes from where &#8221;<em>45 3D CD 28</em>&#8221; is found until the end of the file. Place this data into a new file.  I&#8217;ve create two such files that can be found in the <a href="http://cypherpoet.com/files/HVX200_reversing/">project working directory</a> called <em>first_cramfs_img_toEOF</em> and <em>second_cramfs_img_toEOF</em>. After extracting using <em>cramfsck</em> or <em>uncramfs</em> you should have two directory structures as seen here:</p>
<p><img class="aligncenter size-full wp-image-108" title="HVX200 CramFS directory structure" src="http://cyphunk.files.wordpress.com/2009/07/picture-21.png?w=254&#038;h=396" alt="HVX200 CramFS directory structure" width="254" height="396" /></p>
<p>From this we can guess that the first is the <em>rootfs.image</em> and the second the <em>home.image</em> referenced at the end of the uncompressed firmware.</p>
<h3>2.3. Panasonic Specific Drivers and Software in Firmware &#8211; Targets</h3>
</div>
<p>Now that we have the filesystem I&#8217;d like to both start compiling a list of targets (software to be reverse engineered) and to better understand the internal hardware and funcional components. This requires some familiarity with linux systems so that you can deduce what is common to basic linux systems and what is specifically added by Panasonic. Lets start walking through it.</p>
<h4>2.3.1. <span style="font-family:'Lucida Grande', 'Times New Roman', 'Bitstream Charter', Times, fantasy;line-height:normal;font-size:12px;">first_cramfs_img_toEOF.mount (rootfs.image)</span></h4>
<h5>2.3.1.1 /dev/</h5>
<p>The device handles that are new to me here are /dev/rt, /dev/vcs and /dev/vcsa. /dev/rt is still a mystery for me but the vcs and vcsa devices are Virtual Console Capture devices (according to a <a href="http://www.lanana.org/docs/device-list/devices.txt">common linux device list</a>). From the <a href="http://dsl.org/cookbook/cookbook_24.html#SEC354">Linux Cookbook</a> (<a href="http://linuxmafia.com/faq/Apps/screen-capture.html">ref2</a>):</p>
<blockquote><p>If the target console is the first virtual console (which you would see by typing [ALT]-[F1]), the device to cat is `/dev/vcs1&#8242;. To take a screen shot of the fourth virtual console, and save it to a file called `screenshot&#8217;, type:</p>
<p>$ cat /dev/vcs4 &gt; screenshot [RET]</p>
<p>In order to re-display the screenshot just paste it back into a free virtual console, type:</p>
<p>$ cat screenshot &gt; /dev/vcs4 [RET]</p></blockquote>
<p>Hence, we might be able to use this for debugging, provided we find some way of grabbing the screencapture file.  Then again, maybe just setting up a serial terminal is going to be easier.</p>
<h5>2.3.1.2 /etc/init.d/</h5>
<p>This directory commonly contains the startup scripts for a linux system that are used to start services that will run in the background while the system is up, load drivers and enable devices. When examining these files I will only include excerpts from the scripts.</p>
<blockquote><p>/etc/init.d/pcmcia</p>
<pre># Panasonic P2 original pcmcia script 2004/07/30
. /lib/modules/`uname -r`/pcmcia-config/pcmcia
    action=$1
    case "$action" in
    start)
	/sbin/modprobe pcmcia_core
	/sbin/modprobe i82365 irq_mode=0
	/sbin/modprobe ds
	/sbin/modprobe cb_enabler
<strong>	/sbin/modprobe spd_mod &gt; /dev/null 2&gt;&amp;1
</strong>	/sbin/cardmgr -q -c /lib/modules/`uname -r`/pcmcia-config
	touch /var/lock/subsys/pcmcia
	EXITCODE=0
	;;</pre>
</blockquote>
<p>All of the modules loaded with this script are common except for <em>spd_mod</em>.  <em>i82365</em> indicates that we are using a Intel i82365sl PCMCIA host controller (there are many clones, <a href="http://linux.about.com/library/cmd/blcmdl4_i82365.htm">ref1</a>). Let&#8217;s examine briefly the strings in <em>./first_cramfs_img_toEOF.mount/lib/modules/2.4.20_mvl31-ms7751rse01-sh_sh4_le/pcmcia/spd_mod.o</em>.</p>
<blockquote><p>./first_cramfs_img_toEOF.mount/lib/modules/2.4.20_mvl31-ms7751rse01-sh_sh4_le/pcmcia/spd_mod.o</p>
<pre>[spd]2.4.1.61(K230)
<strong>&lt;3&gt;[spd]4:%s:%d:R5C812 on Unkown
&lt;3&gt;[spd]4:%s:%d:R5C812 on WRITE
&lt;3&gt;[spd]4:%s:%d:R5C812 on READ</strong>
spdu
&lt;3&gt;[spd]4:%s:%d:register_chrdev() failed(%d)
spd_udev.c
&lt;3&gt;[spd]4:%s:%d:invalid minor number(%d)
&lt;3&gt;[spd]4:%s:%d:unknown ioctl command(%d)
&lt;3&gt;[spd]4:%s:%d:copy_to_user() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_identify_device() failed(%d)
&lt;3&gt;[spd]4:%s:%d:copy_form_user() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_read_sector() failed(%d)
&lt;3&gt;[spd]4:%s:%d:udev_make_sg() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_write_sector() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_log_sense() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_log_write() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_block_erase() failed(%d)
&lt;3&gt;[spd]4:%s:%d:spd_sector_erase() failed(%d)
<strong>&lt;1&gt;[spd]2:%s:%d:ALERT:P2card firmware size 61h only but size=%02xh
</strong>&lt;3&gt;[spd]4:%s:%d:spd_firm_update() failed(%d)
&lt;3&gt;[spd]4:%s:%d:scatterlist overflow(%d)
&lt;3&gt;[spd]4:%s:%d:spd_read_capacity() failed(%d)</pre>
</blockquote>
<p>It is obvious from the various symbols found that this driver is used for writing to some form of memory card.  We also find two important strings, &#8220;<em>ALERT:P2card</em>&#8221; which indicates that this driver is specific to the P2 card and &#8220;<em>R5C812</em>&#8220;. R5C812 indicates that we have a PCMCIA controller from Rocah, in particular the model which supports two PCMCIA/PCcard slots, such is the case on the HVX200. Examination of the <a href="http://www.ricoh.com/LSI/product_pcif/pcc/5c811/index.html">product sheet </a> confirms that this device is also used to control the SD card slot of the camera. We can put this driver into a list of potentially high value targets. With a file size of 98KB and the wonderful gift of a symbol table left in this might not be so dificult to analyze.</p>
<blockquote><p>/etc/init.d/StartUp_Cam.sh</p>
<pre>### execute application for MontaVista Linux Pro. 3.1
##   by Panasonic
#########################
# preload drivers       #
# set environment value #
#########################
<strong>. /etc/p2pfenv</strong>
ulimit -c 0
#####################
# application start #
#####################
cd /var
<strong>/home/apli/sg &amp;</strong></pre>
</blockquote>
<p>A look at the <em>/etc/p2pfenv</em> shows that we preload a driver for the SD card but also gives another possible target in the commenting out of a module that enables the PC mode of the camera (<em>scullp.o</em>).  This is the mode the camera is put into when plugged up to a PC for offloading video.  Herein we might find code for both reading the P2 card filesystem and setting up as a USB client.</p>
<blockquote><p>/etc/p2pfenv</p>
<pre>###################
# preload drivers #
###################
insmod /lib/modules/2.4.20_mvl31-ms7751rse01-sh_sh4_le/kernel/drivers/sdcard/sdcard.o \
&gt; /dev/null 2&gt;&amp;1
#use only PC mode
#insmod /home/usb/scullp.o &gt; /dev/null 2&gt;&amp;1</pre>
</blockquote>
<p>In <em>scullp.o</em> we have strings which indicate the developers login name and the project name in addition to plenty of symbols that confirm that this can access and control the P2 card (not shown here) so lets add <em>scullp.o</em> to our list of Panasonic specific targets:</p>
<blockquote>
<pre>../../../../src/contrib/K230_Kernel/include/linux
../../../../src/contrib/K230_Kernel/include/asm
/opt/montavista/pro/devkit/sh/sh4_le/lib/gcc-lib/sh4-hardhat-linux/3.3.1/include
../../../../src/contrib/K230_Kernel/include/linux/sunrpc
../../../../src/contrib/K230_Kernel/include/p2
../../../../src/contrib/K230_Kernel/include/asm-generic
/home/tanaka/work/K230/myapplication/p2pf/src/driver/usb/buffer</pre>
</blockquote>
<p><em>StarUp_Cam.sh</em> also executes <em>.//second_cramfs_img_toEOF.mount/apli/sg</em>. When examining this file we get a load of other targets:</p>
<blockquote>
<pre>ZION VGA Initialize(NTSC) Success!!
ROM VERSION AREA INITIALIZE ERROR
/home/apli/pm
Create UM
/home/apli/sm
PID[SG_CHILD_PROC_SM] = %d
Create SM
/home/apli/mm
/home/apli/nano-X
nano-X
createSV::arg error eSgStatuse=%d
/home/apli/ext_prgrm.sh
ext_prgrm.sh
execl[EXT] error(%s)
/usr/local/bin/vup-start.sh
vup-start.sh
execl[VUP] error(%s)
/dev/fb0
libev.so
liblg.so
LGInit
libsc.so
libsg.so
liblb.so
libsp.so
libro.so
libm.so.6
GLIBCPP_3.2
GLIBCPP_3.2.3
CXXABI_1.2
GCC_3.0
GLIBC_2.2</pre>
</blockquote>
<p>&#8230;</p>
<p>&#8230; to be continued</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=95&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2009/07/26/targeting-the-panasonic-hvx200-hd-camera/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2009/07/2305925267_96278907701.jpg" medium="image">
			<media:title type="html">Panasonic HVX200</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2009/07/picture-1.png" medium="image">
			<media:title type="html">HVX200_RomFS_hex</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2009/07/picture-21.png" medium="image">
			<media:title type="html">HVX200 CramFS directory structure</media:title>
		</media:content>
	</item>
		<item>
		<title>The Subterfugue process sandbox</title>
		<link>http://deadhacker.com/2008/05/06/the-subterfugue-process-sandbox/</link>
		<comments>http://deadhacker.com/2008/05/06/the-subterfugue-process-sandbox/#comments</comments>
		<pubDate>Tue, 06 May 2008 20:11:13 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/?p=71</guid>
		<description><![CDATA[These are tools that let one run a process and, in a sense, selectively debug by telling the tool to perform analysis when conditions are met in the kernel, such as when a certain argument is sent to sendto() one could replace it on the stack with their own value. You could write your own [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=71&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>These are tools that let one run a process and, in a sense, selectively debug by telling the tool to perform analysis when conditions are met in the kernel, such as when a certain argument is sent to sendto() one could replace it on the stack with their own value.  You could write your own version of functions and hijack them with with LD_PRELOAD but being able to script instead of compile is significantly better for debugging.</p>
<p>There are several frameworks for such debugging available.  <a href="http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html">DTrace</a> with <a href="http://www.internetnews.com/security/article.php/3729486">RE:Trace</a> (osx, sun), <a href="http://sourceware.org/systemtap/documentation.html">SystemTap</a> on linux and <a href="http://www.kenshoto.com/vtrace/">vtrace</a> for win32+linux, all scriptable.  My favorate as yet is   <a href="http://subterfugue.org/">Subterfugue</a> though old its keep-it-simple-stupid methods have kept me coming back.  Here is an <a href="http://subterfugue.org/tutorial.html">example</a> that changes the argument passed to a write() into rot13 ascii:</p>
<blockquote>
<pre>trans = string.maketrans('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
                         'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM')

class Rot13(Trick):
    def callbefore(self, pid, call, args):
        m = getMemory(pid)
        address = args[1]
        size = args[2]
        data = m.peek(address, size)
        m.poke(address, string.translate(data, trans), self)

    def callmask(self):
        return { 'write' : 1 }</pre>
</blockquote>
<p>And the output:</p>
<blockquote>
<pre>bash-2.03$ sf --tri=Rot13 date
Jrq Sro  2 02:55:34 PFG 2000
bash-2.03$ sf --tri=Rot13 --tri=Rot13 date
Wed Feb  2 02:55:37 CST 200</pre>
</blockquote>
<p>So because Im too lazy to make a CVS commit, ill explain how you can revive it yourself.  Hey! Really this is better.  Its future proof: You wont have to worry about the software dieing if I go off to work at some draconian anti-opensource company just like all the other wonderful security engineers out there (Im looking at you <a href="http://boomerang.sourceforge.net/">Boomerang Decompiler</a>).  You wont have to worry because&#8230; within the next 5 minutes youll know how to maintain it yourself, kinda.</p>
<ol>
<li>Downgrade python:<br />
download and install python 1.5.2.  You could try your luck with later versions but the object c methods are different and subterfugue needs these for heavy use of ptrace() hooking.  Lets race to see who recodes them first. Anyway, whatever version to try be sure you have the Makefile.pre.in from the python install sources.</li>
<li>Update system call map:<br />
grab the <a href="http://sourceforge.net/projects/strace/">strace sources</a>.  The system call map that subterfugue is using is dated from 2001 or so and needs to be updated for newer kernels.  compare the syscallmap.py in subterfugue to the syscallent.h of strace.  From about array index 250+ is where the new entries start.  To add them I just cut and paste to a new file, ran a replace routine  <em>for line in f.readlines(): print line.translate(string.maketrans(&#8216;{}/*&#8217;,'()##&#8217;))</em>.  Also needed to be sure there there was no more than one flag in each array.</li>
<li>make install and then test with a trick from /usr/lib/subterfugue/tricks/:  sf &#8211;tri=Count date</li>
</ol>
<p>If time permits I would like to rewrite the ptrace c shell using python 2+ methods. Until then, this works.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/71/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/71/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=71&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2008/05/06/the-subterfugue-process-sandbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>finding entropy in binary files</title>
		<link>http://deadhacker.com/2007/05/13/finding-entropy-in-binary-files/</link>
		<comments>http://deadhacker.com/2007/05/13/finding-entropy-in-binary-files/#comments</comments>
		<pubDate>Sun, 13 May 2007 03:41:35 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2007/05/13/finding-entropy-in-binary-files/</guid>
		<description><![CDATA[Update: added routine to print out hex data for blocks where entropy passes a given threshold. Update: GUI display of graph (using TK) was not working on my system. Code now saves an image of the results in addition to attempting to display with GUI. Ero Carrera responded yesterday to a request on OpenRCE concerning [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=66&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>Update: added routine to print out hex data for blocks where entropy passes a given threshold.<br />
Update: GUI display of graph (using TK) was not working on my system. Code now saves an image of the results in addition to attempting to display with GUI.</em></p></blockquote>
<p><a href="http://blog.dkbza.org/2007/05/scanning-data-for-entropy-anomalies.html">Ero Carrera</a> responded yesterday to a <a href="https://www.openrce.org/forums/posts/478">request</a> on OpenRCE concerning using entropy analysis to find RSA keys and other random blocks of data in binaries.  Here in is a full wrapper for the code he gives.  We use <a href="http://matplotlib.sourceforge.net/">matplotlib</a> instead of <a href="http://www.wolfram.com/">Mathematica</a> to generate the graph.  Also if you plan to scan files larger than 100k I&#8217;d highly recommend downloading the modified progressBar class included here.</p>
<p><span id="more-66"></span><strong>example output:</strong></p>
<p>Target data:</p>
<pre><code>data = ''.join (
  [chr (random.randint (0, 64)) for x in xrange (1024)] +
  [chr (random.randint (0, 255)) for x in xrange (1024)] +
  [chr (random.randint (0, 64)) for x in xrange (1024)] )</code></pre>
<p><a title="example.png" href="http://cyphunk.files.wordpress.com/2007/05/example.png"><img src="http://cyphunk.files.wordpress.com/2007/05/example.png?w=423&#038;h=289" border="0" alt="example.png" width="423" height="289" /></a></p>
<pre><code>[==================================100%=====================================]
     949 7.00: 1a060113050c2d0d 17302e091d2d0117 →♠☺‼♣♀- ↨0. ↔-☺↨</code></pre>
<p><strong>entropy_graph.py</strong></p>
<pre><code>""" Entropy scan
    H() and entropy_scan() originally by Ero Carrera (blog.dkbza.org)

    Modified May 2007 by cyphunk (deadhacker.com)
    Modified Dec 2009 by cyphunk

    USAGE:
    cmd [target_path]
    """

# FLAGS:
SHOWPROGRESS = 1       # Show console progress bar?
PRINTONTHRESHOLD = 6.8 # When block is &gt; than threshold
                       # print first 16 bytes in both
                       # hex and ascii.  Set to 0 to turn
                       # off.
ONLYFIRSTBLOCK = 0     # Set to 1 it will only print the first
                       # block that goes over threshold and not
                       # blocks &gt; threshold that are only offset
                       # by 1.  By setting to zero block windows
                       # that match will be printed.
BLOCKSIZE = 256        # size of blocks scanned.

import math
import random
from pylab import *
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import tkFileDialog
from Tkinter import *
from progressBar import *
from binascii import hexlify
import string
import os
import cPickle # cache results

def H(data):
  if not data:
    return 0
  entropy = 0
  for x in range(256):
    p_x = float(data.count(chr(x)))/len(data)
    if p_x &gt; 0:
      entropy += - p_x*math.log(p_x, 2)
  return entropy

def entropy_scan (data, block_size) :
  if SHOWPROGRESS:
      progress = progressBar(0, len(data) - block_size, 77)
  # creates blocks of block_size for all possible offsets ('x'):
  blocks = (data[x : block_size + x] for x in range (len (data) - block_size))
  i = 0
  for block in (blocks) :
    i += 1
    if SHOWPROGRESS:
        progress(i)
    yield H (block)

# performance improvement if you have psyco
try:
  import psyco
  psyco.full()
  print "got psyco"
except ImportError:
  pass

# get target file as argument var or from dialog:
filename = ""
if sys.argv[1:]:
    filename = sys.argv[1]
else:
    root = Tk()
    root.withdraw()
    filename = tkFileDialog.askopenfilename(title="Target binary",
                                        filetypes=[("All files", "*")])

# run, print graph:

if filename:
    # Open file and scan for entropy:
    if os.path.splitext(filename)[1] == ".entropy":
        print "File is a cached '.entropy' from previous scan"
        results = cPickle.load(open(filename, 'rb'))
        filename = os.path.splitext(filename)[0]
        print filenamea
        raw = open(filename, 'rb').read()
    else:
        raw = open(filename, 'rb').read()
        # debug with test data:
        """
        import random
        raw = ''.join (
        [chr (random.randint (0, 64)) for x in xrange (1024)] +
        [chr (random.randint (0, 255)) for x in xrange (1024)] +
        [chr (random.randint (0, 64)) for x in xrange (1024)] )
        """
        results = list( entropy_scan(raw,BLOCKSIZE) )
        print "saving cache of entropy scan data to %s" % filename+".entropy"
        cPickle.dump(results, open(filename+".entropy", 'wb')) 

    # Print blocks that are above a defined threshold of entropy:
    if PRINTONTHRESHOLD &gt; 0:
        print
        found = 0
        for i in range(len(results)):
            if results[i] &gt; PRINTONTHRESHOLD:
                if found == 0:
                    table = string.maketrans("rnt", '   ') # don't like newlines
                    #blockstr = string.translate(str(raw[i : i+16]), table) # translate to string value
                    print "0x%8x %.2f: %s %s" % (i, results[i], hexlify(raw[i : i+8]),
                                                     hexlify(raw[i+8 : i+16]))
                    #%.3f - %016X / %s" % (i, results[i], raw[i : i + 16], raw[i : i + 16])
                    found = ONLYFIRSTBLOCK
            else:
                found = 0

    # Plot
    filesize = os.path.getsize(filename)
    imgdpi = 100
    imgwidth = filesize / imgdpi

    if imgwidth &gt; 327:
      imgwidth = 327

    majorLocator   = MultipleLocator(0x400)   # mark every 1024 bytes
    majorFormatter = FormatStrFormatter('%X') # change to %d to see decimal offsets

    ax = subplot(111)
    plot(results, linewidth=2.0, antialiased=False)
    subplots_adjust(left=0.02, right=0.99, bottom=0.2)

    ax.axis([0,filesize,0,8])
    ax.xaxis.set_major_locator(majorLocator)
    ax.xaxis.set_major_formatter(majorFormatter)
    xticks(rotation=315)

    xlabel('block (byte offset)')
    ylabel('entropy')
    title('Entropy levels')

    grid(True)

    img = gcf()
    img.set_size_inches(imgwidth, 6)
    img.savefig(filename+".png", dpi=imgdpi)

    draw()
    show()
</code></pre>
<p><strong>progressBar.py</strong> (originally from <a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/168639">active state</a> but modified for our use)</p>
<pre><code>import sys

class progressBar:
    """ Creates a text-based progress bar. Call the object with the `print'
        command to see the progress bar, which looks something like this:

        [=======&gt;        22%                  ]

        You may specify the progress bar's width, min and max values on init.
    """
    def __init__(self, minValue = 0, maxValue = 100, totalWidth=80):
        self.progBar = "[]"   # This holds the progress bar string
        self.min = minValue
        self.max = maxValue
        self.span = maxValue - minValue
        self.width = totalWidth
        self.amount = 0       # When amount == max, we are 100% done
        self.updateAmount(0)  # Build progress bar string
        self._old_pbar = ""   # used to track change
        self.pbar_str = ""

    def updateAmount(self, newAmount = 0):
        """ Update the progress bar with the new amount (with min and max
            values set at initialization; if it is over or under, it takes the
            min or max value as a default. """
        if newAmount &gt; self.max: newAmount = self.max
        self.amount = newAmount

        # Figure out the new percent done, round to an integer
        diffFromMin = float(self.amount - self.min)
        percentDone = (diffFromMin / float(self.span)) * 100.0
        percentDone = int(round(percentDone))

        # Figure out how many hash bars the percentage should be
        allFull = self.width - 2
        numHashes = (percentDone / 100.0) * allFull
        numHashes = int(round(numHashes))

        # Build a progress bar with an arrow of equal signs; special cases for
        # empty and full
        if numHashes == 0:
            self.progBar = "[&gt;%s]" % (' '*(allFull-1))
        elif numHashes == allFull:
            self.progBar = "[%s]\n" % ('='*allFull)
        else:
            self.progBar = "[%s&gt;%s]" % ('='*(numHashes-1),
                                        ' '*(allFull-numHashes))

        # figure out where to put the percentage, roughly centered
        percentPlace = (len(self.progBar) / 2) - len(str(percentDone))
        percentString = str(percentDone) + "%"

        # slice the percentage into the bar
        self.progBar = ''.join([self.progBar[0:percentPlace], percentString,
                                self.progBar[percentPlace+len(percentString):]
                                ])

    def __str__(self):
        return str(self.progBar)

    def __call__(self, value):
        """ Updates the amount, and writes to stdout. Prints a carriage return
            first, so it will overwrite the current line in stdout."""

        self.updateAmount(value)
        self.pbar_str = str(self)
        if self.pbar_str != self._old_pbar:
            self._old_pbar = self.pbar_str
            sys.stdout.write(self.pbar_str + "\r")
            sys.stdout.flush()
</code></pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/66/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/66/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=66&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2007/05/13/finding-entropy-in-binary-files/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2007/05/example.png" medium="image">
			<media:title type="html">example.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Cryptology ePrint Archive RSS</title>
		<link>http://deadhacker.com/2006/02/28/cryptology-eprint-archive-rss/</link>
		<comments>http://deadhacker.com/2006/02/28/cryptology-eprint-archive-rss/#comments</comments>
		<pubDate>Tue, 28 Feb 2006 22:42:08 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Cryptography]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/28/cryptology-eprint-archive-rss/</guid>
		<description><![CDATA[Update: Just use their RSS feeds. They have updated them to include full details rendering my own versions mute. One of the resources I use to monitor for current cryptography papers is the Cryptology ePrint Archive, a routinely updated repository of all cryptography papers. Recently the Archive setup their own RSS feeds. Their feed provides [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=22&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>Update: Just use <a href="http://eprint.iacr.org/rss/">their RSS feeds</a></em><em>. They have updated them to include full details rendering my own versions mute.</em></p></blockquote>
<p>One of the resources I use to monitor for current cryptography papers is the <a title="ePrint ArchiveCryptology ePrint Archive" href="http://eprint.iacr.org/" target="_blank">Cryptology ePrint Archive</a>, a routinely updated repository of all cryptography papers. Recently the Archive setup their own RSS feeds. Their feed provides a link to the article summaries. For me this isn&#8217;t enough and for a while I&#8217;ve had my own bot building an RSS feed listing the latest additions to the archive including their full summary inside the feed itself, not just a link to it. It was too buggy to link publicly so last night I fixed what should be the last of the problems to providing a stable feed.  I have a feed for just <a title="Cryptology ePrint Archive RSS feed" href="http://admin.cypherpoet.com/feeds/crypteprint_new.xml">newly published articles</a> and another for <a title="Cryptology ePrint Archive RSS feed" href="http://admin.cypherpoet.com/feeds/crypteprint_all.xml">all articles new or updated</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=22&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/28/cryptology-eprint-archive-rss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>Formal aspects of mobile code security &#8211; Chapter 5</title>
		<link>http://deadhacker.com/2006/02/22/formal-aspects-of-mobile-code-security-chapter-5/</link>
		<comments>http://deadhacker.com/2006/02/22/formal-aspects-of-mobile-code-security-chapter-5/#comments</comments>
		<pubDate>Wed, 22 Feb 2006 11:11:53 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Cryptography]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/22/formal-aspects-of-mobile-code-security-chapter-5/</guid>
		<description><![CDATA[Formal aspects of mobile code security &#8211; Chapter 5 PhD thesis for Richard Drews Dean 23 page chapter. Incomplete: Need to discuss how the author discovered attacks. Need to check my description using the detailed equations provided. I must illustrate the attack methods. The interest in this thesis is due to its reference in Heard [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=37&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://cyphunk.files.wordpress.com/2006/02/ddean-thesis.pdf">Formal aspects of mobile code security</a> &#8211; Chapter 5<br />
PhD thesis for Richard Drews Dean<br />
23 page chapter.</p>
<blockquote><p><em>Incomplete: Need to discuss how the author discovered attacks. Need to check my description using the detailed equations provided. I must illustrate the attack methods.</em></p></blockquote>
<p>The interest in this thesis is due to its reference in <a href="http://cyphunk.wordpress.com/2006/02/01/herding-hash-functions/">Heard Hash Functions</a> and many other papers relating to hash algorithms.  In Chapter 5 a <em>fixed point</em> attack against hash algorithms is discussed.  Methods are given for overcoming the appended message length specified in <a href="http://en.wikipedia.org/wiki/Hash_functions_based_on_block_ciphers">Merkle-Damgård</a> (<a href="http://cyphunk.files.wordpress.com/2006/02/Wikipedia%20Merkle-Damg%C3%A5rd%20construction.pdf">cache</a>) constructed hash functions.</p>
<p><strong>What is a Fixed Point Attack?</strong><br />
A Fixed Point Attack involves finding a random block whose properties allow the attacker to insert the block into the original message without changing the final hash.  As a result two different messages are created with the same hash (the original message and the original+the special block). To produce this special block first make note of all the <em>internal hash states</em> produced after each block is compressed (see: <a href="http://cyphunk.wordpress.com/2006/02/21/sha-1-illustrated/">SHA-1 Illustrated</a>).  Next generate random blocks (X<em>i</em>) until you find one that meets two properties:</p>
<ol>
<li>The hash state before compression of block X<em>i</em> is the same as the hash state returned after compression.</li>
<li>The hash state of X<em>i</em> equals one of the <em>internal hash states</em> of the original message.</li>
</ol>
<p>After finding such a block it can be inserted into the message directly after the message block whose <em>internal hash state</em> it matched.</p>
<p><strong>Overcoming Message Length<br />
</strong>MD5, MD4 and SHA use <a href="http://en.wikipedia.org/wiki/Hash_functions_based_on_block_ciphers">Merkle-Damgård construction</a> (<a href="http://cyphunk.files.wordpress.com/2006/02/Wikipedia%20Merkle-Damg%C3%A5rd%20construction.pdf">cache</a>) which specifies that the length of the entire message be appended to it.  Therefor, a simple Fixed Point Attack will not do because the message length will change when the special block is inserted.  This intern changes the hash of the last block thereby changing the final hash returned.  The paper gives 3 methods to overcome this.</p>
<p><strong>1. </strong>The length is a 64 bit integer so add the special block 2^64 times, in affect causing the number to loop.  This does not work on SHA because SHA does not cover messages greater than 2^64 bits.</p>
<p><strong>2. </strong>Look for any two <em>internal hash states</em> in the message that equal each other.  If you are lucky enough to have such a message you can delete all the blocks between the two and then expand the message  back to the original size using the Fixed Point Attack.</p>
<p><strong>3. </strong>Run a Fixed Point Attack and make note of the place in the original message where you can insert the special block.  Now, remember that the block compression function adds the resulting hash state to the previous hash state.  That means that compression is a function of the current block and the previous blocks hash state.  With that understood, we want to find another random block that means the following two requirements:</p>
<ul>
<li>The hash state before compression of block X<em>j</em> is set to the first hash state of the original message.</li>
<li>The resulting hash state of X<em>j</em> equals one of the <em>internal hash states</em> of the original message which is less than the hash state matched by the Fixed Point attack.</li>
</ul>
<p>You&#8217;ll notice that this block uses the same method as the Fixed Point only it initializes the incoming hash state to the compression function to be that of the first hash state of the message.</p>
<p>Now we can insert the X<em>j</em> into the message directly after the message block whose <em>internal hash state</em> it matched.  Since the compression of X<em>j </em>takes the first hash state of the message we delete all the blocks up until that point, effectively making X<em>j</em> the first block and reducing the size of the message.  Now the Fixed Point block X<em>i</em> can be inserted into the message directly after the message block whose <em>internal hash state</em> it matched and can be repeated to bring the message back to it&#8217;s original size.</p>
<p>This chapter also discusses how the attack was found as well as possible solutions. which I still need to cover.</p>
<p><strong>References</strong><br />
References I must find:</p>
<ul>
<li>[PvO95] Bart Preneel and Paul C. van Oorschot. MDx-MAC and building fast MACs from hash functions. In Don Coppersmith, editor, Proc. CRYPTO 95, pages 1–14. Springer, 1995. Lecture Notes in Computer Science No. 963.</li>
</ul>
<p>To find the attacks the author used Binary Decision Diagrams to look at the logical structure of MD5,MD5,SHA-1. References I must find:</p>
<ul>
<li>[Bry92] Randal E. Bryant. Symbolic boolean manipulation with ordered binary decision diagrams. ACM Computing Surveys, 24(3):293–318, September 1992.</li>
<li>[Hu97] Alan J. Hu. Formal hardware verification with BDDs: An introduction. In IEEE Pacific Rim Conference on Communications, Computers, and Signal Processing, pages 677–682, 1997.</li>
</ul>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=37&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/22/formal-aspects-of-mobile-code-security-chapter-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>SHA-1 Illustrated</title>
		<link>http://deadhacker.com/2006/02/21/sha-1-illustrated/</link>
		<comments>http://deadhacker.com/2006/02/21/sha-1-illustrated/#comments</comments>
		<pubDate>Tue, 21 Feb 2006 14:29:56 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Cryptography]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/21/sha-1-illustrated/</guid>
		<description><![CDATA[By Nathan Fain Incomplete: must create detailed diagram for compression functions. The following simplifies the specification of SHA-1 in an easy to digest form. First we will cover the general structure of the algorithm. Detail of the expansion and compression routines are covered separately. First we start with a message. The message is padded and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=50&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a rel="license" href="http://creativecommons.org/licenses/publicdomain/"> </a>By Nathan Fain</p>
<blockquote><p><em>Incomplete: must create detailed diagram for compression functions.<br />
</em></p></blockquote>
<p>The following simplifies the specification of SHA-1 in an easy to digest form. First we will cover the general structure of the algorithm. Detail of the expansion and compression routines are covered separately.</p>
<p><img align="right" alt="message" src="http://cyphunk.files.wordpress.com/2006/02/message.png?w=600" />First we start with a message. The message is padded and the length of the message is added to the end. It is then split into blocks of 512 bits (Figure 2).</p>
<p><img alt="message blocks" src="http://cyphunk.files.wordpress.com/2006/02/message_blocks.png?w=600" /><br />
(Figure 2)</p>
<p>The blocks are then processed one at a time.  Each block must be expanded and compressed.  The value after each compression is added to a 160bit buffer called the current <em>hash state</em>.  After the last block is processed the current hash state is returned as the final hash.  A overview of this procedure can be seen in Figure 3.</p>
<p><img alt="sha-1 general process overview" src="http://cyphunk.files.wordpress.com/2006/02/overview.png?w=600" /><br />
(Figure 3)</p>
<p>Let&#8217;s look more closely at the expansion and compression functions.  For expansion each 512 bit message block is separated into chunks of 32 bits. As you can see in Figure 3 these 16 chunks are then used to create 64 more chunks for a total of 80. Details of how this is done are described later.</p>
<p><img alt="expand block to 80 32 bit chunks" src="http://cyphunk.files.wordpress.com/2006/02/block_expland.png?w=600" /><br />
(Figure 4)</p>
<p>Now all 80 of these chunks are compressed into a 160 bit value which is <strong>added</strong> to the <em>current hash state</em> (Figure 5):</p>
<p><img alt="compress block into hash state" src="http://cyphunk.files.wordpress.com/2006/02/compress_chunks.png?w=600" /><br />
(Figure 5)</p>
<p>Figure 5 shows one block being processed.  The expansion and compression functions are repeated for each block with the return constantly being added to the <em>current hash state</em> buffer.   <img align="right" alt="return hash state as hash" src="http://cyphunk.files.wordpress.com/2006/02/return_hash.png?w=600" /> Once all blocks have been processed it is this value that is returned as the hash of the message.</p>
<p>3 tasks were generalized above: How the message is prepared before processing, how exactly the block is expanded to 80 chunks (Figure 4) and how those chunks are compressed (Figure 5).  It is not essential to understand them in detail but should you desire, here are the details.</p>
<p><strong>Message Preparation</strong></p>
<p>The message is prepared in 4 steps:</p>
<ol>
<li>Append a single binary 1 bit to the message</li>
<li>Split into blocks of 512 bits each (Figure 2 above)</li>
<li>The last block must be equal to 448 so that we can append the message length (next step).  If it is under pad with binary 0 bits until equal to 448.  If over, pad until it is 512 bits and create an additional block of 448 binary 0 bits.</li>
<li>Append the length of the original message to the last block.  Represent this length as a 64 bit integer (making the last block equal to 512 bits).</li>
</ol>
<p>I should also mention that before we process any blocks we must initiate the <em>hash state</em> buffer.  The buffer is actually 5 separate 32 bit integers:</p>
<ul>
<li><tt>h0 = 67452301</tt></li>
<li><tt>h1 = EFCDAB89</tt></li>
<li><tt>h2 = 98BADCFE</tt></li>
<li><tt>h3 = 10325476</tt></li>
<li><tt>h4 = C3D2E1F0</tt></li>
</ul>
<p><strong>Block expansion</strong><br />
<img align="right" alt="Animation of block expansion" src="http://cyphunk.files.wordpress.com/2006/02/expand_anim.gif?w=600" />Each 512 bit block is split further into 32 bit chunks (&#8220;<em>words</em>&#8220;) as seen in Figure 4.  These 16 chunks are then expanded to a total of 80.  The processes of expansion is a simple XOR of 4 values.  For instance, the next chunk, chunk 17, is created by XOR&#8217;ing together chunk 17-3,  17-8, 17-14 and 17-16.  For chunk 18 run the same processes but subtracting from 18 instead of 17.  This continues until all 80 have been created.  This can clearly be seen in the animation to the right. (If the animation is not playing reload the page.)</p>
<p><strong>Block compression</strong></p>
<p><!--Creative Commons License--> <a rel="license" href="http://creativecommons.org/licenses/publicdomain/"> <img border="0" align="left" alt="Creative Commons License" src="http://cyphunk.files.wordpress.com/2006/02/norights.gif?w=600" /></a>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/publicdomain/">Creative Commons Public Domain License</a> and may be used however you wish.  For sources to Dia based diagrams, contact me.<!--/Creative Commons License--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/50/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/50/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=50&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/21/sha-1-illustrated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/message.png" medium="image">
			<media:title type="html">message</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/message_blocks.png" medium="image">
			<media:title type="html">message blocks</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/overview.png" medium="image">
			<media:title type="html">sha-1 general process overview</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/block_expland.png" medium="image">
			<media:title type="html">expand block to 80 32 bit chunks</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/compress_chunks.png" medium="image">
			<media:title type="html">compress block into hash state</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/return_hash.png" medium="image">
			<media:title type="html">return hash state as hash</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/expand_anim.gif" medium="image">
			<media:title type="html">Animation of block expansion</media:title>
		</media:content>

		<media:content url="http://cyphunk.files.wordpress.com/2006/02/norights.gif" medium="image">
			<media:title type="html">Creative Commons License</media:title>
		</media:content>
	</item>
		<item>
		<title>An Illustrated Guide to Cryptographic Hashes Intro.</title>
		<link>http://deadhacker.com/2006/02/06/an-illustrated-guide-to-cryptographic-hashes-intro/</link>
		<comments>http://deadhacker.com/2006/02/06/an-illustrated-guide-to-cryptographic-hashes-intro/#comments</comments>
		<pubDate>Mon, 06 Feb 2006 20:39:59 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Cryptography]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/06/an-illustrated-guide-to-cryptographic-hashes-intro/</guid>
		<description><![CDATA[An Illustrated Guide to Cryptographic Hashes by Steve Friedl 15 pages of text Update 2006.02.11: clearer explanation of CTFP preimage resistance. This is a very good introduction to what a hash algorithm is, what it is for and what collisions are all about. It does not cover specific details, only the general understanding. It&#8217;s a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=34&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://cyphunk.files.wordpress.com/2006/02/An%20Illustrated%20Guide%20to%20Cryptographic%20Hashes.pdf">An Illustrated Guide to Cryptographic Hashes</a><br />
by Steve Friedl<br />
15 pages of text</p>
<blockquote><p><em>Update 2006.02.11: clearer explanation of CTFP preimage resistance.</em></p></blockquote>
<p>This is a very good introduction to what a hash algorithm is, what it is for and what collisions are all about. It does not cover specific details, only the general understanding. It&#8217;s a quick read so I&#8217;ll forgo summarizing the contents.</p>
<p>The article explains the common terms used in most papers that discuss collisions. These terms are used to classify the type of collision attacks possible and are necessary to understand when reading other papers:</p>
<ul>
<li><strong>Collision resistance</strong> measures how difficult it is to create two inputs which produce any hash value which is the same for both inputs. In this scenario the attacker can control both inputs.</li>
<li><strong>Preimage resistance</strong> measures how difficult it is to create one input which matches the hash value of an unknown input. Here the attacker does not know the other input and is restricted by needing to create a specific hash value.</li>
<li><strong>Second preimage resistance</strong> measures how difficult it is to create one input which matches the hash value of a known input. Here the attacker can see both inputs but only controls one. Attacker is still restricted by having to create an input which matches the specific hash value of the other. However, knowing the input that produced the hash might be of assistance.</li>
</ul>
<p>Both preimage and second preimage are similar in that the objective is to get one input to match a predefined hash which is not controlled by the attacker. Also, in the <a title="Herding Hash Functions" href="/2006/02/01/herding-hash-functions/">Herding Hash Functions</a> by John Kelsey and Tadayoshi Kohno they that there is a 4rth resistance value:</p>
<ul>
<li><strong>Chosen Target Forced Prefix preimage resistance</strong> measures how difficult it is to create a collision when the first input is known while the second input is not know yet.   This is similar to preimage resistance except that here the attacker controls the first input and not the second.  Well, almost.  The attacker is permitted to append data to the second input.  The attacker must determine the hash first using the first input and then &#8220;herd&#8221; the second input to the same hash.  Herding is done by adding data to the second input to make it collide.  Is a process that involves carefully predetermining the first input and using internal states from its hash generation in the appended data to the second.</li>
</ul>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=34&subd=cyphunk&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/06/an-illustrated-guide-to-cryptographic-hashes-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
	</channel>
</rss>