While searching for a way to convert an HTML table to .CSV file, I found there are 2 ways to generate files to download on the client side with JavaScript:

  1. using data URLs
  2. by generating the file on the client side and posting it to the server which will merely echo the posted file back to trigger the download process normally. something like this or this.

I can't use the first option (data url) because it's IE browser support limitations to images and linked resources like CSS or JS, so I'm going with the second option (generating the file on the client , post it to the server, echo it back to the client), I was thinking of something like this PHP script

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename={$_POST['fileName']}");

How an attacker might exploit this script ?

Does this vulnerability has a known name I can search for ?

  • I think passing "things" for the client side and then let them to be uploaded to the server always is a risk. – OscarAkaElvis Jun 19 '17 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.