任务 5:攻击 64 位服务器程序
章节大纲
-
注意:对于 Apple Silicon 机器,任务 1-4 已经使用了 64 位服务器程序,所以这个任务与任务 4 相同,不需要重复。但是,你可以在这个部分找到有关 64 位机器的有用信息。
在前面的任务中,我们的目标服务器是 32 位程序。在这个任务中,我们攻击一个 64 位服务器程序。我们的新目标是 10.9.0.6,它运行 format 程序的 64 位版本。让我们先给这个服务器发送一个 hello 消息。我们将看到目标容器打印出的以下消息。$ echo hello | nc 10.9.0.6 9090 Press Ctrl+C // 容器控制台上的打印输出 server-10.9.0.6 | Got a connection from 10.9.0.1 server-10.9.0.6 | Starting format server-10.9.0.6 | Input buffer (address): 0x00007fffffffe200 server-10.9.0.6 | The secret message's address: 0x0000555555556008 server-10.9.0.6 | The target variable's address: 0x0000555555558010 server-10.9.0.6 | Input size: 6 server-10.9.0.6 | Frame Pointer (inside myprintf): 0x00007fffffffe140 server-10.9.0.6 | The target variable's value (before): 0x1122334455667788 server-10.9.0.6 | hello server-10.9.0.6 | (^_^)(^_^) Returned from printf() (^_^)(^_^) server-10.9.0.6 | The target variable's value (after): 0x1122334455667788
你可以看到框架指针和缓冲区的地址的值变为 8 字节长(而不是 32 位程序中的 4 字节)。你的工作是构建你的有效载荷来利用服务器的格式化字符串漏洞。你的最终目标是获得目标服务器上的root shell。你需要使用 64 位版本的 shellcode。