[ Diagnostics & resources ]

DMARC XML analyser guide: bound untrusted input

Plan a DMARC aggregate-report importer with bounded decompression, hardened XML processing, schema-aware interpretation and retained provenance.

By the EmailAuth research team · 6 min read

[ Key points ]

  • Bound expanded data and processing work before analysis begins.
  • Apply external-resource restrictions to parsing, schema validation and transformations.
  • Distinguish current aggregate XML from legacy formats and failure reports.
  • Retain duplicate policy, parser outcomes and the unfulfilled malicious-fixture gate.
On this page

Define a report importer before defining a dashboard

A DMARC XML analyser receives potentially hostile files, not inherently trustworthy statistics. Its first responsibility is to control what it accepts and how much work an input can trigger. Only after safe ingestion should it interpret report fields, correlate records or calculate rates. A parser crash or rejected attachment is a collection problem, not an authentication failure by the reported domain.

This article proposes that pipeline but implements none of it. No report was imported, decompressed or evaluated, and no EmailAuth analyser capability is asserted. The exact working-tool gate remains: Implement and test the promised function. An article, mock-up or specification alone is not a working tool.

Classify the input and bound expansion

Record the source channel, receipt time, declared media type, original filename and a controlled artifact identifier. Treat filename and media type as claims to validate, not proof of safe content. Accept only the documented report formats and compression methods supported by the intended implementation. Define a rejection path for unsupported archives rather than extracting arbitrary nested content.

Set separate limits for incoming bytes, expanded bytes, compression ratio, processing time, memory, nesting and record count. Enforce limits during streaming and decompression, not only after a large object has been built. If a container format is supported, handle member paths and counts safely and do not extract user-selected paths into application directories. The exact thresholds are an implementation decision requiring tests, not universal DMARC constants. OWASP file-upload controls.

Harden every XML processing stage

The proposed importer should reject document type declarations where supported and prevent external entity resolution, external DTD retrieval and unnecessary XInclude. Schema validation and stylesheet processing need their own external-resource restrictions; securing only the initial parser is insufficient. Use trusted local schemas selected by application logic, not a network location supplied by the document.

Treat an unsupported security setting as a configuration failure rather than silently continuing with partial protection. Disable unnecessary network and filesystem access in the processing environment and test the actual parser version and options. Blocking external entities does not by itself prevent resource-exhaustion attacks. OWASP XML External Entity Prevention.

Python illustrates why version labels alone are inadequate. Its live documentation, labelled Python 3.15.2 when reviewed, explains that XML behavior depends on the Expat library and whether the interpreter uses a bundled or system copy. It warns about older Expat versions and several resource attacks. This is a documentation example, not a finding about an installed runtime or a recommendation that one default configuration makes all XML safe. Python XML security.

Interpret the current schema without disguising compatibility

RFC 9990, published in May 2026, defines current DMARC aggregate reporting. Its XML namespace is urn:ietf:params:xml:ns:dmarc-2.0, while the optional version element, if present, has value 1.0. Those labels describe different things; do not rewrite one to match the other. Retain the detected schema and namespace beside the parser version. RFC 9990 schema description.

If an importer supports legacy or vendor-specific variants, declare the compatibility path and its limitations. Do not silently label a transformed legacy document as an untouched current-format report. Preserve unknown extension data appropriately or document why it was ignored, while keeping resource limits active. Format validation and semantic validation are separate stages: a well-formed XML document can still have unusable reporting dates, missing required fields or unsupported values.

Current RFC 9989 describes DMARC itself; RFC 9990 describes aggregate XML, and RFC 9991 describes failure reports about individual messages. Failure reports may include sensitive headers or message content and do not belong in the aggregate XML path merely because their subject mentions DMARC. Classify them separately and obtain the appropriate privacy approval. RFC 9989 and RFC 9991.

Retain provenance through deduplication and analysis

Preserve the reporting organization, report identity, policy domain, reporting interval, arrival time and raw-artifact reference. Record parsing and transformation versions. An identical byte hash can identify an exact duplicate file, but it does not resolve every case of overlapping or revised data. RFC 9990 permits receiver choices for handling duplicates; the analyser must state its policy and show how it affects totals.

Separate raw SPF and DKIM results from the DMARC-related alignment results and reported disposition. Avoid counting rows as messages when a row carries a message count. Also avoid treating valid XML as authenticated truth: RFC 9990 explicitly warns that reports can contain forged information intended to influence decisions. Preserve confidence and corroboration limits rather than automatically authorizing senders or changing policy from imported statistics. RFC 9990 duplicate and security guidance.

Make rejection and recovery reviewable

A rejected input should produce a bounded error with a reason category, parser version and artifact reference, without dumping private contents into ordinary logs. Quarantine under approved access controls, record whether any partial data was retained, and ensure partial records cannot silently enter production totals. A later reprocessing run should identify its changed parser or policy and preserve the earlier outcome.

