Quote:
[Originally Posted by sapu;86456]The driver seems quite obfuscated, so no luck with disassembling... any suggestion about how to analyze / de-obfuscate it ? |
Hi
Nice dump of the files. I've looked at the driver a little bit, there seems to be one particular "style" of obfuscation seen throughout that causes a particular problem in the IDA analysis, but can be fixed individually fairly easily.
You want as clean a disassembly as possible before analyzing anything, which means you want to be able to right click on each function call and tell IDA to Create Function and have it accurately define all the parameters and local variables. The obfuscation hinders that.
You'll see stuff like this
add eax, 74503002h
interspersed with redundant push/pops and other useless instructions. They can basically be ignored, keep going until you reach a branch instruction.
There are groups of 3 bytes all over the place which either don't disassemble, or do disassemble incorrectly, but usually corrupt the jump xrefs:
Code:
:00010DF1 77 03 ja short near ptr loc_10DF5+1
:00010DF3 32 20 xor ah, [eax]
:00010DF5
:00010DF5 loc_10DF5: ; CODE XREF: :00010DF1
:00010DF5 A3 E8 65 FD FF mov ds:0FFFD65E8h, eax
So instead, U(ndefine) the problem instructions, skip the 3 garbage bytes and type C(ode) to reassemble again beginning at the correct offset. This will fix the jump xref:
Code:
:00010DF1 77 03 ja short loc_10DF6
:00010DF1 ; ---------------------
:00010DF3 32 db 32h ; 2
:00010DF4 20 db 20h
:00010DF5 A3 db 0A3h ; ú
:00010DF6 ; ---------------------
:00010DF6
:00010DF6 loc_10DF6: ; CODE XREF: :00010DF1
:00010DF6 E8 65 FD FF FF call loc_10B60
Next, you should select Edit/Patch Program/Change Byte and convert those 3 bytes to 90h 90h 90h and reassemble them as NOPS. If you don't, IDA may complain they are undefined bytes when next analysed.
When you fix up ALL those 3 byte sequences within a function, and anything else that doesn't look right, then you can go back and use Create Function and IDA should resolve it properly. Name the function to something and go onto the next one.
To begin with, define the entry point Start function as a regular DriverEntry function, pDriverObject is an important landmark.
int __stdcall DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING RegistryPath)
The PsCreateSystemThread thread seems like it might decrypt and call a function in the data section, passing two values from the StartContext parameter and a pDriverObject. This is probably where the real action takes place.
Not sure if the decryption can be figured out statically, it might be necessary to load the driver and step through it, breaking on both DriverEntry and the PsCreateSystemThread thread. Some finagling with Softice/remote WinDbg and a driver loader should allow live tracing and really suss this thing out.
Thanks for the post,
Kayaker