Skip to main content

DX1: Liberty Island

端口扫描

root@ip-10-10-143-156:~# nmap -sTCV -p- --min-rate 1000 10.10.115.247

Starting Nmap 7.60 ( https://nmap.org ) at 2023-10-08 11:22 BST
Nmap scan report for ip-10-10-115-247.eu-west-1.compute.internal (10.10.115.247)
Host is up (0.0043s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
| http-robots.txt: 2 disallowed entries
|_/datacubes *
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: United Nations Anti-Terrorist Coalition
5901/tcp open vnc VNC (protocol 3.8)
| vnc-info:
| Protocol version: 3.8
| Security types:
| VeNCrypt (19)
| VNC Authentication (2)
| VeNCrypt auth subtypes:
| Unknown security type (2)
|_ VNC auth, Anonymous TLS (258)
23023/tcp open unknown
| fingerprint-strings:
| FourOhFourRequest:
| HTTP/1.0 200 OK
| Access-Control-Allow-Origin: *
| Content-Type: text/plain
| Date: Sun, 08 Oct 2023 10:23:02 GMT
| Content-Length: 90
| UNATCO Liberty Island - Command/Control
| RESTRICTED: ANGEL/OA
| send a directive to process
| GenericLines, Help, Kerberos, LPDString, RTSPRequest, SSLSessionReq, TLSSessionReq:
| HTTP/1.1 400 Bad Request
| Content-Type: text/plain; charset=utf-8
| Connection: close
| Request
| GetRequest, HTTPOptions:
| HTTP/1.0 200 OK
| Access-Control-Allow-Origin: *
| Content-Type: text/plain
| Date: Sun, 08 Oct 2023 10:22:37 GMT
| Content-Length: 90
| UNATCO Liberty Island - Command/Control
| RESTRICTED: ANGEL/OA
|_ send a directive to process

80

root@ip-10-10-143-156:~# gobuster dir -u http://10.10.115.247/ -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,txt,html
===============================================================
Gobuster v3.0.1
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@_FireFart_)
===============================================================
[+] Url: http://10.10.115.247/
[+] Threads: 10
[+] Wordlist: /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt
[+] Status codes: 200,204,301,302,307,401,403
[+] User Agent: gobuster/3.0.1
[+] Extensions: php,txt,html
[+] Timeout: 10s
===============================================================
2023/10/08 11:43:02 Starting gobuster
===============================================================
/index.html (Status: 200)
/terrorism.html (Status: 200)
/robots.txt (Status: 200)
/threats.html (Status: 200)
/server-status (Status: 403)
===============================================================
2023/10/08 11:44:56 Finished
===============================================================

http://10.10.234.178/badactors.html 页面我们可以看到有一个黑名单里面都是用户名, 先攒着万一后门有爆破呢

访问 /robots.txt 可以发现一个禁止爬取的目录

image-20240709192447940

访问这个新发现的目录, 发现

  • 跳转到 0000 我们可能需要进行枚举
  • 从给出的文章内容可以看出密码已经全部被修改了

image-20240709192454300

接着我开始了枚举之路

root@ip-10-10-143-156:~/dx1libertyislandplde# ffuf -w ./dir.txt -u http://10.10.115.247/datacubes/FUZZ
.....
0011 [Status: 301, Size: 323, Words: 20, Lines: 10]
0068 [Status: 301, Size: 323, Words: 20, Lines: 10]
0103 [Status: 301, Size: 323, Words: 20, Lines: 10]
0000 [Status: 301, Size: 323, Words: 20, Lines: 10]
0233 [Status: 301, Size: 323, Words: 20, Lines: 10]
0451 [Status: 301, Size: 323, Words: 20, Lines: 10]

当访问 0451 时, 其输出和其他明显不同

  • 告诉我们这里有一个 VNC 连接
  • 对于登陆密码则是 : smashthestate 使用 username 作为 key 、 MD5 加密的HMAC前 8 位
    • 对于 username 而言是我们之前的黑名单用户同时从 JL 来看应该是 "jallred","jlebedev", "jooleeah” 三个用户

image-20240709192501672

利用这三个用户的进行一波 HMAC 操作, 最终发现其中一个为对应的密码

image-20240709192508362

后渗透

ajacobson (VNC)

使用得到的密码进行连接我们的 VNC 服务端 (如果显示拒绝, 就重启靶机吧)

image-20240709192522961

ajacobson —> root

tip

💡 整个靶机最离谱的来了

在用户的家目录存在一个 badactors-list

C:\home\ajacobson\Desktop> ls -al
total 6792
drwxr-xr-x 2 ajacobson ajacobson 4096 Oct 22 2022 .
drwxr-xr-x 20 ajacobson ajacobson 4096 Oct 8 13:40 ..
-rwxr-xr-x 1 ajacobson ajacobson 6941856 Oct 22 2022 badactors-list
-rw-r--r-- 1 ajacobson ajacobson 643 Oct 22 2022 user.txt

如果你点开此程序, 你会发现他会连接 23023 网页, 而这个网页你如果访问其显示的内容为 要求我们输入一个指令什么的

image-20240709192556741

同时你会发现这个网页提供的内容就是我们之前的黑名单, 根据其功能推断, 我们可以借此来完成更新的操作

image-20240709192604003

接着查看对应的网站黑名单文件你会发现他是 root 用户所有的

image-20240709192611589

同时你会发现你使用应用程序更新的内容在这个文件中会同步, 所以这个应用程序应该是存在某种权限提升的操作, 此时你使用strings 查看程序你会发现存在一段命令

image-20240709192618014

我们可以将其进行替换, 但是一个前提就是大小得一样, 直接使用 vim 进行替换

image-20240709192624363

image-20240709192629900

再次运行程序并进行更新, 你就会发现我们得 payload 进行了执行

image-20240709192635967

扩展

后台任务

在我执行 badactors-list 程序时, 我监控后台进程发现当点击更新时, 会执行一些命令也就是上面的 base 命令

image-20240709192646628

我现在监控的网络流量并进行查看, 从流量中我们可以发现其向 23023 端口发送一条命令, 所以我们可以借此来创建请求实现攻击

image-20240709192658020

我们可以查看指定端口运行的进程可以发现其是 root 用户

image-20240709192705123