登录账户密码字典暴力破解攻击——hydra 工具详细使用教程

2024-06-03 360 0

0x00 简介

暴力破解攻击是一种通过自动化手段尝试猜测密码或密钥的方法,常见于密码破解领域。密码通常以加密形式存储于数据库中。暴力破解可以通过在线方式针对 HTTP、HTTPS、SSH、FTP 等多种服务进行,也可以采用离线方式,尤其是在获取到加密密码文件后,通过离线匹配以寻找对应密码。

尽管暴力破解方法可能显得原始,并对服务器造成较大负担,但目前许多验证码等防破解措施并不能完全阻止其发挥作用。破解目标不仅限于登录系统,还可以针对 FTP、HTTP 认证、SSH 等服务进行。当前,有多种工具可供选择以执行暴力破解,如 Ncrack、Wfuzz、Medusa、Patator 以及 Hydra 等。

在本文中,我们将重点介绍 Hydra 工具的使用,因其普遍性和可靠性而广受欢迎。内容包括:

  • 基本 HTTP 身份验证的暴力破解

  • 默认密码的暴力破解

  • 登录表单的暴力破解

  • 创建个性化的用户名和密码单词列表

  • 针对 FTP 和 SSH 等服务登录的暴力破解

0x01 密码爆破攻击概述

在面对 HTTP 授权认证时,若无有效凭据且没有其他端口或服务信息,暴力破解成为可行的选择。密码攻击有多种类型,包括字典攻击、野蛮爆破、网络拦截、中间人攻击、密钥日志记录和社会工程等。我们将重点关注野蛮爆破和字典攻击,这两种方法都通过尝试不同组合来寻找正确的密码。

我们将主要关注 蛮力爆破​ 和 字典攻击​ 。这两种攻击都会通过 蛮力爆破​ 服务找到密码。

1.蛮力爆破

野蛮爆破不依赖于常用密码列表,而是尝试所有可能的字符组合。例如,对于长度为 4 的密码,将测试从 aaaa 到 zzzz 的所有组合,即使仅使用小写英文字符,也有 456,976 种可能性。随着密码长度的增加,组合数急剧上升,使得野蛮爆破在实际操作中并不理想,尤其是在线爆破可能对服务器造成损害。

所以我们应该考虑可能增加我们猜测正确密码的几率的方法,例如 字典爆破​ .

2.字典爆破

字典爆破则利用已知的密码列表来猜测密码。如果有理由相信目标密码使用了合理的字符组合,此方法将非常有效。幸运的是,有大量密码列表可供使用,例如 SecLists存储库中就包含了多种类型的攻击所用的单词列表。

0x02 Hydra 暴力破解

​Hydra​ 是登录暴力破解的便捷工具,因为它涵盖了各种各样的攻击和服务,并且与其他攻击和服务相比相对较快。它可以测试任何一对凭据并验证它们是否成功,但数量巨大且速度非常快。

如果我们想在自己的机器上使用它,我们可以使用 “ apt install hydra -y​ ” 或下载它并从其 Github 存储库使用它

我们可以看一下提供的选项, hydra 并查看其标志和如何使用它的示例:

[!bash!]$ hydra -h

Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Syntax: hydra [[[-l LOGIN|-L FILE] [-p PASS|-P FILE]] | [-C FILE]] [-e nsr] [-o FILE] [-t TASKS] [-M FILE [-T TASKS]] [-w TIME] [-W TIME] [-f] [-s PORT] [-x MIN:MAX:CHARSET] [-c TIME] [-ISOuvVd46] [-m MODULE_OPT] [service://server[:PORT][/OPT]]

Options:
  -R        restore a previous aborted/crashed session
  -I        ignore an existing restore file (don't wait 10 seconds)
  -S        perform an SSL connect
  -s PORT   if the service is on a different default port, define it here
  -l LOGIN or -L FILE  login with LOGIN name, or load several logins from FILE
  -p PASS  or -P FILE  try password PASS, or load several passwords from FILE
  -x MIN:MAX:CHARSET  password bruteforce generation, type "-x -h" to get help
  -y        disable use of symbols in bruteforce, see above
  -r        use a non-random shuffling method for option -x
  -e nsr    try "n" null password, "s" login as pass and/or "r" reversed login
  -u        loop around users, not passwords (effective! implied with -x)
  -C FILE   colon separated "login:pass" format, instead of -L/-P options
  -M FILE   list of servers to attack, one entry per line, ':' to specify port
  -o FILE   write found login/password pairs to FILE instead of stdout
  -b FORMAT specify the format for the -o FILE: text(default), json, jsonv1
  -f / -F   exit when a login/pass pair is found (-M: -f per host, -F global)
  -t TASKS  run TASKS number of connects in parallel per target (default: 16)
  -T TASKS  run TASKS connects in parallel overall (for -M, default: 64)
  -w / -W TIME  wait time for a response (32) / between connects per thread (0)
  -c TIME   wait time per login attempt over all threads (enforces -t 1)
  -4 / -6   use IPv4 (default) / IPv6 addresses (put always in [] also in -M)
  -v / -V / -d  verbose mode / show login+pass for each attempt / debug mode 
  -O        use old SSL v2 and v3
  -K        do not redo failed attempts (good for -M mass scanning)
  -q        do not print messages about connection errors
  -U        service module usage details
  -m OPT    options specific for a module, see -U output for information
  -h        more command line options (COMPLETE HELP)
  server    the target: DNS, IP or 192.168.0.0/24 (this OR the -M option)
  service   the service to crack (see below for supported protocols)
  OPT       some service modules support additional input (-U for module help)

Supported services: adam6500 asterisk cisco cisco-enable cobaltstrike 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 is a tool to guess/crack valid login/password pairs.
Licensed under AGPL v3.0. The newest version is always available at;
https://github.com/vanhauser-thc/thc-hydra
Please don't use in military or secret service organizations, or for illegal
purposes. (This is a wish and non-binding - most such people do not care about
laws and ethics anyway - and tell themselves they are one of the good ones.)
These services were not compiled in: afp ncp oracle sapr3 smb2.

Use HYDRA_PROXY_HTTP or HYDRA_PROXY environment variables for a proxy setup.
E.g. % export HYDRA_PROXY=socks5://l:[email protected]:9150 (or: socks4:// connect://)
     % export HYDRA_PROXY=connect_and_socks_proxylist.txt  (up to 64 entries)
     % export HYDRA_PROXY_HTTP=http://login:pass@proxy:8080
     % export HYDRA_PROXY_HTTP=proxylist.txt  (up to 64 entries)

Examples:
  hydra -l user -P passlist.txt ftp://192.168.0.1
  hydra -L userlist.txt -p defaultpw imap://192.168.0.1/
  hydra

4A评测 - 免责申明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。

不得将上述内容用于商业或者非法用途,否则一切后果请用户自负。

本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。

如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。敬请谅解!

程序来源网络,不确保不包含木马病毒等危险内容,请在确保安全的情况下或使用虚拟机使用。

侵权违规投诉邮箱:4ablog168#gmail.com(#换成@)

相关文章

电力企业 | 安全建设框架
HTB-Infiltrator:一文带你走进域渗透
JAVA安全 | Classloader:理解与利用一篇就够了
多角度揭秘威胁行为组织CryptoCore复杂的加密货币欺诈活动
网络空间的“边水往事”?针对华语黑产及用户进行攻击的 APT-K-UN3 活动分析
伪装“黑神话悟空修改器”传播木马的活动分析

发布评论