Skip to content
Advertisement

hex code implementation for spawning a shell

I am trying to implement the codes given in smashing the stack for fun and profit by Aleph to learn the basics of buffer overflow attacks.

Machine architecture: Ubuntu 12.10 64 bit

programs compiled using -m32 flag in gcc

So far, I have managed to spawn a shell using the assembly instructions. The next step is to convert those instructions into hexadecimal code, where I have encountered this problem. The assembly code for spawning the shell:

JavaScript

Corresponding hex code is:

JavaScript

A bit of analysis using GDB Debugger led me to these results:

JavaScript

After applying breakpoints, I think the problem lies somewhere in the hex code, which I have not been able to figure out. Also, I don’t seem to understand the context of Illegal instruction here.

Any help would be appreciated.

Advertisement

Answer

You made a couple of mistakes in your shellcode.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement