Users who are careful to download files only from trusted websites may be tricked by a new type of Web vulnerability: this one cons them into downloading malicious executable files that are not actually hosted where they appear to be.

The attack has been dubbed reflected file download (RFD) and is somewhat similar in concept to reflected cross-site scripting (XSS) attacks where users are tricked to click on specifically crafted links to legitimate sites that force their browsers to execute rogue code contained in the URLs themselves.

In the case of RFD, the victim’s browser does not execute code, but offers a file for download with an executable extension like .bat or .cmd that contains shell commands or script files like JS, VBS, WSH that will be executed through the Windows-based script host (Wscript.exe). The contents of the file are passed through the attacker-generated URL that the user clicks on, the website reflecting the input back to the browser as a file download.

This enables powerful social engineering attacks because, even though it’s not physically hosted on the targeted site, the file appears to originate from it. Users would still have to approve the download and execute the file themselves, but it wouldn’t be hard for the attacker to convince them to do it.

For example, a spoofed email from a bank asking users to download and install a new security product that protects their banking sessions could be very convincing if the included download link pointed back at the bank’s real website—and that’s exactly what RFD vulnerabilities allow for.

According to Trustwave security researcher Oren Hafif, who discovered the problem, a website is vulnerable to this attack if three conditions are met. The vast majority of sites that use JSON (JavaScript Object Notation) or JSONP (JSON with padding)—two very popular Web technologies—meet those criteria. Sites that don’t use JSON can also be vulnerable, he said.

Hafif has devised several variations of the attack and presented them at the Black Hat Europe security conference on Friday. He found the flaw in some Google services, in Microsoft’s Bing and in many other Alexa top 100 websites, but he declined to name them because the notification process is ongoing.

The researcher also found a way to bypass the warning that Windows displays when trying to run an executable file downloaded from the Internet, making his attack even more powerful. Details of the bypass, which involves using certain strings in the file name, were shared with Microsoft’s security team, who are working on a defense-in-depth fix.

The files generated through RFD don’t have to be complex and can act as so-called malware droppers because they can leverage the Windows PowerShell, a command-line shell and scripting environment installed by default in Windows 7 and above, to download and install additional malware from a remote server. Essentially, if such a file is executed by the user, the attacker can gain complete control over the system, the researcher said.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.