# Kerberos 委派

Kerberos 委派是什么，以及怎么利用，也许你们现在会感到有些困惑，这不要紧，因为我们目前只是在枚举阶段，但是我们需要知道 Kerberos 委派对于我们的利用是很关键的，因此对其进行枚举是前期就需要完成的事情。

从结果出发，委派可以让我们在其他主机上执行远程命令，从而接管这些主机。但我们也需要注意，有些用户是不允许被委派的，比如域管理员，因为他们具有很高的权限。

WHITE-BIRD 中的 Administrator 就不可被委派。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/GMaSHnU1vOm0mcf2-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/GMaSHnU1vOm0mcf2-image.png)

我们需要枚举的委派有 3 类：

### **非约束委派**

非约束委派无疑是最强大的，因为对非约束委派的成功利用往往可能导致对整个域乃至森林的接管。

```powershell
Get-NetComputer -Unconstrained | select dnshostname
```

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/QndhMQfG8nt2fFza-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/QndhMQfG8nt2fFza-image.png)

当前域中，只有 DC 是被设置了非约束委派的。域控制器总是会被设置非约束委派，但这对于我们并没有帮助。而在 RAVEN-MED 中，我们发现了 mon01 是被设置了非约束委派的。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/F9imO1a3Z7S3RbZ9-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/F9imO1a3Z7S3RbZ9-image.png)

我们在 BloodHound 中，可以用内置的语句查询所有到达被设置了非约束委派主机的路径。图像比较凌乱，但我们可以看到有 4 台 主机被设置了非约束委派。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/KQmfNo0uMDy2njNY-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/KQmfNo0uMDy2njNY-image.png)

###   


### **约束委派**

通常，我们可以通过利用约束委派横向移动到至少 1 台其他主机上，这取决于被设置约束委派的主机/服务帐号可以委派多少主机与服务。不仅主机可以被设置约束委派，服务帐号也可以。

```powershell
Get-NetComputer -TrustedToAuth

Get-NetUser -TrustedToAuth
```

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/OHDlVu7vYBRxFaT9-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/OHDlVu7vYBRxFaT9-image.png)

我们发现 **Web02** 被设置了约束委派。

此外，**med-factory.local** 域中的 **deleg\_exer** 服务帐号也被设置了约束委派。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-04/scaled-1680-/y6oZlmP5ELmw1mdn-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-04/y6oZlmP5ELmw1mdn-image.png)

### **基于资源的约束委派 （RBCD）**

如果被我们控制的主机或服务账号对其他主机具有 **GenericWrite** 以及更高 (例如**GenericAll**) 的权限，我们最终可以通过利用 **S4U** 横向移动到其他主机上。

至于枚举的话，通过查看 BloodHound的 显示更为直观。或者使用脚本 adPEAS 协助我们发现可利用的RBCD。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-04/scaled-1680-/9SsETSWRsAB9tzaZ-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-04/9SsETSWRsAB9tzaZ-image.png)

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-04/scaled-1680-/vBuShfSD4TPer8a2-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-04/vBuShfSD4TPer8a2-image.png)

实际上 File01 对 Dc01 具有 GenericAll 权限，因此可以用于利用 RBCD

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-04/scaled-1680-/HygPGsLFtLCK2zGM-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-04/HygPGsLFtLCK2zGM-image.png)