Go Back  
Reply
 
Thread Tools
Old 10-30-2011   #51
Octopus
Member
 
Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
@granberro Thats because the real klicensee for each game are in elf.
Octopus is offline   Reply With Quote
Old 11-04-2011   #52
JuanNadie
Homebrew Developer
 
Join Date: Oct 2011
Posts: 20
Likes: 11
Liked 368 Times in 19 Posts
Mentioned: 68 Post(s)
Tagged: 0 Thread(s)
Actually an EDAT has several keys. One is in the SELF, others are at the rif and others on firmware. That an EDAT works on lower firmware only proves that the firmware has those keys.

BTW I have tricked the PS3 into decrypt an EDAT (Buzz). The procedure involves knowing how the NPD element is used (most of this is already published).
Code:
   struct {
     uint32_t magic;
     uint32_t unknown2;
     uint32_t license; /* 1 network, 2 local, 3 free */
     uint32_t type; /* 1 exec, 21 update */
     uint8_t content_id[48];
     uint8_t digest[16];
     uint8_t titlefilenameHash[16];
     uint8_t headerHash[16];
     uint64_t unknown3;
     uint64_t unknown4;
   } npdrm;
The NPD has 3 different hashes:
- The first (digest) is a hash of the decrypted data. I don't know the algorithm nor if it is checked.
- The second is a CMAC. The key is npdrm_omac_key3, and the message is the titleID (0x30 bytes) concat to the filename (excluding path and case sensitive),
- The third is again a CMAC. This time the message is the whole NPD from NPD magic to the second hash both included. The key for SELFs launched from the VSH is npdrm_omac_key1 xored with npdrm_omac_key2

But for the rest (Selfs executed inside a program and EDAT) instead of using npdrm_omac_key1 another key is used. That key is called the klicensee (however as that name is already used I would call it devklic (developer klicensee),

That key is selected randomly by the developer(activision, ea, ubisoft, square...) and it is a parameter used when creating a pkg. So for EDAT the key for the third hash is devklic xored with npdrm_omac_key2.

If we are going to recrypt an EDAT we need that key. There are several procedures to obtain it:

- Decrypt the SELF and use RCE to get it. We'll need an idc that locates the call. Very slow, tricky, requires large knowledge but always work.
- Hook the call that opens EDAT. Then we retrieve it on parameter r3. Faster, requires modifying the firmware. Always work
- Brute force it: Decrypt the self and try every combination of 16 sequential bytes on the file. I obtained using this method the key on Buzz and LBP. It faster than RCE but it does not always work (the key could be in other file or obfuscated).

I repeat we will need that key to encrypt an EDAT.

We SONY uses this key? To avoid the following ¿exploit?:

-Obtain the devklic.
-On a PS3 where the EDAT is authorized write a program with the following command;
sceNp....Open(devklic, "PATH_TO_FILE",READ_ONLY,fd,NULL,0);

That will create a file descriptor. The read of it will be on clear... and we can then write it to an output file.

How I think this works? Well, you provide the correct klicense, so the system will validate the NPD and send a request to LV2 to set the decryption key (This would be related to rif for paid or to the devklic if free). Then when reading if the LV2 Will ask the appldr to decrypt it).... Note that seek works so probably the decryption can be made by blocks

BTW something similar was done on PSP

How can we use this?
-First is good to have the plain text of something you0re trying to reverse so for devs it could be useful to reverse EDAT algorithm
-Second you can replace the original file and patch the EBOOT to not use encryption.
-Third you can create a debug EDAT and path lv2 to accept debug files.

However IMHO any warez release that uses those tricks should be NUKED as that is not the correct procedure (that would be reencrypt the EDAT as free).

Other things:
-The first hash of NPD needs to be obtained
-The first 0x80 encrypted bytes of an EDAT (0x90-0x10F) contains a key for decrypting the rest of the file. I think that key is constant for the rest of the file. Reason: the 2 EDAT I decrypted from Buzz has the same contain... which means hash1 is the same (2 and 3 are different cause the filename is different), but the encrypted content in the metadata section changes. Perhaps a signature but I think there is a different key there (the data also changes)


@granberro Buen trabajo. I saw your work at elotrolado allowing the use of non static keys on a NPDRM.

@mathieulh thanks for the compliments on type 2 NPDRM. I also think that someone should modify make_self_npdrm to make SELFs that work "at least" on 3.55 official firmware...

Last edited by JuanNadie; 11-04-2011 at 04:55 AM.
JuanNadie is offline   Reply With Quote
Likes: (9)
Old 11-04-2011   #53
Octopus
Member
 
Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
When we think devklic = decklic, we (our team) are tried decrypt EDAT by this way:
Originally Posted by JuanNadie View Post
-Obtain the devklic.
-On a PS3 where the EDAT is authorized write a program with the following command;
sceNp....Open(devklic, "PATH_TO_FILE",READ_ONLY,fd,NULL,0);
And get 0x80029530 Error.
We can do this now, but we will not decrypt ISO.BIN.EDAT or p3t.EDAT thats way, they don't have self...
maybe if we will
Originally Posted by JuanNadie View Post
- Hook the call that opens EDAT. Then we retrieve it on parameter r3. Faster, requires modifying the firmware. Always work
this will work
Octopus is offline   Reply With Quote
Old 11-04-2011   #54
alphaomega
Member
null
 
