<?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>Iljas Blag</title>
	<atom:link href="http://blogs.23.nu/ilja/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.23.nu/ilja</link>
	<description>Mostly incoherent ramblings and rants about computer security</description>
	<lastBuildDate>Wed, 24 Jun 2009 04:12:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>surely you jest</title>
		<link>http://blogs.23.nu/ilja/2009/06/surely-you-gest/</link>
		<comments>http://blogs.23.nu/ilja/2009/06/surely-you-gest/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 08:09:58 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[un-fucking-believable]]></category>

		<guid isPermaLink="false">http://blogs.23.nu/ilja/?p=236</guid>
		<description><![CDATA[this is a copypast from code I just had to write:
/*
* HOLY FUCK. so pretty much everything in windows is a GUID,
* buy they don&#8217;t have any standard API&#8217;s to deal with GUID&#8217;s.
* for converting GUID&#8217;s to strings I had to use some api from
* ObjBase (all ugly com crap). it has no api to [...]]]></description>
			<content:encoded><![CDATA[<p>this is a copypast from code I just had to write:</p>
<p>/*<br />
* HOLY FUCK. so pretty much everything in windows is a GUID,<br />
* buy they don&#8217;t have any standard API&#8217;s to deal with GUID&#8217;s.<br />
* for converting GUID&#8217;s to strings I had to use some api from<br />
* ObjBase (all ugly com crap). it has no api to covert strings<br />
* to GUID&#8217;s however.<br />
*<br />
* so I look on msdn, and after a long search I find http://msdn.microsoft.com/en-us/library/bb776431(VS.85).aspx<br />
* which is GUIDFromString(), this is hidden in shell32.dll.<br />
* so I try to use it, but the code simply won&#8217;t link. I go back to<br />
* that msdn page and see the following at the end of the page: &#8221;<br />
* remarks:<br />
*    This function is not declared in a header or exported by name from a .dll file.<br />
*    It must be loaded from Shell32.dll as ordinal 703 for GUIDFromStringA and ordinal 704 for GUIDFromStringW.<br />
*<br />
*    It can also be accessed from Shlwapi.dll as ordinal 269 for GUIDFromStringA and ordinal 270 for GUIDFromStringW.&#8221;<br />
*<br />
* ARE YOU KIDDING ME ??? so I spend an hour or so, trying to<br />
* find api&#8217;s to import functions by ordinal, rather than by name<br />
* it turns out there is no GetProcAddress() equivalent for<br />
* ordinals. SON OF A BITCH !!!<br />
*<br />
* so I&#8217;m just going to write my own GUIDFromString() api&#8217;s<br />
*/</p>
<p>man, this really pissed me off.  not that converting back and forth from a string to a GUID is hard, it&#8217;s just that they should have a decent set of api&#8217;s for this, and they simply don&#8217;t. (atleast not for C code).</p>
<p>edit:</p>
<p>after rereading the GetProcAddress() manpage, it turns out you can specify an ordinal value, if you pass it&#8217;s value along as the namepointer effectively encoding the value in a pointer *PUKE*.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2009/06/surely-you-gest/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>sendmail is a gay program, get behind it !</title>
		<link>http://blogs.23.nu/ilja/2008/09/antville-18802/</link>
		<comments>http://blogs.23.nu/ilja/2008/09/antville-18802/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 11:36:49 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2008/09/antville-18802/</guid>
		<description><![CDATA[&#8220;There is some sort of perverse pleasure in knowing that it&#8217;s basically impossible to send a piece of hate mail out through the Internet without its being touched by a gay program. That&#8217;s kind of funny.&#8221; &#8212; Eric Allman.
got that from http://findarticles.com/p/articles/mi_m1589/is_n754/ai_20350568
]]></description>
			<content:encoded><![CDATA[<p>&#8220;There is some sort of perverse pleasure in knowing that it&#8217;s basically impossible to send a piece of hate mail out through the Internet without its being touched by a gay program. That&#8217;s kind of funny.&#8221; &#8212; Eric Allman.<br />
got that from http://findarticles.com/p/articles/mi_m1589/is_n754/ai_20350568</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2008/09/antville-18802/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>what year are we ?</title>
		<link>http://blogs.23.nu/ilja/2008/08/antville-18776/</link>
		<comments>http://blogs.23.nu/ilja/2008/08/antville-18776/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 19:19:58 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2008/08/antville-18776/</guid>
		<description><![CDATA[http://plan9.bell-labs.com/sources/plan9/sys/src/ape/lib/bsd/gethostbyname.c
just did a google codesearch for gethostbyname()
the 90&#8217;s called, they want their bugs back!
]]></description>
			<content:encoded><![CDATA[<p>http://plan9.bell-labs.com/sources/plan9/sys/src/ape/lib/bsd/gethostbyname.c<br />
just did a google codesearch for gethostbyname()<br />
the 90&#8217;s called, they want their bugs back!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2008/08/antville-18776/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>auth by pid doesn&#8217;t work !</title>
		<link>http://blogs.23.nu/ilja/2008/03/antville-17459/</link>
		<comments>http://blogs.23.nu/ilja/2008/03/antville-17459/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 08:49:18 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2008/03/antville-17459/</guid>
		<description><![CDATA[Every once in a while I stumble on some kernel code where the code attempts to do authentication based on the pid of the calling process.
This does not work ! it&#8217;s insecure, just don&#8217;t do it!
Usually, the code assumes that process with pid x has certain privilege&#8217;s.
for example, lets say you only want root to [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while I stumble on some kernel code where the code attempts to do authentication based on the pid of the calling process.<br />
This does not work ! it&#8217;s insecure, just don&#8217;t do it!<br />
Usually, the code assumes that process with pid x has certain privilege&#8217;s.<br />
for example, lets say you only want root to issue ioctl&#8217;s on a device.<br />
you&#8217;d make the open callback for your device do something like:<br />
open_fn() {<br />
	if (current-&gt;uid == 0)<br />
		add_pid_to_trusted_list(current-&gt;pid);<br />
}</p>
<p>and then for all your ioctl&#8217;s you&#8217;d just check if current-&gt;pid is in the trusted list. </p>
<p>This is a horrible kludge !!<br />
All of this works fine, until the procces that opened the device unexpectedly dies.<br />
now there is a dangling pid in the trusted list. all an attacker would have to do is spawn off new processes until you end up with the pid that&#8217;s in the trusted list.<br />
and _BAM_ the attacker gets to issues ioctl&#8217;s on a device he really shouldn&#8217;t get to issues ioctl&#8217;s on. </p>
<p>don&#8217;t think apps do this ? let&#8217;s look at BestCrypt (http://www.jetico.com/).<br />
here&#8217;s it&#8217;s open callback:<br />
static int bc_open(struct inode *inode, struct file *file)<br />
{<br />
&#8230;<br />
	if (capable(CAP_SYS_ADMIN)) {<br />
		bc_add_pid(current-&gt;pid);<br />
	}<br />
	return 0;<br />
}</p>
<p>it&#8217;s ioctl handler looks like:<br />
static int bc_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg)<br />
{<br />
&#8230;<br />
	switch (cmd) {</p>
<p>	BC_HANDLER(&#8221;get_info&#8221;, BC_GET_INFO,      bc_get_info(bc, (struct bc_info*) arg));<br />
	BC_HANDLER(&#8221;set_fd  &#8220;, BC_SET_FD,        bc_set_fd  (bc, bdev, (struct bc_file64 *) arg));<br />
	BC_HANDLER(&#8221;clr_fd  &#8220;, BC_CLR_FD,        bc_clr_fd  (bc, bdev, inode));<br />
	BC_HANDLER(&#8221;lock_dev&#8221;, BC_LOCK_DEV,      bc_lock_dev(bc, inode-&gt;i_rdev, 1));<br />
	BC_HANDLER(&#8221;ulck_dev&#8221;, BC_UNLOCK_DEV,    bc_lock_dev(bc, inode-&gt;i_rdev, 0));<br />
	BC_HANDLER(&#8221;frc_ulck&#8221;, BC_FORCE_UNLOCK,  bc_force_unlock(bc, bdev, inode-&gt;i_rdev));<br />
	BC_HANDLER(&#8221;get_priv&#8221;, BC_GET_PRIV,      bc_get_priv(arg));<br />
	BC_HANDLER(&#8221;hdio_geo&#8221;, HDIO_GETGEO,      hdio_getgeo(bc, (struct hd_geometry *) arg));<br />
	BC_HANDLER(&#8221;vrfy_alg&#8221;, BC_VERIFY_ALG,    bc_vrfy_alg((struct bc_alg*)   arg));<br />
	BC_HANDLER(&#8221;make_key&#8221;, BC_MAKE_KEY,      bc_make_key((struct bc_key*)   arg));<br />
	BC_HANDLER(&#8221;free_key&#8221;, BC_FREE_KEY,      bc_free_key((struct bc_key*)   arg));<br />
	BC_HANDLER(&#8221;encr_blk&#8221;, BC_ENCRYPT_BLOCK, bc_process ((struct bc_block*) arg, BC_ENCRYPT_BLOCK));<br />
	BC_HANDLER(&#8221;decr_blk&#8221;, BC_DECRYPT_BLOCK, bc_process ((struct bc_block*) arg, BC_DECRYPT_BLOCK));<br />
	}<br />
&#8230;<br />
}</p>
<p>BC_HANDLER is an ugly macro that looks like:<br />
#define BC_HANDLER(dbg, x, y)   case (x): /*printk(dbg &#8220;\n&#8221;); */\<br />
				error = (y); \<br />
				break;<br />
all of the functions used there looks like:<br />
static int some_function(struct bc_device *bc, struct block_device *bdev, struct bc_file64 *arg) {<br />
&#8230; variable declaration &#8230;<br />
	if (bc_find_pid_safe(current-&gt;pid) pid) &gt;= 0) {<br />
		current-&gt;cap_effective |= (1&lt;&lt;CAP_SYS_ADMIN)|(1&lt;&lt;CAP_CHOWN)|(1&lt;&lt;CAP_DAC_OVERRIDE)|(1&lt;euid = 0;<br />
	} else {<br />
		return -EPERM;<br />
	}</p>
<p>	if (arg)<br />
		bc_del_pid(current-&gt;pid);<br />
	return 0;<br />
}</p>
<p>yea, isn&#8217;t that great ?<br />
Oh, and here&#8217;s the kicker, BestCrypt comes with an suid root application that&#8217;ll open the device for you ! (which means you can just kill it once it&#8217;s opened the device).<br />
These kind of fuckup&#8217;s don&#8217;t limit themself to linux. I&#8217;ve seen similar screwups in windows drivers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2008/03/antville-17459/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>splitvt</title>
		<link>http://blogs.23.nu/ilja/2008/02/antville-17372/</link>
		<comments>http://blogs.23.nu/ilja/2008/02/antville-17372/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 02:48:33 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2008/02/antville-17372/</guid>
		<description><![CDATA[I was reading http://lists.grok.org.uk/pipermail/full-disclosure/2008-February/060411.html and figured I&#8217;d take a look at some if it&#8217;s code. it&#8217;s not all that secure. here are some code snippets:
void splitvtrc()
{
&#8230;
	char line[BUFSIZ], newline[BUFSIZ*2], *parsed[256];
&#8230;
		for ( i=0, head=ptr=newline; ((ptr-newline)&#60;(BUFSIZ*2-2))
								&#38;&#38; *tail; ) {
&#8230;
				parsed[i++]=head; &#60;&#8211; no boundscheck done for parsed
&#8230;
		}
}
main(argc, argv)
int argc;
char *argv[];
{
&#8230;
	signal(SIGHUP, finish);
	signal(SIGINT, finish);
	signal(SIGQUIT, finish);
	signal(SIGTERM, finish);
	signal(SIGSEGV, finish);
#ifdef SIGBUS
	signal(SIGBUS, finish);
#endif
&#8230;
}
finish() looks like:
static void [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading http://lists.grok.org.uk/pipermail/full-disclosure/2008-February/060411.html and figured I&#8217;d take a look at some if it&#8217;s code. it&#8217;s not all that secure. here are some code snippets:<br />
void splitvtrc()<br />
{<br />
&#8230;<br />
	char line[BUFSIZ], newline[BUFSIZ*2], *parsed[256];<br />
&#8230;<br />
		for ( i=0, head=ptr=newline; ((ptr-newline)&lt;(BUFSIZ*2-2))<br />
								&amp;&amp; *tail; ) {<br />
&#8230;<br />
				parsed[i++]=head; &lt;&#8211; no boundscheck done for parsed<br />
&#8230;<br />
		}<br />
}</p>
<p>main(argc, argv)<br />
int argc;<br />
char *argv[];<br />
{<br />
&#8230;<br />
	signal(SIGHUP, finish);<br />
	signal(SIGINT, finish);<br />
	signal(SIGQUIT, finish);<br />
	signal(SIGTERM, finish);<br />
	signal(SIGSEGV, finish);<br />
#ifdef SIGBUS<br />
	signal(SIGBUS, finish);<br />
#endif<br />
&#8230;<br />
}<br />
finish() looks like:<br />
static void finish(sig)<br />
int sig;<br />
{<br />
	/* Only call this routine after tty_getmode() has been called */<br />
	/* The tty_reset() call flushes the tty&#8217;s input buffers. */<br />
	if ( tty_reset(0) pw_name, upper_tty);<br />
	if ( pw &amp;&amp; bottomok &amp;&amp; lower_tty[0] )<br />
		(void) delutmp(pw-&gt;pw_name, lower_tty);<br />
	(void) replace_me();</p>
<p>	if ( sig )<br />
		printf(&#8221;Exiting due to signal: %d\n&#8221;, sig);<br />
	exit(sig);<br />
}</p>
<p>lots of signal unsafe stuff happening there end_vt100() for example does:<br />
void end_vt100()<br />
{<br />
	int i;</p>
<p>	if ( ! setup_vt100 )<br />
		return;</p>
<p>	/* Clear any old setup */<br />
	lastwin=(-1);<br />
	for ( i=0; i&lt;upper.rows; ++i )<br />
		(void) free(upper.videomem[i]);<br />
	(void) free(upper.videomem);<br />
	(void) free(upper.tabstops);<br />
	for ( i=0; i&lt;lower.rows; ++i )<br />
		(void) free(lower.videomem[i]);<br />
	(void) free(lower.videomem);<br />
	(void) free(lower.tabstops);<br />
	setup_vt100=0;<br />
&#8230;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2008/02/antville-17372/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A whole new world of amazon fun</title>
		<link>http://blogs.23.nu/ilja/2007/03/antville-14506/</link>
		<comments>http://blogs.23.nu/ilja/2007/03/antville-14506/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 21:48:52 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2007/03/antville-14506/</guid>
		<description><![CDATA[I like browsing through amazon&#8217;s website as much as the next guy, but pandzilla showed me a new way of appreciating amazon. Looking for the craziest reviews of items on amazon. Breathtaking !
some things you should see:
http://www.amazon.com/Underhill-Farms-Elk-Carcass/dp/B000IDOB5Y/ref=sr_1_23/104-0721154-5701564?ie=UTF8&#38;s=gourmet-food&#38;qid=1173397485&#38;sr=1-23
http://www.amazon.com/Bobs-Red-Mill-Xanthan-Gum/dp/B0000CCZUO/ref=pd_bbs_2/002-2655636-8027208?ie=UTF8&#38;s=gourmet-food&#38;qid=1173207456&#38;sr=8-2
http://www.amazon.com/gp/product/customer-reviews/B000002UB3/sr=8-3/qid=ARRAY(0&#215;58fc7004)/ref=cm_rev_sort/002-3634337-6436051?customer-reviews.sort_by=%2BOverallRating&#38;s=music&#38;x=12&#38;y=8
http://www.amazon.com/gp/product/customer-reviews/B000001FS3/sr=1-11/qid=ARRAY(0&#215;574a1498)/ref=cm_rev_sort/002-3634337-6436051?customer-reviews.sort_by=%2BOverallRating&#38;s=music&#38;x=8&#38;y=12
isn&#8217;t that hilarious ?
]]></description>
			<content:encoded><![CDATA[<p>I like browsing through amazon&#8217;s website as much as the next guy, but pandzilla showed me a new way of appreciating amazon. Looking for the craziest reviews of items on amazon. Breathtaking !<br />
some things you should see:<br />
http://www.amazon.com/Underhill-Farms-Elk-Carcass/dp/B000IDOB5Y/ref=sr_1_23/104-0721154-5701564?ie=UTF8&amp;s=gourmet-food&amp;qid=1173397485&amp;sr=1-23<br />
http://www.amazon.com/Bobs-Red-Mill-Xanthan-Gum/dp/B0000CCZUO/ref=pd_bbs_2/002-2655636-8027208?ie=UTF8&amp;s=gourmet-food&amp;qid=1173207456&amp;sr=8-2<br />
http://www.amazon.com/gp/product/customer-reviews/B000002UB3/sr=8-3/qid=ARRAY(0&#215;58fc7004)/ref=cm_rev_sort/002-3634337-6436051?customer-reviews.sort_by=%2BOverallRating&amp;s=music&amp;x=12&amp;y=8<br />
http://www.amazon.com/gp/product/customer-reviews/B000001FS3/sr=1-11/qid=ARRAY(0&#215;574a1498)/ref=cm_rev_sort/002-3634337-6436051?customer-reviews.sort_by=%2BOverallRating&amp;s=music&amp;x=8&amp;y=12</p>
<p>isn&#8217;t that hilarious ?</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2007/03/antville-14506/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>fishy FiSH</title>
		<link>http://blogs.23.nu/ilja/2007/03/antville-14493/</link>
		<comments>http://blogs.23.nu/ilja/2007/03/antville-14493/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 01:30:20 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2007/03/antville-14493/</guid>
		<description><![CDATA[FiSH is a plugin for most popular irc clients that implements encryption. I looked at it a few years ago, and it was horrible. Stacksmashes _everywhere_. I briefly looked at it again yesterday, only to discover that all the bugs are still there ! somewhat shocking. I wonder how many people have been owned because [...]]]></description>
			<content:encoded><![CDATA[<p>FiSH is a plugin for most popular irc clients that implements encryption. I looked at it a few years ago, and it was horrible. Stacksmashes _everywhere_. I briefly looked at it again yesterday, only to discover that all the bugs are still there ! somewhat shocking. I wonder how many people have been owned because of those bugs.<br />
I looked at the xchat plugin code (but I believe most of the code is shared and only the entry point code is (obviously) different) and it basicly registers 4 functions that handle incomming data: </p>
<p>	xchat_hook_server(ph, &#8220;PRIVMSG&#8221;, XCHAT_PRI_NORM, decrypt_incoming, 0);<br />
	xchat_hook_server(ph, &#8220;NOTICE&#8221;, XCHAT_PRI_NORM, notice_received, 0);<br />
	xchat_hook_server(ph, &#8220;TOPIC&#8221;, XCHAT_PRI_NORM, decrypt_incoming, 0);<br />
	xchat_hook_server(ph, &#8220;NICK&#8221;, XCHAT_PRI_NORM, nick_changed, 0);<br />
	xchat_hook_server(ph, &#8220;332&#8243;, XCHAT_PRI_NORM, decrypt_topic_332, 0);</p>
<p>so let&#8217;s look at all of those.</p>
<p>int decrypt_incoming(char *word[], char *word_eol[], void *userdata)<br />
{<br />
	unsigned char *msg_ptr, contactName[100]=&#8221;", from_nick[50], msg_event[100]=&#8221;", </p>
<p>psyNetwork[12];<br />
	&#8230;<br />
	if(word[1][0] == &#8216;:&#8217;) ExtractRnick(from_nick, word[1]);<br />
	&#8230;<br />
}</p>
<p>here&#8217;s what ExtractRnick() does: </p>
<p>int ExtractRnick(char *Rnick, char *incoming_msg)<br />
{<br />
	int k=0;</p>
<p>	if(*incoming_msg == &#8216;:&#8217;) incoming_msg++;</p>
<p>	while(*incoming_msg!=&#8217;!&#8217; &amp;&amp; *incoming_msg!=0) {<br />
		Rnick[k]=*incoming_msg;<br />
		incoming_msg++;<br />
		k++;<br />
	}<br />
	Rnick[k]=0;</p>
<p>	if (*Rnick &lt; &#8216;0&#8242;) return FALSE;<br />
	else return TRUE;<br />
}</p>
<p>you can clearly see the stacksmash here (word[1] comes from the network !). the other 3 functions are just as horrible: </p>
<p>int notice_received(char *word[], char *word_eol[], void *userdata)<br />
{<br />
	unsigned int i;<br />
	unsigned char hisPubKey[300], contactName[25]=&#8221;", from_nick[25]=&#8221;";<br />
	&#8230;<br />
	if(ExtractRnick(from_nick, word[1])==0) return XCHAT_EAT_NONE;<br />
	&#8230;<br />
}</p>
<p>int nick_changed(char *word[], char *word_eol[], void *userdata)<br />
{<br />
	unsigned char contactName[100]=&#8221;", theKey[500]=&#8221;", ini_nicktracker[10];<br />
	&#8230;<br />
	if(	*ini_nicktracker==&#8217;0&#8242; || *ini_nicktracker==&#8217;N&#8217; || *ini_nicktracker==&#8217;n&#8217; ||<br />
		(ExtractRnick(contactName, word[1])==0) ||<br />
		(stricmp(contactName, word[3]+1)==0))<br />
		return XCHAT_EAT_NONE;<br />
	&#8230;<br />
}</p>
<p>int decrypt_topic_332(char *word[], char *word_eol[], void *userdata)<br />
{<br />
	unsigned char contactName[100]=&#8221;";<br />
	&#8230;<br />
	strcpy(contactName, word[4]);<br />
	&#8230;<br />
}</p>
<p>yes, that last one is an actual strcpy() stacksmash. The 90&#8217;s called, they want their bugs back :-p</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2007/03/antville-14493/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>awesome quote</title>
		<link>http://blogs.23.nu/ilja/2007/03/antville-14457/</link>
		<comments>http://blogs.23.nu/ilja/2007/03/antville-14457/#comments</comments>
		<pubDate>Fri, 02 Mar 2007 22:41:24 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2007/03/antville-14457/</guid>
		<description><![CDATA[&#8220;trying to unfuck [some issue] while it&#8217;s still unfuckable&#8221; &#8212; Dan Kaminsky
]]></description>
			<content:encoded><![CDATA[<p>&#8220;trying to unfuck [some issue] while it&#8217;s still unfuckable&#8221; &#8212; Dan Kaminsky</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2007/03/antville-14457/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>too funny</title>
		<link>http://blogs.23.nu/ilja/2007/02/antville-14266/</link>
		<comments>http://blogs.23.nu/ilja/2007/02/antville-14266/#comments</comments>
		<pubDate>Wed, 07 Feb 2007 15:46:10 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2007/02/antville-14266/</guid>
		<description><![CDATA[http://www.usatap.org/FAQ.htm
check nr 6. omfg, these people need to be shot !
I&#8217;m sure you&#8217;ve already read it by now, but it&#8217;s no longer just me blagging here. Which is probably a good thing, I&#8217;m rather busy right now and have very little time to blag.
]]></description>
			<content:encoded><![CDATA[<p>http://www.usatap.org/FAQ.htm<br />
check nr 6. omfg, these people need to be shot !</p>
<p>I&#8217;m sure you&#8217;ve already read it by now, but it&#8217;s no longer just me blagging here. Which is probably a good thing, I&#8217;m rather busy right now and have very little time to blag.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2007/02/antville-14266/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Guestblagging!</title>
		<link>http://blogs.23.nu/ilja/2007/02/antville-14258/</link>
		<comments>http://blogs.23.nu/ilja/2007/02/antville-14258/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 19:25:43 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2007/02/antville-14258/</guid>
		<description><![CDATA[You knew it was going to happen eventually.
You&#8217;ve seen her &#8211; that annoying kid &#8211; following Ilja around like some lost puppy, babbling inanely about you&#8217;re not sure what. If you must blame someone, blame prdelka. She (being me, Bitty) now has full guestblagging rights to this blag ;)
(No, I&#8217;m not consistantly making the same [...]]]></description>
			<content:encoded><![CDATA[<p>You knew it was going to happen eventually.</p>
<p>You&#8217;ve seen her &#8211; that annoying kid &#8211; following Ilja around like some lost puppy, babbling inanely about you&#8217;re not sure what. If you must blame someone, blame prdelka. She (being me, Bitty) now has full guestblagging rights to this blag ;)</p>
<p>(No, I&#8217;m not consistantly making the same tyop. Check the title of this blag. It&#8217;s definitely a <a href="http://xkcd.com/c148.html">blag.</a> Blogs are so old meme. Memes are so old meme, too.)</p>
<p>Anyways, we all know I never have anything useful to add to a conversation, so I&#8217;ll just get going now before Ilja realizes his terrible mistake and revokes my posting privileges. Mostly, I&#8217;m here so his RSS feed of new posts doesn&#8217;t look so pathetically lonely&#8230;</p>
<p>~Bitty</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2007/02/antville-14258/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>No, I&#8217;m not dead yet</title>
		<link>http://blogs.23.nu/ilja/2007/01/antville-13882/</link>
		<comments>http://blogs.23.nu/ilja/2007/01/antville-13882/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 18:05:33 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2007/01/antville-13882/</guid>
		<description><![CDATA[Been a while since I blogged. I&#8217;ve been busy you know, xmas, 23c3, newyears, recovering from all that, &#8230;. 
So, euh, happy new year to those 2 people that read my blog (even tho it&#8217;s more then a week late). I guess it&#8217;s customary to make predictions for 2007, however, I&#8217;m not going to do [...]]]></description>
			<content:encoded><![CDATA[<p>Been a while since I blogged. I&#8217;ve been busy you know, xmas, 23c3, newyears, recovering from all that, &#8230;. </p>
<p>So, euh, happy new year to those 2 people that read my blog (even tho it&#8217;s more then a week late). I guess it&#8217;s customary to make predictions for 2007, however, I&#8217;m not going to do that. When people do that, they&#8217;re either safe bets or total bullshit !, I won&#8217;t participate in that.</p>
<p>Since I haven&#8217;t blogged in a while this blogpost will be a mix of things I wanted to blog about in the past 3 weeks.</p>
<p>I guess I&#8217;ll start of with my &#8220;report&#8221; on 23c3. Man was that awesome ! It was my 5th c3 congress (in a row). And as usual, it rocked ! getting drunk, sleep deprived, socializing and wachting talks for 4 days. 2 of those talks were even mine. </p>
<p>I did an IT security standup comedy together with fefe. we basicly bashed pretty much everyone (but it was not evenly divided, apple got a lot of the bashing). Ofcourse any kind of it related bashing has to include Joerg Schilling. Fefe had this great schilly joke. How many schilly&#8217;s does it take to screw in a light bulb ? None, it&#8217;s not his fault the light is off ! Anyways, the feedback we got on it wasn&#8217;t all bad, although apparently people couldn&#8217;t hear me all that well, fefe, who was standing right next to me could hear me just fine, so there must have been something wrong with the microphone. I guess we didn&#8217;t entirely go up in flames as we expected we would. </p>
<p>I also gave a talk that I called &#8220;Unusual bugs&#8221;, at 11:30 in the morning on the 4th (and last) day. That was painful ! (although apparently some people in the us got up at 5:30 in the morning to watch the stream :( which is way more painful). Regardless of the fact it was that early a fair amount of people still showed up (go figure). I talked about exploiting NULL pointer derefs, some issues with alloca(), recursive stack overflow, problems with regex&#8217;s and some other stuff. the slides are online if you want to see them (ilja.netric.org/files/Unusual%20bugs%2023c3.pdf). All in all I&#8217;d say that talk went pretty well. I got some awesome feedback on it, and people have told me about some related things I didn&#8217;t know yet. I also did an demo with an 0day OpenBSD kernel bug. Apparently OpenBSD exploits are easy crowd pleasers, I wonder why. Somewhere in my talk (during the regex thing) I talked about the ^ sign, and not knowing it&#8217;s name I called it the hat sign, untill <a href="http://fabienne.us/">Fabienne</a> was kind enough to tell me it&#8217;s called the caret sign. I was told I should submit that talk to cansec aswell, so I did, let&#8217;s wait and see if they&#8217;ll accept it. </p>
<p>Anyways, 23c3 was just great ! I met up with Gadi Evron btw (you know, the guy that owns the fuzzing mailing list) He&#8217;s quite cool. I also ended up seeing his talk about fuzzing the corporate world. It was pretty cool, it wasn&#8217;t really a technical talk tho, he talked more about how we can introduce fuzzing in the corporate world. What made the talk so great is the way Gadi does it. He pretty much forces audience participation upon you. Remember this, if you ever go see his talk, and you don&#8217;t want to get handed the mike to answer some questions, go sit in the back! if you like that kind of presenting, then I would highly recommend seeing any future talk by Gadi. </p>
<p>I also saw Joanna&#8217;s talk. It was good, as you can expect from her, however, I was a little bit disapointed that it wasn&#8217;t more technical (which you usually expect from her). At some point someone disagreed with something she said (I can&#8217;t quite remember what) and sort of a discussion took place between him and Joanna, at the end someone in the audience yelled &#8220;Objection, speculation&#8221; and she moved on. Somewhere near the end of her talk she said something security related about NetBSD and I could barely hold my laughter. </p>
<p>So I also attended fefe&#8217;s bignum talk, which was interesting. Not that I have any interest in _EVER_ writing bignum code, but he did some benchmarks aswell, to see if how faster certain things work compared to other. I was shocked to see his &#8220;div&#8221; benchmarks, I knew division is slow, but I had no idea it was this slow. In the end he remarked that a lot of the actions you need for bignum code are actually by definition slow, coz that&#8217;s how people design their crypto stuff, the slower it is by design, the better. (so for those who don&#8217;t know, you usually only use bignum code for crypto stuff).</p>
<p>Ofcourse I also saw Kaminsky&#8217;s talk! the man is an awesome entertainer! If you&#8217;ve never seen any of his talks then you should definatly go see one of them when you have the chance, even if you&#8217;re not interested in any of the topics he&#8217;ll cover, you&#8217;ll still like his talks, trust me.</p>
<p>and so, after 23c3 I spend 8 hours in the car, getting back home, yea that was really fun &#8230;.</p>
<p>So one of the things I noticed after my unusual bugs talk, the OpenBSD guys fix bugs _FAST_. I mean really fast ! bugfix and announcement within a few days. Not many vendors can pull that off. While preparing the OpenBSD exploit for my talk, I also noticed that if you mmap with MAP_ANON, your fd has to be set to -1 (on BSD), why in the hell is that ? it gets ignored anyways. that tiny piece of code that checks for -1 in that case is just bloat, would be great if someone just removed that. In linux this is not the case btw, the kernel will just ignore the fd in that case (as it should !).</p>
<p>A few days ago fefe told me about these inotify syscalls in the linux kernel. Basicly you use them so you can get informed automatically about any change to any file. I quickly looked at the code that does it and stumbled on some small security bug. Basicly, what you do is, you call inotify_init() to get an fd to an inotify event queue. then using that fd you can add or remove watch points. There are limits set to how many of those watch points and fd&#8217;s you can get (I believe you can change them in /proc as root) and there&#8217;s a race condition in the code that checks if you&#8217;re over the limit, and increasing the count of how many you already have:<br />
asmlinkage long sys_inotify_init(void)<br />
{<br />
	&#8230;<br />
	user = get_uid(current-&gt;user);<br />
	if (unlikely(atomic_read(&amp;user-&gt;inotify_devs) &gt;=<br />
			inotify_max_user_instances)) {<br />
		ret = -EMFILE;<br />
		goto out_free_uid;<br />
	}<br />
	&#8230; a whole bunch of stuff &#8230;<br />
	atomic_inc(&amp;user-&gt;inotify_devs);<br />
	&#8230;<br />
}<br />
So it checks it, then does a whole bunch of stuff, and only after that changes the count of how many you have. So you could race this and call inotify_init() a bunch of times and basicly go over the limit you&#8217;re supposed to have. Ofcourse I reported this to security@kernel.org, but they don&#8217;t seem to care about this at all. I even got a mail back from torvalds himself saying &#8220;we simply don&#8217;t care whether the limit is exceeded _exactly_, or if somebody can come in and exceed it just a little bit.&#8221;, WTF ? yea I know the skies aren&#8217;t falling, but this is a bug and simply needs fixing! And I wonder how they define &#8220;a little bit&#8221;, my guess is, if you spend some time figureing things out, you could probably greatly exceed the limit. the code to add inotify watches suffers from the same race. </p>
<p>Recently I&#8217;ve had some success with manual fuzzing, I didn&#8217;t really want to blog about this, coz it&#8217;s pretty lame, but fuck, manual fuzzing can be pretty effcient. So euh, what you basicly do is look at some binary file in a hex editor, change some values, and see what happens. Things really _SHOULDNT_ break on this, but they do. it&#8217;s pretty sad really. Anyways, I usually use the 010 hex editor for this (it also has some templates that support certain files, like wav, avi, zip, &#8230;). You should give it a try sometimes, chances are you&#8217;ll find some nice 0day with it.</p>
<p>When reading some stuff on wikipedia I also ran into the <a href="http://en.wikipedia.org/wiki/Irony_mark">irony mark</a>, I&#8217;m so going to use that! it&#8217;s basicly a reversed question mark. </p>
<p>I also released a unix ioctl fuzzer a few days ago, if you&#8217;d like to give it a try you can download it <a href="http://www.digitaldwarf.be/products/ioctlfuzz.tar.gz">here</a>. It works (somewhat) on Open-, Net-, FreeBSD and linux. I also have a somewhat hacked up version for osx, which I&#8217;ll release at some point. It&#8217;s been quite effective, I found the OpenBSD kernel bug with it for example. somewhat simular, I&#8217;ve started working on a sysctl fuzzer, we&#8217;ll see how that goes. </p>
<p>A cool blog you should definatly check out is <a href="http://bitshifted.wordpress.com/">bitty&#8217;s blog</a>, she was also kind enough to make my cool 23c3 slides. </p>
<p>another blog you should read, is <a href="http://taossa.com/">the art of software security assesment&#8217;s blog</a>, from the guys who made THE code auditing bible !</p>
<p>And another blog related announcement, another bug of the month kinda thing. Month of the apple bugs. Some seem to think these kind of things are a mistake, I on the other hand will sit back, relax, eat some popcorn, and ejoy the show. And if it tickles my funnybone, I&#8217;ll laugh !</p>
<p>I also ran into <a href="http://lists.grok.org.uk/pipermail/full-disclosure/2007-January/051647.html">this</a> idefense advisory. What&#8217;s so funny about this one is that the vedor simply won&#8217;t fix the bug: &#8220;QUALCOMM will not be addressing this issue with a software patch and instead recommends that administrators block access to the affected port from untrusted sources at the network level.&#8221; WTF ??? this is a heap overflow in what looks like a supported product, how can you (as a vendor) refuse to fix it ???</p>
<p>Last, but not least, I was going over some BSD syscalls and saw the revoke() syscall. I&#8217;d never heard of this one before, apparently it takes a pathname as input and invalidates _ANY_ fd on the system to that path (assuming you either own the file or are root). Somehow I think there&#8217;s gotta be some security bugs related to this. How can there not be ? Suids for example don&#8217;t get written with the idea that open fd&#8217;s they have all the sudden get invalidated, without any kind of notice. anyways, I still need to dig into this one, expect some funny results from this at some point.</p>
<p>Edit: More proof that I&#8217;m an idiot, the advisory I linked to wasn&#8217;t idefense it was zdi, yea, think I should take that reading 101 class again.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2007/01/antville-13882/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>undefined behavior</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13686/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13686/#comments</comments>
		<pubDate>Sat, 16 Dec 2006 02:45:27 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13686/</guid>
		<description><![CDATA[Every once in a while I go looking for &#8220;undefined behavior&#8221; in some manpages (or the lack thereof).
I found a good one this time. This is straight from the hp-ux pthread_mutex_lock manpage:
WARNINGS
      A recursive mutex can be locked more than once by the same thread
      [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while I go looking for &#8220;undefined behavior&#8221; in some manpages (or the lack thereof).<br />
I found a good one this time. This is straight from the hp-ux pthread_mutex_lock manpage:<br />
WARNINGS<br />
      A recursive mutex can be locked more than once by the same thread<br />
      without causing that thread to deadlock. Undefined behavior may result<br />
      if the owner of a recursive mutex tries to lock the mutex too many<br />
      times.</p>
<p>without giving ANY predefined value for how much is too much. that is just craptastic !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13686/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hardcoded off-by-one&#8217;s</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13685/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13685/#comments</comments>
		<pubDate>Sat, 16 Dec 2006 01:35:52 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13685/</guid>
		<description><![CDATA[About 2 months ago I found some security bug in FreeBSD. I mailed them about it (both colin and security-officer@), no reply, so I mailed again about a month ago, no reply, so I mailed again 2 days ago and finally got a reply (after writing &#8220;I mailed this to you guys twice already in [...]]]></description>
			<content:encoded><![CDATA[<p>About 2 months ago I found some security bug in FreeBSD. I mailed them about it (both colin and security-officer@), no reply, so I mailed again about a month ago, no reply, so I mailed again 2 days ago and finally got a reply (after writing &#8220;I mailed this to you guys twice already in the course of about 2 months, no response so far,trying one last time:&#8221; in my email) from one of their security people that they are looking into it. Today I got a reply saying that &#8220;there is very little risk&#8221;.<br />
because of the nature of this bug (I&#8217;m not going to give too much detail yet :) I mailed back to say I disagree, and am currently looking into some possible attack vectors (it&#8217;s not a trivial stacksmash or anything like that) (woohoo, free QA, think I could bill them ? :). So at some point I start digging into some of their pam code and read the following:<br />
void<br />
makesalt(char salt[SALTSIZE])<br />
{<br />
	int i;<br />
	&#8230;<br />
	for (i = 0; i &lt; SALTSIZE; i += 4)<br />
		to64(&amp;salt[i], arc4random(), 4);<br />
	salt[SALTSIZE] = &#8221;;<br />
}</p>
<p>yes, that&#8217;s a hardcoded off-by-one! from what I can see it *looks like* the way they&#8217;re using it doesn&#8217;t allow for exploitation (although I could be wrong and missing something) but I can certainly imagine this being exploitable in the right circumstances.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13685/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>eweek&#8217;s OnSecurity podcast</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13666/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13666/#comments</comments>
		<pubDate>Thu, 14 Dec 2006 08:22:30 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13666/</guid>
		<description><![CDATA[I just listened to the one where they interviewed Dave Aitel. It was interesting, they talked about some of the common computer security things, disclosure, ZERT, hacker-vendor relationship, &#8230;.
By far the most entertaining thing about that podcast was the small commercial at the beginning. I think it was for some patch management thing from microsoft. [...]]]></description>
			<content:encoded><![CDATA[<p>I just listened to the one where they interviewed Dave Aitel. It was interesting, they talked about some of the common computer security things, disclosure, ZERT, hacker-vendor relationship, &#8230;.<br />
By far the most entertaining thing about that podcast was the small commercial at the beginning. I think it was for some patch management thing from microsoft. In it you hear this aussie saying &#8220;A <a href="http://en.wikipedia.org/wiki/Dingo">dingo</a> ate my server&#8221;. that cracked me up ! </p>
<p>anyways, you can find the podcast at:<br />
http://zdpub.vo.llnwd.net/o2/eWeek/onsecurity12042006.mp3</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13666/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://zdpub.vo.llnwd.net/o2/eWeek/onsecurity12042006.mp3" length="8122520" type="audio/mpeg" />
		</item>
		<item>
		<title>0day alert</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13649/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13649/#comments</comments>
		<pubDate>Sat, 09 Dec 2006 09:28:59 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13649/</guid>
		<description><![CDATA[It seems fefe has been auditing gnupg and found some hilarious bugs. Read about it here. The blog&#8217;s in german, but you don&#8217;t need to be able to read german to find t3h 0day !
Apparenlty stefan esser is no longer part of the php security team.
&#8220;Last night I finally retired from the PHP Security Response [...]]]></description>
			<content:encoded><![CDATA[<p>It seems fefe has been auditing gnupg and found some hilarious bugs. Read about it <a href="http://blog.fefe.de/?ts=bb8644fb">here</a>. The blog&#8217;s in german, but you don&#8217;t need to be able to read german to find t3h 0day !</p>
<p>Apparenlty stefan esser is no longer part of the php security team.<br />
&#8220;Last night I finally retired from the PHP Security Response Team [...] For the ordinary PHP user this means that I will no longer hide the slow response time to security holes in my advisories. It will also mean that some of my advisories will come without patches available&#8221; </p>
<p>So am I to understand we&#8217;ll be getting some php 0day from him ? Read about it <a href="http://blog.php-security.org/archives/61-Retired-from-securityphp.net.html"> here </a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13649/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2 wonderful quotes</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13591/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13591/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 12:23:57 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13591/</guid>
		<description><![CDATA[2 really cool quotes I just read:
&#8220;&#8230;and is of course LGPLed (&#8221;free as in communism&#8221;).&#8221; &#8212; Michal Zalewski
&#8220;These people are looking more and more like a criminal organization every day.&#8221; &#8212; Bruce Schneier about the MPAA
Bruce has a point !
]]></description>
			<content:encoded><![CDATA[<p>2 really cool quotes I just read:<br />
&#8220;&#8230;and is of course LGPLed (&#8221;free as in communism&#8221;).&#8221; &#8212; Michal Zalewski<br />
&#8220;These people are looking more and more like a criminal organization every day.&#8221; &#8212; Bruce Schneier about the MPAA</p>
<p>Bruce has a point !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13591/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenBSD allows suid shellscripts ?</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13587/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13587/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 08:56:26 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13587/</guid>
		<description><![CDATA[I&#8217;m stunned !!
why the fuck would it do that ? No other sane os on the planet has allowed that to happen for adleast a decade !
I wonder what their excuse is (and it&#8217;s just that, an excuse, THERE IS NO JUST REASON WHY YOU WOULD DO THIS!)
I&#8217;m shocked !
I tested this on FreeBSD and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m stunned !!<br />
why the fuck would it do that ? No other sane os on the planet has allowed that to happen for adleast a decade !</p>
<p>I wonder what their excuse is (and it&#8217;s just that, an excuse, THERE IS NO JUST REASON WHY YOU WOULD DO THIS!)</p>
<p>I&#8217;m shocked !<br />
I tested this on FreeBSD and NetBSD aswell and they don&#8217;t seem to allow it (thank god!, or else I would have ranted some more on NetBSD :).</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13587/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Fuck you lenovo</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13580/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13580/#comments</comments>
		<pubDate>Sun, 03 Dec 2006 22:53:38 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13580/</guid>
		<description><![CDATA[A couple of months ago I was forced to buy a new laptop after a liquid experiment with my laptop. I purchased the ibm thinkpad x60, coz I love those small machines. The machine is nice, but the screen really blows. I&#8217;ve only had it for a few months And I&#8217;ve already lost count of [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of months ago I was forced to buy a new laptop after a liquid experiment with my laptop. I purchased the ibm thinkpad x60, coz I love those small machines. The machine is nice, but the screen really blows. I&#8217;ve only had it for a few months And I&#8217;ve already lost count of how many broken pixels it has :(</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13580/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>oh, it&#8217;s just a kernel panic</title>
		<link>http://blogs.23.nu/ilja/2006/12/antville-13579/</link>
		<comments>http://blogs.23.nu/ilja/2006/12/antville-13579/#comments</comments>
		<pubDate>Sat, 02 Dec 2006 18:50:48 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/12/antville-13579/</guid>
		<description><![CDATA[yea right !
so, assume you have a bug in your kernel that simply calls panic() and does nothing else wrong. They do exist, take the fpathconf() bug in osx for example.
A lot of people don&#8217;t believe these are security bugs.
I beg to differ. THEY ARE SECURITY BUGS. for one, a panic effectively causes a shutdown. [...]]]></description>
			<content:encoded><![CDATA[<p>yea right !<br />
so, assume you have a bug in your kernel that simply calls panic() and does nothing else wrong. They do exist, take the fpathconf() bug in osx for example.<br />
A lot of people don&#8217;t believe these are security bugs.<br />
I beg to differ. THEY ARE SECURITY BUGS. for one, a panic effectively causes a shutdown. SHUTTING DOWN A BOX IS A PRIVILEGE NO ONE EXCEPT THE SUPERUSER SHOULD HAVE ! maybe this isn&#8217;t entirely true on a desktop, but this sure makes sense on something that&#8217;s used as a server. So for this fact alone it&#8217;s a security bug. But it gets worse. kernel panics often lead to loss of data on disk. This is because at the time of panic not all data is synced to disk. I&#8217;ve had this happen to me quite a few times when toying with some kernel bugs on OpenBSD and NetBSD. I assume this is probably common among most operating systems, and that none that I&#8217;m aware of have special disk sync code in the panic() function (or BugCheck[Ex](), depending on which os you&#8217;re using).<br />
When I was playing with some osx kernel bugs in late 2004 and early 2005 I once had my entire home directory removed after a kernel panic, something you really don&#8217;t want. But wait, it gets even worse. Kernel panics are unnatural, they interrupt everything you do and basicly panic your system. That means, that some weak hardware might not like it and you might cause hardware to break (while this is probably rare these days, I&#8217;ve been told by some oldtimers that this used to be a big problem for some hardware).<br />
I&#8217;ve talked to lmh (of the month of the kernel bugs) and he told me that if you use filevault on osx, and have a kernel panic that whatever filevault is protecting gets garbled, certainly not something you want. </p>
<p>So, in conclusion, if an unprivileged user can arbitrarily cause a kernel panic, then that is a security bug!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/12/antville-13579/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PinkBSD</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13557/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13557/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 17:22:56 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13557/</guid>
		<description><![CDATA[a.k.a NetBSD blowing up on a trivial ioctl fuzzer.

]]></description>
			<content:encoded><![CDATA[<p>a.k.a NetBSD blowing up on a trivial ioctl fuzzer.<br />
<img src="http://static.23.nu/antville/ilja/images/funkypanic.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13557/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fun with gdb</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13530/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13530/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 02:20:22 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13530/</guid>
		<description><![CDATA[A while ago I was reading the gdb manual. Apparently it reads the .gdbinit file from your homedirectory AND from the current working directory:
&#8220;2.1.3 What gdb does during startup
Heres the description of what gdb does during session startup:
1. Sets up the command interpreter as specified by the command line (see Section 2.1.2
[Mode Options], page 13).
2. [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I was reading the gdb manual. Apparently it reads the .gdbinit file from your homedirectory AND <B>from the current working directory</B>:<br />
&#8220;2.1.3 What gdb does during startup<br />
Heres the description of what gdb does during session startup:<br />
1. Sets up the command interpreter as specified by the command line (see Section 2.1.2<br />
[Mode Options], page 13).<br />
2. Reads the init file (if any) in your home directory1 and executes all the commands in<br />
that file.<br />
3. Processes command line options and operands.<br />
4. <B>Reads and executes the commands from init file (if any) in the current working directory.</B><br />
This is only done if the current directory is different from your home directory.<br />
Thus, you can have more than one init file, one generic in your home directory, and<br />
another, specific to the program you are debugging, in the directory where you invoke<br />
gdb.&#8221;</p>
<p>Anyone besides me that thinks this is a dumb idea ?<br />
Btw, in case you didnt know, it&#8217;s possible to have shell commands in your .gdbinit file.<br />
Anyways, next time I&#8217;m on a shellserver you can bet I&#8217;ll have an evil .gdbinit file in /tmp.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13530/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>how can you fuck this up ??</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13516/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13516/#comments</comments>
		<pubDate>Sun, 26 Nov 2006 02:38:52 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13516/</guid>
		<description><![CDATA[Same httpd as I blogged about earlier:
	strlcpy(orig, params, MYBUFSIZ);
	size = strlen(orig);
	if (size &#60; NI_MAXHOST &#38;&#38;
		sscanf(params, &#8220;http://%[^/]%c&#8221;, http_host, &#38;ch) == 2 &#38;&#38;
		ch == &#8216;/&#8217;)
params can be up to 4096 bytes and is usercontrolled, MYBUFSIZ is 1024 and NI_MAXHOST is 1025 !!
This is the funniest bounds check fuckup i&#8217;ve seen in a while.
I rest my case.
]]></description>
			<content:encoded><![CDATA[<p>Same httpd as I blogged about earlier:<br />
	strlcpy(orig, params, MYBUFSIZ);<br />
	size = strlen(orig);</p>
<p>	if (size &lt; NI_MAXHOST &amp;&amp;<br />
		sscanf(params, &#8220;http://%[^/]%c&#8221;, http_host, &amp;ch) == 2 &amp;&amp;<br />
		ch == &#8216;/&#8217;)</p>
<p>params can be up to 4096 bytes and is usercontrolled, MYBUFSIZ is 1024 and NI_MAXHOST is 1025 !!</p>
<p>This is the funniest bounds check fuckup i&#8217;ve seen in a while.</p>
<p>I rest my case.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13516/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>return values, return values, return values !</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13515/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13515/#comments</comments>
		<pubDate>Sun, 26 Nov 2006 01:02:00 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13515/</guid>
		<description><![CDATA[I was going over some code in some httpd when I saw the following:
strftime(modified, sizeof(modified), &#8220;%a, %d %b %Y %H:%M:%S GMT&#8221;, gmtime(&#38;modtime));
where modtime is under a users control. modfied is a very small buffer. 
not knowing exactly all the features of strftime I looked in the manpage and read the following:
&#8220;The strftime() function returns the [...]]]></description>
			<content:encoded><![CDATA[<p>I was going over some code in some httpd when I saw the following:<br />
strftime(modified, sizeof(modified), &#8220;%a, %d %b %Y %H:%M:%S GMT&#8221;, gmtime(&amp;modtime));<br />
where modtime is under a users control. modfied is a very small buffer. </p>
<p>not knowing exactly all the features of strftime I looked in the manpage and read the following:<br />
&#8220;The strftime() function returns the number of characters placed in the array s, not including the terminating null byte, provided the string, including the terminating null byte, fits. Otherwise, it returns 0, and the contents of the array is <B>undefined</B>. (Thus at least since libc 4.4.4; very old versions of libc, such as libc 4.4.1, would return max if the array was too small.)&#8221;</p>
<p>Obviously that line of code is wrong. as it turns out &#8220;modified&#8221; gets written back to the user, so this piece of code could leak information, or possible cause a segfault when an unmapped page gets hit (since it&#8217;s assumed it&#8217;s a 0-terminated string). </p>
<p>is it really that hard to always and consistently check return values ?</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13515/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reading rfc&#8217;s</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13501/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13501/#comments</comments>
		<pubDate>Sat, 25 Nov 2006 08:39:51 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13501/</guid>
		<description><![CDATA[So I was reading some rfc&#8217;s and apparently it&#8217;s forbidden to send chain letters via electronic mail. It&#8217;s in the rfc, so it must be true. rfc1855:
&#8220;Never send chain letters via electronic mail.  Chain lettersare forbidden on the Internet.  Your network privileges will be revoked.  Notify your local system administrator if your [...]]]></description>
			<content:encoded><![CDATA[<p>So I was reading some rfc&#8217;s and apparently it&#8217;s forbidden to send chain letters via electronic mail. It&#8217;s in the rfc, so it must be true. rfc1855:<br />
&#8220;Never send chain letters via electronic mail.  Chain lettersare forbidden on the Internet.  Your network privileges will be revoked.  Notify your local system administrator if your ever receive one.&#8221; </p>
<p>also, I just saw that there are &#8220;scream awards&#8221; on tv, wtf ??? people are giving away awards for everything these days. If only there were slacker awards, I&#8217;d win every single one of them. </p>
<p>I recently saw this movie &#8220;stormbreaker&#8221; it totally sux !! don&#8217;t spend money on it, hell don&#8217;t even spend bandwidth on it, it&#8217;s not worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13501/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>close and fclose</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13494/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13494/#comments</comments>
		<pubDate>Sat, 25 Nov 2006 03:28:40 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13494/</guid>
		<description><![CDATA[I guess it&#8217;s time for another this-api-is-so-broken blogpost. fclose() as most know is used to close a stream that was obtained from fopen(), fdopen(), popen(), &#8230; . However, almost noone actually bothers checking the return value of fclose. According to the manpage it CAN fail, and hence you should adleast see if it does or [...]]]></description>
			<content:encoded><![CDATA[<p>I guess it&#8217;s time for another this-api-is-so-broken blogpost. fclose() as most know is used to close a stream that was obtained from fopen(), fdopen(), popen(), &#8230; . However, almost noone actually bothers checking the return value of fclose. According to the manpage it CAN fail, and hence you should adleast see if it does or not. fclose() is however broken by design imo. The maanpage states the following:<br />
&#8220;Upon successful completion 0 is returned. Otherwise, EOF is returned and the global variable errno is set to indicate the error. In either case any further access (including another call to fclose()) to the stream results in undefined behaviour.&#8221;<br />
It means that should you check the return value of fclose() and detect that it failed, then there is nothing that you can do about it (hm, well, you could try, but that might lead to heap corruption, something you probably want to avoid), in other words, you&#8217;re doomed if you do and you&#8217;re doomed if you don&#8217;t.<br />
I guess the only thing you could do (if you&#8217;re trying to write correct code) is to basicly abort immediatly if you detect fclose() failed. </p>
<p>This brings me to close() which isn&#8217;t as busted as fclose() but suffers from the same usage problem. Almost noone ever checks it&#8217;s return value, and yet, according to POSIX it can fail. The manpage says the following about it:<br />
&#8220;ERRORS </p>
<p>EBADF<br />
    fd isn&#8217;t a valid open file descriptor.<br />
EINTR<br />
    The close() call was interrupted by a signal.<br />
EIO<br />
    An I/O error occurred.&#8221;</p>
<p>so it could for example get interrupted by a signal, and leave the fd open. The linux manpage goes on and states:<br />
&#8220;Not checking the return value of close is a common but nevertheless serious programming error. It is quite possible that errors on a previous write(2) operation are first reported at the final close(). Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and with disk quota.&#8221;</p>
<p>People should seriously start checking the return value of calls like close(). Not doing so could lead to fd leaks, and placed in the right context those can be a huge security issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13494/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>glib sux !!1!</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13475/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13475/#comments</comments>
		<pubDate>Fri, 24 Nov 2006 02:51:03 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13475/</guid>
		<description><![CDATA[It so does !
Wtf were those guys thinking ? Most of the stuff in there is redundant ! g_malloc() ?!? Hello ??? this shit is useless ! not to mention that using glib makes your code look ugly. 
glib also has it&#8217;s own &#8220;basic types&#8221;
you know, gint, guint, gboolean, gconstpointer ( _YES_, gconstpointer, coz that [...]]]></description>
			<content:encoded><![CDATA[<p>It so does !<br />
Wtf were those guys thinking ? Most of the stuff in there is redundant ! g_malloc() ?!? Hello ??? this shit is useless ! not to mention that using glib makes your code look ugly. </p>
<p>glib also has it&#8217;s own &#8220;basic types&#8221;<br />
you know, gint, guint, gboolean, gconstpointer ( _YES_, gconstpointer, coz that really makes it look nicer , also, see http://www.kuro5hin.org/story/2003/8/12/231143/644 ).</p>
<p>g_strdup_printf(), wtf is wrong with asprintf() ?</p>
<p>I could go on and on, but I won&#8217;t. </p>
<p>Some claim that it&#8217;s usefull for portable code, I disagree. We all know portable code looks ugly from time to time, there is no need to obfuscate it even further !</p>
<p>Also, I think they missed a useless function:<br />
g_lib_sucks_big_hairy_monkey_balls_like_sweet_chocolate_candy()</p>
<p>A while ago I was reading some glib code (and I&#8217;m still sort of sane, I wonder how I pulled that off) and spotted some interesting code: </p>
<p>#define g_new(struct_type, n_structs)		\<br />
    ((struct_type *) g_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))<br />
#define g_new0(struct_type, n_structs)		\<br />
    ((struct_type *) g_malloc0 (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))<br />
#define g_renew(struct_type, mem, n_structs)	\<br />
    ((struct_type *) g_realloc ((mem), ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))</p>
<p>#define g_try_new(struct_type, n_structs)		\<br />
    ((struct_type *) g_try_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))<br />
#define g_try_new0(struct_type, n_structs)		\<br />
    ((struct_type *) g_try_malloc0 (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))<br />
#define g_try_renew(struct_type, mem, n_structs)	\<br />
    ((struct_type *) g_try_realloc ((mem), ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))</p>
<p>can you say integer overflow ? I did report this to the glib people, never got a response (the copypast is from the latest version) </p>
<p>ofcourse they also have alloca wrappers:</p>
<p>#define g_alloca(size)		 alloca (size)<br />
#define g_newa(struct_type, n_structs)	((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs)))</p>
<p>Because alloca() is so secure !!1!. yea, g_newa() also has an overflow, I&#8217;m shocked I tell you, shocked !</p>
<p>I can&#8217;t take people who use glib serious, I tried, I failed. If you&#8217;re a programmer and feel you must use glib then maybe it&#8217;s time to look for a new profession.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13475/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>proftpd</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13474/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13474/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 23:41:15 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13474/</guid>
		<description><![CDATA[it seems a bug I reported in proftpd got mistaken with another bug that Evgeny Legerov found ages ago. A couple of weeks ago I was browsing thru the proftpd code and stumbled on some issues, one of them is the so called &#8220;CommandBufferSize thing&#8221;. This one is an off-by-two underflow. the bug is located [...]]]></description>
			<content:encoded><![CDATA[<p>it seems a bug I reported in proftpd got mistaken with another bug that Evgeny Legerov found ages ago. A couple of weeks ago I was browsing thru the proftpd code and stumbled on some issues, one of them is the so called &#8220;CommandBufferSize thing&#8221;. This one is an off-by-two underflow. the bug is located in the following piece of code: </p>
<p>static void cmd_loop(server_rec *server, conn_t *c) {<br />
  static long cmd_buf_size = -1;<br />
  config_rec *id = NULL;<br />
  char buf[PR_TUNABLE_BUFFER_SIZE] = {&#8221;};<br />
  &#8230;<br />
    if (pr_netio_telnet_gets(buf, sizeof(buf)-1, session.c-&gt;instrm,<br />
        session.c-&gt;outstrm) == NULL) {<br />
        &#8230;<br />
    }<br />
    if (cmd_buf_size == -1) {<br />
      long *buf_size = get_param_ptr(main_server-&gt;conf,<br />
        &#8220;CommandBufferSize&#8221;, FALSE);</p>
<p>      if (buf_size == NULL || *buf_size  sizeof(buf)) {<br />
 pr_log_pri(PR_LOG_WARNING, &#8220;Invalid CommandBufferSize size given. &#8221;<br />
          &#8220;Resetting to 512.&#8221;);<br />
 cmd_buf_size = 512;<br />
      }<br />
    }</p>
<p>    buf[cmd_buf_size - 1] = &#8221;;<br />
 &#8230;.</p>
<p>if CommandBufferSize is set, and it&#8217;s set to something reasonable (go figure) it causes an off-by-two underflow. (for those who don&#8217;t get it, cmd_buf_size remains -1 and hence the following happens buf[-1 -1] = &#8221;; and for those who failed elementary school math&#8217;s that&#8217;s buf[-2] = &#8221;;).<br />
I also reported some other bugs in proftpd, including some readlink() off-by-one&#8217;s in the ls code (3 of them to be exact), one of them I think has potential: </p>
<p>static int nlstdir(cmd_rec *cmd, const char *dir) {<br />
  char **list, *p, *f,<br />
  file[PR_TUNABLE_PATH_MAX + 1] = {&#8221;};<br />
  &#8230;<br />
      if ((i = pr_fsio_readlink(p, file, sizeof(file))) &gt; 0) {<br />
      file[i] = &#8221;;<br />
      f = file;<br />
  &#8230;<br />
}</p>
<p>I blogged about readlink abuse before, but for those who don&#8217;t see it, readlink() returns how many bytes it copied and doesn&#8217;t 0-terminate. so if it copied sizeof(file) bytes, that&#8217;s what it&#8217;ll return. So sizeof(file) gets used as an index to file, and hence causes an off-by-one. Depending on the compiler being used there&#8217;s a possibility you smash right into the saved frame pointer. </p>
<p>I also found a bunch of other off-by-a-one&#8217;s and off-by-a-few&#8217;s (like their &#8220;secure&#8221; strcpy code I blogged about earlier) but exploitation of them seems unlikely. </p>
<p>The carefull reader might have seen that all the crap I&#8217;m talking about are off-by-one&#8217;s and off- by-a-few&#8217;s and they would be right. ProFTPD is off-by-one paradise !!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13474/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>gaim</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13388/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13388/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 01:11:30 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13388/</guid>
		<description><![CDATA[/* just in case you were wondering, this is why DCC is gay */
static void irc_dccsend_send_read(gpointer data, int source, GaimInputCondition cond)
{
	GaimXfer *xfer = data;
	struct irc_xfer_send_data *xd = xfer-&#62;data;
	char *buffer[16];
	int len;
	len = read(source, buffer, sizeof(buffer));
In case you were wondering this is why gaim is gay. 
		if (xd-&#62;rxlen) {
			unsigned char *tmp = g_memdup(xd-&#62;rxqueue + 4, xd-&#62;rxlen);
			g_free(xd-&#62;rxqueue);
			xd-&#62;rxqueue = [...]]]></description>
			<content:encoded><![CDATA[<p>/* just in case you were wondering, this is why DCC is gay */<br />
static void irc_dccsend_send_read(gpointer data, int source, GaimInputCondition cond)<br />
{<br />
	GaimXfer *xfer = data;<br />
	struct irc_xfer_send_data *xd = xfer-&gt;data;<br />
	char *buffer[16];<br />
	int len;</p>
<p>	len = read(source, buffer, sizeof(buffer));</p>
<p>In case you were wondering this is why gaim is gay. </p>
<p>		if (xd-&gt;rxlen) {<br />
			unsigned char *tmp = g_memdup(xd-&gt;rxqueue + 4, xd-&gt;rxlen);<br />
			g_free(xd-&gt;rxqueue);<br />
			xd-&gt;rxqueue = tmp;<br />
		} </p>
<p>because advancing a pointer by 4 is too much of a hassle. </p>
<p>	} else if (!strncmp(cur, &#8220;PING &#8220;, 5)) {<br />
		if (notice) { /* reply */<br />
			/* TODO: Should this read in the timestamp as a double? */<br />
			sscanf(cur, &#8220;PING %lu&#8221;, &amp;timestamp);<br />
			gc = gaim_account_get_connection(irc-&gt;account);<br />
			if (!gc)<br />
				return NULL;<br />
			buf = g_strdup_printf(_(&#8221;Reply time from %s: %lu seconds&#8221;), from, time(NULL) &#8211; timestamp);<br />
			gaim_notify_info(gc, _(&#8221;PONG&#8221;), _(&#8221;CTCP PING reply&#8221;), buf);<br />
			g_free(buf);<br />
			return NULL;<br />
		} </p>
<p>yea ctcp ping infoleaks !!1!</p>
<p>/* Note that this is NOT correct w.r.t. multiple CTCPs in one<br />
	 * message and low-level quoting &#8230; but if you want that crap,<br />
	 * use a real IRC client. */</p>
<p>That sure shows you&#8217;re confident in your own code. </p>
<p>omfg, that code is unbelievable.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13388/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>speaking of solaris</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13387/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13387/#comments</comments>
		<pubDate>Wed, 15 Nov 2006 23:08:54 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13387/</guid>
		<description><![CDATA[I just remembered. I was at hack.lu a couple of weeks ago, and there was a guy giving a talk about how to cause an unlink() without calling free() (in heap exploitation) He worked out some situation where this is possible with just calling malloc() in the solaris and aix heap allocators. During the QA [...]]]></description>
			<content:encoded><![CDATA[<p>I just remembered. I was at hack.lu a couple of weeks ago, and there was a guy giving a talk about how to cause an unlink() without calling free() (in heap exploitation) He worked out some situation where this is possible with just calling malloc() in the solaris and aix heap allocators. During the QA a buddy of mine asked &#8220;Have you tried this with a modern os ?&#8221;. I laughed my ass of with that question (for those who don&#8217;t get it, he&#8217;s implying that aix and solaris are not modern operating systems) but apparently I was the only one in the entire room that though it was funny.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13387/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>more ranting on the most secure os on the planet (read: solaris)</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13386/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13386/#comments</comments>
		<pubDate>Wed, 15 Nov 2006 22:36:59 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13386/</guid>
		<description><![CDATA[So I was reading some of the sunssh code (which is just an ugly mutation of heavely outdated openssh code). And ran into a bug that was fixed in openssh ages ago. It&#8217;s basicly a free of an uninit pointer on the stack in ssh-keysign (for those who don&#8217;t know, in sun ssh and older [...]]]></description>
			<content:encoded><![CDATA[<p>So I was reading some of the sunssh code (which is just an ugly mutation of heavely outdated openssh code). And ran into a bug that was fixed in openssh ages ago. It&#8217;s basicly a free of an uninit pointer on the stack in ssh-keysign (for those who don&#8217;t know, in sun ssh and older versions of openssh it is suid root). </p>
<p>for more details on this bug see:<br />
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/ssh-keysign.c?rev=1.11&amp;content-type=text/x-cvsweb-markup<br />
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/ssh-keysign.c.diff?r1=1.10&amp;r2=1.11&amp;f=h<br />
and<br />
http://cvs.opensolaris.org/source/xref/on/usr/src/cmd/ssh/ssh-keysign/ssh-keysign.c</p>
<p>Obviously I reported this to sun, and got the following email from them:<br />
&#8221;<br />
Thanks for getting in touch to report this issue.  It doesn&#8217;t look like<br />
this would impose any sort of security risk; for example a Denial of<br />
Service (DoS) condition doesn&#8217;t appear to be possible.  We have logged the<br />
following bug for this issue:</p>
<p>6489555 ssh-keysign:valid_request() may SEGV dereferencing uninitialized pointer</p>
<p>For issues which don&#8217;t relate to security vulnerabilities you can log bugs<br />
via:</p>
<p>http://bugs.opensolaris.org/</p>
<p>However for any issue which appears to be a potential security<br />
vulnerability then security-alert@sun.com is the best point of contact.<br />
Thanks again!<br />
&#8221;</p>
<p>Ofcourse free(uninit_ptr) are non exploitable bugs, with the solaris heap being hardended and all ().</p>
<p>I&#8217;m going to have to go with incompetence here !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13386/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dave on finding vulnerabilities</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13345/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13345/#comments</comments>
		<pubDate>Sun, 12 Nov 2006 14:42:15 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13345/</guid>
		<description><![CDATA[&#8220;So one thing that struck me this week was how most good hackers cannot tell
you how they find vulnerabilities. I&#8217;ve asked both Kostya and Sinan how they
find bugs, and there really isn&#8217;t a process behind it, other than
persistance, experience, and gut feel. I&#8217;ve been consulting for a bit to get
my feet wet again. Consulting is [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;So one thing that struck me this week was how most good hackers cannot tell<br />
you how they find vulnerabilities. I&#8217;ve asked both Kostya and Sinan how they<br />
find bugs, and there really isn&#8217;t a process behind it, other than<br />
persistance, experience, and gut feel. I&#8217;ve been consulting for a bit to get<br />
my feet wet again. Consulting is an ego game. Do you think you can break<br />
this in one week? The answer is maybe, but your internal voice better be<br />
saying &#8220;hell yes&#8221; or you won&#8217;t succeed.&#8221;<br />
http://lists.immunitysec.com/pipermail/dailydave/2006-November/003739.html</p>
<p>I couldn&#8217;t have said it better myself. It&#8217;s kindof weird, but he&#8217;s totally right, there isn&#8217;t really a structured process behind finding vulnerabilities.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13345/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vulnerabilities in spyware/adware ?</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13320/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13320/#comments</comments>
		<pubDate>Sat, 11 Nov 2006 00:36:43 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13320/</guid>
		<description><![CDATA[I was reading thru my access_log file and started looking at some of the user-agent messages. What surprised me was that a lot of the MSIE one&#8217;s had some additional crap in there (&#8221;Alexa Toolbar&#8221;, &#8220;FunWebProducts&#8221;, &#8220;SIMBAR&#8221;, &#8230;). Turns out (after some googling) that most of that stuff is spyware/adware. So it got me thinking, [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading thru my access_log file and started looking at some of the user-agent messages. What surprised me was that a lot of the MSIE one&#8217;s had some additional crap in there (&#8221;Alexa Toolbar&#8221;, &#8220;FunWebProducts&#8221;, &#8220;SIMBAR&#8221;, &#8230;). Turns out (after some googling) that most of that stuff is spyware/adware. So it got me thinking, if they all infect your browser, chances are they&#8217;ll also parse every webpage you view. I don&#8217;t think this spyware/adware crap is written by people who actually give a shit about security, and hence it&#8217;s very likely most of them contain some easely exploitable implementation bugs. So I wonder, has anyone ever looked at that ? Will it become a future trend ? And what if you find a vulnerability in it ? You report it to the vendor and then what ? They&#8217;ll kindly ask the people who are unaware they have their crap installed to update ???? Do these people have autoupdate capabilities (let&#8217;s hope not !) ? </p>
<p>This scares me a little.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13320/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Most advanced os on the planet and totally secure</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13304/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13304/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 12:25:35 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13304/</guid>
		<description><![CDATA[It&#8217;s solaris:

I read this in one of those adds you get to pull out of a webpage (if you go to the right upper corner) so it must be true !
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s solaris:<br />
<img src="http://static.23.nu/antville/ilja/images/solaris.jpg" /><br />
I read this in one of those adds you get to pull out of a webpage (if you go to the right upper corner) so it must be true !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13304/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zlib</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13290/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13290/#comments</comments>
		<pubDate>Wed, 08 Nov 2006 11:09:07 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13290/</guid>
		<description><![CDATA[fefe about zlib:
&#62; Have you ever looked at zlib ?
Yes. What did you think made me so cynical?
:) I didnt really get permission to quote this, but it was too good not to !
]]></description>
			<content:encoded><![CDATA[<p>fefe about zlib:<br />
&gt; Have you ever looked at zlib ?<br />
Yes. What did you think made me so cynical?</p>
<p>:) I didnt really get permission to quote this, but it was too good not to !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13290/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>adobe gives code to mozilla</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13281/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13281/#comments</comments>
		<pubDate>Tue, 07 Nov 2006 13:35:12 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13281/</guid>
		<description><![CDATA[Holy batman, what the fuck !!
I just read on fefe&#8217;s blog that Adobe is going to give some code to mozilla. an Action script engine to be precise. let me say that again, AN ACTIONSCRIPT ENGINE FROM ADOBE! I though the mozilla guys wanted to increase security, not decrease it by a few orders of [...]]]></description>
			<content:encoded><![CDATA[<p>Holy batman, what the fuck !!<br />
I just read on fefe&#8217;s blog that Adobe is going to give some code to mozilla. an Action script engine to be precise. let me say that again, AN ACTIONSCRIPT ENGINE FROM ADOBE! I though the mozilla guys wanted to increase security, not decrease it by a few orders of magnitude. </p>
<p>I&#8217;ve been unfortunate enough to read some adobe parsing code, and I&#8217;ve never seen anything more horrifying in my life! </p>
<p>I think this is a mistake that&#8217;ll come back to bite them in the ass !</p>
<p>you can find more info about it here:<br />
http://www.hecker.org/mozilla/adobe-mozilla-and-tamarin<br />
http://www.mozilla.org/projects/tamarin/</p>
<p>A little update: I took a quick peek at some of the code that got uploaded (http://lxr.mozilla.org/mozilla/source/js/tamarin/, for those that are interested), it seems alloca is used A LOT throughout the code. Not really a good idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13281/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uncyclopedia about Pi</title>
		<link>http://blogs.23.nu/ilja/2006/11/antville-13279/</link>
		<comments>http://blogs.23.nu/ilja/2006/11/antville-13279/#comments</comments>
		<pubDate>Tue, 07 Nov 2006 09:08:09 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/11/antville-13279/</guid>
		<description><![CDATA[&#8220;The decimal expression of pi has been traditionally interpreted to be about 3.141592653IGotIt69BeverlyHills90210@aol.com. This estimate dissatisfies modern-day mathematicians, however, who have used supercomputers to calculate the value of pi to the baskillionth jajillionth digit. When these mathematicians declared that digit to be 5, terrorists declared war on mathematics.&#8221;
and you know uncyclopedia is always right !1!!
]]></description>
			<content:encoded><![CDATA[<p>&#8220;The decimal expression of pi has been traditionally interpreted to be about 3.141592653IGotIt69BeverlyHills90210@aol.com. This estimate dissatisfies modern-day mathematicians, however, who have used supercomputers to calculate the value of pi to the baskillionth jajillionth digit. When these mathematicians declared that digit to be 5, terrorists declared war on mathematics.&#8221;</p>
<p>and you know uncyclopedia is always right !1!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/11/antville-13279/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>making your own *str*cpy() &#8230;</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13212/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13212/#comments</comments>
		<pubDate>Tue, 31 Oct 2006 12:02:31 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13212/</guid>
		<description><![CDATA[&#8230; is usually a really dumb idea. You always tend to fuck something up. DON&#8217;T DO IT. Instead use strncpy, strlcpy, strncpy_s, or whatever boundschecking string copy function your libc provides. Obvioulsy this doesn&#8217;t mean your in the clear, but they are usually well documentent, and the documentation will usually tell you about any pitfalls [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; is usually a really dumb idea. You always tend to fuck something up. DON&#8217;T DO IT. Instead use strncpy, strlcpy, strncpy_s, or whatever boundschecking string copy function your libc provides. Obvioulsy this doesn&#8217;t mean your in the clear, but they are usually well documentent, and the documentation will usually tell you about any pitfalls it may have. </p>
<p>one of the most common mistakes with making your own string copy functions is that of forgetting that someone might call it with a length of 0, and you end up with an off-by-one overflow or underflow. </p>
<p>Let me demonstrate with ProFTPD code: </p>
<p>/* &#8220;safe&#8221; strncpy, saves room for  at end of dest, and refuses to copy<br />
 * more than &#8220;n&#8221; bytes.<br />
 */<br />
char *sstrncpy(char *dest, const char *src, size_t n) {<br />
  register char *d = dest;</p>
<p>  if (!dest)<br />
    return NULL;</p>
<p>  if (src &amp;&amp; *src) {<br />
    for (; *src &amp;&amp; n &gt; 1; n&#8211;)<br />
      *d++ = *src++;<br />
  }</p>
<p>  *d = &#8221;;</p>
<p>  return dest;<br />
}</p>
<p>if len is 0 in this case you still end up with *d = &#8221;; and hence cause an off-by-one overflow. </p>
<p>So please, refrain from building your own string copy functions, coz you WILL fuck up !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13212/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wu-ftpd</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13140/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13140/#comments</comments>
		<pubDate>Tue, 24 Oct 2006 07:59:10 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13140/</guid>
		<description><![CDATA[So I just read the COPYRIGHT.c file in wu-ftpd. It states: &#8221; Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P.  Allman.&#8221;
Why am I not surprised ?
]]></description>
			<content:encoded><![CDATA[<p>So I just read the COPYRIGHT.c file in wu-ftpd. It states: &#8221; Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P.  Allman.&#8221;</p>
<p>Why am I not surprised ?</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13140/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>more to come</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13134/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13134/#comments</comments>
		<pubDate>Mon, 23 Oct 2006 16:40:24 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13134/</guid>
		<description><![CDATA[
I wonder what kernel memory looks like :)
Update:
NetBSD ptrace() information leak :)
see ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2006-025.txt.asc
]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.23.nu/antville/ilja/images/netbsd.jpg" /></p>
<p>I wonder what kernel memory looks like :)</p>
<p>Update:<br />
NetBSD ptrace() information leak :)<br />
see ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2006-025.txt.asc</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13134/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>kid&#8217;s can&#8217;t play tag anymore ?</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13078/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13078/#comments</comments>
		<pubDate>Wed, 18 Oct 2006 16:27:26 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13078/</guid>
		<description><![CDATA[http://www.cnn.com/2006/US/10/18/no.tag.ap/index.html
&#8220;Officials at an elementary school south of Boston have banned kids from playing tag, touch football and any other unsupervised chase game during recess for fear they&#8217;ll get hurt and hold the school liable.&#8221;
they go on to say:
&#8220;Recess is &#8220;a time when accidents can happen,&#8221; said Willett Elementary School Principal Gaylene Heppe, who approved the [...]]]></description>
			<content:encoded><![CDATA[<p>http://www.cnn.com/2006/US/10/18/no.tag.ap/index.html</p>
<p>&#8220;Officials at an elementary school south of Boston have banned kids from playing tag, touch football and any other unsupervised chase game during recess for fear they&#8217;ll get hurt and hold the school liable.&#8221;</p>
<p>they go on to say:<br />
&#8220;Recess is &#8220;a time when accidents can happen,&#8221; said Willett Elementary School Principal Gaylene Heppe, who approved the ban.&#8221;</p>
<p>You get a captain obvious award for that one (yea, that&#8217;s right, I stole the captain obvious awards thing from fefe !)</p>
<p>This is <b>INSANE</b>. Especially for this occasion I made an insane-o-meter in ms paint (YES, ms paint !)<br />
<img src="http://static.23.nu/antville/ilja/images/insaneometer.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13078/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apple fucked up</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13072/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13072/#comments</comments>
		<pubDate>Wed, 18 Oct 2006 13:41:32 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13072/</guid>
		<description><![CDATA[http://www.apple.com/support/windowsvirus/
from the webpage:
&#8220;As you might imagine, we are upset at Windows for not being more hardy against such viruses, and even more upset with ourselves for not catching it.&#8221;
So they fucked up and try to blame it on microsoft.
That&#8217;s just grrrrrrrreat !
]]></description>
			<content:encoded><![CDATA[<p>http://www.apple.com/support/windowsvirus/</p>
<p>from the webpage:<br />
&#8220;As you might imagine, we are upset at Windows for not being more hardy against such viruses, and even more upset with ourselves for not catching it.&#8221;</p>
<p>So they fucked up and try to blame it on microsoft.</p>
<p>That&#8217;s just grrrrrrrreat !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13072/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>underhanded code</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13071/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13071/#comments</comments>
		<pubDate>Wed, 18 Oct 2006 11:07:11 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13071/</guid>
		<description><![CDATA[So I was reading some code and saw some really underhanded c code: 
if(something);{
  blah blah blah
}
yea, this stands out now, but it might not if you put it in between a few thousand lines of code !
]]></description>
			<content:encoded><![CDATA[<p>So I was reading some code and saw some really underhanded c code: </p>
<p>if(something);{<br />
  blah blah blah<br />
}</p>
<p>yea, this stands out now, but it might not if you put it in between a few thousand lines of code !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13071/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux kernel intentionally sabotaged.</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13067/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13067/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 12:23:52 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13067/</guid>
		<description><![CDATA[Recently I was looking at how /dev/urandom was implemented in the linux kernel. So I looked at drivers/char/random.c. While I was reading that code I ran into the following:
&#8230;
static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
                    [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was looking at how /dev/urandom was implemented in the linux kernel. So I looked at drivers/char/random.c. While I was reading that code I ran into the following:<br />
&#8230;<br />
static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,<br />
                                    size_t nbytes)<br />
{<br />
	ssize_t ret = 0, i;<br />
	__u8 tmp[EXTRACT_SIZE];<br />
	&#8230;<br />
	while (nbytes) {<br />
		&#8230;<br />
		extract_buf(r, tmp);<br />
		i = min_t(int, nbytes, EXTRACT_SIZE);<br />
		if (copy_to_user(buf, tmp, i)) { &#8230; }<br />
		&#8230;<br />
	}<br />
	&#8230;<br />
}<br />
&#8230;<br />
static ssize_t<br />
urandom_read(struct file * file, char __user * buf,<br />
                      size_t nbytes, loff_t *ppos)<br />
{<br />
	return extract_entropy_user(&amp;nonblocking_pool, buf, nbytes);<br />
}</p>
<p>urandom_read() is a direct read() hook that get&#8217;s called from vfs_read() (which in turn gets called from sys_read()). The bug here is pretty obvious. There is size_t truncation here:<br />
i = min_t(int, nbytes, EXTRACT_SIZE);</p>
<p>At this point I was thinking &#8220;WTF ? this is wrong, how can this be in /dev/urandom code !!!!&#8221;. I remembered that there are some range checks in vfs_read() and hence I looked in vfs_read():</p>
<p>/*<br />
 * rw_verify_area doesn&#8217;t like huge counts. We limit<br />
 * them to something that fits in &#8220;int&#8221; so that others<br />
 * won&#8217;t have to do range checks all the time.<br />
 */<br />
#define MAX_RW_COUNT (INT_MAX &amp; PAGE_CACHE_MASK)</p>
<p>int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count)<br />
{<br />
	&#8230;<br />
	loff_t pos;</p>
<p>	if (unlikely((ssize_t) count &lt; 0))<br />
		goto Einval;<br />
	pos = *ppos;<br />
	if (unlikely((pos &lt; 0) || (loff_t) (pos + count)  MAX_RW_COUNT ? MAX_RW_COUNT : count;</p>
<p>Einval:<br />
	return -EINVAL;<br />
}</p>
<p>ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)<br />
{<br />
	ssize_t ret;<br />
	&#8230;<br />
	ret = rw_verify_area(READ, file, pos, count);<br />
	if (ret &gt;= 0) {<br />
		count = ret;<br />
		&#8230;<br />
			ret = file-&gt;f_op-&gt;read(file, buf, count, pos);<br />
		&#8230;<br />
	}<br />
	return ret;<br />
}</p>
<p>(actually I was told about this code by linus torvalds himself, after I reported a ppc specific bug in /proc. I believe his (almost) exact words were (I lost the email) &#8220;We added this code in 2.6. to prevent integer abuse in read/write hooks, I believe it got backported to 2.4 aswell&#8221;. And it did get backported to 2.4, I checked. The reason I stumbled on this bug (it&#8217;s in src/arch/ppc/kernel/htab.c proc_dol2crvec() btw, bonus points for whoever can spot signedness issue) because of a capture the flag game at HITB bahrain last year. The game got pretty boring so we decided to own one of the organisers laptop (hi Dhillon !) WITH PERMISSION! He was using an iBook with some linux distro on it, and using the 2.6.10 kernel at the time. That kernel didn&#8217;t have the range checks yet and hence the proc_dol2crvec quickly gave us read access to most kernel memory. We eventually ended up rooting it because of that bug. Which brings me to my point, that all of these horrible read/write bugs in drivers were in fact exploitable (and were exploited) on linux prior to just adding the range checking code in rw_verify_area and hence should still have gotten fixed !.) </p>
<p>Hm, wandered off there for a bit, let&#8217;s get back to the code in rw_verify_area(). What it basicly does is check for:<br />
- size not negative<br />
- offset nog negative<br />
- size + offset not negative<br />
and then <b>TRUNCATES</b> size_t -&gt; signed integer, see the code comment. </p>
<p>This is shocking imo! But done for security reasons, which is certainly a noble thing. But this hides horrible bugs. So in fact it does the opposite. It sends out a message that &#8220;It&#8217;s ok to write crappy kernel code, we&#8217;ve got code in place to mitigate&#8221;. Anyone who ever looked at some of the drivers in the linux kernel knows there is a huge pile of low quality code in there, and a lot of copypasting is done (let&#8217;s call it infecting other code with low quality code). So even if you have crappy code that&#8217;s covered by the range checks and truncation in rw_verify_area() and vfs_read() someone might copypast your code in some place where&#8217;s it&#8217;s not covered by these range checks and you&#8217;ve got a big fat security hole on your hands. Not to mention that there might be another codepath to read() hooks in drivers thru some ioctls (where it doesn&#8217;t go thru vfs_read()).</p>
<p>What this means in reality is that on systems where sizeof(size_t) &gt; sizeof(int) (mostly 64 bit architectures) that you only get to read or write at most 2 gigabytes of data (in a single call to read() or write()), even though you might want to read or write more then that. Which is INSANE! There is no need for this. Obviously you could try to make a case for this and state that you should do this in a loop of 2gig reads or write&#8217;s at a time. But this is kind of silly. Because it adds a needless loop (there is already such a loop in place in the kernel most of the time, in the /dev/urandom case for example) and more importantly it adds syscall overhead ! </p>
<p>I&#8217;m sure by now some people are going &#8220;But you could use mmap, USE MMAP !&#8221; NO, you can&#8217;t. Hm, well, not always. See, there are non-regular files out there that don&#8217;t let you mmap. /dev/urandom for example, or /proc/pid/mem (Zalewksi++). But wait, it get&#8217;s worse, write() is covered by the same restrictions as read() in rw_verify_area() and therefor you can only write 2 gigs at a time. Not something you really want (thanks fefe).</p>
<p>I bet there are apps out there that actually break on this! there have to be, with all the crap that people put out there there&#8217;s gotta be 1 or 2 applications that go up in flames because of this!</p>
<p>if you want to add some range checks, then check if the count given is  int truncation. It breaks functionality !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13067/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s just another denial of service</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-13000/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-13000/#comments</comments>
		<pubDate>Mon, 09 Oct 2006 10:57:22 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-13000/</guid>
		<description><![CDATA[http://newsvac.newsforge.com/newsvac/06/10/07/130207.shtml
http://www.pine.nl/press/pine-cert-20030101.txt
enough said !
edit:
another one
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_generic.c.diff?r1=1.150&#38;r2=1.151&#38;f=h
&#8220;Prevent IOC_IN with zero size argument (this is only supported
if backward copatibility options are present) from attempting
to free memory that wasn&#8217;t allocated.  This is an old bug, and
previously it would attempt to free a null pointer.  I noticed
this bug when working on the previous revision, but forgot to
fix it.
Security:	local DoS
Reported [...]]]></description>
			<content:encoded><![CDATA[<p>http://newsvac.newsforge.com/newsvac/06/10/07/130207.shtml<br />
http://www.pine.nl/press/pine-cert-20030101.txt<br />
enough said !</p>
<p>edit:<br />
another one<br />
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_generic.c.diff?r1=1.150&amp;r2=1.151&amp;f=h</p>
<p>&#8220;Prevent IOC_IN with zero size argument (this is only supported<br />
if backward copatibility options are present) from attempting<br />
to free memory that wasn&#8217;t allocated.  This is an old bug, and<br />
previously it would attempt to free a null pointer.  I noticed<br />
this bug when working on the previous revision, but forgot to<br />
fix it.</p>
<p>Security:	local DoS<br />
Reported by:	Peter Holm<br />
MFC after:	3 days&#8221; </p>
<p>free(uninit_ptr);<br />
that&#8217;s not just a DoS :)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-13000/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>asprintf</title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-12995/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-12995/#comments</comments>
		<pubDate>Sun, 08 Oct 2006 21:47:15 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-12995/</guid>
		<description><![CDATA[Since I&#8217;ve already gone 2 post without blogging about security I figured it&#8217;s time to do another security related one. It&#8217;ll be another this-api-is-so-broken post. 
asprintf is basicly very simular to sprintf and snprintf, but unlike those 2 calls it dynamically allocates memory and hence the programmer doesn&#8217;t have to worry about boundschecking. Programmers seem [...]]]></description>
			<content:encoded><![CDATA[<p>Since I&#8217;ve already gone 2 post without blogging about security I figured it&#8217;s time to do another security related one. It&#8217;ll be another this-api-is-so-broken post. </p>
<p>asprintf is basicly very simular to sprintf and snprintf, but unlike those 2 calls it dynamically allocates memory and hence the programmer doesn&#8217;t have to worry about boundschecking. Programmers seem to misunderstand that and think that they&#8217;re in the clear if they just use asprintf. Nothing could be further from the truth. See, there&#8217;s a corner case. What if malloc (which it uses internally) fails ? </p>
<p>Before I go into that, let&#8217;s first see how asprintf works:<br />
int asprintf(char **strp, char *fmt, &#8230;)<br />
Basicly you give it a pointer to a pointer as first argument and then a formatstring with some arguments. </p>
<p>so what if asprintf fails ? It returns -1. However, the content of strp upon failure is &#8220;undefined&#8221; according to the linux manpage. the OpenBSD manpage says the following about it:<br />
&#8220;The asprintf() and vasprintf() functions [...] If sufficient space cannot be allocated, these functions will return -1.  The value of ret in this situation is implementation-dependent (on OpenBSD, ret will be set to the null pointer, but this behavior should not be relied upon).&#8221;</p>
<p>in reality, all the BSD&#8217;s set strp to NULL and the glibc implementation (used on most linux distributions) will not change it. </p>
<p>So in linux this makes it interesting for exploitation. Suppose one uses asprintf() and forgets to check the return value (which is very common btw, but more on that later). it leaves strp uninitialized. in most cases strp will be on the stack. Meaning that it&#8217;s realistic to assume a user has control over this uninitialized variable (more on this can be found at http://www.felinemenace.org/papers/UBehavior.zip and http://www.blackhat.com/presentations/bh-europe-06/bh-eu-06-Flake.pdf) . So depending on what the application does next with this pointer it might be exploitable. Common scenario&#8217;s are passing this pointer to free() at some point (so you don&#8217;t get a memory leak) or for example having it point to some path that&#8217;ll get used in chmod/chown/open/rename/&#8230;. Definatly not a good thing to have. Often (even when asprintf() is used correctly) people tend to forget to free() memory obtained with asprintf(). Sometimes people also incorrectly handle asprintf failure. Since everyone seems to be looking at google code search for vulnerable example&#8217;s I did the exact same thing and quickly spotted a nice example of incorrect failure handling:<br />
static char *<br />
gen_dbsuffix(char *db_name, char *sfx)<br />
{<br />
    char *dbsuffix;</p>
<p>    if (sfx == NULL)<br />
	sfx = &#8220;.ok&#8221;;</p>
<p>    asprintf (&amp;dbsuffix, &#8220;%s%s&#8221;, db_name, sfx);<br />
    if (dbsuffix == NULL) {<br />
	fprintf (stderr, &#8220;gen_dbsuffix: out of memory\n&#8221;);<br />
	exit(1);<br />
    }<br />
    return dbsuffix;<br />
}<br />
that&#8217;s in MIT kerberos btw. Spotting the error should be obvious (considering what I just said about asprintf). While doing these google code searches I found out that the following abuse asprintf in one way or another:<br />
- gnu radius<br />
- heimdal kerberos<br />
- samba (I&#8217;m shocked I tell you !)<br />
- glibc&#8217;s pt_chown<br />
- mailutils<br />
- gnu sasl<br />
- MIT kerberos</p>
<p>rsync used to have a nasty bug related to asprintf aswell, but that one recently got fixed.</p>
<p>edit: 2 things I forgat to mention, the first being, that last time I checked dietlibc has simular behavior to glibc&#8217;s (with regard to asprintf failing). The 2nd that using asprintf in return into libc exploits can be very usefull, since you get to allocate memory, And put data on it, without needing to check any registers.</p>
<p>2nd edit: It seems I made a terrible mistake. fefe just emailed me and told me dietlibc&#8217;s asprintf has always set strp to NULL on failure. I do apolgise for this. Must have confused it with something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-12995/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blogs.23.nu/ilja/2006/10/antville-12969/</link>
		<comments>http://blogs.23.nu/ilja/2006/10/antville-12969/#comments</comments>
		<pubDate>Thu, 05 Oct 2006 14:36:05 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/10/antville-12969/</guid>
		<description><![CDATA[ i never thought i&#8217;d see the day ilja van sprundel looked at microsoft code and decided to check into php security :P
]]></description>
			<content:encoded><![CDATA[<p> i never thought i&#8217;d see the day ilja van sprundel looked at microsoft code and decided to check into php security :P</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/10/antville-12969/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>omfgwtf</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12883/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12883/#comments</comments>
		<pubDate>Wed, 27 Sep 2006 10:24:03 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12883/</guid>
		<description><![CDATA[I don&#8217;t usually blog about these things, but this is just too insane. 
http://www.nytimes.com/2006/09/25/nyregion/25courts.html?ex=1159761600&#38;en=c46719645257c30c&#38;ei=5065&#38;partner=MYWAY
I&#8217;m shocked horriefied and disgusted by this.
one of many shocking things in there:
I just follow my own common sense, Mr. Buckley, in an interview, said of his 13 years on the bench. And the hell with the law.
words fail me to describe [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t usually blog about these things, but this is just too insane. </p>
<p>http://www.nytimes.com/2006/09/25/nyregion/25courts.html?ex=1159761600&amp;en=c46719645257c30c&amp;ei=5065&amp;partner=MYWAY</p>
<p>I&#8217;m shocked horriefied and disgusted by this.</p>
<p>one of many shocking things in there:<br />
I just follow my own common sense, Mr. Buckley, in an interview, said of his 13 years on the bench. And the hell with the law.</p>
<p>words fail me to describe how much this disturbes me !</p>
<p>via fefe: http://blog.fefe.de/?ts=bbe49d57</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12883/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does Fuzzing really work ?</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12867/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12867/#comments</comments>
		<pubDate>Mon, 25 Sep 2006 23:09:50 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12867/</guid>
		<description><![CDATA[Yes. 
But that&#8217;s besides the point. There was a post made to the dailydave mailinglist titled &#8220;Does Fuzzing Really work?&#8221; http://lists.immunitysec.com/pipermail/dailydave/2006-September/003551.html in Which Aviram Jenik states the following:
&#8220;There&#8217;s a lot of talk lately on whether fuzzing can actually be used to find
vulnerabilities &#8211; and more importantly, reliably rule out the existence of
unknown vulnerabilities. &#8230; our [...]]]></description>
			<content:encoded><![CDATA[<p>Yes. </p>
<p>But that&#8217;s besides the point. There was a post made to the dailydave mailinglist titled &#8220;Does Fuzzing Really work?&#8221; http://lists.immunitysec.com/pipermail/dailydave/2006-September/003551.html in Which Aviram Jenik states the following:<br />
&#8220;There&#8217;s a lot of talk lately on whether fuzzing can actually be used to find<br />
vulnerabilities &#8211; and more importantly, reliably rule out the existence of<br />
unknown vulnerabilities. &#8230; our experience shows it can.&#8221;</p>
<p>They&#8217;re wrong. They base this on a bunch of numbers they got from their own fuzzer (I&#8217;m guessing Aviram is one of the people that works on the fuzzer). Some of those numbers are:<br />
&#8220;The FTP protocol has 310 &#8220;scenarios&#8221; of<br />
valid FTP sessions. If you try to overflow each time a different part of the<br />
command in every scenario you get a little over 12M attack combinations. If<br />
you use some of our nifty beSTORM 2.0 optimizations you get to 70,679 attack<br />
vectors.<br />
&#8230;<br />
FTP is too simple you say? With more complex protocols like SIP you have<br />
&gt;15,000 scenarios and something like 40,680,459 attack vectors after<br />
optimizations&#8221;</p>
<p>See, their numbers are wrong. I don&#8217;t know the exact numbers either. No one knows. They&#8217;re only testing what they have tests for (duh !). But one of the things I figured out when I started to play with fuzzers is that if you take any given fuzzer and make some changes (add a test for a length of 0 in a certain protocol for example) (and hence, change the numbers) you find new 0day. So their numbers are incomplete. For example, In their http tests I&#8217;m sure they have code that generates url&#8217;s. But they probably forgat something. Does it also generate ipv6 urls? if so, does it also generate ipv6 url&#8217;s with &#8220;%&#8221;? (http://[::1]%eth0/ for example). maybe the network device name parser has a trivial stacksmash. Does it have a list of all url scheme&#8217;s that might be usefull to fuzz for 1 particular http(-alike) daemon? What about incorrectly formed encoded url&#8217;s. http://isec.pl/vulnerabilities/isec-0020-mozilla.txt for example. I don&#8217;t know of any fuzzer out there that efficiently fuzzes these kinds of bugs except for my own . I once wrote a url fuzzer that does all of these things any many more things, it was pretty big, but more to the point, I&#8217;m sure I forgat something. </p>
<p>&#8220;Sounds scary at first, but a SIP server capable of handling<br />
500 requests per second would take only 22 hours to test, &#8230;&#8221;</p>
<p>Assuming their number are complete (which they&#8217;re not !) this means you can test all possible combinations that matter in 22 hours, how nice. However, in reality you know there are things you missed. So to compensate for this, one of the things I like to do is every once in a while substitute 1 thing I&#8217;m fuzzing with something random and do this in an endless loop. Some people seem to think this is useless (Arrogantly assuming their numbers are complete), but that&#8217;s not true. I&#8217;ve had success with this in the past. Finding bugs after days or even weeks. Where the trigger is something I totally didn&#8217;t anticipate. A nice example here is a bug in the linux tcp/ip stack that dave jones found with isic earlier this year: http://kernelslacker.livejournal.com/35361.html</p>
<p>quoting even more:<br />
&#8220;My point is to those people who mock fuzzers &#8211; you either tried the wrong<br />
kind, or you tried them a long time ago. I&#8217;m not saying that buffer overflows<br />
are suddenly obsolete (don&#8217;t delete that ZERT bookmark just yet!). But<br />
nowadays there is no reason for an FTP server to come out with buffer<br />
overflows; there&#8217;s just no excuse.&#8221;</p>
<p>If their numbers aren&#8217;t complete there might be fuzzable things they&#8217;re not fuzzing, and hence there is an excuse. But let&#8217;s assume they&#8217;re testing all that they can test. Even then there are still issues that might not have been caught by their fuzzer. for example, earlier this year ISS x-force released an advisory for a remote signal race in sendmail (discovered by Mark Dowd). This one would be a bitch to fuzz, and I can&#8217;t think of a way to do it in an efficient manner. </p>
<p>Then again. Maybe this was all just to advertise their new fuzzer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12867/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>irc quotes !!1!</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12852/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12852/#comments</comments>
		<pubDate>Sun, 24 Sep 2006 07:30:46 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12852/</guid>
		<description><![CDATA[ debian is constantly being owned
 ilja: it&#8217;s god&#8217;s punishment for the fact that they use exim as the default mta :p
]]></description>
			<content:encoded><![CDATA[<p> debian is constantly being owned<br />
 ilja: it&#8217;s god&#8217;s punishment for the fact that they use exim as the default mta :p</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12852/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetBSD&#8217;s ping doesn&#8217;t do a privdrop !</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12846/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12846/#comments</comments>
		<pubDate>Sat, 23 Sep 2006 08:03:08 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12846/</guid>
		<description><![CDATA[Yes, this will be a blogpost where I bitch some more about NetBSD.
A couple of hours ago I was reading through the openbsd 3.9 -&#62; 4.0 changes. One of them stated &#8220;Fix signal races in ping(8)&#8221;. So I looked at OpenBSD&#8217;s ping.c and there was indeed a fix for a signal race. I figured, let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, this will be a blogpost where I bitch some more about NetBSD.</p>
<p>A couple of hours ago I was reading through the openbsd 3.9 -&gt; 4.0 changes. One of them stated &#8220;Fix signal races in ping(8)&#8221;. So I looked at OpenBSD&#8217;s ping.c and there was indeed a fix for a signal race. I figured, let&#8217;s check NetBSD, since they still have a lot of shared code, there might be simular races in NetBSD&#8217;s ping code. </p>
<p>And thus, I go to NetBSD&#8217;s cvsweb and look at ping.c and while reading it I though to myself &#8220;well, this is odd, there is no socket() and privdrop before argument parsing&#8221; (and some people might already see where I&#8217;m going with this). socket() was indeed after argument parsing, but I couldn&#8217;t see the privdrop code. So I search for setuid, seteuid, setreuid, setresuid. NOTHING !, absolutely NOTHING. Do my eyes deceive me ? I must have missed something, it cannot be this bad ! </p>
<p>I must have spend an hour digging through their code,<br />
looking for the missing privdrop. thinking to myself &#8220;maybe it&#8217;s abstracted away in some ugly and nasty way, or maybe it&#8217;s in some library code&#8221;. But I found nothing that indicated any of that. Then it sort of hit me, THERE IS NO PRIVDROP IN NetBSD&#8217;S PING IMPLEMENTATION.</p>
<p>Still in disbelieve I decided I needed to test this, so I recompile NetBSD&#8217;s ping from source and add the following right before it exits:<br />
printf(&#8221;euid: %u\n&#8221;, geteuid());</p>
<p>the output I got:<br />
ping -c 1 127.0.0.1<br />
PING localhost (127.0.0.1): 56 data bytes<br />
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.065 ms</p>
<p>&#8212;-localhost PING statistics&#8212;-<br />
1 packets transmitted, 1 packets received, 0.0% packet loss<br />
round-trip min/avg/max/stddev = 0.065/0.065/0.065/0.000 ms<br />
euid: 0</p>
<p>I am<b> Shocked and horrified</b>. You&#8217;d expect this kind of glitches from apple (who added a privdrop to ping and traceroute about a year ago !) but from NetBSD ? It&#8217;s 2006 for fucks sake !! I compared with OpenBSD and FreeBSD, both added a privdrop OVER A DECADE AGO ! </p>
<p>I decided to look at NetBSD&#8217;s traceroute aswell, after all, who knows, they might be consistent in not having privdrop code. They did mildly better in traceroute. There was a privdrop, AFTER argument parsing. </p>
<p>Ofcourse, you could argue that you don&#8217;t need a privdrop, as long as you don&#8217;t have any [security] bugs. But euh, you know, I mentioned these signal race conditions earlier &#8230; </p>
<p>as a final note, I went through all of the ping.c commit messages for NetBSD and some of them stated something about an overrun and some fd_set overflows, but I couldn&#8217;t find anything about this in their advisories.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12846/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>h4h4</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12835/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12835/#comments</comments>
		<pubDate>Thu, 21 Sep 2006 18:26:29 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12835/</guid>
		<description><![CDATA[http://lists.grok.org.uk/pipermail/full-disclosure/2004-June/022850.html
http://cds.xs4all.nl:8081/tmp/excploit.c
]]></description>
			<content:encoded><![CDATA[<p>http://lists.grok.org.uk/pipermail/full-disclosure/2004-June/022850.html<br />
http://cds.xs4all.nl:8081/tmp/excploit.c</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12835/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12816/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12816/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 20:34:12 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12816/</guid>
		<description><![CDATA[ apple users use sheer willpower to secure their OS
]]></description>
			<content:encoded><![CDATA[<p> apple users use sheer willpower to secure their OS</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12816/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ttyname</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12798/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12798/#comments</comments>
		<pubDate>Sat, 16 Sep 2006 10:15:28 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12798/</guid>
		<description><![CDATA[ttyname() is a libc function used to get the path of the tty the fd it gets as argument points to.
on linux (hm, well, glibc on linux) what ttyname() does is return the link used in /proc/self/fd.
which leads to interesting problems. you can have /proc/self/fd point to pretty much anything you want.
it can contain &#8220;..&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>ttyname() is a libc function used to get the path of the tty the fd it gets as argument points to.</p>
<p>on linux (hm, well, glibc on linux) what ttyname() does is return the link used in /proc/self/fd.</p>
<p>which leads to interesting problems. you can have /proc/self/fd point to pretty much anything you want.<br />
it can contain &#8220;..&#8221;, it can itself be a symlink, &#8230;.</p>
<p>So be really carefull when using it (in a suid for example) or avoid it all together and use something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12798/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12795/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12795/#comments</comments>
		<pubDate>Fri, 15 Sep 2006 15:54:48 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12795/</guid>
		<description><![CDATA[ reiserfs, making files and wives dissapear in an instant
]]></description>
			<content:encoded><![CDATA[<p> reiserfs, making files and wives dissapear in an instant</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12795/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m shocked</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12747/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12747/#comments</comments>
		<pubDate>Tue, 12 Sep 2006 23:57:42 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12747/</guid>
		<description><![CDATA[http://www.youtube.com/watch?v=uY74vKDWWNo
It&#8217;s in dutch !
basicly, this is a small piece of some tv show called &#8220;vips&#8221; where they interview this woman who is one of the 22 finalists of the &#8220;Miss Belgian Earth&#8221; contest.
They ask here what the qualities are of such a Miss.
Here response: &#8220;sweet, spontaneous and smart&#8221;.
So the interviewer asks her: &#8220;what&#8217;s the square [...]]]></description>
			<content:encoded><![CDATA[<p>http://www.youtube.com/watch?v=uY74vKDWWNo</p>
<p>It&#8217;s in dutch !<br />
basicly, this is a small piece of some tv show called &#8220;vips&#8221; where they interview this woman who is one of the 22 finalists of the &#8220;Miss Belgian Earth&#8221; contest.<br />
They ask here what the qualities are of such a Miss.<br />
Here response: &#8220;sweet, spontaneous and smart&#8221;.<br />
So the interviewer asks her: &#8220;what&#8217;s the square root of 25 ?&#8221; and she responds: &#8220;Don&#8217;t do this, really, don&#8217;t ! This isn&#8217;t fair, they&#8217;re always out to get me&#8221; clearly showing she doesn&#8217;t know the answer. The interviewer asks her if she&#8217;s better in languages to which she responds: &#8220;no, not good at that either&#8221;.</p>
<p>I don&#8217;t know if I&#8217;m more shocked at the lack of basic mathematical skills this person posseses, or the fact that that particular tv station actually decided to put this on the air.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12747/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>website up again</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12742/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12742/#comments</comments>
		<pubDate>Tue, 12 Sep 2006 11:15:45 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12742/</guid>
		<description><![CDATA[My webpage ( http://ilja.netric.org/ ) is up again. It seems that I was off by about 7 months with my prediction when it&#8217;d be up again.
]]></description>
			<content:encoded><![CDATA[<p>My webpage ( http://ilja.netric.org/ ) is up again. It seems that I was off by about 7 months with my prediction when it&#8217;d be up again.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12742/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nano sucks</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12724/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12724/#comments</comments>
		<pubDate>Sun, 10 Sep 2006 21:25:44 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12724/</guid>
		<description><![CDATA[Apparently, when your disk is full and you want to save something you&#8217;ve been working on for a while in nano (1.2.4) it tells you it can&#8217;t save since the disk is full. It does however still truncate the older version you have. grrrrrrrrrreat.
]]></description>
			<content:encoded><![CDATA[<p>Apparently, when your disk is full and you want to save something you&#8217;ve been working on for a while in nano (1.2.4) it tells you it can&#8217;t save since the disk is full. It does however still truncate the older version you have. grrrrrrrrrreat.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12724/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nasal demons</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12668/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12668/#comments</comments>
		<pubDate>Wed, 06 Sep 2006 14:38:34 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12668/</guid>
		<description><![CDATA[I went looking in some manpages for interesting quotes, and ended up grepping for &#8220;Undefined behaviour&#8221;.
here are some of the one&#8217;s I found: 
&#8220;Not checking the return value of close is a common but nevertheless serious programming error. It is quite possible that errors on a previous write(2) operation are first reported at the final [...]]]></description>
			<content:encoded><![CDATA[<p>I went looking in some manpages for interesting quotes, and ended up grepping for &#8220;Undefined behaviour&#8221;.<br />
here are some of the one&#8217;s I found: </p>
<p>&#8220;Not checking the return value of close is a common but nevertheless serious programming error. It is quite possible that errors on a previous write(2) operation are first reported at the final close(). Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and with disk quota. &#8221; &#8212; linux close</p>
<p>&#8220;When successful, these functions [(v)asprintf] return the number of bytes printed, just like sprintf(3). If memory allocation wasn&#8217;t possible, or some other error occurs, these functions will return -1, and the contents of strp is undefined. &#8221; &#8212; linux asprintf</p>
<p>&#8220;An fd_set is a fixed size buffer. Executing FD_CLR or FD_SET with a value of fd that is negative or is equal to or larger than FD_SETSIZE will result in undefined behavior.&#8221; &#8211; linux select</p>
<p>&#8220;If the mutex type is PTHREAD_MUTEX_DEFAULT, attempting to recursively lock the mutex results in undefined behavior. Attempting to unlock the mutex if it was not locked by the calling thread results in undefined behavior. Attempting to unlock the mutex if it is not locked results in undefined behavior.&#8221; &#8212; linux pthread_creat_mutex</p>
<p>&#8220;Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs&#8221; &#8212; linux malloc</p>
<p>&#8220;provide the additional specifiers q and a as well as an additional behaviour of the L and l specifiers. The latter may be considered to be a bug, as it changes the behaviour of specifiers defined in ANSI X3.159-1989&#8243; &#8212; linux scanf</p>
<p>&#8220;If there is no next argument, or if type is not compatible with the type of the actual next argument (as promoted according to the default argument promotions), random errors will occur.&#8221; &#8212; netbsd varargs </p>
<p>&#8220;All data associated with an ELF descriptor remain allocated until elf_end() terminates the descriptor&#8217;s last activation. After the descriptors have been terminated, the storage is released; attempting to reference such data gives undefined behavior. Consequently, a program that deals with multiple input (or output) files must keep the ELF descriptors active until it finishes with them.&#8221; &#8212; sun libelf</p>
<p>&#8220;Upon successful completion 0 is returned. Otherwise, EOF is returned and the global variable errno is set to indicate the error. In either case any further access (including another call to fclose()) to the stream results in undefined behaviour.&#8221; &#8212; linux fclose</p>
<p>&#8220;The routine handler must be very careful, since processing elsewhere was interrupted at some arbitrary point. POSIX has the concept of &#8220;safe function&#8221;. If a signal interrupts an unsafe function, and handler calls an unsafe function, then the behavior is undefined.&#8221; &#8212; linux signal</p>
<p>Feel free to contribute some in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12668/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading old phrack articles</title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12651/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12651/#comments</comments>
		<pubDate>Mon, 04 Sep 2006 21:38:14 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12651/</guid>
		<description><![CDATA[http://staff.washington.edu/dittrich/talks/security/phrack/p25-5
&#8220;Another bug in the su command exists in some System V ports where if su was unable to open the password file (&#8221;etc/passwd&#8221;), it would grant root access (without checking the reason for the failure).  I guess the programming can tell that something is wrong and grants access so someone can fix things.  [...]]]></description>
			<content:encoded><![CDATA[<p>http://staff.washington.edu/dittrich/talks/security/phrack/p25-5</p>
<p>&#8220;Another bug in the su command exists in some System V ports where if su was unable to open the password file (&#8221;etc/passwd&#8221;), it would grant root access (without checking the reason for the failure).  I guess the programming can tell that something is wrong and grants access so someone can fix things.  The security problem occurs when when su is executed with a full file descriptor table; this will force su to fail its open request on the password file.&#8221;</p>
<p>This isn&#8217;t as unlikely as you&#8217;d think:<br />
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/games/dm/Attic/dm.c?rev=1.9&amp;content-type=text/plain&amp;hideattic=0</p>
<p>I wonder what would happen if read_config() can&#8217;t open the config file &#8230;.</p>
<p>edit:<br />
the FreeBSD and OpenBSD write program have (the OpenBSD guys fixed it) a simular issue. If it can&#8217;t open the utmp file it allows one to write to any file the tty group is allowed to write to.<br />
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/write/write.c.diff?r1=1.23&amp;r2=1.24&amp;f=h</p>
<p>linux shadow utils (su, login, passwd, chfn, chsh) will happely continue working if it can&#8217;t open its configuration file. So this would for example allow one to change his or her shell (chsh) or gecos (chfn) without needing to authenticate.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12651/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blogs.23.nu/ilja/2006/09/antville-12643/</link>
		<comments>http://blogs.23.nu/ilja/2006/09/antville-12643/#comments</comments>
		<pubDate>Mon, 04 Sep 2006 01:57:06 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/09/antville-12643/</guid>
		<description><![CDATA[/*
     * This routine runs as a signal handler. We should not do anything that
     * could involve memory allocation/deallocation, but exiting without
     * proper explanation would be unacceptable.
     */
that&#8217;s from postfix. Apparently it&#8217;s more important to exit with [...]]]></description>
			<content:encoded><![CDATA[<p>/*<br />
     * This routine runs as a signal handler. We should not do anything that<br />
     * could involve memory allocation/deallocation, but exiting without<br />
     * proper explanation would be unacceptable.<br />
     */</p>
<p>that&#8217;s from postfix. Apparently it&#8217;s more important to exit with some meaningfull explenation then to prevent any kind of memory allocation in a signal handler (this is from the timeout watchdog it smtpd !)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/09/antville-12643/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>irc quote</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12623/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12623/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 17:24:48 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12623/</guid>
		<description><![CDATA[ kernel heap overflows are easy as pie
(translated tho)
]]></description>
			<content:encoded><![CDATA[<p> kernel heap overflows are easy as pie<br />
(translated tho)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12623/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prisonbreak in Belgium</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12595/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12595/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 05:05:40 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12595/</guid>
		<description><![CDATA[I normally don&#8217;t blog about these kind of things, but this is just too hilarious.
So 28 people escaped out of a prison in Dendermonde. Let me say that again TWENTY-EIGHT !
How did they do it ? Apparently it was all planned by 2 guys who broke the lock on their door, then continued to threaten [...]]]></description>
			<content:encoded><![CDATA[<p>I normally don&#8217;t blog about these kind of things, but this is just too hilarious.</p>
<p>So 28 people escaped out of a prison in Dendermonde. Let me say that again TWENTY-EIGHT !</p>
<p>How did they do it ? Apparently it was all planned by 2 guys who broke the lock on their door, then continued to threaten 3 guards with 1 knife and glass from a broken mirror. took their keys and locked them up. Next they freed 26 of their inmates, and proceeded to the outer prison walls, where they -and get this- tied some blankets together to make a rope and used that to climb the wall. This is not a lucky Luke cartoon mind you, this is real life! after which they climbed down on a phonebooth. </p>
<p>un-fucking-believable.</p>
<p><img src="http://static.23.nu/antville/ilja/images/gevang_denderm03.jpg" /><br />
The &#8220;rope&#8221; they made to escape</p>
<p><img src="http://static.23.nu/antville/ilja/images/gevang_denderm01.jpg" /><br />
The phonebooth after 28 people jumped on it.</p>
<p>My prediction is that for the next prison break in Belgium someone will make a small tunnel under the prison walls.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12595/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>tcpdump</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12592/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12592/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 00:53:51 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12592/</guid>
		<description><![CDATA[Just read some of it&#8217;s code. Holy crap, too many reads beyond the end of a buffer bugs.
]]></description>
			<content:encoded><![CDATA[<p>Just read some of it&#8217;s code. Holy crap, too many reads beyond the end of a buffer bugs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12592/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>alloca is evil</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12578/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12578/#comments</comments>
		<pubDate>Fri, 18 Aug 2006 03:39:27 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12578/</guid>
		<description><![CDATA[So I ran into fefe&#8217;s slides on writing small and fast software, they&#8217;re pretty nice, there&#8217;s some good advice in there. you can get them at: http://www.fefe.de/dietlibc/diet.pdf
There&#8217;s one part in there that I don&#8217;t really agree with. He encourages people to use alloca (or that&#8217;s what it seems like anyway). imo this is a mistake.
alloca [...]]]></description>
			<content:encoded><![CDATA[<p>So I ran into fefe&#8217;s slides on writing small and fast software, they&#8217;re pretty nice, there&#8217;s some good advice in there. you can get them at: http://www.fefe.de/dietlibc/diet.pdf</p>
<p>There&#8217;s one part in there that I don&#8217;t really agree with. He encourages people to use alloca (or that&#8217;s what it seems like anyway). imo this is a mistake.<br />
alloca really stinks ! basicly for 2 reasons:</p>
<p>most implementations don&#8217;t detect stack overflow, and hence your allocation can just crash and burn when you call alloca (the alloca on windows does btw, and it raises an exception). </p>
<p>More dangerously, if you have an unbounded alloca (which you really should never have !) you&#8217;re pretty much owned. Since (on most implementations) you can cause the stack pointer to int overflow. see http://felinemenace.org/papers/p63-0&#215;0e_Shifting_the_Stack_Pointer.txt for more details.<br />
or go see my ruxcon talk </p>
<p>for those still not convinced the linux alloca manpage states:<br />
&#8220;The alloca() function returns a pointer to the beginning of the allocated space. If the allocation causes stack overflow, program behaviour is undefined. &#8220;,<br />
&#8220;The inlined code often consists of a single instruction adjusting the stack pointer, and does not check for stack overflow. Thus, there is no NULL error return. &#8221; and<br />
&#8220;The alloca() function is machine and compiler dependent. On many systems its implementation is buggy. Its use is discouraged. &#8221;</p>
<p>Don&#8217;t ever use it !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12578/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>most trivial bug of the month</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12577/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12577/#comments</comments>
		<pubDate>Thu, 17 Aug 2006 22:32:12 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12577/</guid>
		<description><![CDATA[http://lists.grok.org.uk/pipermail/full-disclosure/2006-August/048891.html
holy crap, I can&#8217;t believe they fucked that up !
]]></description>
			<content:encoded><![CDATA[<p>http://lists.grok.org.uk/pipermail/full-disclosure/2006-August/048891.html</p>
<p>holy crap, I can&#8217;t believe they fucked that up !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12577/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12575/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12575/#comments</comments>
		<pubDate>Thu, 17 Aug 2006 02:34:16 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12575/</guid>
		<description><![CDATA[http://des.blog.linpro.no/2006/01/17/but-it-works/
the last part is evil !
]]></description>
			<content:encoded><![CDATA[<p>http://des.blog.linpro.no/2006/01/17/but-it-works/<br />
the last part is evil !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12575/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>has it been that long already ?</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12554/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12554/#comments</comments>
		<pubDate>Sun, 13 Aug 2006 20:04:19 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12554/</guid>
		<description><![CDATA[Wow, so it seems I&#8217;ve been mainting this blog on and off for about a year now. Amazing, I never imagined I would.
]]></description>
			<content:encoded><![CDATA[<p>Wow, so it seems I&#8217;ve been mainting this blog on and off for about a year now. Amazing, I never imagined I would.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12554/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>readlink abuse</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12551/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12551/#comments</comments>
		<pubDate>Sat, 12 Aug 2006 20:26:48 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12551/</guid>
		<description><![CDATA[a lot of people seem to inproperly use readlink().
basicly readlink() reads where a link points to.
the function with its arguments is:
readlink(link, buf, len);
readlink() never 0-terminates by itself, so you have to do it by yourself. People often seem to forget this, leading to infoleaks or sometimes memory corruption.
another thing people like to do is:
len = [...]]]></description>
			<content:encoded><![CDATA[<p>a lot of people seem to inproperly use readlink().<br />
basicly readlink() reads where a link points to.<br />
the function with its arguments is:<br />
readlink(link, buf, len);<br />
readlink() never 0-terminates by itself, so you have to do it by yourself. People often seem to forget this, leading to infoleaks or sometimes memory corruption.<br />
another thing people like to do is:<br />
len = readlink(link, buf, sizeof(buf));<br />
buf[len] = &#8221;;<br />
there are 2 problems here, readlink() can return -1 if it fails and hence causing an off-by-one underflow, so always check the readlink return value. The other problem that can occur is that readlink returns how many byted got written to the buffer, in this case it can write up to sizeof(buf) bytes. if it does you basicly end up doing:<br />
buf[sizeof(buf)] = &#8221;; which is an off-by-one overflow.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12551/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12548/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12548/#comments</comments>
		<pubDate>Sat, 12 Aug 2006 05:17:58 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12548/</guid>
		<description><![CDATA[&#8220;Historically, the default path for the execlp() and execvp() functions was &#8220;:/bin:/usr/bin&#8221;.  This was changed to place the current directory last to enhance system security&#8221;
from the freebsd execvp() manpage. And ofcourse noone can ever make execve() arbitrarily fail &#8230;.
]]></description>
			<content:encoded><![CDATA[<p>&#8220;Historically, the default path for the execlp() and execvp() functions was &#8220;:/bin:/usr/bin&#8221;.  This was changed to place the current directory last to enhance system security&#8221;</p>
<p>from the freebsd execvp() manpage. And ofcourse noone can ever make execve() arbitrarily fail &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12548/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>some wwdc talk</title>
		<link>http://blogs.23.nu/ilja/2006/08/antville-12476/</link>
		<comments>http://blogs.23.nu/ilja/2006/08/antville-12476/#comments</comments>
		<pubDate>Tue, 01 Aug 2006 03:16:55 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/08/antville-12476/</guid>
		<description><![CDATA[So I was going through the wwdc talk list, and stumbled across &#8220;Designing for Security&#8221;. It starts off with:
&#8220;Mac OS X is the first mass-market operating system built from the ground up with security in mind.&#8221;
HAHA, I don&#8217;t think so.
]]></description>
			<content:encoded><![CDATA[<p>So I was going through the wwdc talk list, and stumbled across &#8220;Designing for Security&#8221;. It starts off with:<br />
&#8220;Mac OS X is the first mass-market operating system built from the ground up with security in mind.&#8221;<br />
HAHA, I don&#8217;t think so.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/08/antville-12476/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No more deamon tools for me</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12465/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12465/#comments</comments>
		<pubDate>Sun, 30 Jul 2006 19:38:01 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12465/</guid>
		<description><![CDATA[So mouting an iso in windows was kinda annoying. XP doesnt natively support it and so I had to resort to using daemontools (which installs other crapware (spyware/adware)).
Anyways, I just ran into Microsoft virtual cd control panel. As far as I can tell it&#8217;s totally free. and it&#8217;s use is trivial!
you can download it at:
http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe
]]></description>
			<content:encoded><![CDATA[<p>So mouting an iso in windows was kinda annoying. XP doesnt natively support it and so I had to resort to using daemontools (which installs other crapware (spyware/adware)).<br />
Anyways, I just ran into Microsoft virtual cd control panel. As far as I can tell it&#8217;s totally free. and it&#8217;s use is trivial!<br />
you can download it at:<br />
http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12465/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>minix 2.0.x remote root</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12454/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12454/#comments</comments>
		<pubDate>Wed, 26 Jul 2006 23:21:00 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12454/</guid>
		<description><![CDATA[A while ago a minix advisory got released about a pre-auth remote root vulnerability in the minix ftpd:
http://minix1.woodhull.com/news/ftpsecadv.html
the advisory intentionally left out the details so people running minix wouldn&#8217;t get hurt. The most hilarious part about that advisory is that they mention it also affected minix 3 AFTER it got fixed, since they shipped the [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago a minix advisory got released about a pre-auth remote root vulnerability in the minix ftpd:<br />
http://minix1.woodhull.com/news/ftpsecadv.html<br />
the advisory intentionally left out the details so people running minix wouldn&#8217;t get hurt. The most hilarious part about that advisory is that they mention it also affected minix 3 AFTER it got fixed, since they shipped the vuln. binary with minix 3 by accident. </p>
<p>Since I indepentantly discovered this bug about 2 years ago, let me fill you in on the details, the minix ftpd implements site crc, which basicly gives you the crc32 of a file. The first bug (or feature, whatever) is that you can call that without logging in. The 2nd and totally idiotic bug is that it does the following:<br />
system(&#8221;/bin/crc32 &#8220;);<br />
This falls in the &#8220;I can&#8217;t believe they fucked it up&#8221; category. </p>
<p>I have it from reliable sources that ALL 3 minix boxes on the internet got compromised this way.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12454/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The tenex password hack</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12450/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12450/#comments</comments>
		<pubDate>Mon, 24 Jul 2006 04:22:50 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12450/</guid>
		<description><![CDATA[So I was looking for the original advisory on the tenex password hack (I couldn&#8217;t find it, so if you know where it is, please leave a comment or email me). I did however run into rather interesting slides documenting -among other things- the tenex password hack.
http://www.st.cs.uni-sb.de/edu/secdesign/coding.pdf
it also discusses other security issues and then gives [...]]]></description>
			<content:encoded><![CDATA[<p>So I was looking for the original advisory on the tenex password hack (I couldn&#8217;t find it, so if you know where it is, please leave a comment or email me). I did however run into rather interesting slides documenting -among other things- the tenex password hack.<br />
http://www.st.cs.uni-sb.de/edu/secdesign/coding.pdf<br />
it also discusses other security issues and then gives a more secure solution, what&#8217;s funny about ALL of the secure solutions is that they all touch memory after it&#8217;s been free()&#8217;d !!!, yea, that&#8217;s really secure &#8230;</p>
<p>Back to the tenex password hack tho, I&#8217;ve been thinking about this. I think you can also use it on hashes. Suppose you have a program like passwd, and have some nice rainbow tables at your disposal, you could use the tenex password hack to figure out the hash, and hence get the password (since you&#8217;re already using these rainbow tables :)).</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12450/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An accidental bugfix</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12408/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12408/#comments</comments>
		<pubDate>Mon, 17 Jul 2006 06:25:50 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12408/</guid>
		<description><![CDATA[http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/getcwd.c.diff?r1=1.14&#38;r2=1.15&#38;f=h
OpenBSD&#8217;s getcwd implementation used to contain a double free(). Actually it was a double closedir(), which is just a wrapper for free(). The funny thing about that bug is that it was introduced when fixing a memory leak:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/getcwd.c.diff?r1=1.2&#38;r2=1.3&#38;f=h
NetBSD used to have this leak aswell, however it appears as if the OpenBSD guys never told them [...]]]></description>
			<content:encoded><![CDATA[<p>http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/getcwd.c.diff?r1=1.14&amp;r2=1.15&amp;f=h</p>
<p>OpenBSD&#8217;s getcwd implementation used to contain a double free(). Actually it was a double closedir(), which is just a wrapper for free(). The funny thing about that bug is that it was introduced when fixing a memory leak:<br />
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/getcwd.c.diff?r1=1.2&amp;r2=1.3&amp;f=h</p>
<p>NetBSD used to have this leak aswell, however it appears as if the OpenBSD guys never told them about it (I think back then they weren&#8217;t really talking to each other). The NetBSD guys accidentally fixed that memory leak the exact same way the OpenBSD guys fixed the double free(), replacing the libc getcwd() implementation with a systemcall.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12408/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>interesting bugs</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12399/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12399/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 01:31:27 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12399/</guid>
		<description><![CDATA[http://www.pine.nl/press/pine-cert-20030101.txt
http://seclists.org/lists/vuln-dev/2002/Nov/att-0056/0
http://www.security-express.com/archives/bugtraq/2000-01/0012.html
]]></description>
			<content:encoded><![CDATA[<p>http://www.pine.nl/press/pine-cert-20030101.txt<br />
http://seclists.org/lists/vuln-dev/2002/Nov/att-0056/0<br />
http://www.security-express.com/archives/bugtraq/2000-01/0012.html</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12399/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s just a denial of service</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12381/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12381/#comments</comments>
		<pubDate>Wed, 12 Jul 2006 01:49:20 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12381/</guid>
		<description><![CDATA[In my previous post I talked about this whole downplaying thing. I was just reading some secunia advisories and ran into: http://secunia.com/advisories/20349/
&#8220;The vulnerability is cause due to a memory corruption error in the &#8220;dentry_unused&#8221; list within the &#8220;prune_dcache()&#8221; function&#8221;. So you&#8217;re telling me you get to corrupt memory, AND IT&#8217;S JUST A DENIAL OF SERVICE [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post I talked about this whole downplaying thing. I was just reading some secunia advisories and ran into: http://secunia.com/advisories/20349/<br />
&#8220;The vulnerability is cause due to a memory corruption error in the &#8220;dentry_unused&#8221; list within the &#8220;prune_dcache()&#8221; function&#8221;. So you&#8217;re telling me you get to corrupt memory, AND IT&#8217;S JUST A DENIAL OF SERVICE ? are you crazy ?</p>
<p>Here&#8217;s a little tip for people who are forced to make advisories, if an attacker can corrupt memory, assume it&#8217;s exploitable!, what happens if you dont ?<br />
http://www.securityfocus.com/archive/1/394315/30/0/threaded<br />
http://www.securityfocus.com/archive/1/394413/30/0/threaded<br />
http://www.securityfocus.com/archive/1/394318/30/0/threaded</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12381/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This recent kernel bug</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12380/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12380/#comments</comments>
		<pubDate>Wed, 12 Jul 2006 00:51:03 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12380/</guid>
		<description><![CDATA[http://www.securityfocus.com/archive/1/439483 &#8220;The first allows any local user to fill up file systems by causing core dumps to write to directories to which they do not have write access permissions&#8221;
When I read that I was like &#8220;Hold on a minute, so you&#8217;re telling me I can put a file -of which I control large chunks- anywhere [...]]]></description>
			<content:encoded><![CDATA[<p>http://www.securityfocus.com/archive/1/439483 &#8220;The first allows any local user to fill up file systems by causing core dumps to write to directories to which they do not have write access permissions&#8221;</p>
<p>When I read that I was like &#8220;Hold on a minute, so you&#8217;re telling me I can put a file -of which I control large chunks- anywhere on the system, and this is just a DoS ?&#8221;. I didn&#8217;t actually investigate this is detail, since I had more important things to do, but here&#8217;s What I was thinking, have a symlink to /etc/ld.so.preload, then coredump to that symlink (assuming that codepath in the kernel follows symlinks). Last time I checked the gnu dynamic linker is very flexible about that file. basicly it&#8217;ll just go line by line till it finds a lib that works. I don&#8217;t know is this will acutally work, but I&#8217;m sure it&#8217;s something like that. </p>
<p>Then, this morning I read the dailydave mailing list and saw: http://lists.immunitysec.com/pipermail/dailydave/2006-July/003293.html</p>
<p>So the immunitysec guys made an exploit for it, and refering to Paul Starzetz. Later today I ran into http://www.securityfocus.com/archive/1/439610, where Paul states it really is exploitable.</p>
<p>He makes another good point in that post: &#8221; really wonder why in the recent past there is a tendence to declare such things as &#8220;denial of service&#8221; etc &#8211; while they are perfect root backdoors / vulns&#8221;</p>
<p>That&#8217;s been annoying me a little bit lately, and it&#8217;s not just the linux kernel guys, A lot of people have been downplaying bugs (either knowingly -lying- or not -incompetence-). It&#8217;s even worse then that. When (some) people don&#8217;t realize something is exploitable, they tend not to fix it. Although they usually acknowledge it&#8217;s some sort of coding bug. For example, a few weeks ago I mailed some linux vendors regarding a bug is passwd, namely not checking the return value of setuid(). Someone mailed me back stating: &#8220;You know, we don&#8217;t know if this is actually exploitable, and I don&#8217;t want to go fix all of these bugs, So if you can&#8217;t provide me with a ./hackroot exploit, I won&#8217;t fix it&#8221;. Honestly, I think this is unacceptable, Wether or not a bug is exploitable it&#8217;s still a bug, so JUST FIX THE DAMN BUG! more often then not bugs turn out to be exploitable.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12380/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated list</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12324/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12324/#comments</comments>
		<pubDate>Wed, 05 Jul 2006 00:06:38 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12324/</guid>
		<description><![CDATA[It would appear the list of people who should be banned from programming was pretty popular, hence a little update: 
- BuGless AKA Stephen R. van den Berg (procmail)
- Greg A. &#8220;Don&#8217;t worry though &#8212; it&#8217;s definitely not exploitable&#8221; Woods (smail 3)
- Philip Hazel (exim)
- Matt Wright (formmail, wwwboards)
- Rasmus Lerdorf (php)
]]></description>
			<content:encoded><![CDATA[<p>It would appear the list of people who should be banned from programming was pretty popular, hence a little update: </p>
<p>- BuGless AKA Stephen R. van den Berg (procmail)<br />
- Greg A. &#8220;Don&#8217;t worry though &#8212; it&#8217;s definitely not exploitable&#8221; Woods (smail 3)<br />
- Philip Hazel (exim)<br />
- Matt Wright (formmail, wwwboards)<br />
- Rasmus Lerdorf (php)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12324/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I can&#8217;t believe they fucked it up</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12323/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12323/#comments</comments>
		<pubDate>Tue, 04 Jul 2006 23:40:47 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12323/</guid>
		<description><![CDATA[A while ago I spend some time in the osx heap allocator. Man there is so much crap in there, unbelieable. 
One of the things I ran across was that their realloc implementation will never resize to something smaller. While technically this isn&#8217;t a violation of the c standard it&#8217;s still pretty retarded. 
One other [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I spend some time in the osx heap allocator. Man there is so much crap in there, unbelieable. </p>
<p>One of the things I ran across was that their realloc implementation will never resize to something smaller. While technically this isn&#8217;t a violation of the c standard it&#8217;s still pretty retarded. </p>
<p>One other surprising thing I found was that their calloc code in older versions fuckedup boundschecking for 64-bit: http://cvs.opendarwin.org/cgi-bin/cvsweb.cgi/Libc/gen/malloc.c?rev=1.1.1.1&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=apple</p>
<p>#define MAX_ALLOCATION 0xc0000000 // beyond this, assume a programming error<br />
&#8230;<br />
void *malloc_zone_calloc(malloc_zone_t *zone, size_t num_items, size_t size) {<br />
    void	*ptr;<br />
    if (malloc_check_start &amp;&amp; (malloc_check_counter++ &gt;= malloc_check_start)) {<br />
	internal_check();<br />
    }<br />
    if (((unsigned)num_items &gt;= MAX_ALLOCATION) || ((unsigned)size &gt;= MAX_ALLOCATION) || ((long long)size * num_items &gt;= (long long) MAX_ALLOCATION)) {<br />
        /* Probably a programming error */<br />
        fprintf(stderr, &#8220;*** malloc_zone_calloc[%d]: arguments too large: %d,%d\n&#8221;, getpid(), (unsigned)num_items, (unsigned)size);<br />
        return NULL;<br />
    }<br />
    ptr = zone-&gt;calloc(zone, num_items, size);<br />
    if (malloc_logger) malloc_logger(MALLOC_LOG_TYPE_ALLOCATE | MALLOC_LOG_TYPE_HAS_ZONE | MALLOC_LOG_TYPE_CLEARED, (unsigned)zone, num_items * size, 0, (unsigned)ptr, 0);<br />
    return ptr;<br />
}</p>
<p>Incase you don&#8217;t spot the bug here, size_t is 64 bit (on 64-bit machines), but a cast to unsigned means unsigned int which is 32 bits long !!! hence there can be truncation later on !</p>
<p>in new versions they just removed the boundscheck, I kid you not, you just can&#8217;t make this stuff up. </p>
<p>In the older versions malloc and the like had the same flawed lengthcheck which doesn&#8217;t make sense at all !!!! you shouldn&#8217;t do boundschecking on the length at this level. the app that uses malloc should do it. The only thing you might want to check for is int overflow. Speaking of this limitation, the OpenBSD kernel memory allocator has very simular behavior, but only even more retarded: </p>
<p>void *<br />
malloc(unsigned long size, int type, int flags)<br />
{<br />
	struct kmembuckets *kbp;<br />
	struct kmemusage *kup;<br />
	struct freelist *freep;<br />
	long indx, npg, allocsize;<br />
	int s;<br />
	caddr_t va, cp, savedlist;<br />
	&#8230; some debug crap &#8230;<br />
	if (size &gt; 65535 * PAGE_SIZE)<br />
		panic(&#8221;malloc: allocation too large&#8221;);<br />
&#8230;<br />
}</p>
<p>for those who can&#8217;t read c code, what this means is, if you tell malloc to allocate a really big chunck it will instead kernel panic. bug or feature ? I guess it was ok to do this in 1975, but It&#8217;s 2006 for fucks sake. ofcourse netbsd suffers from the same bug/feature. Not too long ago you could trigger this from the ELF loading code and I believe there are still some obsd drivers that allow you to trigger it.</p>
<p>In light of the whole calloc fuckup I started doing some googling, since I remember an advisory being published about this several years ago. http://cert.uni-stuttgart.de/advisories/calloc.php. Someone made the connection with fread and fwrite and it turns out they also contain a simular int overflow. since the osx guys stole fread/fwrite from FreeBSD, I checked fbsd and it appeared to have this int overflow. Then I figured I&#8217;d check openbsd which also has this int overflow. What&#8217;s somewhat more worrysome is that obsd&#8217;s fread and fwrite are NOT thread-safe especially since obsd recently got a whole new threading implementation: http://www.openbsd.org/papers/eurobsd2005/tedu-rthreads.pdf. I figured I&#8217;d check the obsd manpage for fread and fwrite and see if they mention that it&#8217;s not thread-safe. but they didn&#8217;t, infact, their fread and fwrite manpage hasn&#8217;t been update since 1994 !!!! It should come as no surprise that netbsd has the same int overflow issue. I didn&#8217;t even try to check glibc, I still want to hold on to my sanity for a while :)</p>
<p>SMALL UPDATE: There is some discussion on the netbsd current-users mailing list about this. Some seem to have misinterpreted my posting. The osx and NetBSD userland allocator have pretty much nothing in common and I wasn&#8217;t hinting towards that. But the (older version of) osx userland allocator and NetBSD/OpenBSD kernel allocator have 1 thing in common, namely a check like<br />
if (size &gt; something) bailout;<br />
which imo doesn&#8217;t make sense at all especially if &#8220;bailout&#8221; is a kernel panic ! The other thing I mentioned about NetBSD was an int overflow in their fread and fwrite implementation. I made no other statements about NetBSD.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12323/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>what happens if &#8230;.</title>
		<link>http://blogs.23.nu/ilja/2006/07/antville-12303/</link>
		<comments>http://blogs.23.nu/ilja/2006/07/antville-12303/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 20:37:00 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/07/antville-12303/</guid>
		<description><![CDATA[you pour some liquid in a laptop ? 
I&#8217;m sure most have heard the theory that if you do that it dies. So I went to my lab and did some experiments. Turns out that it does effectively die. Although, I did not try it with water but with beer, I wonder if that makes [...]]]></description>
			<content:encoded><![CDATA[<p>you pour some liquid in a laptop ? </p>
<p>I&#8217;m sure most have heard the theory that if you do that it dies. So I went to my lab and did some experiments. Turns out that it does effectively die. Although, I did not try it with water but with beer, I wonder if that makes a difference. </p>
<p>So I go to lenovo.com and order my brand new thinkpad x60 laptop. And since I want it to be here fast I said I want 2-day shipping. AND THE FUCKING ESTIMATED TIME TO SHIP IS THE 14TH OF THIS FUCKING MONTH !!!</p>
<p>HOW LONG DOES IT TAKE TO ASSEMBLE A FREAKING LAPTOP ???? 2 WEEKS ? WTF ARE THESE GUYS DOING ?</p>
<p>Needed to get that off my chest, I feel better now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/07/antville-12303/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>regex evasion</title>
		<link>http://blogs.23.nu/ilja/2006/06/antville-12211/</link>
		<comments>http://blogs.23.nu/ilja/2006/06/antville-12211/#comments</comments>
		<pubDate>Sun, 18 Jun 2006 22:49:29 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/06/antville-12211/</guid>
		<description><![CDATA[It seems the good people from redteam-pentesting ( who also have a blog here: http://blogs.23.nu/RedTeam ) recently released a nice advisory where they could evade a regex and get some sql injection and passwd retrival (for another user) working for phpbannerexchange.
This was related to a small weakness in php where the ereg*() functions aren&#8217;t binary [...]]]></description>
			<content:encoded><![CDATA[<p>It seems the good people from redteam-pentesting ( who also have a blog here: http://blogs.23.nu/RedTeam ) recently released a nice advisory where they could evade a regex and get some sql injection and passwd retrival (for another user) working for phpbannerexchange.<br />
This was related to a small weakness in php where the ereg*() functions aren&#8217;t binary safe and it would stop matching after a 0-byte. </p>
<p>A while ago I&#8217;ve spend some time looking into regex evasion myself. Although not looking for oddities in the regex implementation itself, but instead looking for weaknesses in the regex itself. </p>
<p>For example, if you have: /^\d$/ that would only match numbers (0-9). Or so you would think, the $-sign will also match a next line. A potential attack vector here would be where the inputted data gets written to a line-based file. Where all the sudden you get next line injection. </p>
<p>After some googling I found out that this kind of regex evasion is used sometimes with some ids&#8217;s, there is a nice post about this on the snort forum: http://www.snort.org/archive-3-1353.html</p>
<p>The Redteam people think that we haven&#8217;t seen the last of these kind of attacks and I believe they are right.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/06/antville-12211/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>filesystem fuzzing</title>
		<link>http://blogs.23.nu/ilja/2006/06/antville-12107/</link>
		<comments>http://blogs.23.nu/ilja/2006/06/antville-12107/#comments</comments>
		<pubDate>Sat, 10 Jun 2006 00:05:53 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/06/antville-12107/</guid>
		<description><![CDATA[A couple of months ago I set out to fuzz some of the filesystems that linux supports (and it supports way too many filesystems !). 
Basicly, what I did was look for a filesystems that have userland utils that allowed me to make an empty partion in a file instead of a device. I think [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of months ago I set out to fuzz some of the filesystems that linux supports (and it supports way too many filesystems !). </p>
<p>Basicly, what I did was look for a filesystems that have userland utils that allowed me to make an empty partion in a file instead of a device. I think I ended up fuzzing ext2/3, reiserfs, xfs,jfs and fat12. </p>
<p>Then used mangle.c in a loop with the loopback device and sat back till something happened: </p>
<p>EVERYTHING BLEW UP WITHIN SECONDS !!!</p>
<p>when I say blow up, I mean full kernel panic or atleast very scary oopses. </p>
<p>The only exception is fat12. It didn&#8217;t break. not at all, nothing, I couldn&#8217;t even get it to printk() some debug crap. My guess is this is because a) fat12 is a really trivial fs and b) floppies are so unreliable that whatever corruption you can ever have with fat12 already happened at some point in the past and has been dealt with. </p>
<p>I remember emailing Hans Reiser about some of this stuff, but never got a reply. Several months later there was an interesting thread on lkml:<br />
http://lkml.org/lkml/2006/2/19/138</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/06/antville-12107/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The list</title>
		<link>http://blogs.23.nu/ilja/2006/06/antville-12093/</link>
		<comments>http://blogs.23.nu/ilja/2006/06/antville-12093/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 02:54:19 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/06/antville-12093/</guid>
		<description><![CDATA[A while ago Felix von Leitner and I came up with a small list of people who should be banned from programming because of pouring out too much nasty code with serious security side effects. here&#8217;s the list:
- paul vixie (cron, holds the official record of &#8220;most cert advisories due to a single author&#8221;)
- Andrew [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago Felix von Leitner and I came up with a small list of people who should be banned from programming because of pouring out too much nasty code with serious security side effects. here&#8217;s the list:<br />
- paul vixie (cron, holds the official record of &#8220;most cert advisories due to a single author&#8221;)<br />
- Andrew Tridgell (samba, rsync)<br />
- everyone who ever hacked on wu-ftpd (most insecure ftpd of all times)<br />
- eric allman (sendmail)<br />
- Christos Zoulas (responsible for most recent netbsd (kernel) fuckups)<br />
- Ulrich Drepper (glibc)<br />
- Jörg Schilling (cdrecord)</p>
<p>If you know of more people to be on this list, please make a comment. </p>
<p>As for the fuckedup layout of the previous post, I am aware of it and will fix it at some point (yes, I am a slacker &#8230;.).</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/06/antville-12093/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple Secure Coding Guide</title>
		<link>http://blogs.23.nu/ilja/2006/05/antville-11976/</link>
		<comments>http://blogs.23.nu/ilja/2006/05/antville-11976/#comments</comments>
		<pubDate>Thu, 25 May 2006 06:33:02 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/05/antville-11976/</guid>
		<description><![CDATA[I became aware of a new paper on developer.apple.com today. It&#8217;s about secure coding guidelines. I quickly skimmed over it, here is my preliminary report: 
page 10:
Page 10 covers a list of usefull books to read in addition. There is however no mention of &#8220;writing secure code 2nd edition&#8221; by Michael Howard and David LeBlanc. [...]]]></description>
			<content:encoded><![CDATA[<p>I became aware of a new paper on developer.apple.com today. It&#8217;s about secure coding guidelines. I quickly skimmed over it, here is my preliminary report: </p>
<p>page 10:<br />
Page 10 covers a list of usefull books to read in addition. There is however no mention of &#8220;writing secure code 2nd edition&#8221; by Michael Howard and David LeBlanc. While the book is somewhat windows centric it is one of the best books out there<br />
regarding secure coding, and a lot of whats mentioned there can be applied to unix aswell.The book does get mentioned later on when they cover threat modeling, but it deserves more credit imho. </p>
<p>page 14:<br />
No platform is immune:<br />
&#8220;So far, Mac OS X has not fallen prey to any major, automated attack like the MyDoom virus. There are several reasons for this. One is that Mac OS X is based on open source software such as BSD; many hackers have searched this software over the years looking for security vulnerabilities, so that not many vulnerabilities remain. Another is that the default installation of Mac OS X turns off all networking services that might be used to exploit vulnerabilities. Also, the email and internet clients used most commonly on Mac OS X do not have privileged access to the operating system and are less vulnerable to attack than those used on some other common operating systems. Finally, Apple has an active program of reviewing the operating system and applications for security vulnerabilities and issues downloadable security updates frequently.&#8221;</p>
<p>The fact that something is opensource software and that it has been audited before is no guarantee whatsoever that it&#8217;s more secure then a commercial equivalent. There has been a lot of disscusion around this, and people have concluded that it can have the potential to be more secure but it doesn&#8217;t have to be. In this particular case they use BSD as an example. Every once in a while I audit BSD code, and there is nothing magically secure about it, plenty of security bugs in there to go around. </p>
<p>So OSX turns off all network deamons by default. But the firewall is off by default last time I checked, there is dhcp parsing code IN THE FUCKING KERNEL, and it does send out an recieve mdns constantly. </p>
<p>So the email client, browser, and other utils don&#8217;t run as root. So if you own them you don&#8217;t instantly own the box. That&#8217;s what local root exploits are for, it&#8217;s a very common 2-step thing! I know this is defense in depth, but I wouldn&#8217;t go so far as to brag about it, it might bite you in the ass later. </p>
<p>The Idea that apple&#8217;s browser and email client are less vulnerable to attack then others is total bullcrap. In fact, the opposite is true. When I did browser fuzzing safari was ALWAYS the first to break. It&#8217;s simply not up to par with IE and Firefox when it comes to parsing input !</p>
<p>I guess &#8220;frequent&#8221; is a relative term, as sometimes 3 or 4 months go by without a single security update<br />
only to get followed up by a MONSTER security update (40+ vulns fixed in 1 update). Also &#8220;frequent&#8221;<br />
doesn&#8217;t say anything about consistency, it would be nice to have something like patch tuesday for osx. </p>
<p>page 19:<br />
Types of vulnerabilities:<br />
&#8220;There are two ways in which heap overflows are exploited: First, the attacker tries to find other data<br />
on the heap worth overwriting. Much of the data on the heap is generated internally by the program<br />
rather than copied from user input. For example, an attacker who hacks into a phone companys billing system might be able to set a flag indicating that a bill has been paid. Or, by overwriting a temporarily stored user name, an attacker might be able to log into a program with administrator privileges. This is known as a non-control-data attack.</p>
<p>Second, objects allocated on the heap in many languages, such as C++ and Objective-C, include tables of function pointers. By exploiting a buffer overflow to change such a pointer, an attacker might be able to substitute their own data or to execute their own routine.&#8221;</p>
<p>This is somewhat short on information. Specifically it doesn&#8217;t explicitly mention messing with  heap metadata. Which is what most heap exploits out there do. And this is very much possible with the osx memory allocator, infact there was a phrack paper about it: http://www.phrack.org/phrack/63/p63-0&#215;05_OSX_Heap_Exploitation_Technqiues.txt</p>
<p>page 24:<br />
Types of vulnerabilities: social engineering. </p>
<p>While social engineering is certainly a security issue, It has NOTHING whatsoever to do with secure coding guidelines. Social engineering is also mentioned on page 66 and 67. </p>
<p>page 36:<br />
There is a list of insecure functions and then the more secure equivalent of these functions that should get used. Unfortunatly, some of these more secure functions have some known issues that one should be aware of, they are however not mentioned. More specifically I&#8217;m talking about snprintf and fgets. Also it fails to mention the scanf* functions, which I believe should really be in there. </p>
<p>I blogged about snprintf abuse earlier:<br />
http://blogs.23.nu/ilja/stories/10508/</p>
<p>With fgets, it is very common to overwrite the \n character at the end with a 0byte. often<br />
code like:<br />
if (fgets(s,len,stdin) != NULL)<br />
	s[strlen(s)-1] = &#8221;;<br />
is being used. The problem here is that it&#8217;s possible to have zerolength strings and effectively causing an off-by-one underflow. (if you don&#8217;t believe me, download some opensource software and grep for fgets!, it really is very common).</p>
<p>page 46:<br />
secure file operations:<br />
&#8220;9. Compare the device and inode numbers in the stat structure obtained before you opened the file with those in the stat structure obtained after you opened the file to verify that they are the same file.&#8221;</p>
<p>This is just wrong! just because file x has ino y and is on dev z at time n-1 doesnt mean that at time n the file with ino y and on dev z is file x ! Ok, so this might sounds a bit confusing, there is actually a nice mailing list post about this: http://www.opennet.ru/base/audit/17.txt.html</p>
<p>page 49:<br />
There is a reference to &#8220;building secure software&#8221; for more info on how to prevent file race conditions. Unfortunatly the info in there is flawed and suffers from the same issue as page 46 step 9 as described earlier. </p>
<p>page 57:<br />
&#8220;Because launchd is a critical system component, it receives a lot of peer review by in-house developers at Apple. It is less likely to contain security vulnerabilities then most production code&#8221;. </p>
<p>And yet when I audited it last year It contained a textbook example of a file race condition (see http://www.suresec.org/advisories/adv3.pdf for more details). More worrysome is that at the time the todo file stated (and I quote): &#8220;code review&#8221;.</p>
<p>page 58-59:<br />
a code example, and that&#8217;s not confusing because &#8230;. </p>
<p>page 69:<br />
Page 69 mentions threat modeling, but forgets to mention &#8220;Threat modeling&#8221; by Frank Swiderski and Window Snyder, which is basicly THE book about threat modeling, it covers nothing else !</p>
<p>There were some things I really liked about the paper: </p>
<p>page 10:<br />
mention of david wheelers secure programming for linux and unix howto. That one is actually REALLY good. I wonder why David never turned it into a real book (as in, get it in a professionally printed version). </p>
<p>page 36:<br />
There is a list of insecure functions and then the more secure equivalent of these functions that should get used. It mentions the more secure replacements for strcpy, strcat, strncpy and strncat. Namely strlcpy and strlcat, 2 functions designed by some of the people of openbsd, for more info, see http://www.openbsd.org/papers/strlcpy-paper.ps</p>
<p>page 55:<br />
functions to &#8220;change privilege level&#8221; I like how they specifically say to watch the return value (hi vixie cron) and that those calls are confusing and differ across different unices. </p>
<p>So, a conclusion is in order here I guess. There were some dissapointing things in there, first off, there was no mentioning whatsoever about fuzzing, and testing code was only VERY briefly mentioned. Likewise almost nothing was said about secure kernel programming. The only thing that got briefly mentioned regarding kernel programming was to use Kauth and to be carefull which modules you load if you make a helper program that needs to load a module. Imho there was too much marketing in the paper, I don&#8217;t want to know why osx is more secure then something else<br />
(wether or not it&#8217;s true) I just want to get the facts about writing secure code for osx. I feel this paper didn&#8217;t get much (or adleast not enough) peer review. It&#8217;s too incomplete. Lastly there is a fair amount of usefull content in there, but please, take it with a grain of salt.</p>
<p>edit: The cat is out of the bag, the bug in cron I hinted towards (see page 55 comment) got fixed not too long ago:<br />
http://bugs.gentoo.org/show_bug.cgi?id=134194</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/05/antville-11976/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple does Severity ratings &#8230;</title>
		<link>http://blogs.23.nu/ilja/2006/05/antville-11837/</link>
		<comments>http://blogs.23.nu/ilja/2006/05/antville-11837/#comments</comments>
		<pubDate>Wed, 03 May 2006 02:33:07 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/05/antville-11837/</guid>
		<description><![CDATA[&#8230; and they suck at it. 
Ok, somewhat misleading. They don&#8217;t really do that, but they made an exception for Brian Krebs (a fairly well known tech. reporter at the washington post), you can read about it in his blog: http://blog.washingtonpost.com/securityfix/2006/05/a_time_to_patch_iii_apple_2.html
Basicly Brian made a summary of the last 2 years of vulnerabilities (in OSX) that [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; and they suck at it. </p>
<p>Ok, somewhat misleading. They don&#8217;t really do that, but they made an exception for Brian Krebs (a fairly well known tech. reporter at the washington post), you can read about it in his blog: http://blog.washingtonpost.com/securityfix/2006/05/a_time_to_patch_iii_apple_2.html</p>
<p>Basicly Brian made a summary of the last 2 years of vulnerabilities (in OSX) that got fixed by apple, and ran it by apple. who subsequently gave most of them a severity rating. You can see apple&#8217;s ratings at:<br />
 http://blog.washingtonpost.com/securityfix/apple updated FINAL.htm</p>
<p>from the blogpost: &#8220;Even though the company [apple]officially eschews severity ratings, it didn&#8217;t have any problem assigning numbers to the flaws listed in my spreadsheets, with those flaws earning a &#8220;1&#8243; deemed the most serious and those with a &#8220;4&#8243; the least worrisome&#8221;</p>
<p>So I want to talk about 1 particular vulnerability, namely CVE-2005-3705. This is a remote heap overflow in webkit. Which is basicly the html rendering engine (from kde) that apple uses for safari (and some other programs). It was given a severity rating of 4 by apple, so according to apple it&#8217;s &#8220;least worrisome&#8221;. HILARIOUS ! anyone still taking apple security seriously ? </p>
<p>Let&#8217;s make a hypothetical comparison with microsoft here. Suppose there was a remotely exploitable heap overflow in IE (hm, well to make it more equal, let&#8217;s say in mshtml.dll which I believe ms uses to render html, feel free to correct me). Do you think the good people over at MSRC (http://www.microsoft.com/security/msrc/default.mspx) would even consider rating something like that anything less then critical (which would more or less compare to 1 in the apple severity rating) ? OFCOURSE NOT !!!! the press would have a field day with that one. besides some media attention it just doesn&#8217;t make sense. You have a utility that comes default with your os that you use maybe 100 times a day to surf the internet, and it has a heap overflow in it that could potentially get triggered by ANY WEBPAGE YOU VISIT, without clicking on anything on that webpage. </p>
<p>Some people might be thinking that it got rated least worrisome because there is no exploit for it, or because it would be hard to do. This is simply not true. As it turns out, that particular vulnerability got reported to apple by one of my co-workers (Neil Archibald). And he does have a proof-of-concept exploit for it (no, I will not email it to you!). I&#8217;m sure some people now might think &#8220;ok, so you have an exploit for it, no one else does, so the rating is still valid&#8221;. That would make no sense at all, If Neil can make a working exploit for it, then so can anybody else who knows what he&#8217;s doing !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/05/antville-11837/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>summer of code</title>
		<link>http://blogs.23.nu/ilja/2006/04/antville-11726/</link>
		<comments>http://blogs.23.nu/ilja/2006/04/antville-11726/#comments</comments>
		<pubDate>Sun, 16 Apr 2006 22:49:01 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/04/antville-11726/</guid>
		<description><![CDATA[Google is doing it&#8217;s summer of code again. Personally I&#8217;m not really a big google fan, but I think this summer of code thing is a good initiative. If only they started a few years earlier with it (like when I was in university). I browsed thru some of the projects, and here is one [...]]]></description>
			<content:encoded><![CDATA[<p>Google is doing it&#8217;s summer of code again. Personally I&#8217;m not really a big google fan, but I think this summer of code thing is a good initiative. If only they started a few years earlier with it (like when I was in university). I browsed thru some of the projects, and here is one I really like:<br />
&#8220;IPv6 stack vulnerabilities: Review the last few years worth of IP stack vulnerabilities. Check that these have been fixed in the IPv6 stack too. Fix ones that haven&#8217;t been fixed.&#8221;<br />
This is one of the ideas from FreeBSD. If I was still in university I so would have applied for this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/04/antville-11726/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>integer madness</title>
		<link>http://blogs.23.nu/ilja/2006/04/antville-11683/</link>
		<comments>http://blogs.23.nu/ilja/2006/04/antville-11683/#comments</comments>
		<pubDate>Wed, 12 Apr 2006 03:51:46 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/04/antville-11683/</guid>
		<description><![CDATA[I talked to Micky Snir today. he told me something that blew my mind. what happens when you see something like this: 
long abs(long l) {
  if (l &#60; 0) return -l;
  else return l;
}
It always returns a positive value, right ? Wrong !!!
If you give in 0&#215;80000000 it will return 0&#215;80000000.
Basicly if [...]]]></description>
			<content:encoded><![CDATA[<p>I talked to Micky Snir today. he told me something that blew my mind. what happens when you see something like this: </p>
<p>long abs(long l) {<br />
  if (l &lt; 0) return -l;<br />
  else return l;<br />
}</p>
<p>It always returns a positive value, right ? Wrong !!!<br />
If you give in 0&#215;80000000 it will return 0&#215;80000000.<br />
Basicly if you&#8217;d negate that with 2nd complement you end up with the same negative number.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/04/antville-11683/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Various things</title>
		<link>http://blogs.23.nu/ilja/2006/04/antville-11673/</link>
		<comments>http://blogs.23.nu/ilja/2006/04/antville-11673/#comments</comments>
		<pubDate>Mon, 10 Apr 2006 01:16:49 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/04/antville-11673/</guid>
		<description><![CDATA[First off, some bitching. Online accounts, and why I dont want them or need them. A lot of websites out there want to force you into creating a free (they always mention that its &#8220;FREE&#8221; and so it must be good, right?) account. If you don&#8217;t do so you can&#8217;t access whatever it is you [...]]]></description>
			<content:encoded><![CDATA[<p>First off, some bitching. Online accounts, and why I dont want them or need them. A lot of websites out there want to force you into creating a free (they always mention that its &#8220;FREE&#8221; and so it must be good, right?) account. If you don&#8217;t do so you can&#8217;t access whatever it is you want to access. Now there are obviously cases where you&#8217;d want this (writing a blog entry, buying something on amazon, putting something up for auction on ebay, &#8230;). But people abuse it, I DON&#8217;T WANT NO STINKING ACCOUNT TO DOWNLOAD PAPERS, READ SOMEONE&#8217;S BLOG, OR EVEN ACCESS SOMEONE&#8217;S SITE. coz it&#8217;s timeconsuming, and coz you&#8217;ll want to remember your password (adleast for 5 minutes so you can log in and do whatever you wanted to do). PLEASE STOP DOING THIS UNLESS IT IS NEEDED !!!!</p>
<p>While at a customer this week I learned something really interesting. When you&#8217;re in a meeting and things get written on a whiteboard, do NOT take notes, take pictures !!! </p>
<p>Moving on to some security blogging. I&#8217;ve been doing a whole bunch of code reviews lately and one of the things I&#8217;ve seen are good boundschecks being performed INSIDE assert statements. THIS IS BAD !!!, if you do this, please stop doing so. It doesnt help. The only reason to use assert is to help the programmer catch some things that shouldn&#8217;t happen AT ALL. asserts go away once you do a non-debug compile (and if your stable program releases are compiled with -DDEBUG or something simular you should get shot). DON&#8217;T DO BOUNDSCHECKING INSIDE assert&#8217;s. </p>
<p>A while ago I ran into an interesting return value issue:<br />
pipe(fds);<br />
basicly if you&#8217;d do this you&#8217;re assuming pipe always succeeds. Obviously it doesnt always succeed, and when that happens you end up with uninitialised file descriptors. Turns out they sometimes lead to VERY interesting security bugs. always check your return values !!</p>
<p>Lastly, I want to quickly blog about null pointers. I was planning to write a whole paper about this, but as I wont have any time anywhere in the forseeable future I&#8217;ll just blog it. Basicly, some null pointers can be exploited. The thing is that you have to see them in the right context. The context in this case is kernel space. What happens if you get a null pointer deref in kernel space ? you get a page fault, right ?<br />
These just might be exploitable !. In most modern oses the address space is &#8217;shared&#8217; between the kernel and whatever app is running at that point. on 32 bit machines the first 2 or 3 gigs of address space (which is where 0&#215;00000000 is located) are reserved for the app and the rest is for the kernel (mind you, this is os and in some cases architecture specific). So if the os allows you to map 0&#215;00000000 it&#8217;s possible to exploit (most) null pointer derefs inside the kernel. That means local priv. escalation !.</p>
<p>so basicly, in order to exploit (most) null pointer derefs inside a kernel you need 2 things:<br />
- a &#8217;shared&#8217; address space between your app and the kernel<br />
- the os has to allow your app to map 0&#215;00000000</p>
<p>This works on most modern unices. I would suspect this works on most other modern operating systems aswell. (this doesnt work on osx btw). </p>
<p>Exploiting the null pointer inside userspace is sometimes also possible. I&#8217;ll leave that for another blogpost tho. </p>
<p>Oh, and there are even some public references to exploiting null pointer derefs. In 1994 there was an exploit from a group called 8lgm that exploited a null ptr deref in SCO unix (although this was in userspace). It is mentioned in the shellcoders handbook (check page 505). And last year at cansec there was a talk about memory related problems which also covered exploiting null pointers.</p>
<p>edit: exploiting null ptr derefs this way is not just theoretical, there are real exploits out there for this kind of bugs !</p>
<p>2nd edit: It appears I missed 1 public reference to NULL pointer exploitation in the kernel. http://isec.pl/vulnerabilities/isec-0023-coredump.txt<br />
It is mentioned there in a VERY subtle way :)</p>
<p>3th edit: another subtle post about it<br />
http://eeyeresearch.typepad.com/blog/2006/08/post_ms06035_ma.html</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/04/antville-11673/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A not so slow day</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11535/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11535/#comments</comments>
		<pubDate>Thu, 23 Mar 2006 03:49:29 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11535/</guid>
		<description><![CDATA[You&#8217;ve got slow days and not so slow days. You can say today (hm, well yesterday) was one of those not so slow days. One rather interesting vulnerability got disclosed. A remote signal race in sendmail, which was (not surprsingly) discovered by Mark Dowd of the ISS X-Force. Undoubtably one of the smartest code auditors [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve got slow days and not so slow days. You can say today (hm, well yesterday) was one of those not so slow days. One rather interesting vulnerability got disclosed. A remote signal race in sendmail, which was (not surprsingly) discovered by Mark Dowd of the ISS X-Force. Undoubtably one of the smartest code auditors to walk the face of this earth. The Xforce advisory states that there&#8217;s a signal race condition in the timeout handlers, which under certain conditions might lead to stack or in some cases heap corruption. I haven&#8217;t looked at the particular vulnerability, but assuming its realistic to trigger the race and you get some flexibility to damage the stack this one could be relialibly exploited. The advisory also states that it&#8217;s not a single-shot, so if things don&#8217;t work out quite well you can just try again. This one is certainly interesting! Which brings me to another question, why is it that so many people are still using sendmail in 2006? Sendmail is one of those monsters that dates back from the 80&#8217;s. It should have died by now! It&#8217;s not like there aren&#8217;t any alternatives. One of them was even designed to look and feel like sendmail. </p>
<p>Another IE 0day got disclosed today (by the guys from Computer Terrorism  (UK) :: Incident Response Centre ). It appears that this one ends up having a function pointer to point to (and I quote) &#8221; very remote, non-existent memory location, causing IE to crash (DoS)&#8221;.  The ones who discovered it go on to say that this one is very much exploitable and that they are sitting on a reliable exploit for it. I don&#8217;t doubt that for a second. My guess would be that they&#8217;re using skylined&#8217;s heap spraying method or something simular. It&#8217;s interesting that so many IE bugs still get found to this day. Because IMO pretty much all other browsers (with the exception of firefox) are WAY WORSE off then IE when it comes to being able to parse input correctly. I say this because I&#8217;ve spend a fair amount of time writing and testing browser fuzzers, and IE and Firefox are by far the one&#8217;s that can take the most crap before dieing. I&#8217;d like to take this opportunity to bark at safari, In pretty much all of my tests it came out the worst. Getting safari to segfault is trivial. </p>
<p>This brings me to hdm&#8217;s Hamachi (http://metasploit.com/users/hdm/tools/hamachi/hamachi.html) Which is a small dhtml fuzzer. It would appear that opera, safari, omniweb and konquerer seem to break on it. Firefox (both 1.0.7 and 1.5.x on linux) didn&#8217;t die on it. I don&#8217;t know about IE. I think people have barely scratched the surface when it comes to browser fuzzing (or adleast what has been publicly reported about it).</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11535/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rocksolid unix &#8230;</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11530/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11530/#comments</comments>
		<pubDate>Wed, 22 Mar 2006 12:13:53 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11530/</guid>
		<description><![CDATA[&#8230; I don&#8217;t think so !!!! Obviously I&#8217;m talking about macosX. 
It has tons of stability issues. The thing that currently annoys me most is that extensive usage of the official bittorent client causes almost constant kernel panics. THIS IS HORRIBLE, MODERN UNICES SHOULDN&#8217;T PANIC ON NORMAL USAGE !! I haven&#8217;t looked yet at what [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; I don&#8217;t think so !!!! Obviously I&#8217;m talking about macosX. </p>
<p>It has tons of stability issues. The thing that currently annoys me most is that extensive usage of the official bittorent client causes almost constant kernel panics. THIS IS HORRIBLE, MODERN UNICES SHOULDN&#8217;T PANIC ON NORMAL USAGE !! I haven&#8217;t looked yet at what caused it, but If I had to guess I&#8217;d say its somewhere in the mach code. </p>
<p>So another VERY annoy issue. When I start fuzzing safari with something that doesn&#8217;t instantly break it It tends to have memory leaks, and lots of it. Now I can live with that, after all, which browser doesnt have tons of memory leaks? What really gets me is that that memory SHOULD get freed once you exit safari, AND IT DOESN&#8217;T ! my box ends up being dogslow and I need a reboot, ONCE AGAIN, IN MODERN UNICES THIS ISN&#8217;T SUPPOSED TO HAPPEN, WHEN A PROCESS CALLS exit() THE KERNEL SHOULD FREE ALL IT&#8217;S MEMORY !!!!!! </p>
<p>During the summerschool Max also blogged about this:<br />
http://blogs.23.nu/disLEXia/stories/9929/</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11530/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>*scanf abuse.</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11525/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11525/#comments</comments>
		<pubDate>Tue, 21 Mar 2006 07:36:19 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11525/</guid>
		<description><![CDATA[it&#8217;s no big secret that scanf is/was a function that causes a lot of bufferoverflows. Ofcourse, no one makes trivial overflows with scanf anymore (Hm, well some people still do, http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/games/sail/pl_main.c?rev=1.16&#38;content-type=text/plain, me and max reported that one &#62; 1 year ago btw)
but there are 2 more subtle things you can do wrong with the scanf() [...]]]></description>
			<content:encoded><![CDATA[<p>it&#8217;s no big secret that scanf is/was a function that causes a lot of bufferoverflows. Ofcourse, no one makes trivial overflows with scanf anymore (Hm, well some people still do, http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/games/sail/pl_main.c?rev=1.16&amp;content-type=text/plain, me and max reported that one &gt; 1 year ago btw)</p>
<p>but there are 2 more subtle things you can do wrong with the scanf() familiy of functions. First, some people insist on fixing a bufferoverflow caused by *scanf by changing the format string from %s to %s (%128s for example). The problem here is often that people still cause an off-by-one. See that length will be the amount of bytes copied and AFTER that a 0byte will ALWAYS get appended.<br />
for example:<br />
void f() {<br />
  char b[4];<br />
  scanf(&#8221;%4s&#8221;, b);<br />
  return;<br />
}<br />
would be an exploitable off-by-one caused by abuse of *scanf().</p>
<p>the other thing that might go wrong when scanf is used improperly, is that of using uninitialised variables.<br />
When the string being scanned isnt &#8220;compatible&#8221; with the format string nothing will be copied. This might lead to unintialised integers and strings. Which might later lead to information leaks and buffer overflows. You can check the return value of the *scanf functions to see how many variables got written to.</p>
<p>update:<br />
just ran into another scanf bug which is kinda interesting. basicly the code I was looking at was trying to parse a UUID and did the following:<br />
        if (sscanf(     (unsigned char *)uuid_string,<br />
                        &#8220;%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x&#8221;,<br />
                        (unsigned int *)&amp;uuid-&gt;time_low,<br />
                        (unsigned int *)&amp;uuid-&gt;time_mid,<br />
                        (unsigned int *)&amp;uuid-&gt;time_hi,<br />
                        (unsigned int *)&amp;uuid-&gt;clock_seq[0],<br />
                        (unsigned int *)&amp;uuid-&gt;clock_seq[1],<br />
                        (unsigned int *)&amp;uuid-&gt;node[0],<br />
                        (unsigned int *)&amp;uuid-&gt;node[1],<br />
                        (unsigned int *)&amp;uuid-&gt;node[2],<br />
                        (unsigned int *)&amp;uuid-&gt;node[3],<br />
                        (unsigned int *)&amp;uuid-&gt;node[4],<br />
                        (unsigned int *)&amp;uuid-&gt;node[5]) != 11) { &#8230;. }</p>
<p>the UUID struct looks like:<br />
struct rpc_uuid {<br />
        uint32_t        time_low;<br />
        uint16_t        time_mid;<br />
        uint16_t        time_hi;<br />
        uint8_t         clock_seq[2];<br />
        uint8_t         node[6];<br />
};</p>
<p>this will cause memory corruption. the %02x format specifier will write 0&#215;000000XX to space that can only hold a single byte. I&#8217;m sure there are simular bugs like this out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11525/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I don&#8217;t buy books in Belgium</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11501/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11501/#comments</comments>
		<pubDate>Fri, 17 Mar 2006 14:54:51 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11501/</guid>
		<description><![CDATA[http://www.hcw.be/hcwcs/p.asp?p=G3096
http://www.amazon.com/gp/product/032124544X/sr=8-1/qid=1142610631/ref=sr_1_1/103-0059377-2258253?%5Fencoding=UTF8
Mind you that 1 euro is worth 1.20 dollars right now, so that&#8217;s bout 60 dollars for the book when I buy it in a local bookstore here, compared to 22 dollars on amazon in the us. Even with the shipping (which is like 9 dollar) it&#8217;s still half the price !
The only books I [...]]]></description>
			<content:encoded><![CDATA[<p>http://www.hcw.be/hcwcs/p.asp?p=G3096<br />
http://www.amazon.com/gp/product/032124544X/sr=8-1/qid=1142610631/ref=sr_1_1/103-0059377-2258253?%5Fencoding=UTF8</p>
<p>Mind you that 1 euro is worth 1.20 dollars right now, so that&#8217;s bout 60 dollars for the book when I buy it in a local bookstore here, compared to 22 dollars on amazon in the us. Even with the shipping (which is like 9 dollar) it&#8217;s still half the price !</p>
<p>The only books I buy in europe are really cheap 2nd hand books. You get ripped off big time for anything else.<br />
edit: Oh, and ofcourse dutch books :) you don&#8217;t generally find those on amazon :)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11501/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plagiarism or coincidence ? :)</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11478/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11478/#comments</comments>
		<pubDate>Mon, 13 Mar 2006 16:55:05 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11478/</guid>
		<description><![CDATA[http://www.emergentchaos.com/archives/2006/03/private_thoughts_on_blue.html
http://blogs.msdn.com/michael_howard/archive/2006/03/10/548894.aspx
http://blogs.23.nu/disLEXia/stories/9716/
]]></description>
			<content:encoded><![CDATA[<p>http://www.emergentchaos.com/archives/2006/03/private_thoughts_on_blue.html<br />
http://blogs.msdn.com/michael_howard/archive/2006/03/10/548894.aspx<br />
http://blogs.23.nu/disLEXia/stories/9716/</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11478/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the original fuzz paper</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11459/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11459/#comments</comments>
		<pubDate>Sat, 11 Mar 2006 00:27:33 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11459/</guid>
		<description><![CDATA[Those who know me know I love fuzzing. It makes bug hunting very easy and is oh-so-very-effective. The term fuzzing is used to input random data and then wait till something breaks comes from research done at the university of Wisconsin back in 1990. The guys who did that research also wrote a landmark paper [...]]]></description>
			<content:encoded><![CDATA[<p>Those who know me know I love fuzzing. It makes bug hunting very easy and is oh-so-very-effective. The term fuzzing is used to input random data and then wait till something breaks comes from research done at the university of Wisconsin back in 1990. The guys who did that research also wrote a landmark paper about it ( ftp://ftp.cs.wisc.edu/paradyn/technical_papers/fuzz.pdf )<br />
if you haven&#8217;t read it already, you shoud read it right now, it&#8217;s worth it.<br />
The original fuzz testing was done to see how reliable unix untilities are. What&#8217;s fascinating is that a lot of the results described in that paper tend to be security related (they also talk about security when discussing buffer overflows).</p>
<p>I love that paper, because it identifies some really interesting bug classes. Now some might think that it&#8217;s no big deal since we&#8217;re well aware of those, but really, who was aware of them back in 1990 ? I sure wasn&#8217;t (then again I was in elementry school back then).<br />
A quick rundown of those classes:<br />
- buffer overflows<br />
- no return values checked (I love those bugs, so subtle)<br />
- formatstring bugs ! (tho they didn&#8217;t call it that in the paper, more on this a bit later)<br />
- wrong error handling<br />
- signedness issues<br />
- signal race condition </p>
<p>the only ones really missing there are integer overflows and file races, and you&#8217;d have pretty much everything that goes wrong with c code. </p>
<p>About the format string bugs there. They obviously didn&#8217;t research that all the way down to the %n you can use to write to arbitrary memory locations, but who cares, they weren&#8217;t looking for security bug classes anyways.<br />
Formatstring bugs really aren&#8217;t all that new. If you read &#8220;The C programming language&#8221; 2nd edition you&#8217;ll also see a warning there for formatstring bugs (again, back in 1988 the term &#8220;formatstring bug&#8221; wasn&#8217;t coined yet, but they did give a code example of it and litteraly said &#8220;it&#8217;s not safe&#8221;). Honestly I think back in the early 90&#8217;s some select group of people were aware of the grueling security effects of formatstring bugs. If I&#8217;d have to guess I&#8217;d say that the guys from 8lgm knew about it. </p>
<p>Hm, bit of a rant there about formatstring bugs, but my point was that that paper is so amazingly cool. READ IT !</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11459/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>strncpy vs strlcpy</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11452/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11452/#comments</comments>
		<pubDate>Fri, 10 Mar 2006 14:42:58 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11452/</guid>
		<description><![CDATA[strlcpy() is a string copy replacement for strcpy() and strncpy() designed by the OpenBSD guys. If you haven&#8217;t
heard about it I suggest you read:
http://www.usenix.org/events/usenix99/full_papers/millert/millert.pdf
The thing with strlcpy() is that it&#8217;s not a silver bullet either.
And moreover you shouldn&#8217;t always mindlessly replace
strncpy() with strlcpy(). 
In order to explain, lets look at some of the differences between [...]]]></description>
			<content:encoded><![CDATA[<p>strlcpy() is a string copy replacement for strcpy() and strncpy() designed by the OpenBSD guys. If you haven&#8217;t<br />
heard about it I suggest you read:<br />
http://www.usenix.org/events/usenix99/full_papers/millert/millert.pdf</p>
<p>The thing with strlcpy() is that it&#8217;s not a silver bullet either.<br />
And moreover you shouldn&#8217;t always mindlessly replace<br />
strncpy() with strlcpy(). </p>
<p>In order to explain, lets look at some of the differences between strncpy() and strlcpy(). strncpy() takes as last argument the number of characters to copy, if it encounters a 0byte before it has copied that much characters it pads with 0bytes, If however it doesn&#8217;t come across a 0byte before it reaches this amount it won&#8217;t 0terminate the buffer. </p>
<p>strlcpy() works a bit different. First off it does not pad with 0bytes. Second if the amount of data te copy is not 0 it always 0terminates. </p>
<p>so strlcpy() was made to prevent some fuckups made with strncpy() (for examples, see: http://www.phrack.org/phrack/56/p56-0&#215;0e).</p>
<p>strlcpy() however doesn&#8217;t pad the buffer with the total<br />
size.This might be problematic when the entire buffer is outputted to the user. Leading to an information leak.<br />
A nice example of this is a recently fixed bug in the OpenBSD kernel:<br />
net/if.c:<br />
if_clone_list(struct if_clonereq *ifcr)<br />
{<br />
        char outbuf[IFNAMSIZ], *dst;<br />
                &#8230;<br />
                strlcpy(outbuf, ifc-&gt;ifc_name, IFNAMSIZ);<br />
                error = copyout(outbuf, dst, IFNAMSIZ);<br />
                if (error)<br />
                        break;<br />
        }</p>
<p>        return (error);<br />
}<br />
Pretty obvious that some uninitialised data from the stack<br />
gets leaked here.  (check http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/if.c.diff?r1=1.141&amp;r2=1.142&amp;f=h for the fix). </p>
<p>other issues with strlcpy() that it shares with strncpy() (and most other copy functions that take a length value to copy) is messing up the length value passed to it.<br />
and the fact that strlcpy() doesn&#8217;t 0terminate when the<br />
length passed to it is 0 (I realise this is very rare and will<br />
only occur in weird corner cases, but hey, that&#8217;s where most bugs happen :)</p>
<p>I&#8217;m not arguing here that strncpy() is better then strlcpy()<br />
or visa versa. I&#8217;m just saying that you should think about which function you should use before mindlessly using strlcpy().</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11452/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>website down</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11439/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11439/#comments</comments>
		<pubDate>Wed, 08 Mar 2006 17:39:09 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11439/</guid>
		<description><![CDATA[http://ilja.netric.org/ is down. It has been since late last week. We&#8217;re moving to another datacenter. I had hoped it&#8217;d be up already, but apparently its not. Anyway, it will be up again at some point (hopefully still this week.)
]]></description>
			<content:encoded><![CDATA[<p>http://ilja.netric.org/ is down. It has been since late last week. We&#8217;re moving to another datacenter. I had hoped it&#8217;d be up already, but apparently its not. Anyway, it will be up again at some point (hopefully still this week.)</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11439/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the comming SVG security nightmare</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11417/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11417/#comments</comments>
		<pubDate>Mon, 06 Mar 2006 15:05:43 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11417/</guid>
		<description><![CDATA[SVG stands for scalable vector graphics. It&#8217;s an image format designed by W3C. Basicly It&#8217;s an XML file describing a graphics file. 
I&#8217;ve been toying with this a little bit. It seems that Firefix 1.5 and opera 8 support it, support for safari is in the works, dunnow bout IE but I&#8217;d guess it will/does [...]]]></description>
			<content:encoded><![CDATA[<p>SVG stands for scalable vector graphics. It&#8217;s an image format designed by W3C. Basicly It&#8217;s an XML file describing a graphics file. </p>
<p>I&#8217;ve been toying with this a little bit. It seems that Firefix 1.5 and opera 8 support it, support for safari is in the works, dunnow bout IE but I&#8217;d guess it will/does support it aswell. </p>
<p>Besides the regular parsing hell with these kinds of things (you know, buffer overflows, double free&#8217;s, NULL pointers, heap corruption, &#8230;.) There are 2 other things which I think will contribute to its security nightmare. </p>
<p>First, It&#8217;s possible to embed a hyperlink and javascript INSIDE the graphics file. it has cross site scripting written all over it. If SVG gets widely accepted you might be able to upload an .svg as an avatar on forums, upload .SVG files to online shops, or send it to someone who has webmail, incidentally, also the places where XSS really hurts. </p>
<p>Secondly, as with pretty much all XML crap, there are major information leaks. All the tools that generate SVG files embed stuff like paths and usernames inside SVG files, which might tell you the path of where the svg file is stored on the webserver, on what kinda box it was created (windows, unix), usernames, &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11417/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>79.666% of all statistics are made up on the spot</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11415/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11415/#comments</comments>
		<pubDate>Mon, 06 Mar 2006 11:55:10 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11415/</guid>
		<description><![CDATA[&#8220;Among expert programmers the Apple API is regarded as rock solid and 94.86% total secure. It&#8217;s closest competitor is OpenBSD which is around 89.52% internet secure according to popular calculations.&#8221;
How I hate mac fanboys &#8230;.
]]></description>
			<content:encoded><![CDATA[<p>&#8220;Among expert programmers the Apple API is regarded as rock solid and 94.86% total secure. It&#8217;s closest competitor is OpenBSD which is around 89.52% internet secure according to popular calculations.&#8221;</p>
<p>How I hate mac fanboys &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11415/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hunting down a bug with isic</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11392/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11392/#comments</comments>
		<pubDate>Fri, 03 Mar 2006 17:19:43 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11392/</guid>
		<description><![CDATA[Isic is a tcp/ip stack fuzzer which to this day still finds bugs in a fair number of tcp/ip stacks (quite recently it was used by dave jones to spot the icmp remote DoS in recent 2.6 kernels).
Anyways, At IT Underground, when I was talking to Shawn Merdinger about how I tracked down one particular [...]]]></description>
			<content:encoded><![CDATA[<p>Isic is a tcp/ip stack fuzzer which to this day still finds bugs in a fair number of tcp/ip stacks (quite recently it was used by dave jones to spot the icmp remote DoS in recent 2.6 kernels).</p>
<p>Anyways, At IT Underground, when I was talking to Shawn Merdinger about how I tracked down one particular bug with isic he told me that this kind of stuff should get documented. Since It&#8217;s pretty trivial to do so I dont feel like dedicating a full html page or a paper about it, but I&#8217;ll just blog it. </p>
<p>Basicly, you first run isic doing something like: </p>
<p>isic -s 192.168.10.132 -d 192.168.10.126 -F 15</p>
<p>wait till whatever you try to fuzz panics or breaks in some way and hit ctrl + C. when you do that you see the following: </p>
<p>&#8220;Caught signal 2<br />
Used random seed 5579<br />
Wrote 37001 packets in 2.64s @ 14016.17 pkts/s&#8221;</p>
<p>so you know the tcp/ip stack you broke died somewhere in the last couple of 1000 packets. basicly the next thing you want to do is generate the exact same packets, and then skip the first X packets, and manually do a binary search untill you narrowed it down to a single packet.<br />
This is really easy to do with isic. </p>
<p>Generating the same kind of packets is easy, since you know the seed that got used to generate the packets you can feed it back to isic using the -r switch. Next, you want to skip the first 25000 packets for example, this too is trivial: -k 25000. and then you want it to send no more then the amount of packets you initially send, which in this case is 37001 packets, this can be done with the -p switch. so you&#8217;d do: </p>
<p>isic -s 192.168.10.132 -d 192.168.10.126 -F 15 -r 5579 -k 25000 -p 37001. </p>
<p>now if the tcp/ip stack you fuzzed panics, you know its somewhere in the range of 25000-37001. Now all you need to do is a binary search, and you should find the culprit within 30 minutes or so. </p>
<p>Once you know which packet causes problems (using ethereal as a sniffer for example) you can use scapy (the coolest tool ever to do low level packet construction) to reconstruct the packet in a simple one-liner. So that you can try to figure out what exactly is needed to trigger the bug. </p>
<p>Hope this is usefull to someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11392/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>microsoft preaching for gnu-like things ?</title>
		<link>http://blogs.23.nu/ilja/2006/03/antville-11374/</link>
		<comments>http://blogs.23.nu/ilja/2006/03/antville-11374/#comments</comments>
		<pubDate>Wed, 01 Mar 2006 17:31:14 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[ilja]]></category>

		<guid isPermaLink="false">http://3.blogs.23.nu/ilja/2006/03/antville-11374/</guid>
		<description><![CDATA[Today I went to some link on www.microsoft.com which was linked to from one of the entries in the legal page on thepiratebay.org, it stated the following:
&#8220;Imagine if anything you thought, made, or distributed could be legally reproduced and freely given away by others.&#8221;
I bet if RMS read this he&#8217;d be thrilled. The text doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Today I went to some link on www.microsoft.com which was linked to from one of the entries in the legal page on thepiratebay.org, it stated the following:<br />
&#8220;Imagine if anything you thought, made, or distributed could be legally reproduced and freely given away by others.&#8221;</p>
<p>I bet if RMS read this he&#8217;d be thrilled. The text doesn&#8217;t end there tho, but it shocked me somewhat when I read it the first time. It continues with &#8220;What incentive would there be to continue your hard work? &#8230;&#8221; </p>
<p>The full link is:<br />
http://www.microsoft.com/piracy/how_intellectual.mspx</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.23.nu/ilja/2006/03/antville-11374/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
