<?xml version="1.0"?>
<rss version="2.0">
    <channel>
        <title>OpenRCE: Blog</title>
        <link>http://www.openrce.org/rss/feeds/blog</link>
        <description>OpenRCE: The Open Reverse Code Engineering Community</description>
                <item>
            <title>oSpy is back</title>
                            <pubDate>Thu, 20 Aug 2009 18:45:47 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/1492/oSpy_is_back</link>
                                        <author>oleavr &lt;email-suppressed@example.com&gt;</author>
                                                    <description>It started out as a quick and dirty tool to scratch an itch while reverse-engineering ActiveSync. From that point on it just kept growing, but I thought it was okay as I wasn't going to publish it anyway. Was just one of those tools that you whip up to help you reverse one specific thing, and then forget about it forever.&lt;br /&gt;
Time went by, moved on to reversing other things, and hey, I could just add some more hacks to this SocketSpy thing (which later became oSpy) and I'd save some time. Anyhow, eventually it seemed this tool could be useful for a few things, so I decided I'd publish it, even if I was far from proud of the code.&lt;br /&gt;
Moving a little forward in time, about three years ago I decided it was time to start working on a rewrite in order to do things properly and make my dreams come true. I had this pile of ideas that I was dying to implement, but that I felt didn't fit in oSpy1.&lt;br /&gt;
Still limited to spare-time hacking there was only so much I could get done, but I got the &amp;quot;backend&amp;quot; bits pretty much done and working. But my hacking sprints were many months in between, and I barely even had a UI yet. It got as far as http://oleandre.wordpress.com/2008/06/23/ospy-and-jit-x86-machine-code-generation/, but I eventually realized that this wasn't going to help anyone anytime soon, it was just too ambitious, I needed a full-time job doing this if it was ever going to happen.&lt;br /&gt;
&lt;br /&gt;
So coming to realize that I have finally abandoned the rewrite efforts and decided to brush the dust off oSpy1 and start fixing bugs, improving the UI, adding new features and try to make it suck less with every release. Also rewrite some bits here and there as I go along.&lt;br /&gt;
&lt;br /&gt;
oSpy 1.10.0 marks the beginning of this era, and there's a summary of changes here:&lt;br /&gt;
http://www.openrce.org/downloads/details/231/oSpy&lt;br /&gt;
&lt;br /&gt;
Please don't hesitate to file bugs, send me feature requests, flames, rants, contribute code, contribute artwork -- any contribution is very much appreciated! Let's make 1.10.1 suck even less! :)</description>
                    </item>
                <item>
            <title>Stressful but interesting days</title>
                            <pubDate>Wed, 27 Sep 2006 19:37:12 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/456/Stressful_but_interesting_days</link>
                                        <author>oleavr &lt;email-suppressed@example.com&gt;</author>
                                                    <description>The last days have been stressful, as I've been actively trying to track down an apartment on the other side of the country, where I'll be moving shortly to get started in my new job at &lt;a href=&quot;http://www.tandberg.net/&quot;&gt;Tandberg&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
