Skip to content

Instantly share code, notes, and snippets.

@vah13
Created January 24, 2019 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vah13/1e14c1d19b20266e5090112785519478 to your computer and use it in GitHub Desktop.
Save vah13/1e14c1d19b20266e5090112785519478 to your computer and use it in GitHub Desktop.
Evil content-disposition
<html>
<body>
<form action="upload.phtml" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
<?php
if (isset($_FILES['fileToUpload']) and pathinfo($_FILES['fileToUpload']['name'])['extension']=='jpg')
{
$uploaddir = '/var/www/html/uploads/';
$uploadfile = $uploaddir . basename($_FILES['fileToUpload']['name']);
if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
}
else {
echo "Upload failed";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment