Identificacion de Tipos de Hash

Identificacion de Tipos de Hash

1. Fundamentos de Identificacion de Hash

1.1 Por Que Identificar el Tipo de Hash

Antes de intentar crackear un hash, es necesario identificar su tipo para:

  • Seleccionar la herramienta correcta
  • Elegir la wordlist apropiada
  • Configurar los parametros correctos
  • Ahorrar tiempo de procesamiento

1.2 Longitudes Comunes

Hash Longitud (caracteres) Longitud (bits)
MD5 32 128
SHA-1 40 160
SHA-256 64 256
SHA-512 128 512
bcrypt 60 -
NTLM 32 128

1.3 Prefijos Identificadores

Muchos hashes usan prefijos para identificar el algoritmo:

Formato algoritmo
$1$ MD5
$2a$ bcrypt
$5$ SHA-256
$6$ SHA-512
0x MySQL old
* MySQL nuevo
md5 md5_generic

2. Herramientas de Identificacion

2.1 hashid

Herramienta Python para identificar tipos de hash.

Instalacion

# pip
pip install hashid

# Arch Linux
sudo pacman -S hashid

# Kali/Parrot
which hashid

Uso

# Identificar hash desde texto
hashid 'e10adc3949ba59abbe56e057f20f883e'

# Modo verbose
hashid -m 'e10adc3949ba59abbe56e057f20f883e'

# Modo extended
hashid -e 'e10adc3949ba59abbe56e057f20f883e'

Opciones

Parametro Descripcion
-m Mostrar modo Hashcat
-e Modos extendidos
-o Guardar a archivo
-j Salida JSON

Ejemplos de Salida

hashid 'e10adc3949ba59abbe56e057f20f883e'
Analyzing 'e10adc3949ba59abbe56e057f20f883e'
- MD5
- MD4
- MD2
- Double MD5
- LM
- NT

2.2 hash-identifier

Programa en Python para identificar hashes.

Instalacion

# Descargar
wget https://sourceforge.net/projects/hash-identifier/files/latest

# Tambien en Kali
which hash-identifier

Uso

# Interactivo
hash-identifier

# Con archivo
hash-identifier < hash.txt

2.3 Identificacion Manual

Por Longitud

32 chars  -> MD5, NTLM, MD4
40 chars  -> SHA-1, RIPEMD-160
56 chars  -> SHA-224
64 chars  -> SHA-256, HAS-160
96 chars  -> SHA-384
128 chars -> SHA-512

Por Caracteristicas

SoloHex      -> MD5, SHA, NTLM
Alphanum    -> bcrypt, MySQL
$1$...     -> MD5(Unix)
$2a$...    -> bcrypt
$5$...    -> SHA-256(Unix)
$6$...    -> SHA-512(Unix)
*...       -> MySQL nuevo
0x...      -> MSSQL
S:...      -> Oracle

3. Identificacion por Base de Datos

3.1 Hashes Unix/Linux

DES

Caracteristicas: 13 caracteres, solo letras minusculas
Ejemplo: olqN2.crNel0s
Longitud: 13

MD5

Caracteristicas: Prefijo $1$
Ejemplo: $1$saltsalt$9X7O5Yx2Z1O6Yx3Z
Longitud: 34

SHA-256

Caracteristicas: Prefijo $5$
Ejemplo: $5$rounds=656000$salt$X7O5Yx...
Longitud:_variable

SHA-512

Caracteristicas: Prefijo $6$
Ejemplo: $6$rounds=656000$salt$X7O5Yx...
Longitud:_variable

bcrypt

Caracteristicas: Prefijo $2a$, $2b$, $2y$
Ejemplo: $2a$12$KbQ5c5Yx2Z1O6Yx3Z4Aa5Bb6Cc7Dd8Ee9Ff
Longitud: 60

3.2 Hashes Windows

LM (Legacy)

Caracteristicas: Dos partes de 16 chars, en mayusculas
Ejemplo: C4F3DAB8E7B0C5D8E7F0C4D8A7E8F0D
Longitud: 32 (segun pero son 2 hashes)

NTLM

Caracteristicas: 32 caracteres hex
Ejemplo: e38ad4149434383f6c0c5f2ceaf5c0c5
Longitud: 32

3.3 Hashes MySQL

MySQL old

Caracteristicas: Prefijo *
Ejemplo: *c4caa792ba96e9d7bcb6fe3d74a89f4bc5e2e9c6
Longitud: 16

MySQL nuevo

Caracteristicas: 40 caracteres hex, doble SHA
Ejemplo: *2470c7c06eb5fb1b5e4b658a1b3e8b3b5f8e4c2e
Longitud: 40

3.4 Hashes PostgreSQL

Caracteristicas: Prefijo md5
Ejemplo: md59f9f4cb2a2b7c8e9b9f4cb2a2b7c8e9
Longitud: 34

3.5 Hashes MSSQL

Caracteristicas: Prefijo 0x0100
Ejemplo: 0x0100a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f
Longitud: Variable

3.6 Hashes Oracle

Caracteristicas: Prefijo S:
Ejemplo: S:AC9803EBA54D9C5D6E8F9A0B1C2D3E4F5A6B
Longitud: Variable

4. Identificacion por Contexto

4.1 En Archivos

Algunos archivos contienen hashes en formatos especificos:

Archivo Formato
/etc/shadow $1$, $5$, $6$
/etc/passwd Sin hash (usuarios)
.hash file Linea por hash
SAM (Windows) LM, NTLM

4.2 En Base de Datos

Base de Datos Campo tipico Formato
MySQL password *hash
PostgreSQL passwd md5hash
MSSQL password 0x0100…
Oracle password S:hash

4.3 En Tokens

Tipo Formato
JWT header.payload.signature
API Key Varios formatos
Session Cookies JWT

5. Tabla de Referencia

5.1 Por Algoritmo

Algoritmo Longitud Prefijo Crack con
MD5 32 - hashcat -m 0
SHA-1 40 - hashcat -m 100
SHA-256 64 - hashcat -m 1400
SHA-512 128 - hashcat -m 1800
bcrypt 60 $2a$ hashcat -m 3200
MD5(Unix) 34 $1$ hashcat -m 500
SHA-256(Unix) Variable $5$ hashcat -m 7400
SHA-512(Unix) Variable $6$ hashcat -m 1800
NTLM 32 - hashcat -m 1000
LM 32 - hashcat -m 3000

5.2 Por Modo Hashcat

Numero Hash Numero Hash
0 MD5 1400 SHA-256
100 SHA-1 1410 SHA-256(3)
200 MySQL 1420 SHA-256(hmac)
300 LM 1430 SHA-384
400 MD4 1440 SHA-384(hmac)
500 MD5(Unix) 1500 SHA-512
1000 NTLM 1710 SHA-512(hmac)
1100 DomainCached 1800 SHA-512(Unix)
1200 DomainCached 3200 bcrypt

6. Ejercicios Practicos

6.1 Identificar Estos Hashes

  1. $1$salt$hash -> ?
  2. *c4caa792ba96... -> ?
  3. e38ad4149434383... -> ?
  4. eyJhbGciOiJI... -> ?

6.2 Soluciones

  1. MD5(Unix) - tiene prefijo $1$
  2. MySQL viejo - tiene prefijo *
  3. NTLM - 32 caracteres hex
  4. JWT - formato con puntos

7. Herramientas Relacionadas

7.1 Herramientas Extra

Herramienta Descripcion
hashid Identificar hashes
hash-identifier Interactivo
hashcat -m 0 -b Benchmark
CrackStation Online lookup

7.2 Integracion

# Script para identificar automaticamente
import subprocess

def identify_hash(hash_value):
    result = subprocess.run(
        ['hashid', '-m', hash_value],
        capture_output=True,
        text=True
    )
    return result.stdout

hash_input = "e10adc3949ba59abbe56e057f20f883e"
print(identify_hash(hash_input))