http://www.nextcloud.com/wp-includes/js/swfupload/swfupload.swf allows open redirect / site defacement
The swfupload.swf file on the site accepted query-string parameters that could override the button image URL, allowing an attacker to redirect users to an arbitrary site or display an arbitrary image on the page. The reporter demonstrated both an open redirect and a site defacement using a crafted link.
Originally disclosed on HackerOne
- Fixed in 49 days
- Disclosed after 3.0 years
Good day, I truly hope it treats you well on your side of the screen :)
I have found that your website uses the flash file: swfupload.swf to allow your users to upload files.
The tl;dr version of this bug report is it allows an open redirect to any site a non kind person may want to exploit or website defacement with the option to put any image on your site to share with others. If not greatly in scope I understand, just wanted to help you be more secure :)
The link in question is:
http://www.nextcloud.com/wp-includes/js/swfupload/swfupload.swf?debugEn%xabled=true&buttonImag%xeURL=https://████████/PugOfConcept/pugOfConcept.swf
Friendly url shorted version:
I've already created a fancy animated gif of the exploit in action so you can click, watch, and hopefully see a cute POC surprise on video end.
https://www.dropbox.com/s/0343g6qgjdz1y1r/nextcloud.com_swf_upload_open_redirect_2_27_2017.gif?dl=0
Defacement Link
http://www.nextcloud.com/wp-includes/js/swfupload/swfupload.swf?debug%%Enabled=true&buttonTe%%xt=&buttonImag%%eURL=http://██████████/PugOfConcept/nopuppies.jpg
Full report details:
a) Why Open Redirects can be harmful for your users and your company: https://www.owasp.org/index.php/Top_10_2010-A10-Unvalidated_Redirects_and_Forwards
b) The source of the most recent version of swfupload.swf is here: https://github.com/WordPress/secure-swfupload
The bad news is the newest version is vulnerable to the exploit (I will be reporting it to wordpress to fix hopefully)
They strongly suggest updating to a newer move secure version: http://www.plupload.com/
c) How the exploit works:
When you visit a swf, query string parameters (what appears after the ?) can be passed along in the request:
http://myawesomewebsite.com/wp-includes/js/swfupload/swfupload.swf? <debugEn%xabled=true?&buttonImag%xeURL=https://█████/PugOfConcept/pugOfConcept.swf>
Flash reads in these variables via a special variable: root.loaderInfo.parameters
The intended solution is that they tried to filter out if query string parameters were passed along in the request by checking for them and if the were passed to delete them.
for(key in params)
{
if(query.hasOwnProperty(Utils.trim(key)))
{
delete params[key];
}
}
The trick is that Flash will filter and non valid url encoded variables from a string, so %00-%FF are valid ascii encoded strings, a = %61 b = %62 etc I tricked the system with the variable passed "?debugEnabled=true" normally would be filtered, but with debugEn%xabled=true, the %x is a non valid hex string :) Since Hex counts from 0-F There is no valid %x.
May you be well on your side of the screen :)
-Eric
Also vulnerable:
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
Root cause
Likely the Flash file tried to remove dangerous query-string parameters but the filter could be bypassed by inserting an invalid percent-encoded character into the parameter name, so Flash still read the original parameter.
Impact
An attacker could redirect users to a malicious site or deface the page by displaying an arbitrary image, though the report does not claim any further compromise.
What the attacker needed
Victim clicks a crafted link
The fix
The reporter suggests updating to a more secure version or replacing the file, noting the newest version is still vulnerable.
How it was found
- Visit the swfupload.swf file with a query string containing a debugEnabled parameter and a buttonImageURL parameter pointing to an attacker-controlled image or Flash file.
- Insert an invalid percent-encoded character (such as %x) into the parameter names to bypass the filter.
- Observe that the page redirects to the attacker's site or displays the attacker's image.
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.
A Flash file on the website was meant to let people upload files, but it also read settings from the web address. By adding a special setting to the link, someone could make the page show a different image or send visitors to another website. This is called an open redirect because the site can be tricked into forwarding people anywhere.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.