Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
OutOfTune — 用于Entra ID和Intune MDM的恶意设备注册工具。自动执行设备加入、令牌获取、MDM注册和OMA-DM签入,以提取策略、Wi-Fi凭据、脚本和应用程序,同时绕过条件访问。 | Kitploit
工具/GitHubGitHub/stra-x/outoftune
身份验证与授权权限提升漏洞分析横向移动配置审计信息收集后渗透利用渗透测试云安全移动安全身份与访问管理 (IAM)红队
3134个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
GitHubstra-x/outoftune

OutOfTune

用于Entra ID和Intune MDM的恶意设备注册工具。自动执行设备加入、令牌获取、MDM注册和OMA-DM签入,以提取策略、Wi-Fi凭据、脚本和应用程序,同时绕过条件访问。

查看仓库

OutOfTune

受原始 Pytune 启发,OutOfTune 在 Entra ID 中注册一个恶意设备,将其注册到 Intune MDM,并检查最终的合规状态。

目前仅支持 Windows 设备(这是我的主要目标),未来可能会添加其他平台。

配套博客:

  • https://stra-x.github.io/Re-Engineering-Pytune-Rogue-devices-in-the-age-of-conditional-access/
  • https://stra-x.github.io/Re-Engineering-Pytune-Rogue-devices-in-the-age-of-conditional-access-pt-2/

要求

root@kitploit:~
pip install -r requirements.txt

工作原理

整个链分阶段运行,每个阶段都基于保存到 chain_state.json 的状态。

root@kitploit:~
drs-token  ->  device-join  ->  device-token  ->  mdm-enroll  ->  mdm-checkin
  1. drs-token — 获取 DRS 访问令牌(使用 ROPC 或预先获取的令牌)
  2. device-join — 在 Entra ID 中注册新的设备对象,获取设备证书
  3. device-token — 以设备主体身份进行身份验证,获取 Intune 注册令牌
  4. mdm-enroll — SOAP 发现 + WS-Trust 注册,获取 MDM 客户端证书
  5. mdm-checkin — OMA-DM SyncML 签入,拉取策略,可选设置主要用户

用法

1. 获取 DRS 令牌

使用 ROPC(已知凭据):

root@kitploit:~
python OutOfTune.py drs-token -u [email protected] -p Password1!

使用预先获取的令牌:

root@kitploit:~
python OutOfTune.py drs-token -u [email protected] -t <drs_access_token>

2. 将设备加入 Entra ID

root@kitploit:~
python OutOfTune.py device-join
python OutOfTune.py device-join -n CORP-LAPTOP-01

输出 <DEVICENAME>.pfx — 设备证书。密码为 password。


3. 获取设备主体令牌

root@kitploit:~
python OutOfTune.py device-token
python OutOfTune.py device-token --cert CORP-LAPTOP-01.pfx

以设备对象(而非用户)身份向 AAD 进行身份验证。绕过用户范围的条件访问策略。


4. 注册到 Intune MDM

root@kitploit:~
python OutOfTune.py mdm-enroll
python OutOfTune.py mdm-enroll --profile profiles/dell_win11_ent.json

针对 MDM 端点运行 SOAP 发现,然后提交 WS-Trust PKCS10 注册请求。输出 <DEVICENAME>_mdm.pfx。

使用 --profile 可伪造发送给 Intune 的设备硬件/操作系统属性(参见设备配置文件)。


5. OMA-DM 签入

root@kitploit:~
python OutOfTune.py mdm-checkin
python OutOfTune.py mdm-checkin -r <refresh_token>
python OutOfTune.py mdm-checkin --cert CORP-LAPTOP-01_mdm.pfx
python OutOfTune.py mdm-checkin -O ./output
python OutOfTune.py mdm-checkin -O ./output --save-syncml ./output/raw

针对 r.manage.microsoft.com 运行 OMA-DM SyncML 循环。Intune 会推送配置配置文件、应用程序分配以及任何针对该设备的其他策略。循环完成后,自动提取并显示情报。

