You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have recently added the concept of basic block (#1121) in Triton and we are now able to disassemble and process a block. How this new feature can improve Triton regarding binary deobfuscation? With the concept of block, we are now able to provide a dead store elimination simplification on a given block. Thus, the method simplify can now take a BasicBlock as input.
Example
Let's take as an example a VMProtect sample (thanks to @_xeroxz for giving us such sample). How it works? We will symbolically execute the block and thus create for each instruction their SSA symbolic expressions. With the SSA form, and on a single block, it's then easy to remove expressions that have no more reference. For example:
movrdi,1 ; <-- dead codemovrdi,2 ; previous rdi expression can be removed
Let's see the result on VMProtect's junk code:
.vmp0:000000014000414966 D3 D7 rcl di,cl.vmp0:000000014000414C 58poprax.vmp0:000000014000414D 6641 0F A4 DB 01shldr11w,bx,1.vmp0:000000014000415341 5B popr11.vmp0:000000014000415580 E6 CA anddh,0CAh.vmp0:000000014000415866 F7 D7 notdi.vmp0:000000014000415B 5F poprdi.vmp0:000000014000415C 6641 C1 C1 0C rolr9w,0Ch.vmp0:0000000140004161 F9 stc.vmp0:00000001400041624158popr8.vmp0:0000000140004164 F5 cmc.vmp0:0000000140004165 F8 clc.vmp0:00000001400041666641 C1 E1 0Bshlr9w,0Bh.vmp0:000000014000416B 5A poprdx.vmp0:000000014000416C 6681 F9 EB D2 cmpcx,0D2EBh.vmp0:000000014000417148 0F A3 F1 btrcx,rsi.vmp0:00000001400041754159popr9.vmp0:0000000140004177664121 E2 andr10w,sp.vmp0:000000014000417B 41 C1 D2 10 rcl r10d,10h.vmp0:000000014000417F 41 5A popr10.vmp0:000000014000418166 0F BA F9 0C btccx,0Ch.vmp0:000000014000418649 0F CC bswapr12.vmp0:000000014000418948 3D 9774 7D C7 cmprax,0FFFFFFFFC77D7497h.vmp0:000000014000418F 41 5C popr12.vmp0:000000014000419166 D3 C1 rolcx,cl.vmp0:0000000140004194 F5 cmc.vmp0:000000014000419566 0F BA F5 01btrbp,1.vmp0:000000014000419A 6641 D3 FE sarr14w,cl.vmp0:000000014000419E 5D poprbp.vmp0:000000014000419F 664129 F6 subr14w,si.vmp0:00000001400041A3 6609 F6 orsi,si.vmp0:00000001400041A6 01 C6 addesi,eax.vmp0:00000001400041A8 66 0F C1 CE xaddsi,cx.vmp0:00000001400041AC 9D popfq.vmp0:00000001400041AD 0F 9F C1 setnle cl.vmp0:00000001400041B0 0F 9E C1 setlecl.vmp0:00000001400041B3 4C 0F BE F0 movsxr14,al.vmp0:00000001400041B7 59poprcx.vmp0:00000001400041B8 F7 D1 notecx.vmp0:00000001400041BA 59poprcx.vmp0:00000001400041BB 4C 8D A8 ED 1928 C9 lear13,[rax-36D7E613h].vmp0:00000001400041C2 66 F7 D6 notsi.vmp0:00000001400041CB 41 5E popr14.vmp0:00000001400041CD 66 F7 D6 notsi.vmp0:00000001400041D0 6644 0F BE EA movsxr13w,dl.vmp0:00000001400041D5 41 BD B2 6B 48 B7 movr13d,0B7486BB2h.vmp0:00000001400041DB 5E poprsi.vmp0:00000001400041DC 6641 BD CA 44movr13w,44CAh.vmp0:0000000140007AEA 4C 8D AB 31116314lear13,[rbx+14631131h].vmp0:0000000140007AF1 41 0F CD bswapr13d.vmp0:0000000140007AF4 41 5D popr13.vmp0:0000000140007AF6 C3 retn
If we provide the previous code to Triton for a dead store analysis, we get as result:
I would like to ask a question: how can we quickly convert the code segment in a binary file into blocks? In the example I saw, it is necessary to know the length of each instruction when constructing a block. However, for a block of obfuscated code, it is not easy to determine the length of each instruction.
Introduction
We have recently added the concept of basic block (#1121) in Triton and we are now able to disassemble and process a block. How this new feature can improve Triton regarding binary deobfuscation? With the concept of block, we are now able to provide a dead store elimination simplification on a given block. Thus, the method
simplify
can now take aBasicBlock
as input.Example
Let's take as an example a VMProtect sample (thanks to @_xeroxz for giving us such sample). How it works? We will symbolically execute the block and thus create for each instruction their SSA symbolic expressions. With the SSA form, and on a single block, it's then easy to remove expressions that have no more reference. For example:
Let's see the result on VMProtect's junk code:
If we provide the previous code to Triton for a dead store analysis, we get as result:
Full example here.
The text was updated successfully, but these errors were encountered: