Blackberry COD file format

COD file is a proprietary file format developed by RIM. Generally speaking it is some kind of modified Java .class file. I could not find any information around except this resource , but unfortunately there was no clue how to dig into codfile format as well. So I had a quick look on it by myself and here is a brief description of what I could find so far.

A codfile contains four sections: header, code segment, data segment and tail. A header structure is quite simple:

typedef struct { // codfh
int    flashid;
uint  section_number; //always 0
uint  vtable_pointer; //always 0
time_t timestamp;
uint  user_version;
uint  fieldref_pointer;
ushort  maxtype_list_size;
short    reserved; //always 0xFF
int        data_section; //always 0xFFFF
int        module_info; //always 0xFFFF
ushort  version;
ushort  code_size;
ushort  data_size;
ushort  flags;
} CODFILEHEADER;

SizeOf (CODFILEHEADER) = 0x2C;

The next section is a code segment it starts from offset 0x2C and has length from Code segment size field, then goes a data
segment with size from field Data segment size and then a tail.

Format of information in Code and Data segments is still required some work, but at least I have a something to begin with.

21 Responses to Blackberry COD file format

  1. Hex says:

    Hi man! I feel so happy to find someone interested in .cod reversing. I’ve already made a loader (ldw) for IDA to load the .cod files. But i’m stuck with reversing the JVM opcodes. They’ve changed the opcodes for simple instuctions like iload and replaced the “goto” and “invoke” commands by their own. If you’re still interested in BB reversing here’s my ICQ 157363553.

  2. Dr. Bolsen says:

    Sounds fantastic mate, next week I’ll publish through this blog a script for 010 Editor with more information of structures of COD file.

    Will contact you soon.

  3. Tony says:

    If you could post how to reverse .cod files that would be fantastic! I need to edit a .cod file so it better fits what I want from the program.

  4. […] the example included but with a more complicated project I’ve an error on the data_sector size: Blackberry COD file format Finally, I tried this solution that seemed the simplest one (at the bottom) : Blackberry Blog / […]

  5. toXic says:

    Hey, If anyone has found blackberry decompiler aur debugger or something like that, I would like to have it, I am quite intersted in reverse engineering cod’s….

  6. […] parameter must exactly match the size of the referenced file being downloaded). COD files: Blackberry COD file format Reverse & Форсаж A COD file is a RIM-style code module. The BlackBerry rapc compiler produces a COD file from all […]

  7. brand0n says:

    any idea on how to get around having to sign COD files to access RIM’s “secure” APIs? ;-)

  8. […] bắt đầu tìm hiểu về reverse cho BB, tìm được một số thông tin khá thú vị: Blackberry COD file format – Part I Blackberry COD file format – Part II Small tool to dump signatures from COD file Bypass signature […]

  9. Да, такой блог стопудово надо раскручивать сильнее – что б как можно больше читателей о нем узнали! :)

  10. yeah, I have the same problem…..

    […]Blackberry COD file format « Reverse & Форсаж[…]…

  11. Researching COD file format…

    Recently I made some research in order to extract certain information from Blackberry application files. I found useful information on Dr. {B0lsen} blog (headers, section layout – really great work). I’ve investigated resources layout ……

  12. Sports Floor Refurbishment…

    […]Blackberry COD file format « Reverse & Форсаж[…]…

  13. petite annonce…

    […]Blackberry COD file format « Reverse & Форсаж[…]…

  14. […] Blackberry COD file format « Reverse & Форсаж – COD file is a proprietary file format developed by RIM. Generally speaking it is some kind of modified Java .class file. I could not find any information around except this resource , but unfortunately there was no clue how to dig … […]

  15. […] Blackberry COD file format « Reverse & Форсаж – COD file is a proprietary file format developed by RIM. Generally speaking it is some kind of modified Java .class file. I could not find any information around except this resource , but unfortunately there was no clue how to dig … […]

  16. Thank you for sharing your info. I truly appreciate
    your efforts and I am waiting for your further write ups thank you once again.

  17. “Blackberry COD file format | Reverse & Форсаж” was in fact a quite nice article, .
    Continue writing and I’m going to continue reading through! Thank you ,Geri

  18. you’re really a excellent webmaster. The website loading speed is incredible. It seems that you are doing any unique trick. Also, The contents are masterpiece. you have done a great task in this matter!

  19. Hi superb blog! Does running a blog like this take a large amount of work?
    I have no expertise in computer programming
    however I had been hoping to start my own blog in the near future.
    Anyhow, if you have any recommendations or techniques for new
    blog owners please share. I understand this is off topic but I just
    had to ask. Thanks a lot!

Leave a reply to Converting a MIDlet to a COD file : need help - BlackBerryForums.com : Your Number One BlackBerry Community Cancel reply