NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: melviii100 on June 30, 2014, 09:14:28 AM
-
i am studying shellcode writing. So to spawn a shell i wrote the following program
segment .text
global _start:
_start:
jmp short GotoCall
shellcode:
pop esi
xor eax, eax
mov byte [esi + 7], al #here i get Error
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 80h
GotoCall:
call shellcode
Db '/bin/shJAAAABBBB'
Compiled -> nasm -ggdb -f elf Shellcode_Execve.asm
Linked -> ld -m elf_i386 -ggdb -o Shellcode_Execve Shellcode_Execve.o
When i ran it in GDB, i found in below instruction i get error,
mov byte [esi + 7], al
Can't we write into that memory?
What is the problem in my code?
-
i am studying shellcode writing.
Bummer.
Can't we write into that memory?
No. ".text" is readonly.
Sincerely,
Frank
-
No. ".text" is readonly.
but i have seen many example where they do the same code!
If .text is read only, then how can i overcome that problem to make a shellcode like above?
And Can you please explain how "esi+7" comes in .text sections memory? i don't understand that concept.
-
No. ".text" is readonly.
Sincerely,
Frank
when i did google i could see it is because "Data Execution Prevention". So how can i disable DEP in ubuntu 14.04
-
Firetruckin' script-kiddies! "section kode write exec" might help you. Unless you can tell me a legitimate reason to write code like this, take it to Stack Overflow.
Sincerely,
Frank