Skip to content

CHIT

  • Tutorials
  • Toggle search form

Craccare password con Hashcat Brute Force

Posted on 16 January 201913 August 2023 By chitblog No Comments on Craccare password con Hashcat Brute Force

Guida in italiano sul come “craccare” password con Hashcat usando un attacco Brute Force. Hashcat è un tool molto sofisticato che viene usato per decriptare hashes. È il password cracker più veloce in circolazione anche per via del fatto che sfrutta il GPU della scheda grafica per velocizzare il processo. Con Hashcat si può “crackare” qualsiasi password, anche di WordPress per esempio, basta procurarsi l’hash file per poi “craccarlo” tranquillamente offline.

How to Identify Hash Algorithm Type

Per “crackare” un hash file bisogna prima sapere che tipo di Algoritmo Hashing è stato usato. Per capirlo è facile, basta osservare i primi due caratteri del codice, vedi tabella sottostante.

Simbolo Algoritmo Hashing
$0 DES
$1 MD5 Hashing
$2 Blowfish
$2A Eksblowfish
$5 SHA256
$6 SHA512

Se il codice inizia con $6 vuol dire che l’algoritmo usato è SHA512. Ci sono anche dei programmi come per esempio hashid che possono essere utili nell’identificare il tipo di “algoritmo hashing”.

Eseguire il comando “hashcat –help” e dare un occhiata sotto “Hash modes“, c’è un lista di numeri di identificazione da usare. Nel nostro esempio – craccare password di sistema Linux con Hashcat – il numero da usare è 1800.

  15900 | DPAPI masterkey file v2                          | Operating Systems
  12800 | MS-AzureSync  PBKDF2-HMAC-SHA256                 | Operating Systems
   1500 | descrypt, DES (Unix), Traditional DES            | Operating Systems
  12400 | BSDi Crypt, Extended DES                         | Operating Systems
    500 | md5crypt, MD5 (Unix), Cisco-IOS $1$ (MD5)        | Operating Systems
   3200 | bcrypt $2*$, Blowfish (Unix)                     | Operating Systems
   7400 | sha256crypt $5$, SHA256 (Unix)                   | Operating Systems
   1800 | sha512crypt $6$, SHA512 (Unix)                   | Operating Systems
    122 | macOS v10.4, MacOS v10.5, MacOS v10.6            | Operating Systems
   1722 | macOS v10.7                                      | Operating Systems
   7100 | macOS v10.8+ (PBKDF2-SHA512)                     | Operating Systems
   6300 | AIX {smd5}                                       | Operating Systems
   6700 | AIX {ssha1}                                      | Operating Systems

Modalità di attacco di Hashcat

Numero Descrizione modalità attacco
0 Attacco a vocabolario
1 Combinazione
3 Attacco Brute Force
6 Attacco ibrido

Set di caratteri e maschera

Set di caratteri per Hashcat

Il set di caratteri da usare comprende lettere minuscole, lettere maiuscole, numeri e simboli. Vedi tabella sottostante:

  ? | Charset
 ===+=========
  l | abcdefghijklmnopqrstuvwxyz
  u | ABCDEFGHIJKLMNOPQRSTUVWXYZ
  d | 0123456789
  s |  !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
  a | ?l?u?d?s
  b | 0x00 - 0xff

Quindi per “crackare” una password che si sospetta sia composta da sole lettere minuscole, usare ?l, per lettere maiuscole ?u, per i numeri ?d eccetera. Se si vuole “craccare” una password composta da lettere minuscole, lettere maiuscole e numeri usare per esempio “-1 ?l?u?d ?1?1?1?1”. Se si vuole usare tutti i caratteri possibili usare ?a.

Maschera Hashcat

La maschera serve per definire il numero di caratteri della password da “craccare” come anche il tipo di caratteri da usare.

Un esempio di maschera per una password composta da 4 lettere minuscole potrebbe essere questo: ?l?l?l?l.

Craccare password di sistema Linux con Hashcat

In questo esempio sul come “crackare” password di sistema Linux con Hashcat come prima cosa creo un utente test.

