From Issue #104December 2002
Nice article...but I did not completely understand the code injection part.
The example you have explained inserts the code for printing "hello world" into a running process.
1. I did not exactly understand why you did the jump forward and backward steps.
Can you please elaborate on that?
2. I wrote a normal C program to print hello world:
I generated the byte code for this program using gdb. I replaced the contents of
char insertcode array with this new bytecode and ran the program.
As you might have guessed, it didn't work . What is the difference between your and my implementation?
I carried out this experiment so as to be able to inject code without having to learn assembly language programming. How do I inject the code of normal C program, without having to use assembly coding?
I coded it into:
"movl $4, %eax\n"
"movl $2, %ebx\n"
"movl %esi, %ecx\n"
"movl $12, %edx\n"
".string \"Hello World\\n\"\n"
the instruction set you are using is specific to intel's architecture, amd's architecture may differ and these instruction set will not run on amd. check out amd's manual for its instruction set
he did say all sample code is for x86 only
Practical (and free!) books for the most technical people on the planet. Newly available books include:
Plus many more.