这只是滥用 SeImpersonate 权限的另一种方式。
在这篇博客中,@crisprss 展示了一种使用 AzureAttestService 滥用 SeImpersonate 权限的有趣方法,AzureAttestService 随近期版本的 SQL Server 一起提供,相关 PoC 可在此处找到:https://github.com/crisprss/magicAzureAttestService。
在同一篇博客中,他还展示了另一种利用 DiagTrack 服务滥用 SeImpersonate 权限的可能方式,但作者未能将其武器化。以下内容摘自该博客(原文为中文翻译而来,因此可能并非 100% 准确):
But just when I thought it could be triggered normally, I didn't realize that this service is transparent to service users, which also means that it is not feasible to simulate pipeline privilege escalation through service users, because service users such as sqlserver There is no way to call the RPC interface, which also means that you can only escalate rights from the administrator user to SYSTEM in this way, so here is just a process sharing
是的,如果你尝试以服务用户身份调用该 RPC 服务器公开的方法,就会收到“拒绝访问”的错误。

但是,为什么普通、非特权用户却能调用这个方法呢?
我的猜测是,由于服务用户在会话 0 中运行,他们的令牌中不会有 NT AUTHORITY\INTERACTIVE SID,而通过 RDP 或交互方式登录的正常用户则会拥有该 SID。
那么我们如何才能从会话 0 中获取 NT AUTHORITY\INTERACTIVE SID 呢?实际上非常简单,Secondary Logon 服务会帮我们做到这一点。 我们可以使用 LogonUser API 调用来获取带有 NT AUTHORITY\INTERACTIVE SID 的令牌,并且我们不需要有效的凭据,因为我们将使用 NewCredentials(9) 登录类型。 当使用 NewCredentials 登录类型时,Secondary Logon 会创建一个新的登录会话并复制调用者的令牌,同时还会插入 NT AUTHORITY\INTERACTIVE SID。这对我们来说非常理想,因为我们不需要有效凭据(使用 NewCredentials 登录类型的凭据只有在用户尝试访问网络资源时才会被验证)。
那么,既然我们拥有了带 NT AUTHORITY\INTERACTIVE SID 的令牌,这个利用能成功吗?是的,可以 :D

该 PoC 已在 Windows 10 和 Windows 2019 上测试。
@crisprss - https://www.crisprx.top/archives/561