LiveHelperChat - Remote Code Execution via Vulnerable Theme Upload Function
The theme import feature accepted a JSON file where the offline image data and its extension could be set to a PHP payload, allowing an attacker to upload and execute a PHP web shell on the server. This led to remote code execution as the web server user.
Published on arben.sh
Upon logging in, an import functionality has been identified that accepted input in a JSON format. The JSON format was analyzed and a base64 encoded PNG image input has been identified.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application trusted the user-supplied file extension and content from the imported JSON without validating that the uploaded file was actually an image, allowing a PHP file to be written to a web-accessible directory.
Impact
An authenticated attacker could execute arbitrary code on the server, leading to full compromise.
What the attacker needed
Authenticated user with theme import access
The fix
The application should restrict accepted file types by checking the file extension against a whitelist, prevent double extensions, and make the upload folder non-executable.
How it was found
- Create a basic theme with dummy data in the WidgetTheme section.
- Download the created theme from the Widget directory.
- Modify the offline_image_data parameter to contain a base64-encoded PHP web shell and set offline_image_data_ext to 'php'.
- Upload the modified theme via the theme import page.
- Edit the imported theme in the Widget themes section to trigger loading of the PHP shell.
- Find the uploaded shell's path in the page source and execute commands via the 'cmd' parameter.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A theme import feature let users upload a file that contained an image and a file extension. The attacker changed the extension to 'php' and put PHP code in the image data, so the server saved it as a PHP script. When the attacker visited that script, the server ran the code, giving them control of the server.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.