Hash injection Attacks in a Windows Network

来源:互联网 发布:大气数据惯性基准系统 编辑:程序博客网 时间:2024/05/17 03:40

又是转载的,没啥含量,呵呵。

 

aka  

Why an exposed LM/NTLM Hash is comparable to a clear-text password  

aka 

Why a 127 character long password is not necessarily stronger than a 4 character long password 

aka 

Why generating LM/NTLM rainbow tables is a complete waste of time 

aka 

Passing-the-hash for direct authentication to remote systems 

aka 

Why one vulnerable system can compromise the entire Active directory forest 

aka 

One of the scariest Windows authentication hacks you ever saw……. 

  

During a Microsoft MVP summit in Redmond I demonstrated some of the work done by my group (Truesec Security Team) to some fellow security MVPs. 

I was asked to write a blog on one of the “hash injection”-demos I demonstrated, so here we go: 

Conceptual:  

This is the concept of injecting a compromized hash into a local session and then use the hash to authenticate to network resources. This method eliminates the need for password cracking in a windows environment. 

Description of the demo below: 

1.     Hacker compromises one server/workstation using a remote/local exploit. (This is not demonstrated in this demo) 

2.     The hacker extracts logged on hashes and finds a logged on domain admin account hash 

3.     The hackers use the hash to log on to the domain controller 

4.     The hacker extracts all the hashes in the Active Directory database and can now impersonate any account in the domain. 

Demonstration: 

The starting point of this attack is that an attacker has control over at least one computer using for example a client/server-side exploit. (Since this demo is not about exploits I will leave that out in order to keep focus on the authentication attack) 

To simulate a remote exploit, I´m simply using a psexec connection connecting to the compromised server: 

In this first scenario I´m running a Truesec tool named Gsecdump to dump the logged on hashes. I can see that both a user from the hell-domain named marcus is logged on as well as a local account named service1. 

My next step will be to use the domain-joined password hash to connect to the domain controller. 

Before I do that I will try to connect to the domain controller without the hash to prove that I do not currently have credentials to access the domain controller: 

´m trying to set up a net use session and just as expected, my current credentials doesn´t allow me to mount the hard drive on the domain controller. 

So, my approach would be to start a new session on our local attack-machine and inject the hash into that session: 

dc-msvctl-marcusThe Msvctl tool is a Truesec internal tool that we use in this case to create something similar to a “runas”-session, but instead of using a username and a password we are simply injecting the hash. 

The Truesec Msvctl tool will initiate a new cmd session in the context of the user marcus with the injected hash: 

dc-msvctlNow when we run the net use command again I´m allowed mounting the hard drive on the domain controller. This works since the Marcus account is a member of the Domain Admins group. 

The natural finish would be to run the Gsecdump tool again and extract the password hashes from the entire active directory database: 

dc-ad-hashThis means that since we can extract all the password hashes we now can impersonate any account in the entire domain using the Msvctl tool. 

Another thing that deserves to be mentioned is that the exact same method can be used to extract the local hashes stored in the SAM (Security Account Manager) database of a client or a server: 

srv-sam-hashesIn my experience as a pen tester, most environments still use identical local administrative accounts and passwords between servers and clients. The effect of this is that I can use the local hashes from this computer and use it to gain full access to other servers or clients. This drastically increases the chance that I will be able to extract logged on hashes from any member of the Domain admins group since I will control a greater number of computers. 

(In this demo I have deliberately left out a lot of info on what the Truesec-tools do exactly and we will not make the msvctl tool publicly available.) 

Conclusion: 

This attack proves that if one computer is fully compromised then the attacker can directly impersonate all the logged on accounts and the accounts stored in the local SAM database or Active Directory Database. 

Other important things that needs to be mentioned: 

PKI/Smartcards 

The first natural reaction would be to think that PKI-based smart card logon would solve the problem. Even though I´m personally a big fan of PKI/Smartcard-based authentication it doesn’t prevent this attack. 

