Just an idea I had: for executable protection, rather than taking the approach of using virtualization, what about a route of obfuscation which won't result in a loss of performance?
For example, when speaking in terms of ASM, zeroing a register is almost always done using the XOR operation (XOR [register], [register]). There's many other ways that can be completed in a reasonable number of clock cycles:
Or division/multiplication:Code:SUB REGISTER, REGISTER
MOV REGISTER, 0
LEA REGISTER, [0]
PUSH 0
POP REGISTER
SHL REGISTER, 0x1F
SHL REGISTER, 0x1F
AND REGISTER, 0
IMUL REGISTER, 0
(For odd numbers, in the above example, you would have to make use of addition/subtraction).Code:[IMUL X]
ROL [register], x/2
[IDIV X]
ROR [register], x/2
My idea is to write a permutation engine which would change all instructions in an application, to make reading much more complicated, but runtime nearly identical. At this note, tools such as Hex-Ray's pseudo-code generator (Also known as one of the only reliable "C decompilers") aren't accustomed to analyzing such warped output.
On that note, I've been making a list of permutations for a permutation-engine I intend to begin writing. Some more that are notable:
Code:
XCHG:
XOR [register1], [register2]
XOR [register2], [register1]
XOR [register1], [register2]
ADD:
LEA REGISTER, [x+y]
SUB:
LEA REGISTER, [x-y]
MOV:
PUSH [register1]
{xchg} [register1], [[stackpointer]]
{mov} [[stackpointer]], [ptr]
POP [register2]
{mov} [[stackpointer]], [register1]
POP [register1]
PUSH [value]
POP [register]
CC?

