Testing shellcode->Skeleton Code
Last updated
Was this helpful?
Last updated
Was this helpful?
In previous articles, I mentioned testing shellcode in a skeleton C code. Here is an example of "exit" shellcode in the C skeleton.
When I compile this and run, this happens:
This is always bound to happen using modern systems. I tried identifying the problem and here is a guess. The shellcode lands in the .data section in the assembly after the assembler works. This .data segment is essentially non-executable.
So, to test the shellcode properly using a skeleton, we have to resort to keeping the code in a memory section that is executable. After som suggestions, using mmap() to allocate a page of memory which is executable makes sense. So the skeleton code is:
In GDB, we can inspect and confirm this functionality. AS we seee, the code exited normally