Skip to content

Polyglot File

A single file supports valid interpretations under two or more file formats.

Version
v1 · 2026-11-14 · History
Domain-specific #
14886
Domain group
Applied Sciences & Engineering
Origin domain
Computer Science & Software Engineering
Subdomain
Data Formats → Computer Science & Software Engineering

Core Idea

A polyglot file is one file that is valid under two or more file formats. The same bytes can therefore be processed under different format rules, potentially producing different content or behavior depending on the reader. A researcher defining the term in a particular setting should state what counts as validity: formal conformance to a specification and acceptance by a named implementation are related but distinct claims. An implementation may accept extensions or malformed material that another rejects.[1]

A construction can exploit format features such as tolerated additional data or extensible structures, but there is no single required layout. The Mitra project describes several layout strategies and gives a PNG/DICOM example. Its separate category of near-polyglots is a reminder not to assume every composite file is fully valid in every advertised format.[2]

How would you explain it like I'm…

The Two-Language File

Imagine a sentence that makes sense in two different languages, but says different things in each. A polyglot file is like that for computers: one file that two different kinds of programs can both open, and each might see something different.

One File, Many Formats

Computer files come in formats, like picture files or document files, and each format has its own rules. A polyglot file is a single file that follows the rules of two or more formats at once. So one program might open it as a picture while another opens it as something else, and they might show different things. Some programs are pickier than others, so it's important to say exactly what counts as a file being "valid." People build these files by using spots in a format where extra stuff is allowed.

Multi-Format Valid File

A polyglot file is one file that is valid in two or more file formats at once. Because the same bytes can be read under different format rules, different programs might show different content or behave differently with it. When defining the term, it's important to say what "valid" means: matching the official specification exactly is not the same as being accepted by a particular program, since some programs accept extra or broken data that others reject. Polyglots are built by exploiting format features, like allowing extra data or extendable structures, but there's no single required layout. The Mitra project describes several layout strategies, gives a PNG/DICOM example, and separately identifies "near-polyglots" that aren't fully valid in every format they claim.

 

A polyglot file is a single file that is simultaneously valid under two or more file formats, so that identical bytes can be parsed according to different format rules, potentially yielding different content or behavior depending on which reader processes it. Precision about validity is essential: formal conformance to a specification and acceptance by a named implementation are related but distinct claims, since implementations may tolerate extensions or malformed data that others reject. Polyglot construction exploits format features such as tolerated trailing or extra data and extensible structures, but no single layout is required. The Mitra project catalogs several layout strategies and provides a PNG/DICOM example. It also distinguishes near-polyglots, which caution against assuming that every composite file is fully valid in each format it is advertised as.

Structural Signature

  • One byte sequence: the same stored file is examined in each case.
  • Two or more interpretations: distinct format conventions or implementation behaviors govern parsing.
  • Validity evidence: specification analysis supports conformance; tests of named reader versions establish observed acceptance. The two kinds of evidence are not interchangeable.
  • Layout: the arrangement satisfies the applicable requirements in the tested setting; extra data, containers, offsets or other format-specific features may make this possible.
  • Interpretive result: the content or behavior obtained under each interpretation can differ, though difference in visual appearance is not itself a validity test.

What It Is Not

A renamed extension or a file containing an ordinary embedded object is not automatically a polyglot: the relevant question is whether the same complete file meets the stated validity criterion for each format. Two readers disagreeing about malformed bytes is evidence of a parser discrepancy, but does not by itself prove specification conformance to two formats.

A polyglot need not be malicious, executable, intended to deceive, or accepted identically by all versions of a parser. A security-sensitive file can nevertheless exploit an identification gap when one component recognizes one format while a later component processes another.[1]

Scope of Application

Polyglot files arise in format research, compatibility experiments and security analysis. Mitra's example combines PNG and DICOM representations; its listed construction methods include stacking and placing one format within permitted structures of another. The ORNL study analyzes a collection of malicious uses and detection methods; it does not establish that all polyglots are malicious or that one detector works universally.[2][1]

Clarity

Name the whole file, both formats, the intended validity criterion and the readers or specifications used to check it. Separate claims about what the bytes represent from claims about how a particular operating system routes or executes them. Record version and conformance assumptions where they matter.

Manages Complexity

One byte sequence can be built or interpreted under multiple conventions without making those conventions identical. This can be useful for testing format interactions; it also complicates pipelines that select analysis solely from a single detected type. Verification must examine each relevant interpretation rather than rely only on an extension or first signature.[1]

Abstract Reasoning

Choose the interpretations to be supported; identify their relevant syntactic and semantic constraints; arrange compatible data; and test the whole result under the stated specifications or implementations. Check each result separately and distinguish a genuine two-format file from a merely embedded or near-polyglot object.

Example

The Mitra project documents a construction from PNG and DICOM inputs that it describes as a working PNG/DICOM polyglot. The example is a claim about that construction; actual acceptance should be tested with the intended readers and versions.[2]

Neighborhood in Abstraction Space

Polyglot File sits in a sparse region of the domain-specific corpus (92nd percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Unclustered & Miscellaneous (3155 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

Not to Be Confused With

A file format is a convention for organizing and interpreting files; a polyglot file is an instance with multiple interpretations. Parser differential means implementations disagree on some input and may occur without a file conforming to two distinct formats. Historical dual-format floppy media concern a physical disk layout for different systems; they require their own evidence and are not established by modern file examples.

Historical Companion: Dual-Format Floppy Media

A dual-format floppy disk can be designed to carry material usable by different computer systems on one physical medium. In its August 1988 issue, ST Amiga Format described its cover disk as readable by both the Atari ST and Commodore Amiga and supplied separate instructions for their users. That is a claim about the magazine's disk and those systems, not a claim that every such disk uses the same physical layout.[3]

The Library of Congress later described a preservation example in which KryoFlux can produce Amiga and Atari ST sector-image outputs from a dual-format disk. That observation concerns imaging and interpretation of the medium; it does not by itself establish how the historical disk boots or how a particular track is arranged.[4]

This historical media example is related to, but distinct from, a polyglot file. A physical disk can contain different regions or system-specific structures; its usability on two machines does not establish that one complete file conforms to two file formats. The disk need not instantiate this entry's single-file signature.[3][4]

References

[1] Luke Koch and colleagues, “Where the Polyglots Are: How Polyglot Files Enable Cyber Attack Chains and Methods for Detection & Disarmament,” 2024, research manuscript. registry ↩a ↩b ↩c ↩d

[2] Corkami, “Mitra,” binary polyglot generator and project documentation. registry ↩a ↩b ↩c

[3] ST Amiga Format Issue 2 (August 1988), pp. 64–65, 70, cover-disk contents and instructions. registry ↩a ↩b

[4] Library of Congress, “KryoFlux Stream File”, Notes, Sustainability of Digital Formats, last significant update January 18, 2024. registry ↩a ↩b