> 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/de/password-attacks/brute-force-openssh-.enc.md).

# Verschlüsselten OpenSSH-Schlüssel knacken

> Das **.enc** Erweiterung weist im Allgemeinen auf eine **Chiffre** (verschlüsselte) Datei. Er wird verwendet, um auszudrücken, dass der Inhalt der Datei durch einen Datensicherungsalgorithmus geschützt ist, sodass die Daten ohne den Code oder den entsprechenden Passcode unleserlich sind. Diese Dateien können verschiedene Arten von Daten (Text, Bilder, Videos usw.) enthalten und werden verwendet, um sensible Informationen zu schützen.

Das `.enc` Datei ist mit einem **AES-256-CBC** Algorithmus verschlüsselt und **Base64**.

<figure><img src="/files/1d141733227458e2ad80fe6b331e5eb47c8e509d" alt=""><figcaption></figcaption></figure>

**Schritt 1: Base64-Dekodierung**

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

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

**Schritt 2: Entschlüsselung mit OpenSSL**

Um die Datei zu entschlüsseln, fehlt uns ein Passwort. Geben Sie den Befehl ein, um eine manuelle Entschlüsselung zu versuchen:

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

<figure><img src="/files/57b66c4b0d1654bba64d300c6f14a4d97282a330" alt=""><figcaption></figcaption></figure>

**Schritt 3: Automatisierungsskript für Brute-Force**

Wir verwenden ein Bash-Skript, um eine Liste von Passwörtern zu testen (Beispiel: `rockyou.txt`).

```bash
#!/bin/bash

function ctrl_c(){
    echo -e "/n/n[!] Wird beendet.../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[+] Das Passwort ist : $password/n"
        exit 0
    fi
done; tput cnorm
```

**Ergebnis:**

Das gefundene Passwort ist: **friends**

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

#### **Entschlüsselte Nachricht**

Die entschlüsselte Datei enthält ein neues Passwort:

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

friends
```

* **PencilKeyboardScanner123**

<figure><img src="/files/bb6a9a86996835552dd2473cabcb62620bbe7adb" 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/de/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.