:~ # useradd testuser
:~ # passwd testuser
Nuova password: 
PASSWORD ERRATA: è troppo corta
PASSWORD ERRATA: è troppo semplice
Reimmettere la nuova password: 
passwd: password aggiornata correttamente
:~ #

Il prossimo passo e creare un “hash file”. Le password in sistemi Linux sono contenute in modo criptato nel file /etc/shadow, nei sistemi moderni usando l’Hashing Algorithm” SHA512.

Ora per creare il file che ci serve dobbiamo estrarre questa informazione – la hash della password – dal file /etc/shadow con il seguente comando:

:~ # tail -n1 /etc/shadow 
testuser:$6$3jszVVeWR0jP6Bpr$eVtWKvj3KjQXUvIpz286QNRl1bs5EAcq6gBG.z.TvbJVjYetM0byqyb7rwFKQwkYnIag80QF4HqUBreIhY0Mz1:17911:0:99999:7:::
:~ # tail -n1 /etc/shadow > testuser.hash

Una volta creato l'”hash file” si può procedere. Per craccare la password contenuta nel file eseguire il seguente comando:

:~ # hashcat -m 1800 -a 3 testuser.hash ?l?l?l?l?l
hashcat (v3.00) starting...

OpenCL Platform #1: NVIDIA Corporation  
======================================
- Device #1: GeForce GTX 460, 240/963 MB allocatable, 7MCU

Hashes: 1 hashes; 1 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates
Applicable Optimizers:
* Zero-Byte
* Single-Hash
* Single-Salt
* Brute-Force
* Uses-64-Bit
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 75c

[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => s

Session.Name...: hashcat
Status.........: Running
Input.Mode.....: Mask (?l?l?l?l?l) [5]
Hash.Target....: $6$3jszVVeWR0jP6Bpr$eVtWKvj3KjQXUvIpz286Q...
Hash.Type......: sha512crypt, SHA512(Unix)
Time.Started...: Tue Jan 15 21:02:08 2019 (29 secs)
Time.Estimated.: Tue Jan 15 21:28:50 2019 (26 mins, 7 secs)
Speed.Dev.#1...:     7444 H/s (11.61ms)
Recovered......: 0/1 (0.00%) Digests, 0/1 (0.00%) Salts
Progress.......: 215040/11881376 (1.81%)
Rejected.......: 0/215040 (0.00%)
Restore.Point..: 0/456976 (0.00%)
HWMon.Dev.#1...: Temp: 60c Fan: 39%

$6$3jszVVeWR0jP6Bpr$eVtWKvj3KjQXUvIpz286QNRl1bs5EAcq6gBG.z.TvbJVjYetM0byqyb7rwFKQwkYnIag80QF4HqUBreIhY0Mz1:prova
                                                          
Session.Name...: hashcat
Status.........: Cracked
Input.Mode.....: Mask (?l?l?l?l?l) [5]
Hash.Target....: $6$3jszVVeWR0jP6Bpr$eVtWKvj3KjQXUvIpz286Q...
Hash.Type......: sha512crypt, SHA512(Unix)
Time.Started...: Tue Jan 15 21:02:08 2019 (2 mins, 23 secs)
Speed.Dev.#1...:     7469 H/s (11.59ms)
Recovered......: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts
Progress.......: 1075200/11881376 (9.05%)
Rejected.......: 0/1075200 (0.00%)
Restore.Point..: 35840/456976 (7.84%)

Started: Tue Jan 15 21:02:08 2019
Stopped: Tue Jan 15 21:04:38 2019 
:~ # 
Ethical Hacking / Penetration Testing, Sicurezza / Anonimato Tags:Crackare, decodificare, decriptare, guida, hash file, hashes, italiano, Password, Password Cracker, recuperare, Sicurezza, testare

Post navigation

Previous Post: La perfetta installazione WordPress – Velocizzare
Next Post: Sicurezza WordPress – Penetration test con Kali Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Tutorial on How to Install and Use AnythingLLM
  • Getting Started with Ollama: How to Install and Use AI Models
  • How to crack/recover passwords with Hashcat Brute Force
  • Ethical Hacking – Metasploit, Msfvenom and Meterpreter
  • Hacking WordPress – Content Injection Exploit and DoS