Understanding File Type Identifiers & Scanners
Where
Talks
hack.lu 2024
Duration
33 min
Compares file type identification engines like libmagic, TrID and Magika, and shows how they can be fooled.
Summary
The talk starts from a practical problem: when filtering very large volumes of files, you need to know what each file really is, and existing identification engines often disagree or fail. The speaker, who spent a year working with file formats from many communities beyond security, surveys the landscape. The tour covers libmagic and its derivatives, TrID, Detect It Easy, the Library of Congress format registry, PRONOM, Droid and the shared-MIME database. The engines differ in whether they rely on fixed byte sequences, follow pointers, use conditional logic, scan whole files or only the start, and in whether they use machine learning.
The middle of the talk looks at hard cases. PE executables can place their real header past a DOS stub, old Office documents change layout depending on their version, and JPEG identification depends on optional strings. Several engines cannot follow pointers or handle variable layouts, so they miss legitimate files. The speaker then presents Magika, a non-generative machine learning identifier that examines only the beginning and end of a file, returns probabilistic results in milliseconds, and is used in production. Its limits are also shown: it was not designed to resist adversarial or polyglot files, and it can miss unusual samples that resemble nothing in its training data.
The closing section covers evasion. Fast scanners can be fooled by manipulating headers, placing signatures outside the scanned range, or adding decoy signatures. A single-letter signature from an obsolete format produced a very large number of false positives on VirusTotal. The takeaway is that no engine is complete, so the choice depends on whether speed or depth matters most, and that legacy signatures can quietly cause false detections. The Q&A covered training data scarcity and attributing the software that produced a file.
Related talks
Day 1 Stream 1·50 min
Emily Rexer · Henry Reed
Shows how converting Windows executables into images and applying transfer learning can flag malware never seen before.
Talks·29 min
Philippe Lagadec
Explains why content-only file identifiers fail on weaponized files and proposes combining extensions with content checks.
Talks·24 min
Kseniia Yamburh · Nazar Grycshuk
Shows how machine learning clusters and classifies macOS malware that vendors only label as generic.


