Reflected File Download vulnerability

By
Nash N Sulthan
Published on
24 Jun 2018
1 min read

Reflected File Download (RFD) is an attack executed through a combination of URL path segments with web services. An attacker can perform reflected file download attack through JSONP injection. This vulnerability is used to inject malware into the end users system. JSONP injection is an injection attack that affects the JSON files used in the application. An attacker can insert files on the API link using semicolons(;). When the link gets executed by the browser, it will consider it as a file and execute the file. The attacker can take leverage of this vulnerability to make the end users download the malicious file.

For an attacker to perform an RFD attack, the attacker must be able to:-

  • reflect and inject shell commands.
  • link files using APIs.
  • download the file.

Nowadays, a JSON and JSONP files are used by almost all web applications because the application can asynchronously load data into the pages. This implementation helps to reduce the amount of traffic between the application and clients.

Example

Consider the following link is vulnerable to reflected file download vulnerability.

https://example.beaglesecurity.com/s;/setup.bat;?q=rfd%22 calc 

In the above URL, everything between the semi-colons will not be processed. Instead, the browser will consider it as a file name and download it and execute the file without checking. The downloaded file will be executed as a batch file and calc.exe will be executed.

Impact

Using this attack, the attacker can do the following impacts:-

  • Gain complete control over the user’s machine.
  • Gain access to browsers like Google Chrome (even if, the communication is encrypted).
  • Exploit vulnerabilities using machine’s installed vulnerable software.

Mitigation / Precaution

Beagle recommends the following fixes-

  • Sanitise the application’s API input.
  • Add the Content-Disposition attachments in the application.
  • Add X-Content-Type-Options along with nosniff header to API responses.
Automated human-like penetration testing for your web apps & APIs
Teams using Beagle Security are set up in minutes, embrace release-based CI/CD security testing and save up to 65% with timely remediation of vulnerabilities. Sign up for a free account to see what it can do for you.

Written by
Nash N Sulthan
Nash N Sulthan
Cyber Security Lead Engineer
Find website security issues in a flash
Improve your website's security posture with proactive vulnerability detection.
Free website security assessment
Experience the power of automated penetration testing & contextual reporting.