The commissioning evidence is still absent: A malicious-and-malformed fixture suite with resource limits, expected results and recovery behaviour. Required cases would include oversized expansion, prohibited external references, deep nesting, invalid schema, duplicate identifiers and interrupted processing. These are proposed cases, not payloads executed or tests passed. Sources were reviewed on 8 November 2026. Security review, implementation evidence, independent checking, visual inspection and owner release remain open.

[ Takeaway ]

Safe parsing, format compatibility and credible authentication evidence are separate requirements; none follows merely from valid XML.

[ By role ]

What this means for you

Choose your role for practical next steps.

Parser engineer

Enforce limits before constructing results

A safe ingestion design must account for decompression and every XML processing stage, not just the function that reads a final document tree.

Next steps

  1. Pin the actual parser and dependency versions with supported security options.
  2. Reject unsupported protection settings and prevent unapproved external resources.
  3. Design bounded failures for expansion, nesting, size and interrupted work.

Reporting analyst

Keep counts tied to accepted provenance

A schema-valid row and a credible observation are different things. Preserve import status and duplicate decisions so totals can be reconstructed.

Next steps

  1. Record report source, identity, interval and transformation versions.
  2. Keep message counts distinct from row counts and raw results distinct from alignment.
  3. Exclude quarantined or partial records from final totals unless a documented policy expressly handles them.

Security assurance owner

Require the promised adverse-input evidence

A checklist of controls is not proof that the deployed parser rejects dangerous input. Acceptance should be based on bounded tests and observable recovery behavior.

Next steps

  1. Require malicious and malformed fixtures with explicit expected outcomes.
  2. Observe resource use and error handling in the authorized test environment.
  3. Keep release blocked until the actual implementation and privacy handling are reviewed.

[ FAQs ]

Frequently asked questions

Is disabling external entities enough to make DMARC XML safe?

No. It addresses one attack path. Resource exhaustion can arise from decompression, nesting, token size or other processing behavior. Schema and transformation stages also need external-access restrictions and tested limits.

Should a schema URL inside an imported report be fetched automatically?

No. The proposed pipeline selects trusted local schemas through application configuration and restricts external resources. A report-supplied location must not become permission to read a file or contact a host.

Why does RFC 9990 use a dmarc-2.0 namespace but a version value of 1.0?

They identify different parts of the format. RFC 9990 registers the dmarc-2.0 namespace and specifies 1.0 for the optional version element. Preserve both as defined rather than rewriting either to make the labels look consistent.

May an analyser support older DMARC XML formats?

It can propose an explicit compatibility path, but must label the detected format and transformations. Legacy acceptance must not be presented as untouched current-schema validation, and security limits still apply.

Should an aggregate XML importer process DMARC failure reports the same way?

No. RFC 9991 covers individual-message failure reports, which can contain sensitive headers or content and use a different reporting format. Classify them separately and apply the appropriate access and privacy decisions.

Does a valid aggregate report prove that its reported statistics are true?

No. RFC 9990 warns that false reports can influence policy and platform decisions. Validation checks structure and values; corroboration, provenance and confidence remain separate from whether XML parsing succeeded.

Can identical report IDs simply be deleted without a recorded policy?

Not safely as a general rule. Retain enough source and time context to distinguish retransmission, overlap or inconsistent data. RFC 9990 leaves duplicate handling choices to the receiver, so the analyser must disclose its policy and effect on totals.

Where are the malicious and malformed test results for this analyser?

They have not been produced. The article proposes cases and resource-limit categories but supplies no executed fixture suite or working importer. The exact commissioning and implementation gates remain open.

[ Sources ]

Sources

  1. OWASP File Upload Cheat Sheet
  2. OWASP XML External Entity Prevention Cheat Sheet
  3. Python XML Processing Modules: XML security
  4. RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance
  5. RFC 9990: DMARC Aggregate Reporting
  6. RFC 9991: DMARC Failure Reporting

[ Glossary ]

Glossary

Expansion budget
An implementation-defined bound on how much data and processing a compressed or structured input may produce before it is rejected.
External entity resolution
XML processing that resolves an entity from an external resource, potentially exposing files or causing network access when input is untrusted.
Schema compatibility path
A declared processing route for a supported report format, with its detected namespace and any transformations preserved.
Quarantine outcome
A controlled rejection or sidelining state that retains useful provenance without silently adding questionable data to accepted report totals.
Report credibility
The degree to which a report’s asserted observations are supported by provenance and corroboration, separate from XML well-formedness or schema validity.

Enterprise provenance

Why top financial institutions and governments retired their email security dashboards.

Traditional email authentication platforms sell you a dashboard and ask your engineers to do the labour. In high-stakes environments, manual oversight means delayed enforcement, configuration drift and unmonitored shadow domains.

EmailAuth is the agentic email provenance platform. Our agents enforce p=reject, keep third-party senders aligned and move your domains to full RFC 9989 compliance, the new DMARC standard,, with human-in-the-loop auditability.

Governments Large enterprises Tier-1 financial institutions

SaaS · Dedicated tenancy · Air-gapped on-prem · BYOK encryption

Knowledge Base