<?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>Kevin Deldycke &#187; hack</title> <atom:link href="http://kevin.deldycke.com/tag/hack/feed/" rel="self" type="application/rss+xml" /><link>http://kevin.deldycke.com</link> <description>Free software engineer &#38; wannabe videomaker</description> <lastBuildDate>Fri, 03 Feb 2012 19:08:27 +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>Got &#8220;unsized object&#8221; errors with Debian&#8217;s Mailman ? Try this patch !</title><link>http://kevin.deldycke.com/2008/12/got-unsized-object-errors-with-debian-mailman-try-this-patch/</link> <comments>http://kevin.deldycke.com/2008/12/got-unsized-object-errors-with-debian-mailman-try-this-patch/#comments</comments> <pubDate>Mon, 29 Dec 2008 18:02:22 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[bug]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[etch]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[mail]]></category> <category><![CDATA[mailman]]></category> <category><![CDATA[patch]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://kevin.deldycke.com/?p=459</guid> <description><![CDATA[Last week I came across a showstopper bug on Mailman 2.1.9-7, the current version of Mailman package distributed with Debian Etch. Here is the python traceback (from /var/log/mailman/error logfile) I get each time I&#8217;ve sent a mail to my brand &#8230; <a href="http://kevin.deldycke.com/2008/12/got-unsized-object-errors-with-debian-mailman-try-this-patch/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Last week I came across a showstopper bug on Mailman 2.1.9-7, the <a href="http://packages.debian.org/etch/mailman">current version of Mailman package distributed with Debian Etch</a>.</p><p>Here is the python traceback (from <code>/var/log/mailman/error</code> logfile) I get each time I&#8217;ve sent a mail to my brand new mailing-list:</p><pre class="brush: bash; title: ; notranslate">
Dec 20 01:20:04 2008 (14275) Uncaught runner exception: len() of unsized object
Dec 20 01:20:04 2008 (14275) Traceback (most recent call last):
  File &quot;/usr/lib/mailman/Mailman/Queue/Runner.py&quot;, line 112, in _oneloop
    self._onefile(msg, msgdata)
  File &quot;/usr/lib/mailman/Mailman/Queue/Runner.py&quot;, line 170, in _onefile
    keepqueued = self._dispose(mlist, msg, msgdata)
  File &quot;/usr/lib/mailman/Mailman/Queue/IncomingRunner.py&quot;, line 130, in _dispose
    more = self._dopipeline(mlist, msg, msgdata, pipeline)
  File &quot;/usr/lib/mailman/Mailman/Queue/IncomingRunner.py&quot;, line 153, in _dopipeline
    sys.modules[modname].process(mlist, msg, msgdata)
  File &quot;/usr/lib/mailman/Mailman/Handlers/ToDigest.py&quot;, line 81, in process
    mbox.AppendMessage(msg)
  File &quot;/usr/lib/mailman/Mailman/Mailbox.py&quot;, line 69, in AppendMessage
    g.flatten(msg, unixfrom=True)
  File &quot;/usr/lib/mailman/pythonlib/email/Generator.py&quot;, line 101, in flatten
    self._write(msg)
  File &quot;/usr/lib/mailman/pythonlib/email/Generator.py&quot;, line 136, in _write
    self._write_headers(msg)
  File &quot;/usr/lib/mailman/pythonlib/email/Generator.py&quot;, line 182, in _write_headers
    header_name=h, continuation_ws='\t').encode()
  File &quot;/usr/lib/mailman/pythonlib/email/Header.py&quot;, line 412, in encode
    newchunks += self._split(s, charset, targetlen, splitchars)
  File &quot;/usr/lib/mailman/pythonlib/email/Header.py&quot;, line 297, in _split
    elen = charset.encoded_header_len(encoded)
  File &quot;/usr/lib/mailman/pythonlib/email/Charset.py&quot;, line 354, in encoded_header_len
    raise repr(s)
TypeError: len() of unsized object

Dec 20 01:20:04 2008 (14275) SHUNTING: 1229732404.1069181+dcd89a08bf7911dac2db804b76cd42d20564c71c
</pre><p>Here is the corresponding (anonymized) mail sent to the mailing list from a Gmail account:</p><pre class="brush: bash; title: ; notranslate">
Received: by 10.180.244.13 with HTTP; Fri, 19 Dec 2008 16:32:22 -0800 (PST)
Message-ID: &lt;1f7b086f0812192632x7427c0f7u2048609ddd50673@mail.gmail.com&gt;
Date: Sat, 20 Dec 2008 01:32:22 +0100
From: &quot;Kevin&quot; &lt;kevin@my-domain.com&gt;
To: my-ml@lists.my-domain.com
Subject: sqdfqsdfqsfd
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Content-Disposition: inline
Delivered-To: kevin@my-domain.com

LS0KS2V2LgogIOKAoiBiYW5kOiBodHRwOi8vY29vbGNhdmVtZW4uY29tCiAg4oCiIGJsb2c6IGh0
dHA6Ly9rZXZpbi5kZWxkeWNrZS5jb20K
</pre><p>And now my hackish tale. Based on a quick look at Mailman&#8217;s source code, I made an educated guess that this error is just a side effect of the wrong assumption that the <code>s</code> variable in the <code>Charset.encoded_header_len()</code> method is always a string. So I came up with the following evil patch to handle (gracefully, I hope) the case of <code>s</code> being <code>None</code>.</p><p>Here is the <a href='http://kevin.deldycke.com/wp-content/uploads/2008/12/mailman-219-7-charset-handling.patch'>resulting patch</a> of my python-fu:</p><pre class="brush: diff; title: ; notranslate">
--- /usr/lib/mailman/pythonlib/email/Charset.py.orig   2008-12-28 19:46:23.000000000 +0100
+++ /usr/lib/mailman/pythonlib/email/Charset.py        2008-12-20 01:42:37.000000000 +0100
@@ -351,6 +351,7 @@
             lenqp = email.quopriMIME.header_quopri_len(s)
             return min(lenb64, lenqp) + len(cset) + MISC_LEN
         else:
+            return s is not None and len(str(s)) or 0
             return len(s)

     def header_encode(self, s, convert=False):
</pre><p>And it do the trick ! Of course I can&#8217;t guarantee that this patch is the way to definitely fix the bug. And it may corrupt data. So <strong>use it only if you&#8217;re as crazy as me</strong> ! <img src='http://kevin.deldycke.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p><p>But I know, I know&#8230; As a responsible and serious hacker (sigh), I should report this bug to the Debian or Mailman project. But I&#8217;m still not familiar with Dedian&#8217;s way of reporting bugs (and to be honest, I feel lazy these days :p ). Maybe, one day&#8230;</p> ]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2008/12/got-unsized-object-errors-with-debian-mailman-try-this-patch/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How-to add Google Analytics tracking to Zenphoto</title><link>http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/</link> <comments>http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/#comments</comments> <pubDate>Sat, 16 Aug 2008 20:49:55 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[analytics]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[patch]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Snippet]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[Zenphoto]]></category><guid isPermaLink="false">http://kevin.deldycke.com/?p=286</guid> <description><![CDATA[This is the patch I apply on each Zenphoto I install and upgrade. This little hack add Google Analytics tracking for all users except administrators. Why ? As you can see in ticket #441 in Zenphoto bugtracker, there is no &#8230; <a href="http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><img src="http://kevin.deldycke.com/wp-content/uploads/2008/08/zenphoto-12-150x23.png" alt="" title="zenphoto-12" width="150" height="23" class="alignleft size-thumbnail wp-image-299" /></p><p>This is the patch I apply on each <a href="http://www.zenphoto.org">Zenphoto</a> I install and upgrade. This little hack add <a href="http://www.google.com/analytics/">Google Analytics</a> tracking for all users except administrators.</p><p>Why ? As you can see in <a href="http://www.zenphoto.org/trac/ticket/441">ticket #441 in Zenphoto bugtracker</a>, there is no intention of adding support of GA in Zenphoto, even as an optional plugin. Hence my tiny hack. And for the non-admin stuff, I like having unbiased statistics: on low-audience websites, administrators can generate more traffic than legitimate users (if not all&#8230;).</p><p>Here is the <a href='http://kevin.deldycke.com/wp-content/uploads/2008/08/google-analytics-tracking-for-non-admin-users.patch'>downloadable patch file</a>, and its content:</p><pre class="brush: diff; title: ; notranslate">
diff -ru ./zenphoto-orig/zp-core/template-functions.php ./zenphoto/zp-core/template-functions.php
--- ./zenphoto-orig/zp-core/template-functions.php  2008-08-15 07:43:05.000000000 +0200
+++ ./zenphoto/zp-core/template-functions.php 2008-08-16 17:08:03.000000000 +0200
@@ -147,7 +147,16 @@

    echo &quot;&lt;li&gt;&lt;a href=\&quot;&quot;.$zf.&quot;/admin.php?logout$redirect\&quot;&gt;&quot;.gettext(&quot;Logout&quot;).&quot;&lt;/a&gt;&lt;/li&gt;\n&quot;;
    echo &quot;&lt;/ul&gt;&lt;/div&gt;\n&quot;;
