I am trying to write a shell insertion decoder (my encoder works as expected). But when I try to move one byte to the address inside a register i face a Segmentation fault.
The error happens in this line:
mov BYTE PTR [rdi],bl
Here is my assembly code:
global _start section .text _start: jmp call_decoder rri_shellcode: db 0x48,0x48,0x5b,0x48,0x90,0x5b init_decoder: lea rsi, [rel rri_shellcode] mov rdi, rsi inc rdi xor rax, rax add rax, 1 xor rbx, rbx loop_decoder: mov bl, byte [rsi + rax + 1] mov byte [rdi], bl inc rdi inc rax loop loop_decoder call_decoder: call init_decoder
What happens that i cant move the byte within bl into the address stored within rdi?
PS.: I know the loop wont work since I didn't set rcx yet.
Thanks in advance,