Sunday, October 11, 2020

My tool is progressing nicely.

 After a month's work I have a tool that can more or less create basic blocks from instructions.

I decided my first target, identifying and extracting all basic blocks of the little anti-bp checks of the protector.


393844C383EC 20sub esp,20
393844C6C74424 1C 406CD77Amov dword ptr ss:[esp+1C],7AD76C40
393844CEC74424 18 6E000000mov dword ptr ss:[esp+18],6E
393844D6894C24 14mov dword ptr ss:[esp+14],ecx
393844DAB9 90443839mov ecx,39384490
393844DFC14C24 1C 10ror dword ptr ss:[esp+1C],10
393844E4894424 10mov dword ptr ss:[esp+10],eax
393844E8C1E6 00shl esi,0
393844EB8B01mov eax,dword ptr ds:[ecx]
393844ED014424 1Cadd dword ptr ss:[esp+1C],eax
393844F1C1E7 00shl edi,0
393844F483C1 04add ecx,4
393844F766:FF4C24 18dec word ptr ss:[esp+18]
393844FC75 EDjne 393844EB

 

Just a sample of the code, the overall pattern is sub esp <size>, three movs and the most important pattern, mov reg, imm. The checks only process at most 294 bytes. And there are 22718 of them with an additional 5500 that are probably false-positives.


The next step is to analyze whether these 22k checks all use the same algorithm or are different and somehow extract it programmatically. I am exploring dataflow analysis and symbolic execution, or if the algo is the same only one sample is enough.

No comments:

Post a Comment