HTB-UnderPass

该靶机nmap扫描udp发现161端口snmp服务,利用snmpwalk扫描得到目录信息,使用dirsearch扫描得到一个yml文件,存放数据库账号密码,记录下来,此时需要登录口,使用字典扫描拼接/app目录,得到登录界面,利用版本号搜索默认凭证,找到一个用户,MD5解密hex值,ssh登录,sudo -l 发现mosh,查找利用方式,设置环境变量,然后执行登录

一台现役靶机

image-20250329191431511

一、信息收集

靶机ip:10.10.11.48

攻击机ip:10.10.16.26

nmap扫描,发现服务是Apache/2.4.52 (Ubuntu)

image-20250329192303877

先设置域名解析

echo "10.10.11.48 underpass.htb" |sudo tee -a /etc/hosts

image-20250329192411531

执行UDP扫描

nmap -sU -sV -Pn 10.10.11.48

得到的信息如下,开着snmp服务

PORT     STATE         SERVICE
161/udp  open          snmp
1812/udp open|filtered radius
1813/udp open|filtered radacct

目录扫描

没有泄露目录

image-20250329192720972

子域名扫描

利用ffuf扫描均未发现可用信息

ffuf -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt:FUZZ -u "http://underpass.htb/FUZZ" -ic
ffuf -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt:FFUZ -H "Host: FFUZ.underpass.htb" -u http://underpass.htb -fw 20

没有可用信息

image-20250329195206233

二、边界突破

访问80端口,是一个apache2的配置信息,ubuntu系统

这里查看源码以及指纹信息均未发现泄露的信息,只能重新扫描靶机了

使用snmpwalk执行扫描,关键信息:daloradius

image-20250329223355753

猜测其是目录,拼接进行扫描

image-20250329223906985

目录如下

/daloradius/.gitignore    
/daloradius/app 
/daloradius/ChangeLog                             
/daloradius/doc  ->  http://10.10.11.48/daloradius/doc/
/daloradius/Dockerfile                            
/daloradius/docker-compose.yml                    
/daloradius/library  ->  http://10.10.11.48/daloradius/library/
/daloradius/LICENSE                               
/daloradius/README.md                             
/daloradius/setup  ->  http://10.10.11.48/daloradius/setup/

访问第一个目录,发现一个配置文件,但是无法访问

image-20250329224048765

docker-compose.yml 文件里发现数据库的账户密码

image-20250329224308540

如下,这个时候应该找找有没有登录点,这几个目录均没有,重新扫描/app目录

database:radius
user:radius
passswd:radiusdbpw

扫出来一个登录界面

daloradius/app/users/login.php

image-20250329225134829

一个登录界面,使用上面的账户密码不成功

image-20250329225442482

换一个字典重新扫描,得到一个新目录

dirsearch -u http://10.10.11.48/daloradius/app/ -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -e*
http://10.10.11.48/daloradius/app/operators/login.php

一个登录界面,先尝试上面的账户密码不成功,发现下面有版本号

image-20250329225733944

发现默认用户名administrator和密码radius

image-20250329230041283

成功登录

image-20250329230127615

在config里有个语言可以修改,先换成中文

image-20250329230242616

发现一个用户名和密码

image-20250329230327835

如下

用户名:svcMosh
密码:412DD4759978ACFCC81DEAB01B382403

在该网站识别,拿到密码:underwaterfriends

image-20250330110849114

ssh连接

image-20250330111144509

三、权限提升

user.txt

该目录下存放user.txt,成功查看

image-20250330111306606

root.txt

sudo -l查看,发现一处可执行路径

/usr/bin/mosh-server

image-20250330111429962

执行一下看看,看不懂

image-20250330111614289

查看suid

image-20250330111655341

查找上面发现的可执行路径,参考文章

https://www.cnblogs.com/sunweiye/p/12003616.html

方法如下

image-20250330113200963

重新查看

找到上面的密钥:NnSZo0rz1vdi7bRzX4Hn4g

export MOSH_KEY=NnSZo0rz1vdi7bRzX4Hn4g
mosh-client 127.0.0.1 60001 #这里应该连接的是靶机ip,因为是在靶机里执行,直接连接其本地ip

成功登录,拿到root.txt

image-20250330113548289

结束

image-20250330113655339

四、总结

snmpwalk扫描:

dirsearch字典扫描:

mosh登录:

posted @ 2025-04-09 22:32  H轨迹H  阅读(68)  评论(0)    收藏  举报