进入 shellcode 文件夹。

Task. Please modify the shellcode, so you can use it to delete a file. Please include your modified the
shellcode in the lab report, as well as your screenshots.

根据 Task 的要求,我们对 shellcode_32.py 进行修改,使其能够删除文件。

需要注意的是,shell长度不能变。

然后我们新建 tmpfile 文件并运行 shellcode,过程和结果如下

$ touch tmpfile
$ ./shellcode_32.py
$ ./shellcode_64.py
$ make
$ a32.out
$ a64.out

执行完后,tmpfile 也被删除了。

Task 2: Level-1 Attack

首先关闭 address randomization countermeasure

$ sudo sysctl -w kernel.randomize_va_space=0

进入 server-code 文件夹下,执行命令

$ make
$ make install

然后返回其根目录,执行命令启动 docker

$ dcbuild
$ dcup

进入 attack-code 文件夹,执行

$ echo hello | nc 10.9.0.5 9090

server 显示

我们修改 exploit.py