fix: jump value hotfix, double injection OK
This commit is contained in:
parent
ee6e39f716
commit
621a1ec641
|
@ -0,0 +1 @@
|
|||
nasm -f elf64 -o print.o print.s && ld -o print print.o && nasm -f bin -o payload print.s && hexdump -v -e '"\\\x\" 1/1 "%02x"' payload
|
4
print.s
4
print.s
|
@ -14,7 +14,7 @@ _start:
|
|||
mov rdi, 1
|
||||
mov rdi, 1
|
||||
lea rsi, [rel msg]
|
||||
mov rdx, 10
|
||||
mov rdx, 14
|
||||
mov rax, 1
|
||||
syscall
|
||||
|
||||
|
@ -24,4 +24,4 @@ _start:
|
|||
pop rax
|
||||
jmp 0x00000000
|
||||
|
||||
msg db "..WOODY..",10
|
||||
msg db "....WOODY....",10
|
||||
|
|
|
@ -100,6 +100,7 @@ int insert_payload(t_elf_content *woody, t_payload *payload, size_t payload_posi
|
|||
{
|
||||
int32_t jmp_index = ptr - payload->payload;
|
||||
int32_t jump_value = ((payload_position + payload->len) - woody->Ehdr->e_entry) * -1;
|
||||
jump_value += 14;
|
||||
|
||||
ft_memcpy(&payload->payload[jmp_index + 1], &jump_value, sizeof(jump_value));
|
||||
ft_memcpy(woody->file + payload_position, payload->payload, payload->len);
|
||||
|
|
Loading…
Reference in New Issue