TL;DR
Polyglot files—files that are valid in two or more formats simultaneously—are being actively used by APT groups like Lazarus and IcedID to bypass security filters. This paper introduces PolyConv, a deep learning model that detects these "chameleon" files with over 99% accuracy, vastly outperforming existing signature-based and "polyglot-aware" tools.
What Problem Does This Paper Address?
Most security systems (EDRs, web firewalls, and generative AI interfaces) rely on format identification to decide how to handle a file. If a system identifies a file as a "benign JPG," it might skip the deep inspection reserved for executables.
Polyglots exploit this by conforming to multiple specifications at once. A single file might be a valid image to a viewer but a malicious script to a runtime environment. The authors highlight a disturbing gap: previous research showed that four leading commercial endpoint detection tools failed to detect 100% of malicious JPG+JAR polyglots. This paper seeks to understand how these files are used in the wild and how to build a robust defense against them.
Methods
The researchers took a multi-pronged approach:
- Threat Survey: They conducted the first comprehensive survey of in-the-wild polyglot usage, identifying 30 unique samples and 15 distinct attack chains used by advanced persistent threat (APT) actors.
- Fazah Framework: They developed a tool called Fazah to generate realistic polyglots using four primary methods: Stacking (appending files), Parasites (hiding data in comment markers), Zippers (intertwining files), and Cavities (using padding areas).
- PolyConv Model: They adapted the MalConv architecture (a CNN for malware detection) for polyglot identification. Crucially, they reduced the "window" and "stride" sizes from 512 bytes down to 16 and 8 bytes, respectively. This allows the model to "see" tiny script fragments (like HTA or JS) that are often buried within much larger files.
- ImSan (CDR): For image-based polyglots, they proposed a Content Disarmament and Reconstruction (CDR) approach. Their tool, ImSan, uses the Pillow library to re-save images, effectively stripping away any non-image "covert" data.
Datasets
The authors created the Wild Polyglots Dataset, which includes:
- Monoglots: ~25,000 benign files across 13 common formats (BMP, EXE, HTA, JAR, JPG, JS, MSI, PHP, PNG, PS1, RAR, ZIP).
- Polyglots: Over 1.1 million generated samples covering 32 different format combinations based on real-world adversary techniques.
- In-the-Wild Samples: 30 malicious samples sourced from VirusTotal and MalwareBazaar to validate the model's real-world efficacy.
Key Insights and Ideas
- The "Dual Nature" Vulnerability: The core issue isn't just that a file is "malformed," but that it is perfectly formed for two different parsers.
- Granularity is Key: Standard deep learning models for malware often use large strides to handle big files, but polyglot detection requires high-resolution scanning. By shrinking the convolutional window, PolyConv can detect byte patterns of very short script files hidden within megabytes of image data.
- Signature-Based Tools are Brittle: Tools like
fileorTrIDoften stop at the first match or use generic labels (like "ASCII text") for dangerous scripts, providing a false sense of security. - Translation Invariance: Because PolyConv uses global max pooling, it can detect a covert file regardless of where it is hidden (beginning, middle, or end) within the overt file.
Key Results
- PolyConv Performance: Achieved a 0.999 Precision-Recall AUC and an F1 score of 99.20% for binary detection (is it a polyglot?). For multi-label identification (what are all the formats?), it hit 99.47%.
- Comparison: PolyConv significantly outperformed existing tools. For example,
polyfile(a specialized tool) achieved only a 93.32% F1 score, while the ubiquitousfileutility was even lower. - Sanitization: The ImSan CDR tool was 100% effective at neutralizing image-based polyglots by stripping extraneous data while preserving the visual integrity of the image.
Limitations and Future Work
- File Size Constraints: Like all models trained on raw bytes, PolyConv has a maximum input capacity (1MB in this study). If an adversary hides a covert file inside a 100MB video, the model might not "see" it without intelligent sub-sampling.
- Format Coverage: The study did not deeply explore Open XML formats (like .docx), which are common malware vectors.
- Adversarial Evolution: The authors acknowledge that as detection improves, attackers may find even more creative ways to hide data that don't follow the four standard insertion methods.
- Future Direction: The researchers suggest developing more robust file specifications that leave no "dark corners" (like padding or comments) for covert data to hide.
Summary updated