<?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: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>cyphunks research repository</description>
	<lastBuildDate>Thu, 15 Jan 2009 22:38:39 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
		<url>http://www.gravatar.com/blavatar/64b59878717e00c39f632d8307a5e59f?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>deadhacker.com</title>
		<link>http://deadhacker.com</link>
	</image>
			<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 [...]<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[<div class='snap_preview'><br /><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(&#8217;{}/*&#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>
<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" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2008/05/06/the-subterfugue-process-sandbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" 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>

		<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.  Tidied up code. 
Ero Carrera responded yesterday to a request 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 [...]<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[<div class='snap_preview'><br /><blockquote><p><em>Update: added routine to print out hex data for blocks where entropy passes a given threshold.  Tidied up code. </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)

    USAGE:
    cmd [target_path]
    """

# FLAGS:
SHOWPROGRESS = 1       # Show console progress bar?
PRINTONTHRESHOLD = 7 # When block is &gt; than threshold
                       # print first 16 bytes in both
                       # hex and ascii.  Set to 0 to turn
                       # off.
ONLYFIRSTBLOCK = 1     # 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 *
import tkFileDialog
from Tkinter import *
from progressBar import *
from binascii import hexlify

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)

# 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 and scan for entropy:
    data = open(filename, 'rb')
    raw = data.read()
    results = list( entropy_scan(raw,BLOCKSIZE) )

    # 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("</code><code>r</code><code>n</code><code>t", '   ') # don't like newlines
                    blockstr = string.translate(str(raw[i : i+16]), table)
                    print "%8d %.2f: %s %s %s" % (i, results[i], hexlify(raw[i : i+8]),
                                                     hexlify(raw[i+8 : i+16]), blockstr)
                    #%.3f - %016X / %s" % (i, results[i], raw[i : i + 16], raw[i : i + 16])
                    found = ONLYFIRSTBLOCK
            else:
                found = 0

    # Plot
    plot(results)
    xlabel('block')
    ylabel('entropy')
    title('Entropy levels')
    grid(True)
    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]" % ('='*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>
<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" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2007/05/13/finding-entropy-in-binary-files/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" 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: added seperate feeds for updated and new-only articles
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 a link to the article summaries. For me this isn&#8217;t enough [...]<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[<div class='snap_preview'><br /><blockquote><p><em>Update: added seperate feeds for updated and new-only articles</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>
<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" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/28/cryptology-eprint-archive-rss/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://www.archive.org/download/c.sides_Festival_Jerusalem_2006-the_live_recordings/Falko_Brocksieper-dj_set_at_csides_festival_2006.mp3" length="222842880" type="audio/mpeg" />
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" 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 Hash Functions and many [...]<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[<div class='snap_preview'><br /><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>
<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" /></div>]]></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="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" 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 the length [...]<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[<div class='snap_preview'><br /><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" />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" /><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" /><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" /><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" /><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" /> 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" />Each 512 bit block is split further into 32 bit chunks (&#8221;<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" /></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>
<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" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/21/sha-1-illustrated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" 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 quick read so I&#8217;ll [...]<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[<div class='snap_preview'><br /><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>
<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" /></div>]]></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="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>VB Reversed &#8211; A decompiling approach</title>
		<link>http://deadhacker.com/2006/02/05/vb-reverse-a-decompiling-approach/</link>
		<comments>http://deadhacker.com/2006/02/05/vb-reverse-a-decompiling-approach/#comments</comments>
		<pubDate>Sun, 05 Feb 2006 11:33:38 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/05/vb-reverse-a-decompiling-approach/</guid>
		<description><![CDATA[Visual Basic Reversed &#8211; A Decompiling Approach
by Andrea Geddon
27 pages, 20 of code.
Update 2006.02.11: more intuitive structure list and directions of use.
This is would have made for a good introduction to reversing Visual Basic if it were not for a few errors. One can still learn a bit about the data structure used by the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=25&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://cyphunk.files.wordpress.com/2006/02/VB%20Reversed%20-%20A%20Decompiling%20Approach.pdf">Visual Basic Reversed &#8211; A Decompiling Approach<br />
</a>by Andrea Geddon<br />
27 pages, 20 of code.</p>
<blockquote><p><em>Update 2006.02.11: more intuitive structure list and directions of use.</em></p></blockquote>
<p>This is would have made for a good introduction to reversing Visual Basic if it were not for a few errors. One can still learn a bit about the data structure used by the runtime engine but towards the end when trying to find objects the author mixes names he gave structures, or isn&#8217;t clear enough to keep them in order to. Regardless, a great deal of the structure is described and some of it in a coherent manner.</p>
<p>The author looks at an example VB program with the objective of finding the serial generation code. He starts from the very first data structure (<em>RT_MainStruct</em>). <a target="_blank" href="http://cypherpoet.com/other/researchfiles/vbstructures.html">Here is a bulleted list of the different levels in the vb structure</a> which should make it easier to follow. The author is looking for the onClickCheck event handler. The handlers are not named but can be found working through various levels. 1. First we must find the form name of interest. 2. Then we find the control (button) name of interest (perhaps &#8220;Check Serial&#8221;). 3. We find the onClick event handle for that button.</p>
<ol>
<li>The form names can be found under <em>ProjectStruct.Tree.ModulesList</em>. Each <em>ModulesList </em>represents values of either a form or a module object and contains a <em>ObjName </em>which is the internal ASCII name of the Form/Module.</li>
<li>For Forms you will find a <em>FormDescriptor </em>structure referenced. This structure contains substructures for each control in the form. Buttons, text boxes, labels, etc. The author named them <em>FD0_ControlsList[*]</em>. Inside each of these structures you will find the ASCII name (<em>aText_2_0</em>) given to each control, such as &#8220;btnSerialChk&#8221;, etc.</li>
<li>Inside the structure with the control/button you wish to examine you will find a <em>LocalDispatcher </em>structure referenced. And finally, it is here that you will find references to the functions for each event handler (onClick, onChange, etc). They are not named, only appearing as raw references. So, to determine what is onClick, onChange, onOver, etc&#8230; you can either look for familiar signs in the disassembly (such as calls to message box functions) or build an example project that has every event defined and compare the disassembly of each to it. Once the onSerialClick event handler is found you can follow its value to the serial check function.</li>
</ol>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=25&subd=cyphunk&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/05/vb-reverse-a-decompiling-approach/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to FPGA,CPLD,PLD</title>
		<link>http://deadhacker.com/2006/02/02/introduction-to-fpgacpldpld/</link>
		<comments>http://deadhacker.com/2006/02/02/introduction-to-fpgacpldpld/#comments</comments>
		<pubDate>Thu, 02 Feb 2006 09:25:14 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Logic Design]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/02/introduction-to-fpgacpldpld/</guid>
		<description><![CDATA[Programmable Logic: What&#8217;s it to Ya?
by Michael Barr from Embedded Systems Programming, June 1999
6 pages
This document gives a basic overview of common programmable logic hardware: FPGA&#8217;s, CPLD&#8217;s and PLD. (Hold the mouse over links and acronyms to see their full definition or click to follow to their wikipedia entries).
PLD
In the beginning there was PLD, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=11&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://cyphunk.files.wordpress.com/2006/02/Programmable%20Logic%20Overview%20-%20PLD,%20CPLD,%20FPGA.pdf">Programmable Logic: What&#8217;s it to Ya?</a><br />
by Michael Barr from Embedded Systems Programming, June 1999<br />
6 pages</p>
<p>This document gives a basic overview of common programmable logic hardware: FPGA&#8217;s, CPLD&#8217;s and PLD. (Hold the mouse over links and acronyms to see their full definition or click to follow to their wikipedia entries).<strong><a target="_blank" title="Programmable Logic Devices" href="http://en.wikipedia.org/wiki/Programmable_logic_device" /></strong></p>
<p><strong><a target="_blank" title="Programmable Logic Devices" href="http://en.wikipedia.org/wiki/Programmable_logic_device">PLD</a><br />
</strong>In the beginning there was PLD, and it was good. PLD let you take simple <a href="http://cyphunk.files.wordpress.com/2006/02/Logic%20Gate%20-%20Wikipedia.pdf">Logic Gate</a>  (AND/OR/NOT, etc.) TTL components and combine them into one chip. It is also known as <a target="_blank" title="generic array logic" href="http://en.wikipedia.org/wiki/Programmable_logic_device#GALs">GAL</a>, <a target="_blank" title="programmable Logic Array" href="http://en.wikipedia.org/wiki/Programmable_Logic_Array">PLA</a> and <a title="programmable array logic" href="http://en.wikipedia.org/wiki/Programmable_array_logic">PAL</a>.</p>
<p><strong><a target="_blank" title="Complex Programmable Logic Device" href="http://en.wikipedia.org/wiki/CPLD">CPLD</a><br />
</strong>PLD * <em>n</em>. CPLD&#8217;s combine various common PLD configurations into one component. A switch matrix is used to control IO between, to and from each. A CPLD differers from an FPGA in that not all logical components are equal in a CPLD. Because of this you must choose their CPLD wisely according to their application. The benefit it provides however is that an application could run faster on an optimized CPLD than it would on the ever flexible FPGA.</p>
<p><strong><a target="_blank" title="Field-programmable gate array" href="http://en.wikipedia.org/wiki/FPGA">FPGA</a><br />
</strong>Unlike a CPLD the logical unit of an FPGA is much smaller containing only a few small logic gates. The structure of the hardware itself separates tasks into IO blocks around the perimeter of the chip with the Logic blocks residing in a matrix inside. FPGA&#8217;s are measured by the number of logical gates (gate count), I/O pins and use of ROM or RAM.</p>
<p><a target="_blank" title="Very-high-speed integrated circuit, Hardware Description Language" href="http://en.wikipedia.org/wiki/VHSIC_hardware_description_language">VHDL</a> or <a target="_blank" href="http://en.wikipedia.org/wiki/Verilog">Verilog</a> are used to describe a highlevel architecture for use in an FPGA. These languages are general enough however to be applied to CPLD&#8217;s. They are used in general ASIC design as well. Typically one then uses simulation tools (such as those provided by Cadence) to simulate the high level logic. After simulation one would move to compilation.</p>
<p>Synthesis, the next step, is the process of taking a high level design and producing a Netlist. The netlist is still device independent. It is stored in a format called <a target="_blank" title="Electronic Design Interchange Format" href="http://en.wikipedia.org/wiki/EDIF">EDIF</a>.</p>
<p><a target="_blank" href="http://en.wikipedia.org/wiki/Place_and_route">Place &amp; Route</a>, the step after producing a <a target="_blank" href="http://en.wikipedia.org/wiki/Netlist">netlist</a>, involves &#8220;mapping the logical structures described in the netlist onto actual macrocells, interconnections and input and output pins.&#8221; The result is a bitstream downloaded to the actual device. The bitstream format is device dependent.</p>
<p>Download to the device of the bitstream format is a process which depends on the features of the device. For FPGA&#8217;s that use EPROM to store their definitions one might either need to place the FPGA in a programmer or use JTAG, if the FPGA has separate logic defined for supporting this onboard. For FPGA&#8217;s that use RAM instead of ROM they must support some dynamic programming. An advantage of RAM based FPGA&#8217;s is that definitions can be changed on the fly (swap out DES logic for AES as you please). However they do consume more power and the original definition/bitstream must be reloaded on every power refresh.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=11&subd=cyphunk&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/02/introduction-to-fpgacpldpld/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>Herding Hash Functions</title>
		<link>http://deadhacker.com/2006/02/01/herding-hash-functions/</link>
		<comments>http://deadhacker.com/2006/02/01/herding-hash-functions/#comments</comments>
		<pubDate>Wed, 01 Feb 2006 23:07:31 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Cryptography]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/02/01/herding-hash-functions/</guid>
		<description><![CDATA[Herding Hash Functions and the Nostradamus Attack (presentation slides)
by John Kelsey and Tadayoshi Kohno
8 pages of text
The paper describes an attack that would allow an attacker to massage (&#8221;herd&#8221;) an object to a point where it matches a hash value chosen by the attacker prior. What appears to be an important restriction is that the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=8&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://cyphunk.files.wordpress.com/2006/02/HerdingHash_paper.pdf">Herding Hash Functions and the Nostradamus Attack</a> (<a href="http://cyphunk.files.wordpress.com/2006/02/HerdingHash_slides_and_paper.pdf">presentation slides</a>)<br />
by John Kelsey and Tadayoshi Kohno<br />
8 pages of text</p>
<p>The paper describes an attack that would allow an attacker to massage (&#8221;herd&#8221;) an object to a point where it matches a hash value chosen by the attacker prior. What appears to be an important restriction is that the hash value has to be defined by the attacker prior to attack. This is important because in most uses of hash algorithms the victim would be the one defining the hash, not the attacker. Hence, this attack will not help you construct a message that matches a password hash.</p>
<p><strong>The steps</strong> required for the attack are:</p>
<ul />
<ol>
<li>Attacker runs a collision finding attack on a hash algorithm and creates an array of <em>intermediate hash states</em>. In the paper this array is referred to as the &#8220;diamond structure&#8221;. It is not clear to me how the size of this structure is determined but half of the <em>intermediate hash states</em> in this structure can be used in creating message blocks (next step) to be imposed on the victim object in order to allow the attacker to edit that object and still produce the same hash as the original.</li>
<li>After having the diamond structure made the attacker then runs an exhaustive search for a string which collides with one of the intermediate hash states in the structure. Once found the attacker can &#8220;construct a sequence of message blocks&#8221; in order to build the proper suffix which will be added to the original object and the attackers edited version.</li>
</ol>
<p><strong>Questions </strong>I have concerning the above process are:</p>
<ul>
<li>After finding a collision how does one build the <em>intermediate hash states</em>. For this I will need to read up more on current collision finding methods: <a target="_blank" href="http://www.springerlink.com/index/DWWVMQJU0N0A3UGJ.pdf">Multicollisions in iterated has functions</a> by Antoine Joux (need to find), <a href="http://cyphunk.files.wordpress.com/2006/02/ddean-thesis.pdf">Formal aspects of mobile code security</a> by Richard Drews Dean (attached). Learning more about hash states in a few hash algorithms should also help.</li>
<li>How is the size of the diamond structure determined?</li>
<li>What is the relation of the message blocks (used to create the final suffix added to the two different objects that collide) and the intermediate hash states?</li>
<li>Finally, how does the attacker determine which message blocks are to be used with the suffix, and what is the function for creating the suffix.</li>
</ul>
<p>Perhaps some of the above questions can be answered with another read, if I can find the time. Also would like to find is &#8220;How to Swindle Rabin&#8221; by Gideon Yuval.</p>
<p>One example application mentioned is abusing trust in a manner similar to <a target="_blank" href="http://en.wikipedia.org/wiki/Social_engineering">social engineering</a>. A malicious programmer writing a piece of code for a project which manages the code trust based on hash values. The attacker first runs a computation for building a diamond like structure/list of hash values that are optimum for collision. They then write some legitimate unsuspecting code which hashes to one of the chosen values. An auditor reviews the code and enters it into the code repository. The attacker can now edit that code and add a small back door.</p>
<p>All in all this paper reminds me in some way of Dan Kaminsky&#8217;s exploit of the MD5 collision examples which he describes in his paper <a href="http://cyphunk.files.wordpress.com/2006/02/md5_someday.pdf">MD5 To Be Considered Harmful Someday</a> (attached). He constructed files that included the example collision messages within and continued to produce MD5 collisions. The difference with the Hash herding described here is that the message used can look coherent and unsuspecting. The method differs from Dan&#8217;s in that hash herding uses the internal messages produced at different stages of the hash algorithm to give the attack the flexibility required to have greater control on the message.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=8&subd=cyphunk&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/02/01/herding-hash-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
		<item>
		<title>Bugger The Debugger</title>
		<link>http://deadhacker.com/2006/01/22/paper-bugger-the-debugger/</link>
		<comments>http://deadhacker.com/2006/01/22/paper-bugger-the-debugger/#comments</comments>
		<pubDate>Sun, 22 Jan 2006 12:15:14 +0000</pubDate>
		<dc:creator>cyphunk</dc:creator>
				<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://cyphunk.wordpress.com/2006/01/22/paper-bugger-the-debugger/</guid>
		<description><![CDATA[Bugger The Debugger, Pre Interaction Debugger Code Execution
By Brett Moore, CTO Security-Assessment.com. 10 pages of text, 3 of which are code.
This paper describes a method to construct a binary which can run code before control is passed to a debugger. The method requires changing the PE header of an executable to reference your own dll. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=5&subd=cyphunk&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.security-assessment.com/files/whitepapers/PreDebug.pdf">Bugger The Debugger, Pre Interaction Debugger Code Execution</a><br />
By Brett Moore, CTO Security-Assessment.com. 10 pages of text, 3 of which are code.</p>
<p>This paper describes a method to construct a binary which can run code before control is passed to a debugger. The method requires changing the PE header of an executable to reference your own dll. This could be your own DLL or you could create a malicious version of kernel32.dll. In both cases you will need to edit the import PE header section to reference your DLL. In the case of using a kernel32.dll copy you must change the name of the dll to a unique name and replace the import reference in the PE headers for kernel32.dll to that of your DLL.</p>
<p>The document describes how to impliment both methods, including how to create your own malicious version of kernel32.dll. Edit a copy of kernel32.dll to construct on injection of your own code:</p>
<p><tt>7C598934 FF 15 4C 13 57 7C call dword ptr ds:[7C57134Ch]</tt><br />
<tt>7C59893A FF 55 08 call dword ptr [ebp+8]</tt><br />
<tt>7C59893D 50 push eax</tt><br />
<tt>7C59893E EB 27 jmp 7C598967</tt><br />
<tt>7C598940 8B 45 EC mov eax,dword ptr [ebp-14h]</tt></p>
<p><tt>With</tt></p>
<p><tt><tt>7C598934 FF 15 4C 13 57 7C call dword ptr ds:[7C57134Ch]</tt><br />
<tt>7C59893A 8B 5D 08 mov ebx,[ebp+08]</tt><br />
<tt>7C59893D 66 BB 00 10 mov bx,1000h</tt><br />
<tt>7C59893E FF E3 jmp ebx</tt><br />
<tt>7C598940 8B 45 EC mov eax,dword ptr [ebp-14h]</tt></tt></p>
<p>The <strong><tt>mov bx,1000h</tt></strong> sets the place for the start of your malicious code. The document also describes how construct the referenced code so that after injecting itself it reloads the original kernel32.dll should any other DLL&#8217;s need to import their own instances of kernel32 functions.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cyphunk.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cyphunk.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cyphunk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cyphunk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cyphunk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cyphunk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cyphunk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cyphunk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cyphunk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cyphunk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cyphunk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cyphunk.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=deadhacker.com&blog=31698&post=5&subd=cyphunk&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://deadhacker.com/2006/01/22/paper-bugger-the-debugger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f9899a028a87ab8991049808f91a717?s=96&#38;d=identicon" medium="image">
			<media:title type="html">cyphunk</media:title>
		</media:content>
	</item>
	</channel>
</rss>