[Pwnable.tw] orw

https://pwnable.tw/challenge/#2

这道题涉及到了seccomp。

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

意思就是我们不能使用特殊的系统调用getshell,但是可以用open、read、write三个系统调用去读flag。

只需要在shellcode中加入三个系统调用即可。

open_shellcode:

/home/orw/flag 转换为 16 进制为 2f686f6d652f6f72772f666c6167

记得补零。(不补其实也没问题)

read_shellcode:

write_shellcode:

要学习如何用汇编编写系统调用,下面有个教程。

https://www.tutorialspoint.com/assembly_programming/assembly_system_calls.htm

Leave a Comment