The issue is that LM/NTLM can still be used for network logon event if the users are using smartcards to authenticate  

 (The security settings in Windows can´t force smart-card-based logon for network access, only interactive.) 

The fact that passwords will be changed into long randomized passwords when you implement smartcard doesn´t change anything. The hash is still there and we are simply using that hash, not the password. 

Using the same password for different users 

It´s really easy to try the extracted hashed passwords for different user accounts. My experience from the field is that it´s very common that admins reuse passwords between service accounts, their regular user accounts and their administrative accounts. This means that the low privileged user account that we extract from the admins desktop often gives us control over important servers and sometimes even the entire domain. 

The length of the password it not of importance in this scenario 

In this scenario it doesn´t really matter if a password is a one character password or a complex 127 character password since we are only using the hash. 

A simple security or registry setting is NOT all it takes to get rid of LM/NTLM hashes for network authentication 

The highest setting (Even in Windows Vista) is “Network Security:LAN Manager Authentication Level=Sent NTLMv2 response only”. 

If we could enforce Kerberos or native PKI/smartcard authentication for network authentication this could solve the problem. You can actually do this but it will require an IPSEC authentication implementation in the network. 

The purpose of this post is to generate a discussion on potential countermeasures. I have many thoughts of my own on this topic, but before I post them I´m very interested in ideas from others. 

  

Credits 

This work is a team effort and the biggest credit should rightfully go to Johannes Gumbel for research and coding. Jonas Ländin for researching and testing. Hasain Ashakarti for his fantastic intelligence and support. 

Guys, being in the same team as you in not only educating and stimulating, it´s also incredibly fun! 

-           Marcus Murray, Truesec Security Team 

A post on countermeasures and my personal thoughts will be posted shortly. 

Find it on the Truesec Public Tools Download Page 

Find it on the Truesec Public Tools Download Page 

http://www.truesec.com/PublicStore/catalog/Downloads,223.aspx

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 发出的邮件别人看了撤回不了怎么办 域名和邮箱是不同的公司怎么办 qq音乐听过的歌单找不到了怎么办 快手开直播前置摄像头太暗怎么办 小米手机帐号绑定无法侠用怎么办 用交易猫买完游戏账号被骗了怎么办 一个华为账号有两个游戏账号怎么办 加密u盘电脑上打开空怎么办 国网加密u盘电脑打开为空怎么办 足球竞彩软件下架后里面的钱怎么办 竞彩足球提现不到账怎么办 竞彩足球投注后输了怎么办 英雄联盟鼠标箭头右键点不了怎么办 上古卷轴5数值修改错了怎么办 小时候打针把屁股脂肪打扁了怎么办 大繁盛满腹市场2对话时闪退怎么办 月经来了一个月了还不停怎么办 对办公室的异性老师产生好感怎么办 上古卷轴5任务NPC老打我怎么办 1岁半宝宝走路内八字怎么办 最近几个月例假周期都25天怎么办 从pr导出的视频大小不一样怎么办 合作医疗收据丢了不给报销怎么办 沧州新生医院—老人腹胀了该怎么办 内痔疮术后一个月吃了点辣椒怎么办 肛周脓肿手术后大便干怎么办 月经半个月了还没干净怎么办 房东出租违建房不退房租怎么办 上海公租房住满5年后怎么办 监狱对死缓犯人延长转为无期怎么办 手机号码办理的宽带不想要了怎么办 朋友诈骗罪被关看守所了该怎么办 打架被拘留家里有孩子没人看怎么办 刑事拘留满37天给逮捕了怎么办 因打架被拘留十五天释放后会怎么办 犯罪人在拘留所生了小孩怎么办 我申请了进京证更换车辆怎么办 丈夫去世前想把财产留给妻子怎么办 假货中通代收货款发现是假货怎么办 注册志愿者时身份证被使用该怎么办 双眼皮贴贴的皮肤送了怎么办?