Join Date: Nov 2011
Posts: 42
Likes: 0
Liked 0 Times in 0 Posts
Mentioned: 5 Post(s)
Tagged: 0 Thread(s)
So crysis 1 soon? Nice work guys you are HEROES
alphaomega is offline   Reply With Quote
Old 11-05-2011   #55
tiefputin2
Member
 
Join Date: Apr 2011
Posts: 62
Likes: 0
Liked 39 Times in 22 Posts
Mentioned: 6 Post(s)
Tagged: 0 Thread(s)
That key is selected randomly by the developer(activision, ea, ubisoft, square...) and it is a parameter used when creating a pkg. So for EDAT the key for the third hash is devklic xored with npdrm_omac_key2.

If we are going to recrypt an EDAT we need that key. There are several procedures to obtain it:

- Decrypt the SELF and use RCE to get it. We'll need an idc that locates the call. Very slow, tricky, requires large knowledge but always work.
- Hook the call that opens EDAT. Then we retrieve it on parameter r3. Faster, requires modifying the firmware. Always work
- Brute force it: Decrypt the self and try every combination of 16 sequential bytes on the file. I obtained using this method the key on Buzz and LBP. It faster than RCE but it does not always work (the key could be in other file or obfuscated).
look out for klicensee.py
developer klic is within the .pkg at offset 0x60 or so too
tiefputin2 is offline   Reply With Quote
Likes: (1)
Old 11-05-2011   #56
Saimin
Apprentice
 
Join Date: Nov 2011
Posts: 2
Likes: 4
Liked 0 Times in 0 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Originally Posted by tiefputin2 View Post
look out for klicensee.py
developer klic is within the .pkg at offset 0x60 or so too
I haven't had any luck using the KLicensee generated by that. I can verify the title/filename hash for all 16 edat files in the Dunamis15 demo, but trying to generate the header hash using the KLicensee from the pkg and JuanNadie's description always gives me something different from the hash in the edat.

I haven't tried any of the other methods for finding the KLicensee, cause I wouldn't know where to start with it.
Saimin is offline   Reply With Quote
Old 11-05-2011   #57
jester
Member
null
 
Join Date: Dec 2008
Posts: 30
Likes: 0
Liked 8 Times in 6 Posts
Mentioned: 3 Post(s)
Tagged: 0 Thread(s)
Originally Posted by Saimin View Post
I haven't tried any of the other methods for finding the KLicensee, cause I wouldn't know where to start with it.
Decrypt the game EBOOT.BIN than write a bruteforce routine that tries to generate the hash using every 16bytes of the EBOOT.
jester is offline   Reply With Quote
Likes: (1)
Old 11-06-2011   #58
Saimin
Apprentice
 
Join Date: Nov 2011
Posts: 2
Likes: 4
Liked 0 Times in 0 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Originally Posted by jester View Post
Decrypt the game EBOOT.BIN than write a bruteforce routine that tries to generate the hash using every 16bytes of the EBOOT.
I must not've had my head on straight this morning. Thanks! I got the KLicensee from the decrypted eboot, and I'm correctly generating the header hash on all 16 edat files.
Saimin is offline   Reply With Quote
Old 11-06-2011   #59
Octopus
Member
 
Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
For example "Flower" weighs about 10 Mb, it means it has about 11 millions of bytes, it means we must try about 11 millions of keys. Nice)
Octopus is offline   Reply With Quote
Old 11-07-2011   #60
jester
Member
null
 
Join Date: Dec 2008
Posts: 30
Likes: 0
Liked 8 Times in 6 Posts
Mentioned: 3 Post(s)
Tagged: 0 Thread(s)
Originally Posted by Octopus View Post
For example "Flower" weighs about 10 Mb, it means it has about 11 millions of bytes, it means we must try about 11 millions of keys. Nice)
What's the problem? It is faster than you can imagine! about 2 minutes with a crappy laptop...

EDIT: I've tried to use the licensee extracted from the relative .rif to try to generate the third hash for a paid edat, but it doesn't seems to be the right way

EDIT2: I'm now certain that this dev_klic has nothing to do with rif key for paid content...

Last edited by jester; 11-08-2011 at 02:35 PM.
jester is offline   Reply With Quote
Likes: (1)
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



PS3Hax.net is Copyright © 2010-2013.
Use of this site is governed by our Terms of Use and Privacy Policy. All Trademarks and images are owned by their respected owners.
Posts and links are subject to each author on this forum and are no way affiliated with the operations and/or opinions of ps3hax.net
All times are GMT -5. The time now is 12:43 AM.