VulnHub:Quaoar Local Victim Quaoar IP: 192.168.31.54
Get a shell
Get root access
There is a post exploitation flag on the box
偵查
VM 開起來以後唯一的資訊就是一個 IP,第一件事就先拿去 Nmap 看一看開啟了哪些對外的服務。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
root@kali:~# nmap -sS 192.168.31.54
Starting Nmap 7.60 ( https://nmap.org ) at 2017-09-13 06:37 UTC Nmap scan report for 192.168.31.54 Host is up (0.011s latency). Not shown: 991 closed ports PORT STATE SERVICE 22/tcp open ssh 53/tcp open domain 80/tcp open http 110/tcp open pop3 139/tcp open netbios-ssn 143/tcp open imap 445/tcp open microsoft-ds 993/tcp open imaps 995/tcp open pop3s
Nmap done: 1 IP address (1 host up) scanned in 2.18 seconds
太棒了,80 port 有開一個 http 的服務,web 可能會是很好的一個攻擊入口。不過用瀏覽器一看只有兩張圖片而已。只好進入例行步驟看看有哪些路徑,我自己習慣先看看有沒有robots.txt,在這裡還真的藏了 Wordpress 在裡面。
WordPress Security Scanner by the WPScan Team Version 2.9.3 Sponsored by Sucuri - https://sucuri.net @_WPScan_, @ethicalhack3r, @erwan_lr, pvdl, @_FireFart_ _______________________________________________________________
[!] The WordPress 'http://192.168.31.54/wordpress/readme.html' file exists exposing a version number [+] Interesting header: SERVER: Apache/2.2.22 (Ubuntu) [+] Interesting header: X-POWERED-BY: PHP/5.3.10-1ubuntu3 [+] XML-RPC Interface available under: http://192.168.31.54/wordpress/xmlrpc.php [!] Upload directory has directory listing enabled: http://192.168.31.54/wordpress/wp-content/uploads/ [!] Includes directory has directory listing enabled: http://192.168.31.54/wordpress/wp-includes/
[+] WordPress version 3.9.14 (Released on 2016-09-07) identified from advanced fingerprinting, meta generator, readme, links opml, stylesheets numbers [!] 15 vulnerabilities identified from the version number ...
System information as of Wed Sep 13 04:10:59 EDT 2017
System load: 0.16 Processes: 97 Usage of /: 29.9% of 7.21GB Users logged in: 0 Memory usage: 39% IP address for eth0: 192.168.31.54 Swap usage: 10% IP address for virbr0: 192.168.122.1
Graph this data and manage this system at https://landscape.canonical.com/
New release '14.04.5 LTS' available. Run 'do-release-upgrade' to upgrade to it.
Last login: Wed Sep 13 04:09:53 2017 from 192.168.31.193 root@Quaoar:~# cat flag.txt 8e3f9ec016e3598c5eec11fd3d73f6fb
Final flag
最後一個 flag 我一直沒有頭緒藏在哪裡,看來官方給的一些 Walkthrough 才知道,原來這要考的是進入伺服器之後要檢查 crontab 的習慣,很多時候滲透進伺服器後會利用 crontab 來反彈 shell。而檢查也不單純只是下個$ crontab -l的方法,這個會有瑕疵,只會列出目前使用者 (root) 的 crontab,最保險的做法還是得自己到/etc/cron.d底下看看全部的 crontab。的確有一個/etc/cron.d/php5的檔案,最後一個 flag 就在這裡面。
1 2 3 4 5 6 7 8
root@Quaoar:/etc/cron.d# cat php5 # /etc/cron.d/php5: crontab fragment for php5 # This purges session files older than X, where X is defined in seconds # as the largest value of session.gc_maxlifetime from all your php.ini # files, or 24 minutes if not defined. See /usr/lib/php5/maxlifetime # Its always a good idea to check for crontab to learn more about the operating system good job you get 50! - d46795f84148fd338603d0d6a9dbf8de # Look for and purge old sessions every 30 minutes 09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete
結語
第一次玩這種 vulnerable vm 的 CTF,有別於單純的線上 CTF 解題,更需要全面的思考和執行,我覺得更能夠練習到完整地滲透測試,從偵查、滲透到提權,一步一步的掌握整個伺服器。以後該多多練習這方面的挑戰。