
Originally Posted by
aurik
Very simple to look for a function that doesn't change. When you compile a function it will turn into a series of bits. Identify which bits in that function are generally the same from compile to compile (hint: stuff like opcodes, constants, etc) and just do a memory compare. For example, a certain function might have the characteristic of having the first 32 bits, then skip 5 bits, then the next 27 bits, then skip 50 bits, then the next 16 bits always match the exact same thing. This characteristic is the "signature" of the function. If you know that the pointer to the correct memloc is the value at (for example) 16(SP), all you need to do is intercept the memory at 16(SP) during the function and you're golden.
By "function signature" I assumed you meant the unique identification of a function based on its name, return type, and argument list. But yea, you could look for "patterns" in the sequence of code bytes that either exactly match or are vaguely similar to some known "snapshot" that you've taken. Just that you you will quickly start getting into the realm of what is and isn't deterministic, and the x86 instruction set is ridiculously complicated, you would basically have to write your own entire disassembler for it to be feasible. The complexity of this algorithm to find the dynamic memlocs would explode with each very minor attempt by SE to thwart the hackers.
If you're really feeling fancy you could even cleverly detect nops and skip over them. Like regexes, except you're doing it on binary data.
This would be impossible without implementing your own disassembler, because x86 opcodes don't have a fixed length like they do on many other architectures. So the "nop" opcode can actually appear in the middle of another opcode, and the only way to detect a true "nop" would be to diassemble everything to make sure you know the opcode boundaries.
[quote:7bd44]
but that would require real effort on SE's part