Skip to content

Commit e07a0fc

Browse files
authored
Detection of .xls files
Support for detection of .xls (MS Office Excel) files that have the same header as .msi files - which can be used to send executable files disguised as .xls'es. Comparing number of .xls files I found similiarity at 512 byte, that differ from .msi files.
1 parent bd26aba commit e07a0fc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/SoftCreatR/MimeDetector/MimeDetector.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,19 @@ public function getFileType(): array
832832
];
833833
}
834834

835+
/**
836+
* Microsoft Office Excel, according to this document @link https://www.garykessler.net/library/file_sigs.html
837+
*/
838+
if (
839+
$this->checkForBytes([0x09, 0x08, 0x10, 0x00, 0x00, 0x06, 0x05, 0x00], 2048)
840+
|| $this->checkForBytes([0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff], 512)
841+
) {
842+
return [
843+
'ext' => 'xls',
844+
'mime' => 'application/vnd.ms-excel'
845+
];
846+
}
847+
835848
return [
836849
'ext' => 'msi',
837850
'mime' => 'application/x-msi'

0 commit comments

Comments
 (0)