> For the complete documentation index, see [llms.txt](https://ajaykumar-kanthi.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-keeper.md).

# HTB - Keeper

## Enumeration and Foothold

### NMAP

```bash
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    nginx 1.18.0 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
```

### HTTP

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FPeMxDRnXhfSPkkphhQiY%2Fimage.png?alt=media&amp;token=46f09b7e-2ec5-4d4e-96b1-28294472c3ff" alt=""><figcaption></figcaption></figure>

subdomain leaked add to the hosts file.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F1USeNIDfE2mgobFiD9gv%2Fimage.png?alt=media&amp;token=a47b4375-23c3-4cd8-8d40-a4b9e072f2e1" alt=""><figcaption></figcaption></figure>

tickets.keeper.htb hosts a login form.

login form is not vulnerable to sql injection.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FQgcQmJJFNmRTMKXfPCWL%2Fimage.png?alt=media&amp;token=1e06b382-4d89-418e-abb6-37203ab52cea" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FY2mJ18vAv8RpBLlJUNH2%2Fimage.png?alt=media&amp;token=aa271bad-74ad-4874-9df8-40bc75b537ec" alt=""><figcaption></figcaption></figure>

using the default creds got access to the RT.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FXyFyfy8GZvXjCyU6P0mN%2Fimage.png?alt=media&amp;token=43c3521d-a98b-4c63-9908-593ba4e4cdde" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FTy7VGcPbQ8hp5hLPWHxW%2Fimage.png?alt=media&amp;token=4414cfaf-05f1-4857-a5a5-5577ead582fa" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FeVkxmSrAwGLaoyeZDc8z%2Fimage.png?alt=media&amp;token=1085db5f-202e-4ccc-a22d-a903a7a24266" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FedUD2GDFI2vEEnTUTLBY%2Fimage.png?alt=media&amp;token=c1c600fe-70ca-4391-ac40-ae4348da51e0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FHGTNFnWFuGWhUTAno3ZZ%2Fimage.png?alt=media&amp;token=02c65433-993c-4daa-b0c2-ac5cd4dd5f89" alt=""><figcaption></figcaption></figure>

talks about the keepass but the files is removed.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FV6BukVmsiM41Djj4k25Y%2Fimage.png?alt=media&amp;token=7299233a-0605-4ac9-8864-9d345111918c" alt=""><figcaption></figcaption></figure>

checking the user information leaks the password of lnorgaard.

## Shell as lnorgaard

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FCzp0R4qX3XSwRci16sJi%2Fimage.png?alt=media&amp;token=24926b31-029e-4c0f-9092-da82ea3bf1ad" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FGLTp3voPSyqBnPMCBKlj%2Fimage.png?alt=media&amp;token=18714792-4c12-4580-bc5a-9b994df9fecd" alt=""><figcaption></figcaption></figure>

there is a zip file in the user directory probably the keepass that was discussed on the RT.

```bash
lnorgaard@keeper:~$ unzip RT30000.zip 
Archive:  RT30000.zip
  inflating: KeePassDumpFull.dmp     
 extracting: passcodes.kdbx          
lnorgaard@keeper:~$ 
```

transfer the files to attack machine

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FXcgmbcdEdjcgIjB94Zgr%2Fimage.png?alt=media&amp;token=4cc95ce0-cca6-4a42-a85d-01e212f53c5b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F5KDennYpJ6LdtXtVl6Qc%2Fimage.png?alt=media&amp;token=a799ecb6-af31-40e4-9caf-87a65e9f69fd" alt=""><figcaption></figcaption></figure>

the kdbx file is empty probably will display after we supply password.

### Extracting keepass password from memory dump

{% embed url="<https://meetcyber.net/extracted-keepass-memory-forensics-via-cve-2023-32784-master-key-recovery-tryhackme-359e9bdc85ca>" %}

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FuaYwwvE7LyZnnuVeP4ev%2Fimage.png?alt=media&amp;token=65c1cc50-2315-421e-8fa2-baa518abe34a" alt=""><figcaption></figcaption></figure>

{% embed url="<https://github.com/matro7sh/keepass-dump-masterkey>" %}

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FEEkX2lkroghMe6t00hcj%2Fimage.png?alt=media&amp;token=72739582-4b84-498a-b106-bcce897057e3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FM72dsIIY0r5FVHnfDhsI%2Fimage.png?alt=media&amp;token=7c9f7fb0-ccb2-495d-815d-8a1d7d1af026" alt=""><figcaption></figcaption></figure>

looking over google found the name that could be a potential key.

`rødgrød med fløde`

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F3fUxS9wiRh6DCV7d0zzO%2Fimage.png?alt=media&amp;token=570204cb-44ec-469a-8762-39e8f93b1d53" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FhjjPbDOXoe5icdkWZn84%2Fimage.png?alt=media&amp;token=3b31ee45-66e9-4a85-91de-213a0d25b373" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FsTaLvNkJVDJbpwwoquU8%2Fimage.png?alt=media&amp;token=e363c0b5-a11f-4023-97d4-ceecc868e6f5" alt=""><figcaption></figcaption></figure>

copy and pasting the root user pass to notepad reveals the pass.

`F4><3K0nd!`

## Shell as Root

### Putty key to SSH

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Ffo5GgvxVWELdwFnrcZ5C%2Fimage.png?alt=media&amp;token=aba51324-a422-4f3e-bac8-8abd1d115e6d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FDRxO5xYJJVQ6dixLYvfr%2Fimage.png?alt=media&amp;token=6a3957b1-f3f5-419a-849c-5317ad8fa117" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F83lZdCPieNXON0GkBRV9%2Fimage.png?alt=media&amp;token=d38a1c8e-ee13-476a-aa67-7917ed34fbf4" 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://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-keeper.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.
