doug
August 24th, 2005, 20:38
I found this laying on my hdd doing nothing, so I made a small update & decided to share it here.
===============
Readme:
In v5 and v7, SecuROM incorporates a sofisticated code obfuscator engine. It
is better than any obfuscation I have seen elsewhere, so the simple pattern
matching of macros do not work very well (at all).
This tool cleans code that was protected/obfuscated with SecuROM's
code obfuscator. While this tool handles a LOT of things, it is not perfect,
so don't expect to be able to run files that were cleaned with it. The purpose
of this tool is to simplify a reverse-engineering/security analysis
of those binaries.
Full source code is included (GPL for the files with my name in the header).
This tool only supports PE images. Since starting with some version,
the securom .text section is compressed, just use LordPE to dump the
entire process (dump full) to disk at the point where the .init section
jumps (via a RET) to the real securom entrypoint in .text.
Usage
------
Just run the srom7_cleaner.exe and specify the file that you which to clean.
Recommended:
* Redirect the output to a text file. The log can get up to 7 MB large.
Use the included .bat file for that purpose.
* First just scan .init to analyze the decompression code. Then dump
the process when .text (securom's) is unpacked.
* When the process is dumped, you may clean both .text & .init.
* Load in IDA and enjoy ;-).
Known issues:
------------
* The CMP pattern is known to produce a lot of collisions/errors, so I
just commented out the line in the source code. The handler needs a
little rework before I feel that I can enable it again.
===============
Sample Report from log:
=================================================
== Scan Report ==
=================================================
Jmp : Fixed: 6803, Failed: 0
AddEsp : Fixed: 4985, Failed: 0
AddEsp s : Fixed: 667, Failed: 0
SubEsp : Fixed: 602, Failed: 0
AntiTrace : Fixed: 42106, Failed: 0
AddRegConst : Fixed: 15374, Failed: 4042
Slicer : Fixed: 4042, Failed: 0
Test reg/reg : Fixed: 1684, Failed: 0
Jcc 1a : Fixed: 12148, Failed: 0
Jcc 1b : Fixed: 58, Failed: 0
AddRegImm : Fixed: 1925, Failed: 0
Prolog : Fixed: 945, Failed: 0
Epilog : Fixed: 888, Failed: 0
StackRead : Fixed: 26350, Failed: 0
Call : Fixed: 6429, Failed: 0
MovRegImm32 : Fixed: 662, Failed: 0
MovRegDwordPtr : Fixed: 1043, Failed: 14
LeaRegDwordPtr : Fixed: 10107, Failed: 102
Push Offset1 : Fixed: 1224, Failed: 0
Push Offset2 : Fixed: 144, Failed: 0
MovRegImm32_2 : Fixed: 2, Failed: 0
PushReg : Fixed: 18914, Failed: 0
Ret : Fixed: 247, Failed: 0
PopReg : Fixed: 389, Failed: 0
MovRegImm32s : Fixed: 46, Failed: 0
=================================================
Total fixed: 157784
Total failed: 4158
Failure rate: 2.64%
Without AddRegConst acceptable errors:
Total failed: 116
Failure rate: 0.07%
=================================================
Enjoy!
doug
===============
Readme:
In v5 and v7, SecuROM incorporates a sofisticated code obfuscator engine. It
is better than any obfuscation I have seen elsewhere, so the simple pattern
matching of macros do not work very well (at all).
This tool cleans code that was protected/obfuscated with SecuROM's
code obfuscator. While this tool handles a LOT of things, it is not perfect,
so don't expect to be able to run files that were cleaned with it. The purpose
of this tool is to simplify a reverse-engineering/security analysis
of those binaries.
Full source code is included (GPL for the files with my name in the header).
This tool only supports PE images. Since starting with some version,
the securom .text section is compressed, just use LordPE to dump the
entire process (dump full) to disk at the point where the .init section
jumps (via a RET) to the real securom entrypoint in .text.
Usage
------
Just run the srom7_cleaner.exe and specify the file that you which to clean.
Recommended:
* Redirect the output to a text file. The log can get up to 7 MB large.
Use the included .bat file for that purpose.
* First just scan .init to analyze the decompression code. Then dump
the process when .text (securom's) is unpacked.
* When the process is dumped, you may clean both .text & .init.
* Load in IDA and enjoy ;-).
Known issues:
------------
* The CMP pattern is known to produce a lot of collisions/errors, so I
just commented out the line in the source code. The handler needs a
little rework before I feel that I can enable it again.
===============
Sample Report from log:
=================================================
== Scan Report ==
=================================================
Jmp : Fixed: 6803, Failed: 0
AddEsp : Fixed: 4985, Failed: 0
AddEsp s : Fixed: 667, Failed: 0
SubEsp : Fixed: 602, Failed: 0
AntiTrace : Fixed: 42106, Failed: 0
AddRegConst : Fixed: 15374, Failed: 4042
Slicer : Fixed: 4042, Failed: 0
Test reg/reg : Fixed: 1684, Failed: 0
Jcc 1a : Fixed: 12148, Failed: 0
Jcc 1b : Fixed: 58, Failed: 0
AddRegImm : Fixed: 1925, Failed: 0
Prolog : Fixed: 945, Failed: 0
Epilog : Fixed: 888, Failed: 0
StackRead : Fixed: 26350, Failed: 0
Call : Fixed: 6429, Failed: 0
MovRegImm32 : Fixed: 662, Failed: 0
MovRegDwordPtr : Fixed: 1043, Failed: 14
LeaRegDwordPtr : Fixed: 10107, Failed: 102
Push Offset1 : Fixed: 1224, Failed: 0
Push Offset2 : Fixed: 144, Failed: 0
MovRegImm32_2 : Fixed: 2, Failed: 0
PushReg : Fixed: 18914, Failed: 0
Ret : Fixed: 247, Failed: 0
PopReg : Fixed: 389, Failed: 0
MovRegImm32s : Fixed: 46, Failed: 0
=================================================
Total fixed: 157784
Total failed: 4158
Failure rate: 2.64%
Without AddRegConst acceptable errors:
Total failed: 116
Failure rate: 0.07%
=================================================
Enjoy!
doug