
Reference di Hashcat per OSCP/penetration testing: identificazione degli hash, sintassi di cracking per Linux, Windows, archivi, database, ticket Kerberos e attacchi basati su regole.
Cheatsheet di Hashcat per OSCP https://hashcat.net/wiki/doku.php?id=hashcat
hash-identifier
Hash di esempio: https://hashcat.net/wiki/doku.php?id=example_hashes
Ho scoperto che posso ottenere più potenza dal cracking degli hash aggiungendo questi parametri:
--force -O -w 4 --opencl-device-types 1,2
Questi parametri costringono Hashcat a usare l'interfaccia GPU CUDA, che è instabile ma offre prestazioni migliori (–force), ottimizzano per password di 32 caratteri o meno (-O) e impostano il carico di lavoro su "Insane" (-w 4), che dovrebbe rendere il computer di fatto inutilizzabile durante il processo di cracking. Infine, "--opencl-device-types 1,2" forza HashCat a usare sia la GPU che la CPU per gestire il cracking.
Crea un file .hash con tutti gli hash che vuoi craccare, puthasheshere.hash: $1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/
Esempio di hashcat per craccare password Linux md5crypt $1$ usando rockyou:
hashcat --force -m 500 -a 0 -o found1.txt --remove puthasheshere.hash /usr/share/wordlists/rockyou.txt
Esempio di hashcat per craccare password Wordpress usando rockyou:
hashcat --force -m 400 -a 0 -o found1.txt --remove wphash.hash /usr/share/wordlists/rockyou.txt
Hash di esempio http://openwall.info/wiki/john/sample-hashes
Not So Secure ha creato una regola personalizzata con cui ho avuto fortuna in passato:
https://www.notsosecure.com/one-rule-to-rule-them-all/
La regola può essere scaricata dal loro sito GitHub:
https://github.com/NotSoSecure/password_cracking_rules
Di solito inserisco OneRuleToRuleThemAll.rule nella sottocartella rules e la eseguo così dal mio computer Windows (in base all'articolo di notsosecure):
hashcat64.exe --force -m300 --status -w3 -o found.txt --remove --potfile-disable -r rules\OneRuleToRuleThemAll.rule hash.txt rockyou.txt
predefined charsets
?l = abcdefghijklmnopqrstuvwxyz
?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ
?d = 0123456789
?s = «space»!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
?a = ?l?u?d?s
?b = 0x00 - 0xff
?l?d?u equivale a:
?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Forza bruta su tutte le password di lunghezza 1-8 con possibili caratteri A-Z a-z 0-9
hashcat64 -m 500 hashes.txt -a 3 ?1?1?1?1?1?1?1?1 --increment -1 ?l?d?u
| ID | Description | Type |
|---|---|---|
| 3000 | LM | Sistemi operativi |
| 1000 | NTLM | Sistemi operativi |
Dopo aver recuperato o dumpato il file NTDS.dit e l'hive di registro SYSTEM, oppure dumpato la memoria LSASS da un sistema Windows, spesso ci si ritrova con hash NTLM.
| Path | Description |
|---|---|
| C:\Windows\NTDS\ntds.dit | Database di Active Directory |
| C:\Windows\System32\config\SYSTEM | Hive di registro contenente la chiave usata per cifrare gli hash |
E usando Impacket per dumpare gli hash
impacket-secretsdump -system SYSTEM -ntds ntds.dit -hashes lmhash:nthash LOCAL -outputfile ntlm-extract
Puoi craccare il dump degli hash NTLM usando la seguente sintassi di hashcat:
hashcat64 -m 1000 -a 0 -w 4 --force --opencl-device-types 1,2 -O d:\hashsample.hash "d:\WORDLISTS\realuniq.lst" -r OneRuleToRuleThemAll.rule
Benchmark con una Nvidia 2060 GTX: Velocità: 7000 MH/s Tasso di recupero: 12.47% Tempo trascorso: 2 ore e 35 minuti
Un nome principale di servizio (SPN) è un identificatore univoco di un'istanza di servizio. Gli SPN sono usati dall'autenticazione Kerberos per associare un'istanza di servizio a un account di accesso al servizio. Ciò consente a un'applicazione client di richiedere che il servizio autentichi un account anche se il client non dispone del nome dell'account. KRB5TGS - Kerberoasting degli account di servizio che usano SPN. Una volta identificato un account di servizio Kerberoastable (Bloodhound? Powershell Empire? - probabilmente un account di servizio MS SQL Server), qualsiasi utente AD può richiedere un hash krb5tgs da esso, che può essere usato per craccare la password.
In base ai miei benchmark, il cracking KRB5TGS è 28 volte più lento di NTLM.
Hashcat supporta più versioni dell'hash KRB5TGS, che possono essere facilmente identificate dal numero tra i simboli del dollaro nell'hash stesso.
KRB5TGS Type 23 - wordlist Crackstation solo umani con la lista di regole di mutazione OneRuleToRuleThemAll.
hashcat64 -m 13100 -a 0 -w 4 --force --opencl-device-types 1,2 -O d:\krb5tgs.hash d:\WORDLISTS\realhuman_phill.txt -r OneRuleToRuleThemAll.rule
Benchmark con una Nvidia 2060 GTX: Velocità: 250 MH/s Tempo trascorso: 9 minuti
Potrebbe esserti richiesto di recuperare una password da un'autenticazione SMB (NTLMv2) da una cattura di pacchetti. Di seguito è riportato un processo in 9 passaggi per formattare correttamente l'hash a questo scopo. https://research.801labs.org/cracking-an-ntlmv2-hash/
unshadow passwd-file.txt shadow-file.txt
unshadow passwd-file.txt shadow-file.txt > unshadowed.txt
zip2john Zipfile.zip | cut -d ':' -f 2 > hashes.txt
hashcat -a 0 -m 13600 hashes.txt /usr/share/wordlists/rockyou.txt
Hashcat sembra avere problemi con alcuni formati di hash zip generati da zip2john. Puoi risolvere modificando il contenuto dell'hash zip per allinearlo al formato di hash zip di esempio presente nella pagina degli esempi di hashcat:
$zip2$*0*3*0*b5d2b7bf57ad5e86a55c400509c672bd*d218*0**ca3d736d03a34165cfa9*$/zip2$
John sembra accettare una gamma più ampia di formati zip per il cracking.
PRINCE (PRobability INfinite Chained Elements) è un'utility di hashcat per generare casualmente password probabili:
pp64.bin --pw-min=8 < dict.txt | head -20 shuf dict.txt | pp64.bin --pw-min=8 | head -20
Riferimento:
https://github.com/hashcat/princeprocessor
L'attacco Purple Rain usa una combinazione di Prince, un dizionario e regole di mutazione casuali per creare dinamicamente infinite combinazioni di password.
shuf dict.txt | pp64.bin --pw-min=8 | hashcat -a 0 -m #type -w 4 -O hashes.txt -g 300000
Riferimento:
https://www.netmux.com/blog/purple-rain-attack
| ID | Description | Type |
|---|
| 500 | md5crypt $1$, MD5(Unix) | Sistemi operativi |
| 200 | bcrypt $2*, Blowfish(Unix) | Sistemi operativi |
| 400 | sha256crypt $5$, SHA256(Unix) | Sistemi operativi |
| 1800 | sha512crypt $6$, SHA512(Unix) | Sistemi operativi |
| ID | Description | Type |
|---|
| 900 | MD4 | Hash grezzo |
| 0 | MD5 | Hash grezzo |
| 5100 | Half MD5 | Hash grezzo |
| 100 | SHA1 | Hash grezzo |
| 10800 | SHA-384 | Hash grezzo |
| 1400 | SHA-256 | Hash grezzo |
| 1700 | SHA-512 | Hash grezzo |
| ID | Description | Type |
|---|
| 11600 | 7-Zip | Archivi |
| 12500 | RAR3-hp | Archivi |
| 13000 | RAR5 | Archivi |
| 13200 | AxCrypt | Archivi |
| 13300 | AxCrypt in-memory SHA1 | Archivi |
| 13600 | WinZip | Archivi |
| 9700 | MS Office <= 2003 $0/$1, MD5 + RC4 | Documenti |
| 9710 | MS Office <= 2003 $0/$1, MD5 + RC4, collider #1 | Documenti |
| 9720 | MS Office <= 2003 $0/$1, MD5 + RC4, collider #2 | Documenti |
| 9800 | MS Office <= 2003 $3/$4, SHA1 + RC4 | Documenti |
| 9810 | MS Office <= 2003 $3, SHA1 + RC4, collider #1 | Documenti |
| 9820 | MS Office <= 2003 $3, SHA1 + RC4, collider #2 | Documenti |
| 9400 | MS Office 2007 | Documenti |
| 9500 | MS Office 2010 | Documenti |
| 9600 | MS Office 2013 | Documenti |
| 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documenti |
| 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documenti |
| 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documenti |
| 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documenti |
| 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documenti |
| 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documenti |
| 16200 | Apple Secure Notes | Documenti |
| ID | Description | Type | Example Hash |
|---|
| 12 | PostgreSQL | Server di database | a6343a68d964ca596d9752250d54bb8a:postgres |
| 131 | MSSQL (2000) | Server di database | 0x01002702560500000000000000000000000000000000000000008db43dd9b1972a636ad0c7d4b8c515cb8ce46578 |
| 132 | MSSQL (2005) | Server di database | 0x010018102152f8f28c8499d8ef263c53f8be369d799f931b2fbe |
| 1731 | MSSQL (2012, 2014) | Server di database | 0x02000102030434ea1b17802fd95ea6316bd61d2c94622ca3812793e8fb1672487b5c904a45a31b2ab4a78890d563d2fcf5663e46fe797d71550494be50cf4915d3f4d55ec375 |
| 200 | MySQL323 | Server di database | 7196759210defdc0 |
| 300 | MySQL4.1/MySQL5 | Server di database | fcf7c1b8749cf99d88e5f34271d636178fb5d130 |
| 3100 | Oracle H: Type (Oracle 7+) | Server di database | 7A963A529D2E3229:3682427524 |
| 112 | Oracle S: Type (Oracle 11+) | Server di database | ac5f1e62d21fd0529428b84d42e8955b04966703:38445748184477378130 |
| 12300 | Oracle T: Type (Oracle 12+) | Server di database | 78281A9C0CF626BD05EFC4F41B515B61D6C4D95A250CD4A605CA0EF97168D670EBCB5673B6F5A2FB9CC4E0C0101E659C0C4E3B9B3BEDA846CD15508E88685A2334141655046766111066420254008225 |
| 8000 | Sybase ASE | Server di database | 0xc00778168388631428230545ed2c976790af96768afa0806fe6c0da3b28f3e132137eac56f9bad027ea2 |