On the bright side I got a little reverse-engineering done on Windows Live Messenger and a few features added to &lt;a href=&quot;http://code.google.com/p/ospy&quot;&gt;oSpy&lt;/a&gt;. But, today's been a great day as it marks the day when oSpy got its first community member -- &lt;i&gt;Frode Hus joined in on the development and contributed an Oracle TNS parser&lt;/i&gt;, &lt;b&gt;awesome!&lt;/b&gt;&lt;br /&gt;
Another thing worth mentioning is that the newly released &lt;a href=&quot;http://projects.collabora.co.uk/~oleavr/oSpy/oSpy-1.8.7.zip&quot;&gt;1.8.7 release&lt;/a&gt; (those of you who didn't know should subscribe to &lt;a href=&quot;http://www.openrce.org/rss/feeds/downloads&quot;&gt;OpenRCE's Downloads feed&lt;/a&gt;) also features &lt;a href=&quot;http://www.datarescue.com/idabase&quot;&gt;IDA&lt;/a&gt; integration, as demonstrated by the screencast published immediately after releasing 1.8.7:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://projects.collabora.co.uk/~oleavr/oSpy/ida-integration.html&quot;&gt;Screencast: IDA integration&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Basically you can right-click on a row and choose &amp;quot;Go to return address in IDA&amp;quot;, which automatically finds the relevant &lt;a href=&quot;http://www.datarescue.com/idabase&quot;&gt;IDA&lt;/a&gt; window, shows it and jumps to that offset. This is a very common use-case, at least for me, when tracing an application and wanting to peek at the code surrounding a particular function-call.&lt;br /&gt;
&lt;br /&gt;
Enjoy!</description>
                    </item>
                <item>
            <title>MSNP15 authentication scheme REd</title>
                            <pubDate>Sun, 24 Sep 2006 13:15:41 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/449/MSNP15_authentication_scheme_REd</link>
                                        <author>oleavr &lt;email-suppressed@example.com&gt;</author>
                                                    <description>Just finished reverse-engineering the new authentication scheme introduced by MSNP15 (which appeared in the Windows Live Messenger 8.1 betas). No decompiled code was touched at all, oSpy was used exclusively to figure out everything. So here you go, a tiny python implementation that should be fairly self-explanatory.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
