in comp science
but I’m having a bit of a problem writing it
I’m reading a book called The Shellcoder's Handbook
and it gives me a code that wont work properly
This is the code:
section .text global _start _start: jmp short GotoCall shellcode: pop rsi xor eax, eax mov byte [esi + 7], al lea ebx, [esi] mov long [esi + 8], ebx mov long [esi + 12], eax mov byte al, 0x0b mov ebx, esi lea ecx, [esi + 8] lea edx, [esi + 12] int 0x80 GotoCall: Call shellcode db '/bin/shJAAAAKKKK'simply put this is supposed to spawn a shell...
but it wont work and when i use gdb to debug it
i get a weird code
this is the gdb output:
gdb ./sclivro
Dump of assembler code for function _start: 0x0000000000400080 <_start+0>: jmp 0x4000a2 <_start+34> 0x0000000000400082 <_start+2>: pop %rsi 0x0000000000400083 <_start+3>: xor %eax,%eax 0x0000000000400085 <_start+5>: addr32 mov %al,0x7(%esi) 0x0000000000400089 <_start+9>: addr32 lea (%esi),%ebx 0x000000000040008c <_start+12>: addr32 mov %ebx,0x8(%esi) 0x0000000000400090 <_start+16>: addr32 mov %eax,0xc(%esi) 0x0000000000400094 <_start+20>: mov $0xb,%al 0x0000000000400096 <_start+22>: mov %esi,%ebx 0x0000000000400098 <_start+24>: addr32 lea 0x8(%esi),%ecx 0x000000000040009c <_start+28>: addr32 lea 0xc(%esi),%edx 0x00000000004000a0 <_start+32>: int $0x80 0x00000000004000a2 <_start+34>: callq 0x400082 <_start+2> ### What is all this???#### 0x00000000004000a7 <_start+39>: (bad) 0x00000000004000a8 <_start+40>: (bad) 0x00000000004000a9 <_start+41>: imul $0x414a6873,0x2f(%rsi),%ebp 0x00000000004000b0 <_start+48>: rex.B 0x00000000004000b1 <_start+49>: rex.B 0x00000000004000b2 <_start+50>: rex.B 0x00000000004000b3 <_start+51>: rex.WXB 0x00000000004000b4 <_start+52>: rex.WXB 0x00000000004000b5 <_start+53>: rex.WXB 0x00000000004000b6 <_start+54>: rex.WXB End of assembler dump.I compile the code using yasm and ld
yasm -f elf64 sclivro.asm
ld -o sclivro sclivro.o
i get a segmentation fault error
My OS is Debian 6.0 x64
I have a Intel Celeron processor
My question is... what is all that code below my comment
0x00000000004000a7 <_start+39>: (bad) 0x00000000004000a8 <_start+40>: (bad) 0x00000000004000a9 <_start+41>: imul $0x414a6873,0x2f(%rsi),%ebp 0x00000000004000b0 <_start+48>: rex.B 0x00000000004000b1 <_start+49>: rex.B 0x00000000004000b2 <_start+50>: rex.B 0x00000000004000b3 <_start+51>: rex.WXB 0x00000000004000b4 <_start+52>: rex.WXB 0x00000000004000b5 <_start+53>: rex.WXB 0x00000000004000b6 <_start+54>: rex.WXBwhy is that code there??
and what am i doing wrong?
thanks for your time.


Sign In
Create Account

Back to top









