JonathanSalwan / Triton

Triton is a dynamic binary analysis library. Build your own program analysis tools, automate your reverse engineering, perform software verification or just emulate code.
https://triton-library.github.io
Apache License 2.0
3.39k stars 524 forks source link

Why is this POC yielding these results? #1301

Open imliuxin opened 6 months ago

imliuxin commented 6 months ago

What should I do? poc.zip

JonathanSalwan commented 6 months ago

You should probably first post your snippet of code and a short description of the issue in this thread.

imliuxin commented 6 months ago

the code of before simple:

or eax,FFFFFFFF
xor edx,edx
div dword ptr ss:[ebp+14]
mov esi,dword ptr ds:[ecx+C8]
mov dword ptr ss:[ebp-8],edx
movzx ecx,bl
movzx ecx,word ptr ds:[esi+ecx*2] mov edx,ecx

the code of after simple:

or eax,FFFFFFFF
xor edx,edx
div dword ptr ss:[ebp+14]

the content of poc file:

from triton import *

if name == 'main':

Set the architecture

ctx = TritonContext(ARCH.X86)
# Set a symbolic optimization mode
ctx.setMode(MODE.ALIGNED_MEMORY, True)

block = BasicBlock([Instruction(b"\x83\xc8\xff"),
    Instruction(b"\x33\xd2"),
    Instruction(b"\xf7\x75\x14"),
    Instruction(b"\x8b\xb1\xc8\x00\x00\x00"),
    Instruction(b"\x89\x55\xf8"),
    Instruction(b"\x0f\xb6\xcb"),
    Instruction(b"\x0f\xb7\x0c\x4e"),
    Instruction(b"\x8b\xd1")
    ])

ctx.disassembly(block, 0x40149f)
print(block)
print('-------------')
sblock = ctx.simplify(block)
ctx.disassembly(sblock, 0x40149f)
print(sblock)