> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/password-attacks/brute-force-openssh-.enc.md).

# Cracking de claves OpenSSH cifradas

> El **.enc** la extensión generalmente indica un **cifrado** archivo (cifrado). Se utiliza para indicar que el contenido del archivo está protegido por un algoritmo de protección de datos, lo que permite que los datos sean ilegibles sin el código o el código de acceso apropiado. Estos archivos pueden contener la cantidad del tipo de datos (texto, imágenes, videos, etc.) y se utilizan para proteger información sensible.

El `.enc` el archivo está cifrado con un **AES-256-CBC** algoritmo y codificado en **Base64**.

<figure><img src="/files/6d5588d064aa3e246a32ad39cccf068dea72c052" alt=""><figcaption></figcaption></figure>

**Paso 1: Decodificación Base64**

```bash
cat .drupal.txt.enc | base64 -d > file_decoded.enc
```

<figure><img src="/files/aa3f86aad17c060759ff66244f532b61450f3f81" alt=""><figcaption></figcaption></figure>

**Paso 2: Descifrado con OpenSSL**

Para descifrar el archivo, necesitamos una contraseña. Ejecute el comando para intentar el descifrado manual:

```bash
openssl enc -aes-256-cbc -d -in .drupal.txt.enc -out .drupal.txt -base64
```

<figure><img src="/files/c8ddd92754669af052df660361d0e01b9c49981c" alt=""><figcaption></figcaption></figure>

**Paso 3: Script de automatización para fuerza bruta**

Usamos un script Bash para probar una lista de contraseñas (por ejemplo: `rockyou.txt`).

```bash
#!/bin/bash

function ctrl_c(){
    echo -e "/n/n[!] Saliendo.../n"
    tput cnorm; exit 1
}

# Ctrl+C
trap ctrl_c INT

tput civis
for password in $(cat /usr/share/wordlists/rockyou.txt); do
    openssl aes-256-cbc -d -in drupal.enc -out drupal.decrypted -pass pass:$password &>/dev/null

    if [ "$(echo $?)" == "0" ]; then
        echo -e "/n[+] La contraseña es : $password/n"
        exit 0
    fi
done; tput cnorm
```

**Resultado:**

La contraseña encontrada es: **amigos**

<figure><img src="/files/313badd57ba9deeb0f4b32e867a49818e1e3f5d6" alt=""><figcaption></figcaption></figure>

#### **Mensaje descifrado**

El archivo descifrado contiene una nueva contraseña:

```bash
openssl enc -aes-256-cbc -d -in .drupal.txt.enc -out .drupal.txt -base64

amigos
```

* **PencilKeyboardScanner123**

<figure><img src="/files/1493e001670253b1eb116bf7c522d5a8aa3b29e6" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/es/password-attacks/brute-force-openssh-.enc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
