<?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>Smörgåsbord &#187; windows</title>
	<atom:link href="http://smorgasbord.gavagai.nl/tags/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://smorgasbord.gavagai.nl</link>
	<description>Ambachtelijk bereide beschouwingen.</description>
	<lastBuildDate>Fri, 06 Jan 2012 21:30:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XS2ALL — or: edit an .exe today!</title>
		<link>http://smorgasbord.gavagai.nl/2009/10/xs2all-or-edit-an-exe-today/</link>
		<comments>http://smorgasbord.gavagai.nl/2009/10/xs2all-or-edit-an-exe-today/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 23:34:32 +0000</pubDate>
		<dc:creator>Wicher</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[crack]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hex editing]]></category>
		<category><![CDATA[WebDAV]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[XS2ALL]]></category>
		<category><![CDATA[XS4ALL Webdisk]]></category>

		<guid isPermaLink="false">http://smorgasbord.gavagai.nl/?p=347</guid>
		<description><![CDATA[In this post I&#8217;ll show you how to do basic &#8216;cracking&#8217; of a piece of software and make WebDAV work well in Windows Vista (32-bit).
WebDAV. Accessing a filesystems, or anything collection-like, over HTTP. It&#8217;s a fantastic invention. Sadly, every Windows version in the past decade has contained a botched client implementation of this protocol.
Fact #1. [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I&#8217;ll show you how to do basic &#8216;cracking&#8217; of a piece of software and make WebDAV work well in Windows Vista (32-bit).</p>
<p><a href="http://tools.ietf.org/html/rfc4918">WebDAV</a>. Accessing a filesystems, or anything collection-like, over HTTP. It&#8217;s a fantastic invention. Sadly, every Windows version in the past decade has contained a botched client implementation of this protocol.<br />
Fact #1. I run WebDAV servers.<br />
Fact #2. Some people still use &#8216;Windows&#8217;.<br />
Herein lies a problem.</p>
<p>So I have been on the hunt for a sane third-party implementation for Vista. And it just so happens that a certain ISP (XS4ALL) offers WebDAV access. They must have run into trouble with Vista&#8217;s anti-implementation of WebDAV too as they&#8217;re offering a third-party WebDAV client to the Windows hoi polloi.<br />
And it happens to work rather well. You get an extra &#8216;drive&#8217; so to any userspace program it&#8217;s just as if it&#8217;s interfacing a regular filesystem. One problem, though:</p>
<p><img src="http://smorgasbord.gavagai.nl/wp-content/uploads/2009/10/xs2almostnone.png" alt="xs2almostnone" title="xs2almostnone" class="aligncenter size-full wp-image-604" /></p>
<p>It seems to be &#8216;configured&#8217; to disallow access to other servers than XS4ALL&#8217;s.<br />
Of course, we could locally spoof their DNS record and pray the software will accept our dodgy SSL certificate, but that does not scale to the end-users that wish to connect to my WebDAV server.</p>
<p>Start by downloading XS4ALL-webdisk.exe <a href="http://www.xs4all.nl/allediensten/experimenteel/webdisk.php">from this page</a>. It says its version number is 5.00.06 and its MD5sum should be <code>9d008d79099cd1c74abe6e0f1397b0a1</code>. If you get a different checksum don&#8217;t worry &#8211; you may still be able to crack it, because at the very least you know what to look for when you&#8217;re done reading this. I can&#8217;t provide you with the version I downloaded because I don&#8217;t own the copyright and I haven&#8217;t received a license to redistribute.<br />
Go ahead and run the installer. Then, try connecting to a WebDAV server of choice and observe that any attempts will be defeated.</p>
<p>Next, get a hex editor. <a href="http://mh-nexus.de/en/hxd/">Here&#8217;s the freeware one</a> that I picked. With your editor, open <code>wdfsctl.exe</code> from wherever it is you installed the Webdisk. You should see something resembling this:</p>
<p><img src="http://smorgasbord.gavagai.nl/wp-content/uploads/2009/10/hexwindow.png" alt="hexwindow" class="aligncenter size-full wp-image-606" /></p>
<p>To the left, in blue, is the offset. It&#8217;s the position in the file. To the right of the offset are bytes in hexadecimal representation. To the far right is the text representation of those bytes.<br />
Now, an .exe can have text mixed in with executable code. A text representation of executable instructions does not make sense which is why you encounter copious amounts of gibberish in the right column. But, as you scroll up and down in the file, you&#8217;ll discover lots of proper English sentences in the right column. Select the text and the corresponding bytes will be highlighted. Move over to those bytes in the middle column, change them, and observe that the corresponding text representation also changes. It works the other way around, too. Fun as that may seem we can&#8217;t go around changing strings (bits of text are called strings) willy-nilly. Specifically, we cannot change their <b>length</b> or <b>position</b>. Why not? Well, bits and pieces of the program are referenced from other bits and pieces of the program by their offset. Change the offset (position) of some program instruction in the binary (by adding text in front of it or something) and you&#8217;ll have to update any and all references to this position. It can be done but we aren&#8217;t going to do it. HxD helpfully warns you if you&#8217;re trying to do it.<br />
OK, let&#8217;s go string hunting. We&#8217;re looking for something that is matching <code>xs4all.nl</code></span> since the restriction most probably works by whitelisting. It took me a quite a while to find it, but it&#8217;s at offset <code>6DAB2</code>. You&#8217;ll find the string <code>x.s.4.a.l.l...n.l</code> there. Look over to the hex representation and you&#8217;ll find it&#8217;s a pattern of characters separated by <code>00</code>. That&#8217;s called null-delimited. Mind you, the <code>00</code> you see in the hex representation is not the same as &#8216;00&#8242; in the text representation:</p>
<ul>
<li>Enter a &#8216;.&#8217; in the text representation and you get <code>2E</code> in the hex representation.</li>
<li>Enter a &#8216;0&#8242; in the text representation and you get <code>30</code> in the hex representation.</li>
<li>Enter a <code>00</code> in the hex representation and you get a &#8216;.&#8217; in the text representation.</li>
</ul>
<p>It&#8217;s the hex representation that counts. Now, after some poking around I established that this string itself is null-terminated, too. So, to end the string, the hex representation has to read <code>00 00 00</code> because the characters inside the string are null-terminated as well. That&#8217;s two levels of null-termination.<br />
After discovering this, it&#8217;s time to dick around with patterns. Change the &#8216;4&#8242; in <code>x.s.4.a.l.l...n.l</code> to a null by typing &#8216;00&#8242; in the hex representation at byte <code>06</code>, offset <code>0006DAB0</code>. Run the program. Try to connect to <code>https://ha.xs/quux</code> . Chances of success are very slim, but the program doesn&#8217;t stop you from trying! You can put anything in front of &#8216;.xs&#8217; and it will try to connect. Change byte <code>00</code> to &#8216;a&#8217; (in the text representation) and convince yourself that the program will now get out of your way should you attempt to connect to <code>https://fabuloushaxs/quux</code>, but it still stops you from connecting to <code>https://fabuloushaxz/quux</code>.<br />
It appears that the string we&#8217;ve just changed has to match the end of the host we&#8217;re trying to connect to. So, originally, for <code>https://justconnectmetomyserveralready.net/mydir</code> it would check whether it ends with <code>xs4all.nl</code> which, of course, it doesn&#8217;t. However, we can make the string very, very short. In fact, we can make it empty, causing it to always match the end of any host we enter. To do that, just enter <code>00</code> in the hex representation at byte <code>00</code> at offset <code>0006DAB0</code>. Connect to your favourite WebDAV server. It works, doesn&#8217;t it?</p>
<p>What we have just done is actually pretty basic. &#8216;Real&#8217; crackers, the folks that let you bypass registration requirements or serial number checks, use tools to look into the memory area of a running program to see which steps make up its behaviour. They don&#8217;t just edit some strings, they add and change instructions (and offsets). That requires a much deeper understanding of what&#8217;s going on.</p>
<p>There&#8217;s various other stuff to be modified. You can change the window title or the help texts. I disabled the auto-update by replacing the URLs at offset <code>0006BA60</code>, maybe you should do so too.</p>
<p>Now for some legalities. For me, to publish <i><b>how</b></i> I edited this .exe, is perfectly legal — especially considering the educative character of this post.<br />
Redistributing the original program wouldn&#8217;t be legal. Me or you distributing any modified versions wouldn&#8217;t be legal, either. That&#8217;s basic copyright law.</p>
]]></content:encoded>
			<wfw:commentRss>http://smorgasbord.gavagai.nl/2009/10/xs2all-or-edit-an-exe-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

