<?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>Lukas&#039; Weblog</title>
	<atom:link href="http://lukas-prokop.at/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://lukas-prokop.at/blog</link>
	<description>tail -f /var/log/web</description>
	<lastBuildDate>Wed, 01 Feb 2012 10:44:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>BRGproj docu</title>
		<link>http://lukas-prokop.at/blog/2012/02/brgproj-docu/</link>
		<comments>http://lukas-prokop.at/blog/2012/02/brgproj-docu/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 10:44:36 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[BRG3]]></category>
		<category><![CDATA[BRGblog]]></category>
		<category><![CDATA[BRG_HP]]></category>
		<category><![CDATA[Projekte]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2208</guid>
		<description><![CDATA[Als ich 2008 das BRG Viktring Schülerforum abschaltete, planten wir von Anfang an eine informative Nachlassseite, die unsere gemeinsame Zeit dokumentieren soll. Dieses Ziel wurde jetzt für mich erreicht und ich möchte eine Dokumentation der abgeschalteten BRGproj veröffentlichen. Dies inkludiert: &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2012/02/brgproj-docu/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Als ich 2008 das BRG Viktring Schülerforum abschaltete, planten wir von Anfang an eine informative Nachlassseite, die unsere gemeinsame Zeit dokumentieren soll. Dieses Ziel wurde jetzt für mich erreicht und ich möchte eine Dokumentation der abgeschalteten BRGproj veröffentlichen. Dies inkludiert:</p>
<ul>
<li>BRG_HP (homepage)</li>
<li>BRG3 / BRG4 (board)</li>
<li>BRGblog (weblog)</li>
<li>BRGwiki (wiki)</li>
<li>BMS (blog management system)</li>
<li>BDB (BRGproj development blog)</li>
</ul>
<p>&gt;&gt;&gt; zur <a href="http://lukas-prokop.at/proj/documents/brgproj/">Dokumentation</a></p>
<p>Sie zeigt Zeitleisten, Statistiken und beschreibt die Ereignisse rund um meine ersten Softwareprojekte.</p>
<p>Großer Dank an Peter, Stefan und Toja! <img src='http://lukas-prokop.at/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2012/02/brgproj-docu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aren&#8217;t we supposed to check for SQL-injection?</title>
		<link>http://lukas-prokop.at/blog/2012/01/sql-injection/</link>
		<comments>http://lukas-prokop.at/blog/2012/01/sql-injection/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 19:17:12 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[Universität]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2200</guid>
		<description><![CDATA[&#62; 2) Aren&#8217;t we supposed to check for SQL-injection? No, the course has nothing to do with security. via tugraz Newsgroup. &#60;IMHO&#62;I agree, that you should not mix up course contents. But I disagree that good practice should not be &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2012/01/sql-injection/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote>
<p>&gt; 2) Aren&#8217;t we supposed to check for SQL-injection?<br />
No, the course has nothing to do with security. </p>
</blockquote>
<p>via tugraz Newsgroup.</p>
<p>&lt;IMHO&gt;I agree, that you should not mix up course contents. But I disagree that good practice should not be taught. So: Disagree.&lt;/IMHO&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2012/01/sql-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How FLOSS does not work</title>
		<link>http://lukas-prokop.at/blog/2011/12/how-floss-does-not-work/</link>
		<comments>http://lukas-prokop.at/blog/2011/12/how-floss-does-not-work/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 18:28:14 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[software & technology]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2037</guid>
		<description><![CDATA[Pythonists are working on a stackoverflow alternative publicly available in the pypi ([pypi] [website] [github]). At the same time a company is working on a stackoverflow alternative privately for a customer. Please repeat yourself and reinvent the wheel. This is &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/12/how-floss-does-not-work/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Pythonists are working on a stackoverflow alternative publicly available in the pypi (<a href="http://pypi.python.org/pypi/askbot/0.7.20">[pypi]</a> <a href="http://askbot.org/">[website]</a> <a href="https://github.com/ASKBOT/askbot-devel/">[github]</a>). At the same time a company is working on a stackoverflow alternative privately for a customer.</p>
<p>Please repeat yourself and reinvent the wheel. This is where the software industry is going nowadays. The boundaries between company contexts and voluntary projects are too broad to be crossed in a copyright-driven society.</p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/12/how-floss-does-not-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The top 10 signs you&#8217;re a computer scientist</title>
		<link>http://lukas-prokop.at/blog/2011/12/the-top-10-signs-youre-a-computer-scientist/</link>
		<comments>http://lukas-prokop.at/blog/2011/12/the-top-10-signs-youre-a-computer-scientist/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 16:48:08 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[Lustiges]]></category>
		<category><![CDATA[Universität]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2190</guid>
		<description><![CDATA[You explain your kids the clock using the word &#8220;modulo&#8221; If you terminate all your sentences with a NULL byte\0 If you extend your 101-keys-keyboard for 42 more keys If you answer infinity calculations in math courses with &#8220;BufferOverflow&#8221; If &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/12/the-top-10-signs-youre-a-computer-scientist/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<ol>
<li>You explain your kids the clock using the word &#8220;modulo&#8221;</li>
<li>If you terminate all your sentences with a NULL byte\0</li>
<li>If you extend your 101-keys-keyboard for 42 more keys</li>
<li>If you answer infinity calculations in math courses with &#8220;BufferOverflow&#8221;</li>
<li>If you have to <code>andl $-16, %esp</code> your priority queue if your boss assigns you a new task</li>
<li>If you think you know more about inheritance than biologists</li>
<li>If execution, command and kill are harmless words for you</li>
<li>If you think that 2 spaces are missing in the source code, but you cannot explain <em>the why</em> to someone else.</li>
<li>If <code>(0.1 + 0.7) * 10</code> is anything else than 8 for you</li>
<li>You expected a list with 10<sub>2</sub> elements here</li>
</ol>
<p>based on <a href="http://spikedmath.com/456.html">spikedmath:456</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/12/the-top-10-signs-youre-a-computer-scientist/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Harvard CS75</title>
		<link>http://lukas-prokop.at/blog/2011/11/harvard-cs75/</link>
		<comments>http://lukas-prokop.at/blog/2011/11/harvard-cs75/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 21:57:15 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[Universität]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2193</guid>
		<description><![CDATA[Just some short notes/comparisons about watching the CS 75 course of Harvard university (you can download it at cs75.tv): There is more interaction between students and professors than here. Students here prefer not to question lecture content and questions to &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/11/harvard-cs75/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Just some short notes/comparisons about watching the <a href="https://www.cs75.net/Main_Page">CS 75</a> course of Harvard university (you can download it at <a href="http://cs75.tv/2010/fall/">cs75.tv</a>):</p>
<ul>
<li>There is more interaction between students and professors than here. Students here prefer not to question lecture content and questions to the audience have higher response times than in Harvard. I think one of the major reasons include the missing reaction to problems (&#8220;XY at slide Z is incorrect&#8221; will be ignored even though the lecturer agreed at the lecture).</li>
<li>The professor is well prepared and has a specific topic to finish in one lecture. Whereas the second is true in most cases here, the first one cannot be satisfied by slides of previous years and out-dated course websites</li>
<li>Specifically about this topic: The first OOP source code of PHP you will see here is out-dated PHP 4. Even though there are more lectures, topics like scalability are not part of the course here.</li>
</ul>
<p>Liked it <img src='http://lukas-prokop.at/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/11/harvard-cs75/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First marzipan experiments</title>
		<link>http://lukas-prokop.at/blog/2011/11/first-marzipan-experiments/</link>
		<comments>http://lukas-prokop.at/blog/2011/11/first-marzipan-experiments/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 07:26:56 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[Leben]]></category>
		<category><![CDATA[Lustiges]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2185</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div id="attachment_2186" class="wp-caption aligncenter" style="width: 310px"><a href="http://lukas-prokop.at/blog/wp-content/uploads/2011/11/marzipan1.jpg"><img src="http://lukas-prokop.at/blog/wp-content/uploads/2011/11/marzipan1-300x225.jpg" alt="Marzipan figures animals photo" width="300" height="225" class="size-medium wp-image-2186" /></a><p class="wp-caption-text">Marzipan Animals</p></div>
<div id="attachment_2187" class="wp-caption aligncenter" style="width: 310px"><a href="http://lukas-prokop.at/blog/wp-content/uploads/2011/11/marzipan2.jpg"><img src="http://lukas-prokop.at/blog/wp-content/uploads/2011/11/marzipan2-300x225.jpg" alt="Marzipan figures animals 2nd photo" width="300" height="225" class="size-medium wp-image-2187" /></a><p class="wp-caption-text">Marzipan animals</p></div>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/11/first-marzipan-experiments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inkscape PDF Export stopped working</title>
		<link>http://lukas-prokop.at/blog/2011/11/inkscape-pdf-export-stopped-working/</link>
		<comments>http://lukas-prokop.at/blog/2011/11/inkscape-pdf-export-stopped-working/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 12:29:29 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[software & technology]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2181</guid>
		<description><![CDATA[Save As Copy with extension pdf worked very well for almost a year. Suddenly it stopped working. PDF export resulted in File {FILENAME}.pdf could not be saved. Very uncomfortable for me as far as I am using SVGs on a &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/11/inkscape-pdf-export-stopped-working/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><q>Save As Copy</q> with extension pdf worked very well for almost a year. Suddenly it stopped working. PDF export resulted in <q>File {FILENAME}.pdf could not be saved</q>. Very uncomfortable for me as far as I am using SVGs on a regular basis.</p>
<p>The internet is filled up the bug reports&#8230; some are having specific plugin problems, some only get blank PDF pages. Well&#8230; <a href="https://answers.launchpad.net/inkscape/+question/99089">this Inkscape 0.47 bug report</a> got the solution for me. Remove the preferences.xml file (for me ~/.config/inkscape/preferences.xml) and Inkscape will create a new one when starting up.</p>
<p>What is the reason? I think some important package got upgraded and Inkscape is holding some old, conflicting information about this package.</p>
<p><strong>Tags:</strong> Inkscape 0.47 pdf export SVG could not be saved preferences cairo</p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/11/inkscape-pdf-export-stopped-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>switch/case in assembly</title>
		<link>http://lukas-prokop.at/blog/2011/10/switchcase-in-assembly/</link>
		<comments>http://lukas-prokop.at/blog/2011/10/switchcase-in-assembly/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 00:16:46 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[software & technology]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2178</guid>
		<description><![CDATA[Because of a discussion with my brother I got curious about the internal handling of switch/case statements in assembly. So I compiled the stuff and studied it. Furthermore I wrote an article about it. I thought an external document is &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/10/switchcase-in-assembly/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Because of a discussion with my brother I got curious about the internal handling of switch/case statements in assembly. So I compiled the stuff and studied it. Furthermore I wrote an article about it. I thought an external document is a better approach:</p>
<p><a href="http://lukas-prokop.at/proj/documents/hashtable.html">&#8220;switch in amd64 assembly&#8221;</a> [HTML]</p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/10/switchcase-in-assembly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twiki and 8 character passwords</title>
		<link>http://lukas-prokop.at/blog/2011/10/twiki-and-8-character-passwords/</link>
		<comments>http://lukas-prokop.at/blog/2011/10/twiki-and-8-character-passwords/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 23:55:23 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[software & technology]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2150</guid>
		<description><![CDATA[At university, TWiki is a pretty common software. At least at the second Google search results page (for &#8220;twiki&#8221; as search term) I can see some twiki running at our university&#8217;s webserver. TWiki is written in perl and I will &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/10/twiki-and-8-character-passwords/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>At university, <a href="http://twiki.org/">TWiki</a> is a pretty common software. At least at the second Google search results page (for &#8220;twiki&#8221; as search term) I can see some twiki running at our university&#8217;s webserver. TWiki is written in perl and I will refer to the deprecated 4.1.x version which was my test system. I got annoyed by limited security for passwords. Passwords are limited to 8 characters.</p>
<h4>Login Managers</h4>
<p>During installation you will face a select field like this (in the &#8220;Security Setup&#8221; section):</p>
<p style="text-align:center"><a href="http://lukas-prokop.at/blog/wp-content/uploads/2011/10/twiki_loginmanager.png"><img src="http://lukas-prokop.at/blog/wp-content/uploads/2011/10/twiki_loginmanager-300x148.png" alt="Twiki Loginmanager in Installation" title="twiki_loginmanager" width="300" height="148" /></a></p>
<p>All those selections refer to different password management backends. <code>Twiki::Client::ApacheLogin</code> is implemented by <code>/twiki/lib/TWiki/Users/ApacheHtPasswdUser.pm</code> and <code>Twiki::Client::TemplateLogin</code> is implemented by <code>/twiki/lib/TWiki/Users/HtpasswdUser.pm</code>. In <code>/twiki/lib/TWiki/Users/Password.pm</code> the <a href="http://twiki.org/cgi-bin/view/TWiki04/TWikiUsersPasswordDotPm">interface</a> is defined. You can check out funny source code sequences like this:</p>
<div class="syntax perl"> 86 <span class="cm">&#8212;++ ObjectMethod checkPassword( $user, $passwordU ) -&gt; $boolean</span><br />
 87<br />
 88 <span class="cm">Finds if the password is valid for the given login.</span><br />
 89<br />
 90 <span class="cm">Returns 1 on success, undef on failure.</span><br />
 91<br />
 92 <span class="cm">=cut</span><br />
 93<br />
 94 <span class="k">sub </span><span class="nf">checkPassword</span> <span class="p">{</span><br />
 95    <span class="k" style="margin-left:30px">return</span> <span class="mi">1</span><span class="p">;</span><br />
 96 <span class="p">}</span></div>
<p>Well&#8230; this is our interface. Let&#8217;s have deeper look into the implementation.</p>
<h4>Twiki::Client::ApacheLogin</h4>
<p><a href="http://www.france-vo.org/twiki/bin/view/TWiki/TWikiUserAuthentication#Apache_Login_select_TWiki_Client">ApacheLogin</a> uses the Apache interface to send <a href="http://en.wikipedia.org/wiki/Http_status_codes#4xx_Client_Error">401 HTTP Status codes</a>. If the client receives one of those status codes, a Username and Password Dialog pops up.</p>
<p style="text-align:center"><a href="http://lukas-prokop.at/blog/wp-content/uploads/2011/10/401_password_dialog.png"><img src="http://lukas-prokop.at/blog/wp-content/uploads/2011/10/401_password_dialog.png" alt="Password Dialog for 401 Status Codes" title="401_password_dialog" width="387" height="247" /></a></p>
<p>Using this dialog, the login information will be sent to the server. Using a loop in perl, we can print out what the server receives as CGI variables (the ones defined by the server and given to the perl interpreter). I have put the following source code into <code>/twiki/lib/Twiki/Users/HtPasswdUser.pm</code> subroutine <code>new</code> (don&#8217;t forget to <a href="http://twiki.org/cgi-bin/view/Codev/TWikiDebugging">include Data::Dumper</a>).</p>
<div class="syntax perl">    <span class="k">my</span> <span class="nv">$key</span><span class="p">;</span><br />
    <span class="k">foreach</span> <span class="nv">$key</span> <span class="p">(</span><span class="nb">sort</span><span class="p">(</span><span class="nb">keys</span> <span class="nv">%ENV</span><span class="p">))</span> <span class="p">{</span><br />
        <span class="k">print</span> <span class="bp">STDERR</span> <span class="nn">Data::</span><span class="n">Dumper</span><span class="o">-&gt;</span><span class="n">Dump</span><span class="p">([</span> <span class="nv">$ENV</span><span class="p">{</span><span class="nv">$key</span><span class="p">}</span> <span class="p">]</span><span class="o">,</span> <span class="p">[</span><span class="nv">$key</span><span class="p">]</span>);<br />
    <span class="p">}</span></div>
<p>From the Apache log, we will get the following information.</p>
<pre>[...]
HTTP_COOKIE = 'TWIKISID=d00fe404e65832f9d95658d6d9112bec';, referer: /twiki/bin/logon/TWiki/TWikiRegistration
[...]
REDIRECT_REMOTE_USER = 'LukasProkop';, referer: /twiki/bin/logon/TWiki/TWikiRegistration
[...]
REDIRECT_STATUS = '401';, referer: /twiki/bin/logon/TWiki/TWikiRegistration
[...]
</pre>
<p>Actually I was looking for REMOTE_USER, which is a CGI variable only defined when Authorization was done. The cookie is not really interesting, but REDIRECT_STATUS approves that auth was done. REDIRECT_REMOTE_USER seems to be REMOTE_USER I am looking for&#8230; in some way. Alright&#8230; so what do we have here? Well&#8230; password and username associations are tested automatically by the Apache server and perl will not receive the password itself. Perl can assume that auth was done successfully and does not recognize it any further. Alright. So we have to determine where the passwords are stored.</p>
<p>Passwords for <a href="http://httpd.apache.org/docs/2.0/mod/mod_auth.html">mod_auth</a> are stored in <code>.htpasswd</code> files. A small UNIX <code>find</code> will return <code>/twiki/data/.htpasswd</code>. This file is updated for each change by the perl script.</p>
<pre>LukasProkop:11/Yysc0Op9D2:unixuser@localhost</pre>
<p>So the password is stored as a hash associated with the Login name and the local user name. Now let&#8217;s come to our real topic: Passwords with more than 8 characters. Let us create some additional accounts.</p>
<table style="width:100%">
<thead>
<tr>
<td>Username</td>
<td>Password</td>
</tr>
</thead>
<tbody>
<tr>
<td>KarlOrff</td>
<td>1234567</td>
</tr>
<tr>
<td>CamrinaBurana</td>
<td>123456789</td>
</tr>
<tr>
<td>DiesIrae</td>
<td>123456789123456789</td>
</tr>
<tr>
<td>SixteAjoutee</td>
<td>123456768912345678<strong>0</strong></td>
</tr>
</tbody>
</table>
<p>Well&#8230; our <code>.htpasswd</code> says:</p>
<pre>CarminaBurana:UXjIprwRygc1.:unixuser@localhost
DiesIrae:UtCp6NoUsQdaQ:unixuser@localhost
KarlOrff:7kQC9KJ/39yA.:unixuser@localhost
LukasProkop:11/Yysc0Op9D2:unixuser@localhost
SixteAjoutee:R07ipKyeiYlho:unixuser@localhost</pre>
<p>Now let&#8217;s log in with various accounts. As far as Twiki does not support a Logout button, the most comfortable way is to delete the cookie (see above) and refresh the page. Now we can see our problem: SixteAjoutee and DiesIrae can log in with each other ones password. The strange thing is, that their hashes are different. Our source code journey goes on&#8230;</p>
<h4>Violation of second-preimage resistance?</h4>
<pre>$TWiki::cfg{Htpasswd}{Encoding} = 'crypt';</pre>
<p>Our configuration file at <code>/twiki/lib/LocalSite.cfg</code> defines a variable for the various encoding algorithms. Of course such a variable is a perfect name to search for. The <code>configure</code> uses this variable, but HtPasswdUser.pm is the only other file.</p>
<p>The file encrypting the password is <code>HtPasswdUser.pm</code> at line 134. This file will apply the <a href="http://osix.net/modules/article/?id=571">crypt function</a> with a random salt to the password. The salt is 2 characters in length and stored at the front of the <strong>actually stored password</strong>. A small test script reveals the truth:</p>
<div class="syntax perl"><span class="k">print</span> <span class="nb">crypt</span><span class="p">(</span><span class="s">&quot;123456789123456789&quot;</span><span class="p">,</span> <span class="s">&quot;Ut&quot;</span><span class="p">)</span> <span class="ow">eq</span> <span class="s">&quot;UtCp6NoUsQdaQ&quot;</span><span class="p">;</span><br />
<span class="k">print</span> <span class="nb">crypt</span><span class="p">(</span><span class="s">&quot;123456789123456780&quot;</span><span class="p">,</span> <span class="s">&quot;R0&quot;</span><span class="p">)</span> <span class="ow">eq</span> <span class="s">&quot;R07ipKyeiYlho&quot;</span><span class="p">;</span></div>
<p>So there we have our problem. crypt uses the DES algorithm from the operating system and is limited to an input of 8 characters.</p>
<div class="syntax perl"><span class="k">print</span> <span class="nb">crypt</span><span class="p">(</span><span class="s">&quot;12345678B&quot;</span><span class="p">,</span> <span class="s">&quot;Ut&quot;</span><span class="p">)</span> <span class="ow">eq</span> <span class="s">&quot;UtCp6NoUsQdaQ&quot;</span><span class="p">;</span><br />
<span class="k">print</span> <span class="nb">crypt</span><span class="p">(</span><span class="s">&quot;12345678A&quot;</span><span class="p">,</span> <span class="s">&quot;R0&quot;</span><span class="p">)</span> <span class="ow">eq</span> <span class="s">&quot;R07ipKyeiYlho&quot;</span><span class="p">;</span></div>
<h4>The collision-free solution</h4>
<p>Of course the algorithm is the problem and a selection of another algorithm like sha1 (nope, <strong>no</strong> MD5!) would solve the problem. We do <em>not</em> rely on the <a href="http://google.at/search?q=unix+8+characters+password">operating system</a> or missing implementations of other crypto algorithms.</p>
<div class="syntax perl"><span class="c1">#!/usr/bin/perl -wT</span></p>
<p><span class="nb">require</span> <span class="nn">MIME::</span><span class="n">Base64</span><span class="p">;</span><br />
<span class="nb">import</span> <span class="nn">MIME::</span><span class="n">Base64</span> <span class="sx">qw( encode_base64 )</span><span class="p">;</span><br />
<span class="nb">require</span> <span class="nn">Digest::</span><span class="n">SHA1</span><span class="p">;</span><br />
<span class="nb">import</span> <span class="nn">Digest::</span><span class="n">SHA1</span> <span class="sx">qw( sha1 )</span><span class="p">;</span></p>
<p><span class="k">sub </span><span class="nf">get</span><br />
<span class="p">{</span><br />
    <span class="k">my</span><span class="p">(</span> <span class="nv">$passwd</span> <span class="p">)</span> <span class="o">=</span> <span class="nv">@_</span><span class="p">;</span></p>
<p>    <span class="k">my</span> <span class="nv">$encodedPassword</span> <span class="o">=</span> <span class="s">&#39;{SHA}&#39;</span><span class="o">.</span><br />
    <span class="nn">MIME::Base64::</span><span class="n">encode_base64</span><span class="p">(</span> <span class="nn">Digest::SHA1::</span><span class="n">sha1</span><span class="p">(</span> <span class="nv">$passwd</span> <span class="p">)</span> <span class="p">);</span><br />
    <span class="nv">$encodedPassword</span> <span class="o">=~</span> <span class="sr">s/\s+$//</span><span class="p">;</span><br />
    <span class="k">return</span> <span class="nv">$encodedPassword</span><span class="p">;</span><br />
<span class="p">}</span></p>
<p><span class="k">print</span> <span class="n">get</span><span class="p">(</span><span class="s">&quot;1234568B&quot;</span><span class="p">),</span> <span class="s">&quot;\n&quot;</span><span class="p">;</span><br />
<span class="k">print</span> <span class="n">get</span><span class="p">(</span><span class="s">&quot;1234568A&quot;</span><span class="p">),</span> <span class="s">&quot;\n&quot;</span><span class="p">;</span></div>
<p>This program returns two <strong>different</strong> hashes:</p>
<pre>{SHA}sgDumzcRNpPJL8tCgM18JIR1ayc=
{SHA}RsUxZFkQgYAeTdsPmIixTYEdFgg=</pre>
<h4>Migration</h4>
<p>How can thousands of user accounts be migrated to another algorithm? As far as the hash is stored as a one-way encrypted string, the encryption of the real password with another algorithm is almost impossible. I have written a small crypt() <a href="http://paste.pocoo.org/show/495254/">cracking program</a> in python (sorry, Perl <img src='http://lukas-prokop.at/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ), but of course it is way too slow; even for a single password. So the only solution is to reset all passwords of all users. First call the /twiki/bin/configure script and change the algorithm setting (&#8220;{Htpasswd}{Encoding}&#8221; in the &#8220;Security Setup&#8221; section) [0] and secondly, <a href="http://www.twiki.org/cgi-bin/view/Wiki/BulkResetPassword">BulkResetPassword</a> will help you reset the passwords for all users. It takes some effort and time, but in the end you will gain a higher level of security <img src='http://lukas-prokop.at/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />      </p>
<p>[0] It is also possible to directly modify the <code>$TWiki::cfg{Htpasswd}{Encoding}</code> line in <code>/twiki/lib/LocalSite.cfg</code></p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/10/twiki-and-8-character-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Bugfix file too large for wordpress importer</title>
		<link>http://lukas-prokop.at/blog/2011/09/howto-bugfix-file-too-large-for-wordpress-importer/</link>
		<comments>http://lukas-prokop.at/blog/2011/09/howto-bugfix-file-too-large-for-wordpress-importer/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 21:30:55 +0000</pubDate>
		<dc:creator>meisterluk</dc:creator>
				<category><![CDATA[software & technology]]></category>

		<guid isPermaLink="false">http://lukas-prokop.at/blog/?p=2106</guid>
		<description><![CDATA[During the update to WordPress 3.2, I encountered (like many other people) the problem with limitation of the filesize for file uploads. Per default PHP will set it to 2MB whereas my wordpress export backup file (XML) has already 4MB. &#8230;<p class="read-more"><a href="http://lukas-prokop.at/blog/2011/09/howto-bugfix-file-too-large-for-wordpress-importer/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>During the update to WordPress 3.2, I encountered (like many other people) the problem with limitation of the filesize for file uploads. Per default PHP will set it to 2MB whereas my wordpress export backup file (XML) has already 4MB. No, reconfiguring PHP&#8217;s <code>upload_max_filesize</code> was no option for me as far as the backup was already stored as a dump at the server. So my only thing to do was to replace the uploaded file with the already existing at the harddisk and make WordPress recognizing it. And this was not that difficult if you know where to look for. So here is my patch to get the wordpress-importer import a file already stored at the server hard disk. The wordpress export file to load has to be stored at <code>wp-content/uploads/wordpress.import.xml</code>.</p>
<div class="syntax">
<pre class="diff"><span class="gh">diff --git a/wp-content/plugins/wordpress-importer/wordpress-importer.php b/wp-content/plugins/wordpress-importer/wordpress-importer.php</span>
<span class="gh">index 5e38484..e0cace0 100644</span>
<span class="gd">--- a/wp-content/plugins/wordpress-importer/wordpress-importer.php</span>
<span class="gi">+++ b/wp-content/plugins/wordpress-importer/wordpress-importer.php</span>
<span class="gu">@@ -102,6 +102,7 @@ class WP_Import extends WP_Importer {</span>
         * @param string $file Path to the WXR file for importing
         */
        function import( $file ) {
<span class="gi">+               $file = ABSPATH . &#39;wp-content/uploads/wordpress.import.xml&#39;; #wp_import_handle_upload();</span>
                add_filter( &#39;import_post_meta_key&#39;, array( $this, &#39;is_valid_meta_key&#39; ) );
                add_filter( &#39;http_request_timeout&#39;, array( &amp;$this, &#39;bump_request_timeout&#39; ) );

<span class="gu">@@ -132,7 +133,7 @@ class WP_Import extends WP_Importer {</span>
        function import_start( $file ) {
                if ( ! is_file($file) ) {
                        echo &#39;&lt;p&gt;&lt;strong&gt;&#39; . __( &#39;Sorry, there has been an error.&#39;, &#39;wordpress-importer&#39; ) . &#39;&lt;/strong&gt;&lt;br /&gt;&#39;;
<span class="gd">-                       echo __( &#39;The file does not exist, please try again.&#39;, &#39;wordpress-importer&#39; ) . &#39;&lt;/p&gt;&#39;;</span>
<span class="gi">+                       echo __( &#39;The file &#39;.htmlspecialchars($file).&#39; does not exist, please try again.&#39;, &#39;wordpress-importer&#39; ) . &#39;&lt;/p&gt;&#39;;</span>
                        $this-&gt;footer();
                        die();
                }
<span class="gu">@@ -188,7 +189,7 @@ class WP_Import extends WP_Importer {</span>
         * @return bool False if error uploading or invalid file, true otherwise
         */
        function handle_upload() {
<span class="gd">-               $file = wp_import_handle_upload();</span>
<span class="gi">+               $file = array(&#39;id&#39; =&gt; 4869, &#39;file&#39; =&gt; ABSPATH . &#39;wp-content/uploads/wordpress.import.xml&#39;); #wp_import_handle_upload();</span>

                if ( isset( $file[&#39;error&#39;] ) ) {
                        echo &#39;&lt;p&gt;&lt;strong&gt;&#39; . __( &#39;Sorry, there has been an error.&#39;, &#39;wordpress-importer&#39; ) . &#39;&lt;/strong&gt;&lt;br /&gt;&#39;;
</pre>
</div>
<p>I did not put any further (compatibility) research into that issue. Worked for me™ with WordPress Version 3.2 and PHP Version 5.3.</p>
<p><a href="http://codex.wordpress.org/FAQ_Working_with_WordPress#Importing_and_Exporting">WordPress FAQ: Import and Export</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lukas-prokop.at/blog/2011/09/howto-bugfix-file-too-large-for-wordpress-importer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

