r/AskReverseEngineering • u/homeless_psychopath • Oct 15 '23
How do you deal with self-modifying code in IDA?
What techniques exist to deal with this thing in ida or x64dbg?
2
Upvotes
r/AskReverseEngineering • u/homeless_psychopath • Oct 15 '23
What techniques exist to deal with this thing in ida or x64dbg?
4
u/d_stroid Oct 15 '23
Debug, create memdumps at certain points and analyze code of memdumps to understand what exactly is going on. Can get annoying if the code is paired with anti vm and anti devig techniques
1
u/anaccountbyanyname Oct 16 '23
x64dbg is a linear disassembler. When you get to a modified instruction it'll just already be what it's supposed to be. If you're debugging I'm IDA it fixes on the static disassembly. There's a way to force it to update that I don't remember offhand (you can undefine and reanalyze it but I think there's a cleaner way)
Just make sure you're not setting int3 breakpoints in the middle of it, or at best they'll disappear and at worst they'll get decrypted and trash that section.
Sometimes VirtualProtect will be used, but sometimes the segment is just declared rwx to begin with. If you really want the full picture you need to write a Pin tools or something to do an execution trace and match up writes with executed addresses