Arbitrary file upload when setting an avatar
The avatar upload feature fetches a remote file and saves it with the same extension and content, allowing an attacker to upload an SVG with an onload handler that executes JavaScript. This could lead to arbitrary command execution if other file types are uploaded.
- Triaged in 5 days
- Fixed in 7 days
- Disclosed after 21 months
Hello,
When an administrator attempts to set an avatar from an external link, the parser just takes the source of whatever link they point it to and creates a file with the same extension and content in the uploads folder.
##Steps to reproduce:
1- Visit http://[HOST]/admin.php?/cp/members/profile/settings and scroll to the "Change avatar" section.
2- Choose "Link to avatar" and set it's value to http://strukt.tk/test.svg
3- After redirection, if you have a proxy, a request will be made to something like http://[HOST]/images/avatars/test_1.svg on your localhost. Try opening that in your browser and you should see an alert box over there.
4- You can try that with https://ellislab.com/asset/file/ee_server_wizard.zip, it will create a .zip file over there.
That being said, an attacker can use other file types and may be able to run arbitrary commands on the OS.
Regards
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could execute JavaScript in the context of the site and may be able to run arbitrary commands on the OS by uploading other file types.
What the attacker needed
Administrator access to the control panel
How it was found
- Visit the admin profile settings page and scroll to the 'Change avatar' section.
- Choose 'Link to avatar' and enter a URL to an SVG file.
- After redirection, a request is made to a path like /images/avatars/test_1.svg on the localhost.
- Open that URL in a browser and an alert box appears, confirming script execution.
- The same method can be used with a ZIP file to create a .zip file on the server.
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 report has not been written yet. The Original tab links to the source.
When you set an avatar by linking to an external image, the server downloads that file and saves it on its own site. The problem is it keeps the original file type, so if you link to a file that contains a script, the server saves it as a script file. When someone opens that saved file in a browser, the script runs, which can be dangerous.
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.