DEV Community

Cover image for Crimson Desert 2.06.01 Analysis with IDA
pleasecallme.stef
pleasecallme.stef

Posted on Edited on

Crimson Desert 2.06.01 Analysis with IDA

Since Crimson Desert 2.06.01, reverse engineering the .exe got a little bit more complicated since they are using a custom .reloc section which isnt getting analyzed correctly by IDA.

To still be able to analyse Crimson Desert in IDA i wrote a few tools and projects to dump missing sections, reconstruct import table ( won't be shown in Imports subview but in usage ) and extract VTable information/ assign it to IDA adress spaces.

Getting Started

First of all we need to checkout my project PureLiquid-Crimson-Desert-External on GitHub.

Opening CrimsonDesert in IDA

After that open up CrimsonDesert.exe in IDA but make sure Analyse Enabled is unchecked.

Dumping and Inserting Missing Segment

After that we need to run our first tool from my Repo called MissingSegmentDumper.
For that run Crimson Desert 2.06.01 and start MissingSegmentDumper in Release mode.

This will dump the .reloc section containing Imports, VTable pointers and so on from runtime.
Follow the instructions of the MissingSegmentDumper on how to import it.

Missing Segment Dumper Result

Start analysis

Once this is done, rebase the program to 0x0 by going to Edit -> Segments -> Rebase Program

Rebase

After that we are going to let IDA analyse the program by going to
Options->General-> Analysis Tab and checking the Enabled checkmark.

Analyse disable

Since this is a 300mb Executable and will Analyse for a long time, in the meantime we can Dump the RTTI.

Dumping VTables & RTTI

For that we will open the PureLiquid-Crimson-Desert-External Solution in Visual Studio 26 and run RTTIDumper. Please be patient. It took around 40 minutes on my i9 11900kf to dump RTTI.
This will produce a ~3.5mb file containing all the RTTI it can find including their VTable Offset.

VTable Dump

ManagerDumper & ImportsDumper

Since IDA may still be Analysing we will run ImportsDumper and ManagerDumper in the meantime.

ImportsDumper
ImportsDumper will dump all the used imports at runtime since some of them won't be able during Static Analysis in IDA. ( Some of them are in the Previous inserted .missing Section )
Once ImportsDumper has done its work, copy the result over to the variable resolved_imports in imports_fixer2.py.

Imports dumper result

ManagerDumper

There are a lot of internal Managers in the Game which handles stuff like inventory, actors, wanted level, ...
To dump all of them and create a rename list for IDA run ManagerDumper from the PureLiquid-Crimson-Desert-External Solution .

This will write two files ( manager_function_names.txt and manager_offset_names.txt ).

Manager Dumper Result

We will import those later in IDA.

Applying All the Patches

In the meantime the analysis of CrimsonDesert.exe should be done.
Now click on File -> Script File and run import_reconstructor_walk.py.
This will rename all the referenced functions found in .impdata section so we can easier Analyse later on.

ImpData Fix

After that, we are going to run import_fixer2.py which will rename all the other imports.

Missing Imports fix

Once we are done with that, we will run rtti_dump_VTable_Rename.py to rename all the VTables offsets using crimson_desert_rtti_dump.txt and be able to find their usage.

Vtable fix

The last step is to rename all the managers.
For that we run rename_functions_ida.py by pointing to manager_function_names.txt.

Manager function names fix

Result

Now you will have a good typed .i64 file reflecting all the data from Crimson Desert v2.06.01.

Hapy analysing :)

Top comments (0)