import struct&lt;br /&gt;
from base64 import standard_b64encode, standard_b64decode&lt;br /&gt;
from Crypto.Hash import HMAC, SHA&lt;br /&gt;
from Crypto.Cipher import DES3&lt;br /&gt;
from Crypto.Util import randpool&lt;br /&gt;
&lt;br /&gt;
CRYPT_MODE_CBC = 1&lt;br /&gt;
CALC_3DES&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;= 0x6603&lt;br /&gt;
CALG_SHA1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;= 0x8004&lt;br /&gt;
&lt;br /&gt;
def mbi_encrypt(key, nonce):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def derive_key(key, magic):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hash1 = HMAC.new(key, magic, SHA).digest()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hash2 = HMAC.new(key, hash1 + magic, SHA).digest()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hash3 = HMAC.new(key, hash1, SHA).digest()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hash4 = HMAC.new(key, hash3 + magic, SHA).digest()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return hash2 + hash4[0:4]&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Read key and generate two derived keys&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;key1 = standard_b64decode(key)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;key2 = derive_key(key1, &amp;quot;WS-SecureConversationSESSION KEY HASH&amp;quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;key3 = derive_key(key1, &amp;quot;WS-SecureConversationSESSION KEY ENCRYPTION&amp;quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Create a HMAC-SHA-1 hash of nonce using key2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hash = HMAC.new(key2, nonce, SHA).digest()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Encrypt nonce with DES3 using key3&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# IV: 8 bytes of random data&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iv = randpool.KeyboardRandomPool().get_bytes(8)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;obj = DES3.new(key3, DES3.MODE_CBC, iv)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# XXX: win32's Crypt API seems to pad the input with 0x08 bytes to align on 72/36/18/9 boundary&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ciph = obj.encrypt(nonce + &amp;quot;\x08\x08\x08\x08\x08\x08\x08\x08&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Generate the blob&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blob = struct.pack(&amp;quot;&amp;lt;LLLLLLL&amp;quot;, 28, CRYPT_MODE_CBC, CALC_3DES, CALG_SHA1,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; len(iv), len(hash), len(ciph))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blob += iv + hash + ciph&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return standard_b64encode(blob)&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
So the new authentication scheme basically goes like this:&lt;br /&gt;
1. Connect to the notification server as usual, but when sending the initial USR, you should send:&lt;br /&gt;
&amp;gt;&amp;gt; USR 19 SSO I foo@hotmail.com&lt;br /&gt;
and in the reply you get the &lt;i&gt;nonce&lt;/i&gt; as the last parameter, and the &lt;i&gt;policy&lt;/i&gt; parameter should be set to &lt;i&gt;MBI&lt;/i&gt;:&lt;br /&gt;
&amp;lt;&amp;lt; USR 19 SSO S &lt;i&gt;MBI&lt;/i&gt; &lt;i&gt;&amp;lt;nonce&amp;gt;&lt;/i&gt;&lt;br /&gt;
2. Authenticate with Passport 3.0 (documented in &lt;a href=&quot;http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener&quot;&gt;MSNPiki&lt;/a&gt;), requesting a token for &lt;i&gt;&amp;quot;messengerclear.live.com&amp;quot;&lt;/i&gt; with policy URI set to &lt;i&gt;&amp;quot;MBI&amp;quot;&lt;/i&gt;. In the response, store the &lt;i&gt;security-token&lt;/i&gt; (RequestedSecurityToken.BinarySecurityToken) and &lt;i&gt;proof-token&lt;/i&gt; (RequestedProofToken.BinarySecret).&lt;br /&gt;
3. Call mbi_encrypt() with key=&lt;i&gt;proof-token&lt;/i&gt; and nonce=&lt;i&gt;nonce&lt;/i&gt;, and store the base64-encoded &lt;i&gt;blob&lt;/i&gt; returned.&lt;br /&gt;
4. Send the final USR to the notification server:&lt;br /&gt;
&amp;gt;&amp;gt; USR 20 SSO S &lt;i&gt;&amp;lt;security-token&amp;gt;&lt;/i&gt; &lt;i&gt;&amp;lt;blob&amp;gt;&lt;/i&gt;&lt;br /&gt;
and, if successful you should receive:&lt;br /&gt;
&amp;lt;&amp;lt; USR 20 OK foo@hotmail.com 1 0</description>
                    </item>
                <item>
            <title>oSpy 1.8.2 -- all your hashes are belong to us</title>
                            <pubDate>Sat, 23 Sep 2006 21:41:36 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/425/oSpy_1.8.2_--_all_your_hashes_are_belong_to_us</link>
                                        <author>oleavr &lt;email-suppressed@example.com&gt;</author>
                                                    <description>I've been working on reverse-engineering Windows Live Messenger's newer authentication scheme lately, which was introduced with MSNP15 and implemented by the WLM 8.1 betas. This lead me to hooking the Crypt API to make it easy to pin down the code responsible for the new funky stuff. So here's 1.8.2 with quite a few changes:&lt;br /&gt;
&lt;br /&gt;
UI:&lt;br /&gt;
- Made the HTTP parser smarter.&lt;br /&gt;
- Temporarily don't clear the messagequeue when starting a capture.&lt;br /&gt;
- Implemented scrolling in ASCII view mode.&lt;br /&gt;
- Minor improvements to the MSN parser.&lt;br /&gt;
&lt;br /&gt;
Agent:&lt;br /&gt;
- Hooked parts of the Crypt API:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptImportKey&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptExportKey&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptGenKey&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptGetKeyParam&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptDestroyKey&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptGenRandom&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptCreateHash&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptDestroyHash&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptHashData&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptGetHashParam&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CryptSetHashParam&lt;br /&gt;
&lt;br /&gt;
- Implemented hooking of WLM's Passport DLL to get the debug messages. Not all of the internal debugging functions are currently hooked. This is temporarily disabled because it's work in progress, but can be easily enabled for those interested (just check out the code and build).&lt;br /&gt;
- Logging bugfixes.&lt;br /&gt;
- Extended FunctionName field from 16 to 32 characters.</description>
                    </item>
                <item>
            <title>oSpy 1.8.1 released</title>
                            <pubDate>Fri, 15 Sep 2006 20:17:00 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/415/oSpy_1.8.1_released</link>
                                        <author>oleavr &lt;email-suppressed@example.com&gt;</author>
                                                    <description>Just released oSpy 1.8.1. Fixed a &amp;quot;bug&amp;quot; in the parser that resulted in streams not getting fully parsed in case of really long lines for line-based protocols like HTTP and MSN.</description>
                    </item>
            </channel>
</rss>
