I am trying to attach debug a program that has an "anti-debug" feature on it. When stepping through, it seems to step through a maze of call and jmp commands that eventually just loop around. The loop only happens when stepping line by line and I am trying to understand it.
I don't know if there is added obfuscation, but why would lines such as this appear?
014D658C 0FCA BSWAP EDX
014D658E 0FCA BSWAP EDX
If I understand correctly, BSWAP will just invert the bits, but twice in a row should leave the EDX register untouched. I've also noticed other strange things like comparing registers and then seemingly doing nothing with the result (no jump calls after or setcc or anything like that)
014D657C 66:81FF 8408 CMP DI,884
014D6581 30D8 XOR AL,BL
014D6583 8D96 1A30A4DD LEA EDX,DWORD PTR DS:[ESI+DDA4301A]
BSWAP
s don't do anything (watch out for code jumping to the secondBSWAP
however, and theCMP DI,884
doesn't do anything either (as the the next instruction resets the flags). This may be an attempt to evade antivirus signatures as well, by introducing nonsense into the code that can be modified to different nosense easily. – Guntram Blohm Jul 30 '15 at 20:01