PSAS Support Forum

This is the official board for all PSAS/QMAT users. Welcome !
It is currently Tue Sep 07, 2010 1:39 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: I need some help in decrypting firmware
PostPosted: Thu Jan 14, 2010 3:00 pm 
Offline

Joined: Wed Feb 18, 2009 2:52 pm
Posts: 35
Hello, I have a firmware for some home controling device, it's atmel based (ARM7) so it's rather close to main idea of that forum.. Once I ad a power lost and afterthat memory of my device somehow wiped out, I used Segger j-link to read memory and it was FFFFFF... I've tried to write smth to device, and it can be read back quite easy. So I have to write some firmware to atmel... I have an app for that device programming, it can update firmware, make some changes.. etc.. I found firmware file in that app system folder, and firmware is encrypted. I'll attach it here..
You may open in for ex. in Microsoft Word, as its not a binary, and I recommend thouse who may help me to start with word, cause firmware is xml-based..
You can see that it flashes to device with 256bytes blocks. From adres 0 futher you may see two md5 hashes and firmware block. It's easy to guess that it's encrypted with base64, moreover you may see that first part of block
Code:
VG3GC4Ypete5QDHTo6yR2Wmr9l3spxJfmcTAXx/1rCeB5cLltfXwU8bdpqSOiHz7LMp6g7hmDm2ul0zdhuaoLnksw888/rtnYUW5d80ZOQWLmafuUlIDBPBNlEITqwbX

is same for every firmware part.
Ok for now if we just decrypt base64 and compute md5 hash it match one of written upper hashes. If we just remove part which is same for all blocks then firmware size don't match 256byte, moreover it's clear that firmware is still encrypted as I suppose we have to see some firmware header in the first block, while we can see only some crazy hex..

Ok.. As for me I couldn't get any futher, anyways I suppose that I had to start with latest blocks, which seems to be FFFFFFFFFFFFFFF (in decrypted firmware) We may see that for last few blocks encrypted parts are same and hashes are same, so FFFF should make clear why it is so. While we know potential code we may try to decrypt last block, and found out how it is encrypted..

You may mention that firs part of block which is same for every firmware slice is 128byte long, while decrypted with base64 it's 96ytes long, all that sizes suit's as for me for encryption keys, but I can't figure out what type of encryption is used.

I know that it may take some time to help me, but if you may support me somehow, I may pay. Any answere will be much appreciated


Attachments:
File comment: firmware
nc_zw_eu.zip [52.19 KiB]
Downloaded 23 times
Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Fri Jan 15, 2010 12:21 am 
Offline

Joined: Wed Feb 11, 2009 11:28 pm
Posts: 22
it would help to know which device it is
you can pm me if you want to keep it confidential ..


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Fri Jan 15, 2010 12:41 am 
Offline

Joined: Wed Feb 18, 2009 2:52 pm
Posts: 35
It's not a secret, but I don't know how can it help.. It's a "Nevo Connect NC-50" AT91SAM7S128 based


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Fri Jan 15, 2010 1:05 pm 
Offline

Joined: Mon Sep 22, 2008 3:46 pm
Posts: 1061
If you've got the full firmware dump, it should be no problem.

But trying to decrypt this encrypted file won't be easy as it could be any algorithm.


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Fri Jan 15, 2010 1:13 pm 
Offline

Joined: Wed Feb 18, 2009 2:52 pm
Posts: 35
I have one more working device, but I can't dump firmware, I don't know why, core is not identified, pinout is 100% correct, and soldering was rechecked 100 times, seems on working firmware smt. prevents me from jtagging.
The only thing I have is app, which write firrmware via usb, while device is working. I suppose that it might be possible to disasm it, and to search for algorythm, but I'm too noobie in such projects(

According, to what you've said I'm shure we have some king of full dump. Each block is encrypted personally, with no involve to other blocks, it's absolutely clear. As last blocks of 256 bytes are same, I suppose in binary they are FFFFFFFFFFFFFFFF or 000000000000000, we know the size it's 256. I'll post block here to make clear my idea..
Code:
<Segments>
  <Start>32000</Start>
    <Prehash>
       <Algorythm>MD5</Algorythm>
       <Value>348a9791dc41b89796ec3808b5b5262f</Value>
    </Prehash>
    <Posthash>
       <Algorythm>MD5</Algorythm>
       <Value>8137f01019e55a5958dfe90da32cf612</Value>
    </Posthash>
    <Imagesize>256</Imagesize>
    <Presize>124</Presize>
    <Image>VG3GC4Ypete5QDHTo6yR2Wmr9l3spxJfmcTAXx/1rCeB5cLltfXwU8bdpqSOiHz7LMp6g7hmDm2ul0zdhuaoLnksw888/rtnYUW5d80ZOQWLmafuUlIDBPBNlEITqwbX1aeZlNkPNE0wtvOVbwXMuLTwnt79uYJnKm82AWmB9iE=</Image>
