<?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/"
	>

<channel>
	<title>Yet another web log &#187; Security</title>
	<atom:link href="http://blog.philippheckel.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.philippheckel.com</link>
	<description>Life, Linux and other things</description>
	<lastBuildDate>Thu, 17 Mar 2011 10:04:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Hacking Flash Applications and Games: A Case Study</title>
		<link>http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/</link>
		<comments>http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 06:00:40 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[SWF]]></category>
		<category><![CDATA[SWF Decompiler]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=674</guid>
		<description><![CDATA[Adobe&#8217;s proprietary Flash format has become a significant part of the Internet as it is today. While its importance in Web applications is slowly decreasing due to Web 2.0 technologies and HTML5, it is still a major player in the browser game and application sector. The majority of these games and applications are for entertainment [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe&#8217;s proprietary Flash format has become a significant part of the Internet as it is today. While its importance in Web applications is slowly decreasing due to Web 2.0 technologies and HTML5, it is still a major player in the browser game and application sector. The majority of these games and applications are for entertainment only and offer you nothing but a nice rank in the high score. On rare occasions, however, there are Flash games in which you can actually win something valuable such as concert tickets or even money. And of course there are applications that let you stream, but not download content from a website.</p>
<p>So what&#8217;s the problem with that, you think? The problem is that almost <strong>all Flash applications can be hacked</strong> very easily and most developers are not aware of that. </p>
<p>As a reminder of how vulnerable Flash applications are, this post aims to raise awareness for these issues. In a case study, it shows how a Flash-based game and its server side high score can be tricked within a few minutes using free tools only.</p>
<p><span id="more-674"></span></p>
<hr />
<div class="toc">
<ol>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Disclaimer">Disclaimer</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Introduction">1. Introduction</a>
<ol>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#The-problem-with-Flash-applications">1.1. The problem with Flash applications</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Checksums-as-a-solution">1.2. Checksums as a solution?</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Tools-and-basic-approach">1.3. Tools and basic approach</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Case-study-a-car-parking-game">2. Case study: a car parking game (with high score)</a>
<ol>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Capture-the-client-server-communication">2.1. Capture the client-server communication</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Decompile-the-SWF-file-and-find-the-checksum-algorithm">2.2. Decompile the SWF file and find the checksum algorithm</a></li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Write-a-script">2.3. Write a script</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/#Conclusion">3. Conclusion</a></li>
</ol>
</div>
<hr />
<h3 id="Disclaimer" >Disclaimer</h3>
<p>This post is meant to raise awareness for the vulnerabilities of Flash-based applications. It is not a hacking tutorial or how-to. For that reason, I will not describe all steps in great detail, but only sketch the basic steps.</p>
<h3 id="Introduction" >1. Introduction</h3>
<h4 id="The-problem-with-Flash-applications" >1.1. The problem with Flash applications</h4>
<p>Flash applications are similar to normal Windows/Linux executables: Like normal programs, their source code is compiled to a binary format and later executed on the client machine. The major difference to .exe or Linux binaries is that decompiling is a lot easier: while a C or C++ compiler translates the source code into machine code, i.e. CPU instructions, SWF files contain the ActionScript code in plain text. That is with the right tools, <strong>extracting the complete code is a no-brainer</strong>!</p>
<p>Combining this with the fact that <strong>sniffing into the client-server communication</strong> is also not the most difficult task, one can easily simulate the Flash client with own code snippets and scripts, and thereby send <strong>forged requests</strong> to the server.</p>
<h4 id="Checksums-as-a-solution" >1.2. Checksums as a solution?</h4>
<p>Most application developers at least know that the client-server communication can be sniffed into. As an attempt to make it more difficult for people to send forged requests to the server, applications mostly use a message authentication code (MAC) or some other checksum-based mechanism. So instead of sending a plain text update query to the server (1), the application creates a hash by concatenating the user input with (to the user unknown) other data (2):</p>
<table style="width: 90%; margin: 5px auto; line-height: 130%" border="0">
<tr class="toprow">
<td style="width: 50%; text-align: left; font-size: 12px; padding: 5px">(1) Without checksum mechanism</td>
<td style="width: 50%; text-align: left; font-size: 12px; padding: 5px">(2) With checksum mechanism</td>
</tr>
<tr class="odd">
<td style='width: 50%; vertical-align: top; text-align: left; font-size: 12px; padding: 5px'>
<b>POST</b> /write-highscore.php <b>HTTP/1.1</b><br />
<b>Host</b>: www.example.com<br />
<b>User-Agent</b>: Mozilla/5.0 &#8230;<br />
&#8230;<br />
name=Phil&#038;score=40
</td>
<td style='width: 50%; vertical-align: top; text-align: left; font-size: 12px; padding: 5px'>
<b>POST</b> /write-highscore.php <b>HTTP/1.1</b><br />
<b>Host</b>: www.example.com<br />
<b>User-Agent</b>: Mozilla/5.0 &#8230;<br />
&#8230;<br />
name=Phil&amp;score=40&amp;<span style="color: red; font-weight: bold">check=283647a&#8230;</span>
</td>
</tr>
</table>
<p>This mechanism is completely based on the fact that the user does not know how the checksum is created. While this approach is very effective in regular applications, it completely fails in Flash programs: disassembling a Windows or Linux binary is very difficult and requires know how in assembler. Decompiling SWF files, however, is fairly easy and can be done in under a minute. That is retrieving the code that generates the checksum is only a matter of seconds.</p>
<h4 id="Tools-and-basic-approach" >1.3. Tools and basic approach</h4>
<p>The following steps present a generic approach on how any Flash application can be exploited like described above. </p>
<p><strong>Required Tools</strong>:</p>
<ul>
<li><a href="https://addons.mozilla.org/en-us/firefox/addon/firebug/">Firebug</a>: Firefox plugin for basic communication sniffing</li>
<li><a href="http://www.sothink.com/product/flashdecompiler/">Sothink Flash Decompiler</a>: required to extract ActionScript code (trial version is sufficient)</li>
<li><a href="http://www.wireshark.org/">Wireshark</a>: required for detailed communication sniffing (byte-for-byte)</li>
</ul>
<p><strong>Generic Approach</strong>:</p>
<ol>
<li>Enable Firebug and start sniffing with Wireshark.</li>
<li>Go to the target web site and play the game or use the application.</li>
<li>Look at the communication of the Flash application with the server. If there are any parts of the requests that cannot be recreated without the source code, e.g. checksums, download the important SWF files and decompile them.</li>
<li>Analyze the ActionScript code and find the part which creates the checksum.</li>
<li>Make a script that generates the same request with arbitrary input data, e.g. any score or name. For this script, the checksum algorithm from the ActionScript code can be used (or recreated).</li>
</ol>
<h3 id="Case-study-a-car-parking-game" >2. Case study: a car parking game (with high score)</h3>
<p>Our local newspaper <a href="http://www.morgenweb.de/">Mannheimer Morgen</a> recently hosted a competition in which users had to park a (virtual) car into different parking spots without damaging the car and with minimal fuel usage. Prizes were a safety training and concert tickets. While in this case the score of the participants did not decide who won (winners were drawn by lot), the winner in other competitions might be the one with the best score. <em>Please note that I did not take part in this competition and I did under no circumstances try to win the prizes.</em></p>
<p><img src="http://blog.philippheckel.com/wp-content/uploads/2011/02/parking-screenshot.png" alt="" title="parking-screenshot" width="450" height="349" class="aligncenter size-full wp-image-729" style="border: 0" /></p>
<p style="text-align: center; font-size: .8em; line-height: 115%"><strong>Parking Game</strong>: The target application in this case is a game called &#8220;Parking&#8221;.</p>
<h4 id="Capture-the-client-server-communication" >2.1. Capture the client-server communication</h4>
<p>Following the instructions from above, the first step is to capture the communication between the Flash client and the server. In this case, we are particularly interested in how to <strong>add our name with an arbitrary score to the high score list</strong>.</p>
<p><strong>Firebug</strong>:<br />
Using Firebug, we can see three interesting requests: </p>
<ul>
<li><em>savescore.swf</em> is the part of the client that is responsible for sending the score to the server.</li>
<li><em>serverdate-read.php</em> is called by savescore.swf for no obvious reason &#8211; very suspicious. We will later see that the result is used in the checksum generation.</li>
<li><em>highscore-write.php</em> is also called by savescore.swf and actually writes the user&#8217;s score to the database on the server.</li>
</ul>
<p><img src="http://blog.philippheckel.com/wp-content/uploads/2011/02/firebug.png" alt="" width="500" height="399" class="aligncenter size-full wp-image-735" /></p>
<p style="text-align: center; font-size: .8em; line-height: 115%"><strong>Firebug</strong> identifies the interesting files and requests.<br />In this case, three requests are relevant for the high score forgery.</p>
<p>What is particularly important is the two parameters <b>__ctrl</b> and <b>controlvalue</b>. Both are obviously generated by some checksum function in the <em>savescore.swf</em>-file. So the next step is to decompile the SWF file and look for the checksum-generating function.</p>
<p><strong>Wireshark</strong>:<br />
If we additionally enable Wireshark, we can get a plain text (or hex) representation of the HTTP request-response cycle. That is particularly important if one wants to forge a request in a way that it cannot be detected by the server. </p>
<h4 id="Decompile-the-SWF-file-and-find-the-checksum-algorithm" >2.2. Decompile the SWF file and find the checksum algorithm</h4>
<p>Using the SWF Decompiler software (trial version is sufficient), the <em>savescore.swf</em> can be examined very closely. Most of the applications are not very complex and the relevant code pieces are found very easily.</p>
<p><img src="/wp-content/uploads/2011/02/swfdecompile.png" alt="" width="500" height="334" class="aligncenter size-full wp-image-742" /></p>
<p>When analyzing <em>savescore.swf</em>, the two parts in which the checksums are created are found at different positions in the file. The <b>__ctrl</b> parameter is generated by taking a MD5 hash over the two concatenated values of <em>score</em> and <em>email</em>. The <b>controlvalue</b> parameter is created in a similar fashion and involves the previously queried <em>serverdate</em>.</p>
<p><img src="/wp-content/uploads/2011/02/checksum1.png" alt="" width="491" height="197" class="aligncenter size-full wp-image-740" /></p>
<p style="text-align: center; font-size: .8em; line-height: 115%">The <b>__ctrl</b> parameter is a hash value over two of the variable input parameters.<br />The <b>controlvalue</b> parameter is created similarly.</p>
<h4 id="Write-a-script" >2.3. Write a script</h4>
<p>Once it is clear how the checksums are generated, the puzzle is solved. The only thing left is to write a script that allows entering arbitrary input values, and using the previously determined checksum-mechanisms to generate a MAC.</p>
<p>Here is a short excerpt of how this could look like (using PHP):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$score</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;999.999&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;nobody@example.com&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">&quot;__ctrl&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$score</span><span style="color: #339933;">.</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	<span style="color: #339933;">...</span>
	<span style="color: #0000ff;">&quot;score&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$score</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;controlvalue&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">...</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	<span style="color: #339933;">...</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> 
	<span style="color: #000088;">$data_enc</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$req</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST /parking/highscore-write.php HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
     <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;Host: www.morgenweb.de<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
     <span style="color: #339933;">...</span>
     <span style="color: #339933;">.</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data_enc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;www.morgenweb.de&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>	
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3 id="Conclusion" >3. Conclusion</h3>
<p>This blog post introduced a common way to outsmart Flash applications and games. It demonstrated that by sniffing into client-server communication and decompiling SWF files, many Flash applications can be misused. Using the example of a Flash game, the post showed that SWF cannot be compared to Windows/Linux binaries, but must rather be seen as JavaScript-like client code. </p>
<p>Even though this post only demonstrated this using a rather harmless game, more serious misuse is also possible. Flash-based music streaming sites such as <a href="http://www.simfy.com/">Simfy</a>, <a href="http://www.spotify.com/">Spotify</a> <a href="http://www.grooveshark.com/">Grooveshark</a> are affected as well. They all use a similar mechanism for their Flash-based music player. Using the approach presented above combined with tools like <em>rtmpdump</em> can potentially harm their services significantly.</p>
<p>Flash once was a great way for bringing a little dynamic in the Web 1.0, but is no outdated. With various JavaScript frameworks and HTML5 on the way, Flash is going to retire soon. Developers and companies must be aware of the flaws of Flash and adjust their services accordingly to make sure that they cannot be misused.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2011/03/01/hacking-flash-games-a-case-study/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simsafe: Simple command-line password safe</title>
		<link>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</link>
		<comments>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:20:29 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[GPG]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</guid>
		<description><![CDATA[Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine requires to create lots of different users for every kind of service, &#8212; be it Postfix, Sendmail, Courier, MySQL, PostgreSQL, etc. Most of them require some kind of super-user password or account.</p>
<p>This is where a password manager comes in handy: Open the password vault by typing in the master password, put in all you secrets and crucial information, save it and be happy. <em>As if!</em></p>
<p>Almost every password manager I found on the Web was crowded out by details so that it took minutes to add a single account. What I wanted was something like a text-file with password &#8212; and that&#8217;s what I made: <strong>A simple command-line password safe</strong>.</p>
<p><span id="more-22"></span></p>
<h3 id="toc-how-it-works">How it works</h3>
<p>Simsafe is nothing else but a simple Perl script wrapped around the symmetric encryption functions of GPG. Every box with GPG and Perl installed can hence use the script (= every linux box!). And even if the <em>simsafe</em>-script is not installed on the system, a simple <em>gpg &#8211;decrypt FILE</em> shows the plain text contents. That is, Simsafe files are nothing more but <strong>text-files with password!</strong></p>
<h3 id="toc-usage">Usage</h3>
<p>It&#8217;s simple and really easy to use.<br />
Syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe FILE</pre></div></div>

<h4 id="toc-create-a-new-password-safe-file">Create a new password safe file</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Creating a new password safe 'mySafe'
simsafe: Please enter the new password: (type in your password)
simsafe: Please confirm the password: (confirm your password)
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Encrypting with GPG ...</pre></div></div>

<h4 id="toc-addingremoving-entries-to-the-password-vault">Adding/Removing entries to the password vault</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Please enter the safe password: (type in your password)
simsafe: Decrypting with GPG ...
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Safe unchanged.</pre></div></div>

<h3 id="toc-get-it">Get it!</h3>
<p>It&#8217;s a reeeaallly small script and this post is possible longer than the perl-file itself, but here it is. Simply download it, make it executable and put it somewhere in your PATH.</p>
<p><strong>Download:</strong> <a href="/uploads/2009/04/simsafe">Simsafe v0.1, Apr. 2009</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KadS: a secure version of the Kademlia protocol</title>
		<link>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/</link>
		<comments>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 15:56:40 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Distributed Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Kademlia]]></category>
		<category><![CDATA[Peer-to-Peer]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/</guid>
		<description><![CDATA[There are various peer-to-peer protocols out there. All of them focus the decentralisation of storage and other system resources. Most implement a distributed hash table (DHT) to store information. That is, each node of the network only holds a small part of the hash table but is able to locate and retrieve any requested entry. [...]]]></description>
			<content:encoded><![CDATA[<p>There are various peer-to-peer protocols out there. All of them focus the decentralisation of storage and other system resources. Most implement a distributed hash table (DHT) to store information. That is, each node of the network only holds a small part of the hash table but is able to locate and retrieve any requested entry. <a href="http://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf">Kademlia</a>, a protocol designed by two <a href="http://www.nyu.edu/">NYU</a> students in 2002, is one of them.</p>
<p><span id="more-21"></span></p>
<h3 id="toc-the-kademlia-protocol">The Kademlia Protocol</h3>
<p>Kademlia is based on four simple remote procedure calls (RPCs) and guarantees a very fast and lightweight exchange of information by using the connection-less UDP instead of TCP. Every node as well as every entry of the DHT is tagged with an identifier, called <em>node ID</em> or <em>key</em>. By XORing identifiers, one can calculate the distance between them and is hence able to walk through the network knowing whether one is near or far to a specific node. This so called <em>XOR metric</em> makes it possible to group the entries of the DHT around the K closest nodes to the entry&#8217;s key. An entry with the key 10, for instance, will be stored at the nodes with a node ID close to 10.</p>
<h3 id="toc-kademlia-pki-kads-the-secure-extension">Kademlia + PKI = KadS: The Secure Extension</h3>
<p>In my Bachelor thesis, I am going to extend Kademlia from a simple peer-to-peer protocol to a <em>trusted</em> and <em>secure</em> network. The proposed KadS network is almost identical to the Kademlia network, i.e. it consists of the described RPCs and implements the same XOR metric. The major extension to the protocol is that every node is equipped with a public/private key-pair signed by a trusted CA. This extends the normal Kademlia network to a public key infrastructure (PKI) in which every communication is encrypted, every node can be trusted and only verified nodes can participate in the network.</p>
<p>Every connection is synchronously encrypted with a session key which is created and exchanged in a handshake procedure when two nodes first meet. That is, a node has a different session key for the connection with each node it knows in the network. The handshake is similar to the one used in other software except for the fact that both clients exchange their public key and need to verify each others identity. After a successful handshake, two nodes are able to exchange lightweight encrypted messages using the session key and the basic protocol applies</p>
<h3 id="toc-an-application-the-distributed-url-blacklisting-service">An application: The distributed URL blacklisting service</h3>
<p>As an application to the proposed KadS network, I chose a distributed URL blacklisting service. Please read more in my <a href="/uploads/2009/03/kads-url-blacklisting-2009-thesis-expose.pdf">Bachelor thesis exposé</a>, or simply download the whole thesis: </p>
<p><a href="/uploads/2009/05/Blacklisting-Malicious-Web-Sites-using-a-Secure-Version-of-the-DHT-Protocol-Kademlia.pdf">Blacklisting Malicious Web Sites using a Secure Version of the DHT Protocol Kademlia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

