Map.dat Decryption/encryption
#1
Posted 09 February 2004 - 04:38 PM
I've managed to decrypt the map.dat file for the custom emoticons in VB.
The result is a tag like this:
<msnobj Creator="xxx@xxx.xxx" Size="5684" Type="2" Location="TFRDD.dat" Friendly="AAA=" SHA1D="Poxkp25S0dmfLOtkM4U2krbFoT4=" SHA1C="uF4G/233aTsNxaTuPJbIKPNRxkE="/>
Decrypting TFRDD.dat also works fine. In this file there is a tag for each custom emoticon like this one:
(webc) webcam <msnobj Creator="xxx@xxx.xxx" Size="258" Type="2" Location="TFR51.dat" Friendly="AAA=" SHA1D="o0YBBk9i6bxFd4WK4awWnnZsdqQ=" SHA1C="Frw1WNunppuDunQ+DvR/Xj8bak0="/>
But when I try to encrypt map.dat again it goes wrong. The byte size is equal to the original file (612 bytes in my case, shouldn't be much smaller or bigger by other MSN users).
The contents is not the same as the original, but that is normal because each time you encrypt the same file it is different (Decrypting my encrypted file again results in the same contents as the original). When I put the encrypted map.dat in the CustomEmoticons directory MSN will fail to open it. The custom emoticon screen in MSN stays empty.
Has anyone succeeded in encrypting the map.dat file again? Or does anyone know what is going wrong?
Other question:
Listcache.dat is also decryptable. But when I view the results it looks like crap. Some parts are viseble. Like all the email addresses in my contact list. But for the rest it looks like binary stuff to me... Does anyone has an idea what kind of file this could be?
Wouter
#2
Posted 10 February 2004 - 12:36 AM
As for the list cache, its in some format, im not sure what, the first few bytes are the same as a word document, would probably just need to see what librarys/function messenger accesses when reading it.
#3
Posted 10 February 2004 - 01:07 AM
And I've just tested it to encrypt the temp file listed in the map.dat file at the same time as the map.dat file but that also wouldn't work.
In MS docs I found that the CryptUnProtectData function only works when you have the same privileges as the encryptor. That is true in my case. I have only one account here: Administrator.
MS doesn't say anything about the the function cannot decrypt when it is encrypted in an other application. So that can't be the cause of the problem.
There must be a way to get it working properly... To bad that I can't find any documentation on this subject on the internet. I'll try to find the solution. And when I have it I'll post it here with the source..
Wouter
#4
Posted 10 February 2004 - 01:14 AM
WouterL, on Feb 10 2004, 02:07 PM, said:
The list cache isnt realtime... its only updated when you sign out..
But anyway, you might be having another problem, like the couple of extra bytes at the start of the file, ive forgotten what the story is, but the file should be something like
03 04 ENCRYPTED DATA....
The 2 or 3 bytes at the start of the file might be some version info, im not sure...
#5
Posted 10 February 2004 - 01:26 AM
I've just tested the realtime issue... When I encrypt the files all goes well and the emoticons are still there. After I restarted MSN the emoticons are gone. So MSN keeps them in memory the entire time it is loaded. Map.dat is a caching file like listcache.dat. But I am sure that the contents of map.dat is not on the server like listcache.dat. Because if I use MSN on an other computer I have no custom emoticons. And if you remove map.dat the emoticons are gone for ever...
#6
Posted 10 February 2004 - 01:56 AM
Could it have somthing to do with the time the files are created? could Messenger be checking when it was unloaded and when the files were changed? Just a thought.
#7
Posted 10 February 2004 - 04:01 PM
As said in my first post. The file looks different each time I encrypt it so there could be some kind of time stamp or whatever, or another possibility:
The CryptProtectData function uses keys for encryption. These keys are stored in the registry. Maybee MSN knows the key the file was encrypted with.
And if it is encrypted with another key it won't work. But there is no possibility to get the key used with the CryptProtectData function.
So maybe MSN saves it in the registry or something. But I can't verify that.
I haven't discovered a registry key that could contain such information.
Maybe someone else has?
#8
Posted 24 February 2004 - 01:59 PM
CryptProtectData generates a key based on the user's credentials, so if that's the function used by Messenger (gonna try to find out with a bit of reverse engineering) then it should work just fine. Even checked to see if they included a description in the encryption, which according to my findings they didn't.
The next thought that came to mind was Messenger keeps another hash somewhere, perhaps in the registry. Testing showed that wasn't the case. The test was simple: first I backed up my UserTile folder, then added a new display picture. This would cause map.dat and the index file to change. I then placed the backup back, overwriting the map.dat. Messenger showed the old list just fine, which indicates to me the only problem here is the way the file is encrypted...
So far no solution either :(
#9
Posted 24 February 2004 - 03:43 PM
I still think it has something to do with the flags of the CryptProtectData function.
There are more flags then Microsoft describes on MSDN. Check this sample to see more flags http://www.mvps.org/...o/protect.shtml
#10
Posted 25 February 2004 - 01:53 PM
If Patchou decrypts the files using the same method we do it's easy enough to get the PNGs. That's not the issue in this whole thing, the problem is that Messenger (and only Messenger it seems) fails after reencrypting them... very strange...
#11
Posted 25 February 2004 - 03:53 PM
More research is to come...

Sign In
Register
Help

MultiQuote