- }
+ } else {
+    echo &quot;&lt;script type=\&quot;text/javascript\&quot;&gt;
+var gaJsHost = ((\&quot;https:\&quot; == document.location.protocol) ? \&quot;https://ssl.\&quot; : \&quot;http://www.\&quot;);
+document.write(unescape(\&quot;%3Cscript src='\&quot; + gaJsHost + \&quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\&quot;));
+&lt;/script&gt;
+&lt;script type=\&quot;text/javascript\&quot;&gt;
+var pageTracker = _gat._getTracker(\&quot;UA-XXXXXX-Y\&quot;);
+pageTracker._trackPageview();
+&lt;/script&gt;&quot;;
+  }
 }

 /**
</pre><p>This patch was generated from a <a href="http://www.zenphoto.org/2008/08/zenphoto-12-release-announcement/">Zenphoto v1.2</a> and will likely not work with any other version.</p><p>Do not forget to update the dummy Google Analytics account ID above (<code>UA-XXXXXX-Y</code>) by yours.</p><p>And finally, to apply the patch, invoke the classic <code>patch</code> command:</p><pre class="brush: bash; title: ; notranslate">
patch -p0 &lt; ./google-analytics-tracking-for-non-admin-users.patch
</pre>]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2008/08/how-to-add-google-analytics-tracking-to-zenphoto/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>WordPress 2.2 Security Hole: Identity Theft</title><link>http://kevin.deldycke.com/2007/06/wordpress-22-security-hole-identity-theft/</link> <comments>http://kevin.deldycke.com/2007/06/wordpress-22-security-hole-identity-theft/#comments</comments> <pubDate>Thu, 07 Jun 2007 15:22:51 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[log]]></category> <category><![CDATA[security]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://kevin.deldycke.com/2007/06/wordpress-22-security-hole-identity-theft/</guid> <description><![CDATA[I&#8217;m running 4 WordPress blogs, for me and my friends. All of them are updated to latest version of WordPress as soon as a new one is available. One of them, Maomium, was hacked last night. Someone created a user &#8230; <a href="http://kevin.deldycke.com/2007/06/wordpress-22-security-hole-identity-theft/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I&#8217;m running 4 WordPress blogs, for me and my friends. All of them are updated to latest version of WordPress as soon as a new one is available.</p><p>One of them, <a href="http://maomium.com">Maomium</a>, was hacked last night. Someone created a user account on it then stole my admin identity to post content. As soon as I discovered the hack, I&#8217;ve put the blog down and changed all passwords which may have been exposed to the hacker (database, etc&#8230;).</p><p>Before the hack happened, my apache log show me that a person was looking for blogs powered by WordPress 2.2 and open to registration:</p><pre class="brush: bash; title: ; notranslate">
123.76-136-217.adsl-dyn.isp.belgacom.be www.maomium.com - [07/Jun/2007:00:51:55 +0200] &quot;GET /category/wordpress/ HTTP/1.1&quot; 200 2960 &quot;http://www.google.be/search?hl=fr&amp;q=%22powered+by+wordpress+2.2%22+Register&amp;btnG=Rechercher&amp;meta=&quot; &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4&quot;
</pre><p>This person was my hacker. As you can see he&#8217;s a belgian guy and his broadband provider is <a href="http://selfcare.belgacom.net/index.html?l=private:internet:security:notify&#038;a=hacking_skynet">Belgacom, to which I sent an abuse request</a>. He register himself as <a href="http://waryas.skynetblogs.be">Waryas</a> with his <code>myv4you@hotmail.com</code> email. I know that, thanks to the email WordPress send me each time someone register. Then <a href="http://www.google.fr/search?q=myv4you%40hotmail.com">google told me</a> that <a href="http://www.coolforum.net/forum/detail.php?forumid=1&#038;id=17468&#038;p=1#29054">this hack was not his first</a>.</p><p>If you want to disect his behaviour, you can <a href='http://kevin.deldycke.com/wp-content/uploads/2007/06/wordpress-22-register-new-user-hack.txt' title='wordpress-22-register-new-user-hack.txt'>download my apache log</a>.</p><p>This event show us that the WordPress vulnerablility regarding guest account registration is still there. So the <a href="http://www.4null4.de/174/wp-users-disable-guest-account-registration-immediately/">advice given by CountZero</a> <strong>must</strong> be applied !</p> ]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2007/06/wordpress-22-security-hole-identity-theft/feed/</wfw:commentRss> <slash:comments>20</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/15 queries in 0.703 seconds using apc
Object Caching 644/666 objects using apc

Served from: kevin.deldycke.com @ 2012-02-08 04:05:59 -->