</Segments>

Let's convert <Image> to binary from base64.. Will get that binary
Code:
546DC60B86297AD7B94031D3A3AC91D969ABF65DECA7125F99C4C05F1FF5AC2781E5C2E5B5F5F053C6DDA6A48E887CFB2CCA7A83B8660E6DAE974CDD86E6A82E792CC3CF3CFEBB676145B977CD1939058B99A7EE52520304F04D944213AB06D7D5A79994D90F344D30B6F3956F05CCB8B4F09EDEFDB982672A6F36016981F621

If we compute hash it will be
Code:
8137F01019E55A5958DFE90DA32CF612
It's clear that it match Posthash

First part of block
Code:
VG3GC4Ypete5QDHTo6yR2Wmr9l3spxJfmcTAXx/1rCeB5cLltfXwU8bdpqSOiHz7LMp6g7hmDm2ul0zdhuaoLnksw888/rtnYUW5d80ZOQWLmafuUlIDBPBNlEITqwbX

Is same for every block, if we just remove it ve recieve
Code:
1aeZlNkPNE0wtvOVbwXMuLTwnt79uYJnKm82AWmB9iE=

Which is base64->binary
Code:
D5A79994D90F344D30B6F3956F05CCB8B4F09EDEFDB982672A6F36016981F621

It's a 32byte while we need 256byte, morover it will be very strange to have same hex in previous few blocks. I suppose that needed binary is
Code:
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

So what is the algorytm to convert previos 32byte code to 256byte FFFFFF? If some app for such calculetions exsist I'm ready to calcilate that algorythm for few mounths 24/7


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Sun Jan 17, 2010 2:08 pm 
Offline

Joined: Mon Sep 22, 2008 3:46 pm
Posts: 1061
It must be some compression then.
I strongly guess it must be lzma or gzip, both is supported by QMAT.


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Sun Jan 17, 2010 2:30 pm 
Offline

Joined: Wed Feb 18, 2009 2:52 pm
Posts: 35
Can not decompress it, may be some header for each part is missing?


Last edited by vorkachev on Sun Jan 17, 2010 2:30 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Tue Jan 19, 2010 10:13 am 
Offline

Joined: Mon Sep 22, 2008 3:46 pm
Posts: 1061
Could be. I will have a look at it on the weekend.


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Tue Jan 19, 2010 11:02 am 
Offline

Joined: Wed Feb 18, 2009 2:52 pm
Posts: 35
Thx, Viperbjk, I respect it very much, I'll contribute for any help)


Top
 Profile  
 
 Post subject: Re: I need some help in decrypting firmware
PostPosted: Mon Feb 08, 2010 3:44 pm 
Offline

Joined: Wed Feb 18, 2009 2:52 pm
Posts: 35
If someone is still kind enough to help me, I want to tell you that I'll donate 30$ for that help.
For your reference I've found out that if we take in count last blocks, which are identical, they (decryped) cosist of
Code:
0000000000000000000[etc..]

I've found out about this, while trying of creating 256bytes blocks filled by smt. and calculating their md5.
As far as we know form main file which md5 we should get, it was quite easy to find out encryoted value.
So finally we have encrypted bin:
Code:
546DC60B86297AD7B94031D3A3AC91D969ABF65DECA7125F99C4C05F1FF5AC2781E5C2E5B5F5F053C6DDA6A48E887CFB2CCA7A83B8660E6DAE974CDD86E6A82E792CC3CF3CFEBB676145B977CD1939058B99A7EE52520304F04D944213AB06D7D5A79994D90F344D30B6F3956F05CCB8B4F09EDEFDB982672A6F36016981F621

and decrypted bin
Code:
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

As far as we know first part of encrypted binary is same for all blocks, it may be dictionary for archive or some key, anyways if ve trunk it we will see that finally encrypted bin is
Code:
D5A79994D90F344D30B6F3956F05CCB8B4F09EDEFDB982672A6F36016981F621

And it should become 256byte 0000000000
How it can be done I don't know.
Pls someone, 30$ PP really, I'm shure it's an easy task for you, as you're pro.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group