强制身份认证

利用Windows一些接口函数特性,能让目标机器以system(本地)或者说机器用户(域内)来进行身份验证,再将协议协商为ntlm,就可以在域内获取机器用户的Net-Ntlm hash

例如:我这里在域内某台机器(10.10.10.234)使用spoolsample工具让目标机器(dc 10.10.10.139)对kali机器(10.10.10.10)进行强制身份验证,可以从wireshark监听到的数据包和responder的结果来看确实获取到了目标机器的Net-Ntlm v2 hash

往wireshark前面看看

第一个箭头是创建ipc$,创建这个也是要身份验证的(所以在域内使用该攻击方式需要获取域用户/机器用户凭据或者令牌),下面的spoolss应该是打印机专属的管道,第二个箭头是调用RemoteFindFirstPrinterChangeNotificationEx 函数,可见调用函数后有一群Negotiate字样的数据包,这些是协议协商,在这里设置使用ntlm协议认证,之后就可以看见dc向我们认证

这是调用函数那个数据包,可以看见它把server name设为了kali机器,所以会向kali进行身份验证

攻击面

  • 基于资源的约束委派(机器用户相当于本地system账户,可以对自己写入属性)

  • 非约束委派(让对方与非约束委派机器建立连接)

  • 服务账户模拟提权(模拟system账户)

可强制身份验证的一些方法

  • [MS-DFSNM]:分布式文件系统 (DFS):命名空间管理协议

    • 远程调用 NetrDfsAddStdRoot (opnum 12)

    • 远程调用 NetrDfsRemoveStdRoot (opnum 13)

  • [MS-EFSR]:加密文件系统远程 (EFSRPC) 协议

    • 远程调用 EfsRpcOpenFileRaw (opnum 0)

    • 远程调用 EfsRpcEncryptFileSrv (opnum 4)

    • 远程调用 EfsRpcDecryptFileSrv (opnum 5)

    • 远程调用 EfsRpcQueryUsersOnFile (opnum 6)

    • 远程调用 EfsRpcQueryRecoveryAgents (opnum 7)

    • 远程调用 EfsRpcFileKeyInfo (opnum 12)

    • 远程调用 EfsRpcDuplicateEncryptionInfoFile (opnum 13)

    • 远程调用 EfsRpcAddUsersToFileEx (opnum 15)

  • [MS-FSRVP]:文件服务器远程 VSS 协议

    • 远程调用 IsPathSupport (opnum 8)

    • 远程调用 IsPathShadowCopyed(opnum 9)

  • [MS-PAR]: 打印系统异步远程协议

    • 远程调用 RpcAsyncOpenPrinter (opnum 0)

  • [MS-RPRN]:打印系统远程协议

    • 远程调用 RpcRemoteFindFirstPrinterChangeNotificationEx (opnum 65)

来自:p0dalirius/windows-coerced-authentication-methods:通过具有各种协议的远程过程调用 (RPC) 强制 Windows 计算机向攻击者控制的计算机进行身份验证的方法列表 (github.com)arrow-up-right

工具

spoolsample

这是利用打印机错误,RpcRemoteFindFirstPrinterChangeNotificationEx 接口来实现的工具

可用于非约束委派攻击,基于资源的约束委派攻击

工具地址:leechristensen/SpoolSample: PoC tool to coerce Windows hosts authenticate to other machines via the MS-RPRN RPC interface. This is possible via other protocols as well. (github.com)arrow-up-right

用法:

printspoofer

这也是利用打印机错误,RpcRemoteFindFirstPrinterChangeNotificationEx 接口来实现的工具

可用于拥有SeImpersonatePrivilege特权的用户(iis,SQL server等服务用户)进行权限提升

工具地址:itm4n/PrintSpoofer: Abusing Impersonation Privileges on Windows 10 and Server 2019 (github.com)arrow-up-right

用法:

coercer

这是利用了很多接口来实现的工具

同样可用于非约束委派攻击,基于资源的约束委派攻击

工具地址:Releases · p0dalirius/Coercer (github.com)arrow-up-right

用法:

petitpotato

可用于拥有SeImpersonatePrivilege特权的用户(iis,SQL server等服务用户)进行权限提升

工具地址:Releases · wh0amitz/PetitPotato (github.com)arrow-up-right

用法:

可用于较新的系统例如Windows server 2022

petitpotam

同样可用于非约束委派攻击,基于资源的约束委派攻击

工具地址:

topotam/PetitPotam: PoC tool to coerce Windows hosts to authenticate to other machines via MS-EFSRPC EfsRpcOpenFileRaw or other functions. (github.com)arrow-up-right

用法:

一些其他工具

cube0x0/SharpSystemTriggers: Collection of remote authentication triggers in C# (github.com)arrow-up-right

Last updated