PXEThief 提取微软端点配置管理器中密码的小工具

作者:Sec-Labs | 发布时间:

PXEThief

PXEThief是一套工具,实现了在DEF CON 30演讲《Pulling Passwords out of Configuration Manager》(https://forum.defcon.org/node/241925)中讨论的针对微软端点配置管理器(或ConfigMgr,仍被称为SCCM)中操作系统部署功能的攻击路径。

它允许从配置的网络访问账户(https://docs.microsoft.com/en-us/mem/configmgr/core/plan-design/hierarchy/accounts#network-access-account)和任何任务序列账户或存储在ConfigMgr集合变量内的凭证中收集凭证,这些变量已被配置为 "所有未知计算机 "集合。这些活动目录账户通常权限过高,允许特权升级到域中某个地方的管理访问,至少在我的个人经验中是这样。

很可能,用这种工具执行的最严重的攻击涉及PXE启动的部署被支持到没有密码或密码很弱的分发点上的 "所有未知计算机"。前面提到的对暴露在OSD下的ConfigMgr账户的过度授权,可以让整个活动目录攻击链在只有网络访问目标环境的情况下被执行。

项目地址

https://github.com/MWR-CyberSec/PXEThief

使用说明

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 in 'settings.ini'
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 (obtained from PXE, bootable or prestaged media) 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 Policy XML file retrieved from a stand-alone 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'
pxethief.py -h - Print PXEThief help text

pxethief.py 5 <变量-文件名>应该被用来生成一个媒体变量文件的 "哈希值",可以用Hashcat模块在https://github.com/MWR-CyberSec/configmgr-cryptderivekey-hashcat-module,用于密码猜测攻击。

 

配置选项

包含在PXEThief主文件夹中的一个文件被用来设置更多的静态配置选项。这些选项如下。

[SCAPY SETTINGS]
automatic_interface_selection_mode = 1
manual_interface_selection_by_id = 

[HTTP CONNECTION SETTINGS]
use_proxy = 0
use_tls = 0

[GENERAL SETTINGS]
sccm_base_url = 
auto_exploit_blank_password = 1

scapy设置

automatic_interface_selection_mode将尝试自动确定Scapy的最佳接口,以方便使用。它使用两种主要的技术来实现这一点。如果设置为1,它将尝试使用能够到达机器的默认GW的接口作为输出接口。如果设置为2,它将寻找它发现的第一个具有非自动配置或本地主机IP地址的接口。在某些情况下,这将无法选择合适的接口,这就是为什么你可以用'manual_interface_selection_by_id'强制使用一个特定的接口。
manual_interface_selection_by_id允许你指定你希望Scapy使用的接口的整数索引。在这个文件中使用的ID应该从运行pxethief.py 10获得。

一般设置

sccm_base_url对于重写工具将与之对话的管理点很有用。如果DNS不能解析(所以不能使用从媒体变量文件中读取的值),或者你已经确定了多个管理点并希望将你的流量发送到一个特定的管理点,这就很有用。这应该以基本URL的形式提供,例如:http://mp.configmgr.com,而不是mp.configmgr.comhttp://mp.configmgr.com/stuff
auto_exploit_blank_password 改变pxethief 1的行为,以自动尝试利用一个没有密码保护的PXE分配点。将此设置为 1 将启用自动开发,而设置为 0 将打印你应该用来下载媒体变量文件的 tftp 客户端字符串。请注意,几乎所有的时候你都希望将其设置为1,因为非密码保护的PXE使用了一个二进制密钥,该密钥在你要求分配点执行PXE启动时,在你收到的DHCP响应中发送。

设置说明

  • 创建一个新的Windows虚拟机
  • 安装Python (从https://www.python.org/ 或通过商店,两者都能正常工作)
  • 通过pip安装所有需求(pip install -r requirements.txt)。
  • 为Scapy安装Npcap (https://npcap.com/#download) (或与之捆绑的Wireshark)
  • 将虚拟机连接到运行为PXE/OSD设置的ConfigMgr分配点的网络上。
  • 如果使用pxethief.py 1pxethief.py 2来识别和生成媒体变量文件,请确保工具使用的接口设置为正确的接口,如果不正确,请在'settings.ini'中手动设置,从pxethief.py 10中识别要使用的正确索引ID
标签:工具分享, 主机安全