如果提供了 -r,则刷新令牌会交换为 manage.microsoft.com 访问令牌,并在每个 SyncML 请求中作为 Authorization: Bearer 发送。Intune 从该令牌中读取 UPN,并将其设置为设备的主要用户,从而使以用户为范围的合规策略生效。您只需要运行一次带有 -r 的签入即可为用户分配,后续所有签入都可以在无刷新令牌的情况下运行。

如果没有 -r,设备将没有主要用户。

在首次签入之后,如果长时间(通常为 5-7 天)不再次签入,设备可能因默认的“处于活动状态”策略而变得不合规。根据 Intune 的配置,设备可能会进入宽限期,然后才被标记为不合规。如果发生这种情况,请重新运行 mdm-checkin。如果您之前使用过刷新令牌来分配主要用户,则无需再次提交,因为主要用户已存储在 Intune 后端中。

标志

提取的有用信息


解析已保存的 SyncML 轮次

在无需实时签入的情况下,重新解析使用 --save-syncml 保存的原始 XML 轮次。

root@kitploit:~
python OutOfTune.py parse-checkin --dir ./output/raw -O ./output2
python OutOfTune.py parse-checkin --file ./output/raw/round_001.xml -O ./output2

检查合规状态

root@kitploit:~
python OutOfTune.py check -u [email protected] -r <refresh_token>
python OutOfTune.py check -u [email protected] -p Password1!

从设备证书生成 PRT,将其交换为 IWService 令牌,然后查询 IWService/Devices 以获取设备的合规状态和任何不合规规则。

如果租户 CA 要求对注册资源进行 MFA,请使用 -r 配合 MFA 会话刷新令牌。


下载应用和脚本

通过 IME SideCarGateway 获取分配给设备的 Win32 应用和 PowerShell 脚本。仅需 MDM 客户端证书 — 无需用户令牌。

root@kitploit:~
python OutOfTune.py download-apps
python OutOfTune.py download-apps --cert CORP-LAPTOP-01_mdm.pfx
  • PowerShell 脚本保存到 scripts/<PolicyId>.ps1
  • Win32 应用从 CDN 下载、解密并提取到 apps/<AppName>/

下载修复脚本

获取分配给设备的主动修复脚本(检测 + 修复配对)。

root@kitploit:~
python OutOfTune.py get-remediations
python OutOfTune.py get-remediations --cert CORP-LAPTOP-01_mdm.pfx

每个策略保存到 remediations/<PolicyId>/,包含:

  • detection.ps1 — 检测脚本
  • remediation.ps1 — 修复脚本
  • params.json — 策略 ID 和任何脚本参数

清理

如果从 Intune 删除设备失败,请从 Entra 中删除它。随后该设备将进入 Intune 的宽限期,并在稍后自动被保留。

从 Intune 删除设备:

root@kitploit:~
python OutOfTune.py retire-intune -u [email protected] -r <refresh_token>

从 Entra ID 删除设备对象:

root@kitploit:~
python OutOfTune.py entra-delete

检查链进度

root@kitploit:~
python OutOfTune.py status

设备配置文件

在注册和签入期间发送给 Intune 的设备属性完全可以通过 JSON 配置文件进行伪造。这包括硬件标识符、操作系统版本、制造商以及所有自我报告的合规 CSP 值(BitLocker、防火墙、Defender、TPM、安全启动)。

root@kitploit:~
python OutOfTune.py mdm-enroll --profile profiles/dell_win11_ent.json
python OutOfTune.py mdm-checkin   # 配置文件已保存到状态并自动重用

包含的配置文件

文件设备
profiles/default.json默认值(VMware / Win10 企业版)
profiles/dell_win11_ent.jsonDell Latitude 5540 / Windows 11 企业版 23H2

配置文件字段

所有 DeviceStatus CSP 值均为自我报告,由 Intune 信任,无需独立验证。需要真正 TPM 的 HAS 认证合规检查(如 HealthAttestation CSP 中的 BitLockerEnabled、SecureBootEnabled)无法通过此方式伪造。


全局标志

