What Does the LUXCM-Only File Format Actually Do?

.wpmpx Format Explained—Why I Built a Proprietary File Format and How It Differs from WXR (.xml)

I abandoned WordPress’s standard WXR (.xml) export format and built my own binary format, .wpmpx.

I didn’t do it simply because I wanted something of my own. I made that decision after examining three specific problems that arise the moment you try to move media files in a text-based format such as XML: encoding overhead, upload-size limits, and security vulnerabilities.

In this article, I’ll examine each of those problems, explain the evidence behind them, and show how .wpmpx addresses them in practice.

Base64 Doesn’t End with a “33% Penalty”

Whether you use XML or JSON, binary files such as images and video must be encoded in base64 before they can be embedded in a text-based format.

The overhead from that encoding is mathematically fixed.

As this article on the space overhead of base64 encoding explains, “to send 3 bytes (24 bits) of information, you have to use 4 bytes (24 bits)”—which means the data can become up to 33 percent larger in theory.

But rereading that article made me realize that one important qualification needed to be made.

The article argues that applying gzip compression as well can recover much of that penalty—bringing the overhead down to under 5% for small files and as low as 2.5% for large files compared with the original.

That conclusion is correct, but it depends on an important condition: for gzip to be effective, the data being compressed must still contain “uncompressed repeating patterns.”

The media files I work with—JPEGs, PNGs, and MP4s—are already highly compressed formats in their own right.

With text content, gzip can recover much of the space lost to base64. But in migration files made up largely of photos and video, I found in practice that there was little recovery to expect.

And this is not just a disk-space problem.

The 33 percent expansion becomes especially painful when the same data exists in several forms in memory at once. There are moments when the original file bytes, the enlarged base64 string, the JSON array containing that string, and the option string created by serializing that array all occupy memory simultaneously.

I ran into this problem myself while exporting a media-heavy site.

That is why .wpmpx does not use base64 at all. It copies the attachment bytes directly into a separate binary section at the end of the file, while the metadata stores only the offset and size indicating where that file begins and how many bytes it occupies.

There is no opportunity for the encoding, decoding, or the resulting 33 percent penalty to occur in the first place.

Upload limits are not theoretical—they stop real people from migrating their sites.

I built the split-export feature for a practical reason, not because of an abstract concern.

A roundup by WPBeginner includes concrete figures from users who encountered this problem firsthand.

One user tried to upload a 20MB XML file to a hosting account with a maximum upload limit of 32MB and ran into an error.

Another user had a 121MB file, while the hosting provider allowed only 62MB.

There are two common ways to deal with this problem.

One is to ask the hosting provider to raise the limit temporarily. The other is to use a separate tool to split the file into multiple parts.

Neither struck me as an ideal solution.

Most users on shared hosting cannot change the hosting limit themselves. Using an external splitting tool, meanwhile, creates another manual task: the files must be divided and then reassembled in the correct order on the destination site.

So I built the feature directly into the plugin.

.wpmpx exports are automatically split into multiple parts, using a default size of 19MB that can be adjusted from 1MB to 500MB. On the import screen, users can select all the parts at once, and the importer reads the sequence numbers in the filenames to reassemble the file automatically.

If even one part is missing or duplicated, the system reports it immediately.

My goal was to make the process adaptable to any hosting upload limit simply by adjusting the size of each part.

Parsing XML is itself an attack surface.

I consider the third reason the most important.

The clearest example came from WordPress core itself.

According to Sonar’s analysis, WordPress 5.7 contained an XXE (XML External Entity) vulnerability, CVE-2021-29447.

A user with author-level access—someone permitted only to upload media, for example—could exploit the vulnerability simply by uploading a WAV audio file containing malicious XML in an iXML chunk.

The attacks that were possible included reading internal server files such as wp-config.php, which contains database credentials, and inducing the server to send arbitrary HTTP requests on the attacker’s behalf through SSRF.

Even when the result was not displayed directly on screen, an attacker could exfiltrate the file contents through DNS or HTTP requests—a “blind XXE” attack.

The root cause was an assumption that, in a PHP 8 environment, it was safe to omit the libxml_disable_entity_loader(true) safeguard. In reality, entity substitution was re-enabled because simplexml_load_string() was used with the LIBXML_NOENT flag.

Sonar’s conclusion in this case is clear: “Disabling external entity processing at the configuration level entirely” is a one-line defense that eliminates the entire class of XXE vulnerabilities.

That case made me take seriously the fact that even WordPress’s core development team failed to maintain this protection correctly during XML parsing, resulting in a real vulnerability.

I do not trust the assumption that a file is safe simply because “only an administrator will upload it.”

A compromised administrator account, or a malicious collaborator with administrator privileges who uploads a tampered export file, is a realistic scenario. The fact that this protection was once missed even in WordPress core reinforces that point.

And using a proprietary format such as .wpmpx avoids much of this problem from the outset.

.wpmpx first validates the file using a fixed magic-byte signature and checksum, and only then begins processing. Its metadata is read as gzip-compressed JSON rather than XML.

I keep the XML parser itself behind a narrow passage used only when importing legacy .xml files. I have reduced the attack surface to this “narrow channel left open occasionally for compatibility,” and XXE protection is always enabled within it—this is the structure I chose.

Verifying uploaded files was not just an XML problem.

Beyond the format itself, I also treated the process of verifying that an uploaded file came from a genuine request as something that could not be taken lightly.

A .wpmpx file first uses u003ccodeu003eis_uploaded_file()u003c/codeu003e to verify that the file actually came from an upload associated with the request. It then moves the file through the WordPress filesystem API into a private directory that cannot be listed or executed from outside.

The folder is automatically cleaned up immediately after each file is processed.

This is separate from the fixed signature and checksum validation. It answers a different question: “Was this file actually uploaded as part of this request?” I decided that these two checks—verifying the file’s origin and verifying its contents—should remain separate rather than being combined.

To sum up,

At first glance, .wpmpx has a simple structure: “magic bytes + compressed metadata + binary sections.” But behind that simplicity are answers to three real-world problems.

I eliminated the encoding itself because I knew base64’s overhead could not be fully recovered with gzip when dealing with media files. I built splitting and reassembly into the plugin because I knew hosting upload limits vary and genuinely block people’s migrations. And because I knew XML involved an attack class—XXE—that had even breached WordPress core once, I narrowed the path through which XML is handled and kept its defenses permanently enabled.

I did not create this format simply to have “something of our own.” I created it to close off, one by one, the points where standard formats fail in real-world use.

References

This article was designed using DECOBLOCKS.