RaspberryMatic / OCCU contains a unauthenticated remote code execution (RCE) vulnerability, caused by multiple issues within the Java based HMIPServer.jar component. The webui allows for Firmware uploads which can be reached through the URL `/pages/jpages/system/DeviceFirmware/addFirmware`. This allows an unauthenticated attacker to upload a malicious .tgz archive to the server, which will be automatically extracted without any further checks. As this entry can contain ../sequences, it is possible to break out of the predefined temp directory and write files to other locations outside this path. This vulnerability is commonly known as the Zip Slip vulnerability and can be used to overwrite arbitrary files on the main filesystem. It is therefore possible to overwrite the watchdog script with a malicious payload in `/usr/local/addons/mediola/bin/`, which will be executed every five minutes through a cron job where attackers can gain remote code execution as root user, allowing a full system compromise. RaspberryMatic versions <= `3.73.9.20240130` are vulnerable.
Linux,Unix
cmd
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
msf > use exploit/linux/http/raspberrymatic_unauth_rce_cve_2024_24578
msf exploit(raspberrymatic_unauth_rce_cve_2024_24578) > show targets
...targets...
msf exploit(raspberrymatic_unauth_rce_cve_2024_24578) > set TARGET < target-id >
msf exploit(raspberrymatic_unauth_rce_cve_2024_24578) > show options
...show and set options...
msf exploit(raspberrymatic_unauth_rce_cve_2024_24578) > exploit
Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.
– Jim O’Gorman | President, Offensive Security