千家信息网

如何进行CVE-2020-1313漏洞分析及利用PoC

发表于:2024-10-26 作者:千家信息网编辑
千家信息网最后更新 2024年10月26日,这期内容当中小编将会给大家带来有关如何进行CVE-2020-1313漏洞分析及利用PoC,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。Windows Update
千家信息网最后更新 2024年10月26日如何进行CVE-2020-1313漏洞分析及利用PoC

这期内容当中小编将会给大家带来有关如何进行CVE-2020-1313漏洞分析及利用PoC,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

Windows Update Orchestrator Service是一个DCOM服务,Windows系统内的其他组件需要使用该服务来安装已下载好的Windows更新。但是,由于该服务中的代码在认证调用函数时存在问题,导致其易受权限提升攻击的影响,即任意用户提升至本地系统权限。该漏洞将影响Windows 10和Windows Server Core产品。

漏洞分析

UniversalOrchestrator服务(9C695035-48D2-4229-8B73-4C70E756E519),其代码在usosvc.dll中实现,并且将以NT_AUTHORITY\SYSTEM权限运行,如果拥有BUILTIN\Users的访问权,即可对其进行配置。即使该服务所实现的COM类枚举功能已经被屏蔽了,但是IUniversalOrchestrator接口(c53f3549-0dbf-429a-8297-c812ba00742d)仍然可以通过标准的COM API调用来访问获取。下面给出的就是暴露的三个方法:

virtual HRESULT __stdcall HasMoratoriumPassed(wchar_t* uscheduledId, int64_t* p1);//usosvc!UniversalOrchestrator::HasMoratoriumPassedvirtual HRESULT __stdcall ScheduleWork(wchar_t* uscheduledId, wchar_t* cmdLine, wchar_t* startArg, wchar_t* pauseArg);//usosvc!UniversalOrchestrator::ScheduleWorkvirtual HRESULT __stdcall WorkCompleted(wchar_t* uscheduledId, int64_t p1);//usosvc!UniversalOrchestrator::WorkCompleted

ScheduleWork方法可以用来在服务的上下文环境下设置命令执行的计划任务,并且可以在不进行任何认证的情况下执行。目标可执行程序本身必须拥有数字签名,并且必须位于"c:\windows\system32"或"Program Files"目录下。但是,我们同样可以通过命令行参数来执行目标可执行文件,这样我们就可以通过启动"c:\windows\system32\cmd.exe",并且以NT_AUTHORITY\SYSTEM权限执行任意代码,最终在目标系统中实现提权。

概念验证PoC

C:\111>whoamidesktop-43rnlku\unprivileged C:\111>whoami /priv PRIVILEGES INFORMATION---------------------- Privilege Name                Description                          State============================= ==================================== ========SeShutdownPrivilege           Shut down the system                 DisabledSeChangeNotifyPrivilege       Bypass traverse checking             EnabledSeUndockPrivilege             Remove computer from docking station DisabledSeIncreaseWorkingSetPrivilege Increase a process working set       DisabledSeTimeZonePrivilege           Change the time zone                 Disabled C:\111>whoami /priv C:\111>UniversalOrchestratorPrivEscPoc.exeObtaining reference to IUniversalOrchestratorScheduing work with id 56594Succeeded. You may verify HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler to see the task has indeed been onboarded. The command itself will be executed overnight if there is no user interaction on the box or after 3 days SLA has passed.

计划任务的入口点将添加至注册表中:

指定的命令可以在不需要任何用户交互的情况下,在夜间(大约23:20)的时候执行。

漏洞发现过程

当我发现我们无法通过OleView.NET来获取USO服务的接口定义时,我专门创建了一个脚本来遍历大量的CLSID/IID组合。于是乎,我们发现了下列内容:

void TestUpdateOrchestratorInterfaceAgainstService(IID& clsId, const char* className, const wchar_t* iidStr, const char *interfaceName){void *ss = NULL;IID iid;ThrowOnError(IIDFromString(iidStr, (LPCLSID)&iid)); // working with e at the end, failing with anything else HRESULT res = CoCreateInstance(clsId, nullptr, CLSCTX_LOCAL_SERVER, iid, (LPVOID*)&ss); printf("%s %s: %s\n", className, interfaceName, res == S_OK ? "WORKING" : "failure");} void TestUpdateOrchestratorInterface(const wchar_t* iidStr, const char *interfaceName){// TestUpdateOrchestratorInterfaceAgainstService(CLSID_AutomaticUpdates, "AutomaticUpdates", iidStr, interfaceName); // timeouting!TestUpdateOrchestratorInterfaceAgainstService(CLSID_UxUpdateManager, "UxUpdateManager", iidStr, interfaceName);TestUpdateOrchestratorInterfaceAgainstService(CLSID_UsoService, "UsoService", iidStr, interfaceName);TestUpdateOrchestratorInterfaceAgainstService(CLSID_UpdateSessionOrchestrator, "UpdateSessionOrchestrator", iidStr, interfaceName);TestUpdateOrchestratorInterfaceAgainstService(CLSID_UniversalOrchestrator, "UniversalOrchestrator", iidStr, interfaceName);// TestUpdateOrchestratorInterfaceAgainstService(CLSID_SomeService, "SomeService", iidStr, interfaceName); // timeouting!} ... TestUpdateOrchestratorInterface(L"{c57692f8-8f5f-47cb-9381-34329b40285a}", "IMoUsoOrchestrator");TestUpdateOrchestratorInterface(L"{4284202d-4dc1-4c68-a21e-5c371dd92671}", "IMoUsoUpdate");TestUpdateOrchestratorInterface(L"{c879dd73-4bd2-4b76-9dd8-3b96113a2130}", "IMoUsoUpdateCollection");        // ... and hundreds of more

方法的执行结果如下:

UniversalOrchestrator IUniversalOrchestrator: WORKINGUpdateSessionOrchestrator IUpdateSessionOrchestrator: WORKINGUxUpdateManager IUxUpdateManager: WORKING

接下来,我就开始对上述方法执行逆向工程分析,并且发现了本文所介绍的漏洞。

漏洞修复

微软目前已在2020年6月份的漏洞补丁中,通过添加CoImpersonateClient API调用来修复了该问题。

在部署漏洞补丁之前,方法的实现代码如下:

部署了漏洞补丁之后,方法的实现代码如下:

实际上,身份伪装实在处理请求的开始时完成的,因此更新注册表的API调用是在调用方的安全上下文中执行的。如果调用方没有访问HKEY_LOCAL_MACHINE的高级权限,那么USO API方法也将无法被执行。

上述就是小编为大家分享的如何进行CVE-2020-1313漏洞分析及利用PoC了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。

0