<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by MalX Labs on Medium]]></title>
        <description><![CDATA[Stories by MalX Labs on Medium]]></description>
        <link>https://medium.com/@malx-labs?source=rss-18cd0ae062aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EiqZHTLzbaALbm3hM4pWmQ.png</url>
            <title>Stories by MalX Labs on Medium</title>
            <link>https://medium.com/@malx-labs?source=rss-18cd0ae062aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 16:06:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@malx-labs/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Adversarial PE Analysis Series, Part 1 — Why PE Parsers Break: Introducing the 99 Adversarial…]]></title>
            <link>https://medium.com/@malx-labs/the-adversarial-pe-analysis-series-part-1-why-pe-parsers-break-introducing-the-99-adversarial-1769556ab473?source=rss-18cd0ae062aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1769556ab473</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[windows-internals]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[MalX Labs]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 15:06:31 GMT</pubDate>
            <atom:updated>2026-06-12T08:20:31.708Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Adversarial PE Analysis Series, Part 1 — Why PE Parsers Break: Introducing the 99 Adversarial Fixtures</h3><p><strong>An exploration of malformed Portable Executable structures and how analysis tools really behave when the rules stop making sense.</strong></p><p><em>This article explores adversarial PE analysis — a research effort focused on understanding how tools behave when binaries stop following the rules.</em></p><p><em>The entire adversarial corpus and fixture specification referenced in this article can be found here: </em><a href="https://github.com/iocx-dev/iocx/tree/main/tests/contract/fixtures/layer3_adversarial">https://github.com/iocx-dev/</a></p><h3>Introduction</h3><p>The Windows Portable Executable (PE) format is one of the most flexible and permissive binary formats in widespread use (Nisi et al., 2021). However, the tooling ecosystem around PE parsing often operates on the implicit assumption that <strong>most binaries are well‑formed</strong>, an assumption that is frequently incorrect, and one whose failure can ripple through malware‑triage pipelines, forensic workflows, and automated analysis systems. Tools that appear stable and trustworthy under normal conditions may normalise malformed metadata, omit structurally inconsistent fields, or encounter crashes when confronted with adversarially constructed but still loadable PE files.</p><p>This article introduces a research artefact designed to expose these behaviours: a <strong>99‑fixture adversarial PE corpus</strong> engineered to systematically challenge assumptions across every major subsystem of the PE format.</p><h3>Why PE Parsers Break</h3><p>The Windows Portable Executable (PE) format is widely recognised in the security literature as one of the most permissive and inconsistently interpreted binary formats in mainstream use. Research shows that Windows will successfully load PE files that violate the specification in numerous ways, including overlapping sections, malformed or out‑of‑bounds directory entries, contradictory metadata, and structurally invalid resource trees (Nisi et al., 2021). This permissiveness stems from the PE format’s under-specification, and the Windows loader’s tolerance for irregular or internally inconsistent structures, a behaviour long exploited by malware authors to evade analysis (Carrera, 2012; Sikorski &amp; Honig, 2012). Studies of adversarial manipulation further demonstrate that PE fields such as RVAs, entropy regions, and Authenticode‑related structures can be malformed, negative, or contradictory while still being accepted by the operating system (Ling et al., 2023). As a result, many PE‑analysis tools, that are often built around <em>expected</em> rather than <em>actual</em> structure, struggle when confronted with intentionally malformed but still loadable binaries.</p><p>When those expectations are violated, tools tend to fall into one of four behavioural categories:</p><ol><li>Literal parsers</li></ol><p>They report the bytes exactly as they appear.</p><p>(radare2, PEview)</p><p>2. Semantic parsers</p><p>They “repair” malformed fields to present a coherent view.</p><p>(CFF Explorer)</p><p>3. Heuristic tools</p><p>They ignore structure and focus on entropy or signatures.</p><p>(Detect It Easy)</p><p>4. Reconstructive loaders</p><p>They construct an internal representation of the binary, normalising or omitting metadata that conflicts with the loader’s model.</p><p>(Ghidra)</p><p>Each philosophy encounters distinct failure modes when confronted with structures that fall outside the assumptions encoded in its parsing model.</p><h3>The Need for Adversarial Fixtures</h3><p>Real malware samples are unsuitable for evaluating the robustness of PE‑analysis tools because they contain multiple anomalies simultaneously, lack reliable ground truth, and are heavily distorted by packers and obfuscators. This makes it impossible to attribute a tool’s failure to any specific structural condition within the sample (Sikorski &amp; Honig, 2012). Research further shows that PE files in the wild often include malformed or contradictory metadata that Windows still accepts, meaning real samples rarely represent clean, isolated test cases (Nisi et al., 2021). Studies on adversarial PE manipulation reinforce that controlled, synthetic inputs are required for scientific evaluation, as naturally occurring malware cannot reveal what the file <em>should</em> look like (Ling et al., 2023).</p><p>This is why the research behind this article created a synthetic, controlled, reproducible artefact: <strong>99 adversarial PE fixtures, each containing exactly one corruption pattern, with authoritative ground‑truth metadata.</strong></p><p>This allows:</p><ul><li>precise attribution of tool inconsistencies</li><li>cross‑tool comparison</li><li>reproducible evaluation</li><li>isolation of variables</li><li>systematic coverage of the entire PE format</li></ul><h3>How the 99 Fixtures Were Built</h3><p>Each of the 99 fixtures is constructed by starting from a minimal, valid Portable Executable (PE) file and introducing <strong>exactly one</strong> deliberate corruption. This ensures that every fixture isolates a single structural anomaly, allowing precise attribution of tool behaviour to a specific malformed condition. The fixtures expose anomalies across the following PE format subsystems:</p><h4>Entrypoint anomalies</h4><ul><li>EP points into overlay</li><li>EP points to unmapped memory</li><li>EP is negative</li></ul><h4>Section table anomalies</h4><ul><li>overlapping sections</li><li>zero‑length executable sections</li><li>sections overlapping headers</li></ul><h4>Optional Header anomalies</h4><ul><li>SizeOfImage too small</li><li>NumberOfRvaAndSizes inconsistent</li><li>impossible alignment values</li></ul><h4>Directory anomalies</h4><ul><li>directories pointing outside the file</li><li>directories overlapping each other</li><li>truncated directory tables</li></ul><h4>TLS anomalies</h4><ul><li>TLS callback in discardable section</li><li>invalid TLS directory size</li></ul><h4>Authenticode anomalies</h4><ul><li>signature overlapping <em>.text</em></li><li>invalid WIN_CERTIFICATE length</li></ul><h4>Resource anomalies</h4><ul><li>recursive resource tree</li><li>resource data beyond EOF</li></ul><h4>Entropy anomalies</h4><ul><li>NaN entropy</li><li>negative entropy</li><li>zero‑length entropy region</li></ul><p>Each fixture is paired with a JSON metadata file describing the <strong>intended</strong> structure, which serves as the ground truth for the study and enables reproducible, single‑variable evaluation of PE‑analysis tools.</p><h3>Why Synthetic Fixtures Matter</h3><p>Synthetic fixtures address four methodological problems that real malware cannot solve:</p><ol><li>Ground truth is known</li></ol><p>Because each fixture is constructed from a minimal valid PE with a single controlled modification, the intended metadata and structure are fully known in advance. This eliminates ambiguity about what the file <em>should</em> look like.</p><p>2. Variables are isolated</p><p>Each fixture contains exactly one anomaly, with no secondary corruption or packer artefacts. This removes confounding factors and allows tool behaviour to be attributed to a single, well‑defined condition.</p><p>3. Reproducibility</p><p>Fixtures can be regenerated deterministically from their specifications, enabling independent researchers to reproduce experiments, verify results, and compare tools under identical conditions.</p><p>4. Systematic coverage</p><p>Real malware does not reliably exercise rare or pathological PE behaviours , such as TLS edge cases, recursive resource trees, malformed Authenticode structures, or entropy‑field anomalies. Synthetic fixtures allow these cases to be represented explicitly and consistently, ensuring comprehensive coverage of the PE format’s failure modes.</p><h3>What the Fixtures Revealed</h3><p>The evaluation revealed several systemic behavioural patterns across PE‑analysis tools — patterns that do not surface in normal workflows and have not previously been documented in a controlled setting.</p><h4>Literal tools (e.g., radare2, PEview)</h4><ul><li>preserve the exact on‑disk structure</li><li>provide no diagnostics or semantic interpretation</li><li>remain extremely stable across all anomalies</li></ul><h4>Semantic tools (e.g., CFF Explorer)</h4><ul><li>generally stable</li><li>normalise malformed fields to produce a coherent view</li><li>may obscure anomalies by adjusting metadata</li></ul><h4>Heuristic tools (e.g., DIE)</h4><ul><li>robust under corruption</li><li>disregard structural metadata</li><li>do not detect malformed or contradictory fields</li></ul><h4>Reconstructive loaders (e.g., Ghidra)</h4><ul><li>rebuild internal representations of sections and directories</li><li>normalise or omit metadata that does not align with the loader’s model</li><li>may encounter crashes when metadata violates expected invariants</li><li>present a reconstructed view of the binary rather than a literal byte‑level view</li></ul><h4>Hybrid literal‑semantic tools (e.g., IOCX)</h4><ul><li>preserve raw metadata faithfully</li><li>provide explicit anomaly detection</li><li>remain stable across all fixtures</li><li>match ground‑truth structure across all adversarial cases</li></ul><p>This study represents the first systematic documentation of these behavioural classes, made possible through controlled, single‑variable synthetic fixtures.</p><p>Across all evaluated tools, only hybrid literal‑semantic approaches exhibited both structural fidelity and semantic correctness across the full 99‑fixture corpus.</p><h3>Why This Matters for Analysts</h3><p>When an analysis tool reconstructs or normalises PE metadata, the analyst may no longer be examining the literal on‑disk binary but a model‑driven interpretation of it. Critical structural anomalies can be normalised, hidden, or overwritten, causing the analyst to draw conclusions from a representation that differs from the original file. For example, a section overlapping the headers may be adjusted, a directory pointing outside the file may be zeroed, a malformed TLS callback may disappear, and a corrupted Authenticode signature may appear structurally valid. These behaviours matter because they can lead to missed indicators of compromise, incorrect triage decisions, misclassification of malware families, broken unpacking workflows, and inaccurate assumptions about the binary’s true structure.</p><p>Literal tools avoid these problems by preserving raw metadata, but they provide little semantic insight. Heuristic tools avoid them by ignoring structure entirely, which leaves them blind to anomalies. Reconstructive loaders behave differently under adversarial conditions; because they rebuild an internal model of the binary, they may reinterpret or omit metadata that violates expected invariants, producing a view that reflects the loader’s model rather than the literal on‑disk layout.</p><p>These behavioural classes emerged only after evaluating all 99 adversarial fixtures under controlled, single‑variable conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jl79MtTtn6QtU7L5ybI0_w.png" /></figure><h3>Why This Matters for Tool Developers</h3><p>Synthetic fixtures expose failure modes that rarely appear in normal workflows but are critical for tool developers to understand. They reveal where parsers assume well‑formed input, where loaders reconstruct rather than parse, where normalisation obscures anomalies, where crashes occur, and where metadata is dropped because it conflicts with the tool’s internal model. Together, these behaviours form a diagnostic map of how tools respond to malformed PE structures.</p><p>This provides a concrete roadmap for improving loader design, parser correctness, diagnostic transparency, and adversarial robustness. By testing against controlled, single‑variable anomalies, developers can identify fragile assumptions, surface meaningful warnings, avoid unintended normalisation, and harden their tools against intentionally malformed binaries.</p><h3>Conclusion</h3><p>The 99‑fixture adversarial PE corpus exposes a simple truth:</p><blockquote><strong><em>PE tools behave very differently once the binary stops playing by the rules.</em></strong></blockquote><p>Some tools preserve the raw on‑disk structure, some normalise or reinterpret malformed fields, and some rely on heuristics that bypass structural anomalies entirely. Others may encounter crashes when metadata violates expected invariants, or reconstruct a view of the binary based on an internal model rather than the literal file layout.</p><p>Understanding these behaviours is essential for malware analysts, tool developers, and researchers working with adversarial or malformed binaries. It determines whether an analyst sees the true on‑disk structure, a partially reconstructed interpretation, or a model‑driven representation — and whether a tool can be trusted when the input becomes hostile.</p><h3>References</h3><p><strong>Carrera, E.</strong> (2012) <em>The Art of PE Parsing</em>. Black Hat USA.</p><p><strong>Ling, X., Liu, Y., Zhang, Z., Li, J. &amp; Liu, Y.</strong> (2023) ‘Adversarial Attacks Against Windows PE Malware Detection: A Survey of the State‑of‑the‑Art’, <em>Computers &amp; Security</em>, 128, 103123.</p><p><strong>Nisi, D., Graziano, M., Fratantonio, Y. &amp; Balzarotti, D.</strong> (2021) <em>Lost in the Loader: The Many Faces of the Windows PE File Format</em>. In: Proceedings of the 24th International Symposium on Research in Attacks, Intrusions and Defenses (RAID ’21), 6–8 October, San Sebastian, Spain. ACM.</p><p><strong>Sikorski, M. &amp; Honig, A.</strong> (2012) <em>Practical Malware Analysis: The Hands‑On Guide to Dissecting Malicious Software</em>. No Starch Press.</p><h4>Tools used in this research</h4><p><strong>radare2</strong> (2026) <em>UNIX-like reverse engineering framework and command-line toolset</em>, version 6.1.4. Available at: <a href="https://github.com/radareorg/radare2">https://github.com/radareorg/radare2</a></p><p><strong>PEview</strong> (2026) <em>Portable Executable viewer</em>, version 0.9.9. Available at: <a href="http://wjradburn.com/software/">http://wjradburn.com/software/</a></p><p><strong>CFF Explorer </strong>(2026) <em>Explorer Suite</em>, version III (18/11/2012). Available at: <a href="https://ntcore.com/explorer-suite/">https://ntcore.com/explorer-suite/</a></p><p><strong>Ghidra</strong> (2026) <em>Software reverse engineering (SRE) framework, </em>version 12.1. Available at: <a href="https://github.com/nationalsecurityagency/ghidra">https://github.com/nationalsecurityagency/ghidra</a></p><p><strong>Detect It Easy</strong> (2026) <em>File‑type identification and analysis tool</em>, version 3.21. Available at: <a href="https://github.com/horsicq/detect-it-easy">https://github.com/horsicq/detect-it-easy</a></p><p><strong>IOCX</strong> (2026) <em>An extensible, deterministic static‑analysis engine that extracts high‑signal IOCs from PE binaries and text</em>, version 0.7.4.1. Available at: <a href="https://github.com/iocx-dev/iocx">https://github.com/iocx-dev/iocx</a></p><p><strong>This article is part of <em>The Adversarial PE Analysis Series</em>.</strong></p><p><em>It is based on research conducted for my paper on adversarial PE analysis. A full academic version will be published separately.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1769556ab473" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>