PSX-SCENE Forum Discussion for Sony PlayStation/PsOne/PS2/PS3/PSP/PS VITA
  • Slynk’s: PS3 IDA Tutorial + NPDRM Basic Info

    Slynk, the developer who has been working on QA Flagging, has released some interesting info this weekend. He has released some info regarding NPDRM, which is the security employed on PSN content. In addition he has posted a tutorial regarding IDA, which is software used in reverse engineering.

    Attachment 1284

    NPDRM Basic Info


    I’d like to begin this post with a few comments.

    1. Only a little bit of this is my own findings, a lot of this info was found from other sources.
    2. NPDRM discussion does not have to be a topic of piracy, it can be used in conjunction with signing/encrypting homebrew if it is fully documented one day.
    3. This is mostly to bring together the bits of info scattered across the interwebs.


    NPDRM Types

    NP 3 is a free licensed app. It has no license check. No edata/riff. Just install and use. This can be trial software as well.

    NP 2 is a locally licensed app. First time activation must take place online. After which you’ll have an edata/riff for that app and somehow this is connected to your act.dat.

    NP1 is a network licensed app. It requires network authentication every time it is launched.

    The offset for determining the NPDRM type of a self is at the NPDRM Header offset + 0x1C.



    NPDRM Security

    NPDRM as well as edata use AES, ECDSA, and CMAC for authenticity. These keys, with the exception of the CMAC key, are out there in the ether and can be found without much effort for someone who knows what they’re doing. The specifics of the algorithm are still being researched but a few people have already figured it out; but of course they won’t share their info.

    AES and ECDSA are handle by appldr like always. CMAC is handle by one of vsh’s modules. (Don’t know which one, just adding it for completeness.)

    Another form of security used in NPDRM is called a k_license. This is a 16 byte key that the developer makes that functions as sort of a “project key”. It’s used in all npdrm encrypted files within the project to prevent one of the files from being replaced by another project’s file. It is also referred to as an SCE NPDRM Key.



    NPDRM Header

    The current known structure of the NPDRM Header:

    Code:
    typedef struct
    {
        byte[4] block_type;  // this is 3(NPDRM)
        byte[4] block_size;  // this is 0x90(sizeof(Self_NPDRM))
        byte[4] unknown1;    // So far always 0
        byte[4] unknown2;    // So far always 0
        byte[4] magic;       // 0x4E504400(NPD)
        byte[4] unknown3;    // So far always 1
        byte[4] license;     // 1 Network License, 2 Local License, 3 Free
        byte[4] type;        // 1 Executable, 21 Update for Disc Based Game
        byte[2] titleid[0x30];
        byte[2] hash_unknown[0x10];
        byte[2] hash1[0x10];
        byte[2] hash2[0x10];
        byte[2] padding[0x10];
    ** Self_NPDRM
    I hear there’s plenty of more info in the official sdk for anyone who legally owns it as well. Anyway, I’ll post more if anything else comes to light. ^^

    PS3 IDA Tutorial

    First off, will not help you obtain a copy of IDA. Go buy it.


    http://www.mediafire.com/?kb3s14zi6hramrx


    Extract the contents into your IDA folder. I don’t take credit for these plugins and loaders.



    Loading a File

    There are two file types I’ll teach you to load. SPU and ELF files.
    SPU files can only loaded in IDA 32bit mode. When you load IDA choose “Go” and drag the file onto IDA. Make sure elf is highlighted at the top. In processor type, choose “IBM SPU Cell Processor: spu.” Click set. Click OK. “Undefined or unknown…blabla” yes. You should be good to go.

    Elf files can be loaded in either 32 or 64 bit mode. When you load IDA choose “Go” and drag the file onto IDA. Make sure PlayStation 3 ELF is highlighted at the top. Don’t mess with the processor type. Kernel option 1 check “Create function if data xref data-> code32 exists.

    Optional: I don’t know what these do but I turn them on anyways XD In kernel option 2 choose “Coagulate data segments in the final pass”, “Perform ‘no-return’ analysis”, and “Perform full stack pointer analysis.”

    Click OK. Sometimes you get a better result from running the analyze_self script. (File->IDC File->C:/Program Files/IDA/idc/analyze_self.idc) Hit yes, copy the TOC Address it shows you and click OK. Go to Options->General->Analysis->Processor specific analysis options. Type the TOC address in (I use 0: instead of 0x to be safe. No clue if it makes a difference.) While you’re at it click “Create subi instructions. Click OK. Click Reanalyze Program. Click OK. And wait.

    You’ll know when a script is done because at the bottom left it’s say “AU: idle”.



    IDA Basics

    Just a few things. The program is expansive and I’d love to get to know more about it but here’s a few things I know. Hex view and IDA view are connected. That means if you find a string in hex view, you can see it in IDA view. This won’t show you magically where it’s used at but sometimes, that string is xrefed. If under the string you see “# DATA XREF: ” you can right click the “:off_XXXX” at the end, and choose XREF To or From. To, will give you a graph of any functions that have a call “to” that offset. From give’s a graph of offset’s called “from” that offset (mostly only useful for viewing a graph of where all a function leads to.)


    In IDA view, you can search for either an immediate value, a string, or a byte sequence. I’ve never “not” checked “find all occurrences.” Don’t know why you wouldn’t want to. It’ll return a list of occurrences in its own window.
    If you’re lucky, the file you scanned will have some of the functions named (something other than sub_, nullsub_, or start). These are known functions that are defined in the ps3 sdk.

    When exiting, always make sure, unless you WANT to re analyze the whole file again, to choose one of the Pack database options and Collect garbage.


    Comments 21 Comments
    1. TWITDADDY's Avatar
      TWITDADDY -
      Quote Originally Posted by kootari View Post
      No your not twelve but your not helping the thread either. DONT quote unless its valid info or at least a question.

      Like mine.... What is all this and what does it mean. Seems like its a program that can derypt the ps3 and its usages? being able to read calls and see where they go. IE for making Homebrew or figuring ways around DRM? am i close.?
      whoops...............................
  • Daily Digest


    Want to receive the latest PSX info in your email?

    Sign up for our Daily Digest!



    Want to learn more about the team keeping you up to date with the latest scene news?

    Read about them now!

    Check out our Developer bios, too!

  • Recent Threads

    cora212509

    ps3usercheat update pkg help!

    Thread Starter: cora212509

    ok so i got a link leading me to brewology.com where they have usercheat upgrade pkgs for games i downloaded the one i needed based on my game and im

    Last Post By: BahumatLord Today, 01:29 AM Go to last post
    andif

    4 us Noobz, nice and simple what firmware?

    Thread Starter: andif

    Hey everyone, for us Noobz and people who have been away for a while what is the latest safest CFW?
    I used to be on 3.55 just checked my phat ps3

    Last Post By: mschumacher69 Today, 02:35 AM Go to last post
    Murderloc

    isos wont appear cfw 6.60 pro-c

    Thread Starter: Murderloc

    Ive tried everything I can think of and isos wont appear under the game menu or under promethus ive tried multiple ones I know their good I also have

    Last Post By: Murderloc Yesterday, 10:11 PM Go to last post
    Mike McCarty

    First RIP Not Working

    Thread Starter: Mike McCarty

    I'm a newbie to McBoot, but not to software and such.

    I've tried to find a "detailled" or step-by-step procedure,
    but

    Last Post By: RandQalan Today, 01:48 AM Go to last post
    Mike McCarty

    Mike McCarty - New Member

    Thread Starter: Mike McCarty

    Hello, just joined. A little about me:

    Born in 1952, so I'm however old that makes me. I don't track trivial stuff like that.
    Grew

    Last Post By: indirect76 Today, 01:26 AM Go to last post
    zeon9881

    Fat PS3-60GB-Fan Noise

    Thread Starter: zeon9881

    So a while back my PS3 got the YLOD and my brother gave it to a repair shop (private shop) for repair. The guy fixed our ps3 but also put the fan speed

    Last Post By: zeon9881 Today, 02:51 AM Go to last post
  • Recent Comments

    bitsbubba

    {Update #1} Rogero's CFW 4.40 v1.02 Released

    actually *Install Package Files and (app_home/PS3_GAME) look more legit as that's what Sony has... Go to last post

    bitsbubba Today 03:51 AM
    bitsbubba

    {Update #1} Rogero's CFW 4.40 v1.02 Released

    lol the video is a link so obviously he can post links 10/10 he has, coincidentally only mod I see... Go to last post

    bitsbubba Today 03:20 AM
    tthousand

    {Update #1} Rogero's CFW 4.40 v1.02 Released

    You can either attach it here, upload it to our download section. or post the link without any... Go to last post

    tthousand Today 03:13 AM
    bitsbubba

    {Update #1} Rogero's CFW 4.40 v1.02 Released

    is this a mod or just a port? Go to last post

    bitsbubba Today 02:41 AM
    exofreak

    {Update #1} Rogero's CFW 4.40 v1.02 Released

    here is a video
    https://www.youtube.com/watch?v=J9PowNRaHVY&feature=youtube_gdata_player
    i want... Go to last post

    exofreak Today 01:31 AM
    nova89

    Super Pixel Jumper v1.2 by ThatOtherPerson

    well i can see a new game addiction to add to my list now lol Go to last post

    nova89 Yesterday 10:23 PM
    atreyu187

    Fan Control Utility v1.7 Relased CFW 4.41 Supported!!

    So if you go into rebug toolbox and alter the settings one should not have to go into mM first.... Go to last post

    atreyu187 Yesterday 09:05 PM
    JOshISPoser

    Super Pixel Jumper v1.2 by ThatOtherPerson

    if he's looking to improve this, i say add background music support or just background music. i... Go to last post

    JOshISPoser Yesterday 08:31 PM
    lunacryed

    Super Pixel Jumper v1.2 by ThatOtherPerson

    cool game thanks ThatOtherPerson Go to last post

    lunacryed Yesterday 06:33 PM
    aldostools

    {Update #1} Rogero's CFW 4.40 v1.02 Released

    exofreak please post a link of your "mod" or share it in the official thread at ps3crunch

    A... Go to last post

    aldostools Yesterday 06:15 PM