root@kitploit:~
--debug          详细 HTTP + 令牌日志记录
--proxy <url>    通过代理路由流量(例如 http://127.0.0.1:8080)

这些标志应放在命令之前:

root@kitploit:~
python OutOfTune.py --debug device-token
python OutOfTune.py --proxy http://127.0.0.1:8080 mdm-checkin

证书覆盖

如果您有之前运行的证书或想使用特定的 PFX 文件:

root@kitploit:~
python OutOfTune.py device-token      --cert path/to/device.pfx
python OutOfTune.py mdm-enroll        --cert path/to/device.pfx
python OutOfTune.py mdm-checkin       --cert path/to/mdm.pfx
python OutOfTune.py check             --cert path/to/device.pfx
python OutOfTune.py download-apps     --cert path/to/mdm.pfx
python OutOfTune.py get-remediations  --cert path/to/mdm.pfx

状态文件

所有阶段的输出都保存到工作目录中的 chain_state.json。删除它以重新开始。使用 status 查看当前状态而无需运行任何操作。如果您在操作多个设备,请确保每个设备都有自己的状态文件。默认状态文件可以在脚本开头更改为您正在操作的任何设备。请谨慎使用证书覆盖选项,它们主要用于调试目的。

致谢

大量功劳归于 @temp43487580,他创建了原始 Pytune,其原始研究使得这一切成为可能:

  • https://i.blackhat.com/EU-24/Presentations/EU-24-Chudo-Unveiling-the-Power-of-Intune-Leveraging-Intune-for-Breaking-Into-Your-Cloud-and-On-Premise.pdf
  • https://temp43487580.github.io/intune/bypass-enrollment-restictions-to-break-byod-barriers-in-intune/
  • https://github.com/secureworks/pytune
下载工具
标志描述
--cert FILE要使用的 MDM PFX — 设备名称自动从文件名派生
-r RT用户刷新令牌 — 设置主要用户(仅需一次)
-O DIR将提取的工件保存到 DIR(wifi/、vpn/、scripts/、certs/、add_values.json、policy_values.json)
--save-syncml DIR将每轮原始 SyncML XML 保存到 DIR,以便离线重新解析
-o FILE将完整控制台输出写入 FILE
类别保存到备注
Wi-Fi 配置文件wifi/<SSID>.xml + _psk.txt如果存在,提取明文 PSK
VPN 配置文件vpn/<name>.xml完整的 ProfileXML
证书负载certs/cert_N.b64加密的 PFX 块(原始,尚未解密)
SCEP 挑战显示CA 型号名称、挑战 URL
脚本scripts/<name>.ps1通过 OMA-DM 推送的 PowerShell 脚本
MSI 下载 URL显示LOB 应用的直接 CDN 链接
ODJ 块odj_blob.b64 + odj_strings.txt离线域加入 — 提取可读字符串
添加值add_values.json所有其他添加命令(根 CA 证书、MDE 载入、策略配置)
替换值policy_values.jsonIntune 设置的策略 CSP 值
字段CSP备注
os_versionDevDetail/SwV最小/最大操作系统版本合规检查
os_edition_syncmlWindowsLicensing/Edition4 = 企业版,48 = 专业版
manufacturerDevInfo/Man某些策略允许指定制造商
mac_addressSOAP AdditionalContext/MAC全零是一个明显的指示器
hw_dev_id_enrollSOAP AdditionalContext/HWDevID64 个十六进制字符
bitlocker_statusBitLocker/Status/DeviceEncryptionStatus2 = 已加密(自我报告)
encryption_complianceDeviceStatus/Compliance/EncryptionCompliance1 = 合规(自我报告)
firewall_statusDeviceStatus/Firewall/Status0 = 已开启(自我报告)
secure_boot_stateDeviceStatus/SecureBootState1 = 已启用(自我报告,非 HAS 认证)
tpm_versionDeviceStatus/TPM/SpecificationVersion无加密证明
defender_enabledDefender/Health/DefenderEnabledtrue = 正在运行
defender_versionDefender/Health/DefenderVersion某些策略强制执行最低版本