Title:
MIME based validation not working when .doc file renamed to .xls and set the accept attibute as 'application/vnd.ms-excel'
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): Pradeep Vinitha / Pradeep Vinitha ()
Created: 08/14/2017
Components: File Management, CFFile
Versions: 2016
Failure Type: Non Functioning
Found In Build/Fixed In Build: 2016 /
Priority/Frequency: Normal / All users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 0
As part of security project we need to block the files which are not allowed upload to our system. We use <cffile action=”upload”> or fileupload method with in <cfscript> to upload the files.
When accept attribute is used to specify the MIME type of file to upload, <cffile> tag and fileUpload method will restrict uploading files of other mime types . Exception thrown and file is not uploaded even when the user intentionally modify the file by editing the file extension to match the mime type mentioned in with accept attribute .
I think internally CF matches the mime type mentioned with accept attribute of a file with the mime type based on the extension of the file tried to upload. if they are different CF does not allow to upload the file and throws an exception.
All scenarios except office 2007 based files are throwing CF exception and the file is not uploaded. Office 2007 files tested are with file extension .doc,.ppt and .xls. Only these file types can be uploaded modifying it to either of these extensions interchangeably.
Following are the scenarios should throw exception. But unfortunately successfully uploaded by CF.
Actual File Extension Modified Extension Accept attribute used Expected result Actual result
doc xls Application/vnd.ms-excel Should not upload Uploaded
doc ppt Application/ vnd.ms-powerpoint Should not upload Uploaded
xls doc Application/msword Should not upload Uploaded
xls ppt Application/ vnd.ms-powerpoint Should not upload Uploaded
ppt doc Application/msword Should not upload Uploaded
ppt xls Application/vnd.ms-excel Should not upload Uploaded
I believe this is an issue with CF implementation of CFFILE tag and fileUpload method.
Example Call:
cf_fileUpload = fileUpload(
GetTempDirectory()
, “theFile” // name of upload field …<input type="file" name="theFile" />
, ‘Application/vnd.ms-excel’
, ‘MakeUnique’
, true
);
Please see the attachment
Attachments:
- August 14, 2017 00:00:00: file upload not validating file mime type for 2007 office file extensions..msg
Comments: