Join our Newsletter — 33% off our NHI Course
Home› Guides› D3-CNR Content Rebuild: Rebuilding Untrusted Files Safely and…
Guide Email & Communications Security

D3-CNR Content Rebuild: Rebuilding Untrusted Files Safely and Proving It Works

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 12 November 2026 14 min read
On this page

Scanning can only block what it recognises, so a file built to evade detection still reaches the user unless something rebuilds it into a known safe form first. MITRE D3FEND names that countermeasure Content Rebuild (D3-CNR), synonym Content Reconstruction, and defines it as "Rebuild the file according to the spec so any unreferenced components or objects are removed." It sits under the Isolate tactic as a child of Content Modification (D3-CM), which in turn sits under Content Filtering (D3-CF). This card covers what D3-CNR does to a file, which ATT&CK techniques D3FEND relates to it, where it is deployed, how to test that rebuilt files are actually clean and still usable, and where the technique stops. It is written for email, web and application security engineers who already know the purchasing side from the Content Disarm and Reconstruction buyer's guide.

Key takeaways

  • Rebuild, not repair. D3-CNR parses a file into components and assembles a new file from the parts that conform to the format specification, so anything the specification does not reference is left behind.
  • It is the reconstruction half of CDR. D3FEND's only reference for the whole Content Modification family is an OPSWAT patent on content disarm and reconstruction, which disassembles structured storage, processes each item and reassembles an output file in the same format.
  • The ATT&CK links are broad and inferred. D3FEND relates D3-CNR to a long list of techniques because it modifies the File artefact; the techniques where rebuilding genuinely changes the outcome are malicious attachments, macros, file padding and hidden content.
  • Verification is part of the control. The UK NCSC safe import pattern places a separate verification step after transformation and says every verification failure should raise an alert, because in a working design it should never fail.
  • It is not a guarantee. The parser that rebuilds the file processes hostile input, and the NCSC states the import pattern "is not a guarantee of safety"; keep scanning, sandboxing and macro controls alongside it.

D3-CNR at a glance

AttributeValue
D3FEND IDD3-CNR (d3f:ContentRebuild), synonym Content Reconstruction
TacticIsolate
Parent techniqueContent Modification (D3-CM), under Content Filtering (D3-CF)
Sibling techniquesContent Excision (D3-CNE), Content Format Conversion (D3-CFC), Content Substitution (D3-CNS)
Digital artefacts (inherited from D3-CM)Modifies File; filters Digital Media, File Content Block and File Metadata; enforces Content Policy
D3FEND referencePatent US20190268352A1, Method For Content Disarm and Reconstruction (OPSWAT, Inc.)
Typical inputsOffice documents, PDF, images, archives, files arriving by email, web download, upload or cross-domain transfer
Main limitationOnly helps formats the engine can parse and rebuild; encrypted and unsupported files need a separate policy decision

D3FEND version 1.6.0, checked November 2026. The parent, sibling and artefact relations above are taken from the D3FEND ontology; D3-CNR declares no artefact relations of its own and inherits them from D3-CM.

How it works

D3FEND's description is brief: if content is divided into components for scrutiny, "the components may be combined back afterwards in a safer state." The OPSWAT patent that D3FEND cites gives the mechanism in more detail. The engine receives a file with structured storage, disassembles it into stream subfiles, identifies each item, judges the item on three questions (is its behaviour acceptable, is it visible to the user, is it necessary) and then assembles the processed subfiles into an output file of the same format as the input.

  • Parse against the specification: the engine reads the file using the format's own structure (for example the parts inside an Office Open XML package, or the object tree of a PDF), not by searching for known bad patterns.
  • Keep what is referenced and needed: text, layout, images and other content that the document actually uses are carried into the new file.
  • Drop what is unreferenced or unwanted: orphan objects, data appended after the logical end of the file, hidden streams and active elements the content policy forbids are not carried over. Deciding what to do with a forbidden element is where the siblings come in: remove it (Content Excision), replace it with a placeholder (D3-CNS Content Substitution) or convert the file to a simpler format (Content Format Conversion).
  • Write a new file: the output is generated, not edited in place, which is why padding, appended payloads and malformed structures that rely on parser leniency do not survive.

The UK NCSC safe import pattern puts the same idea in an architecture: transform complex content into a simpler form on the untrusted side, pass it through a protocol break and one-way flow control, then verify it on the trusted side, where "verification components should ensure all potentially active content has been removed." The pattern also notes that after verification "you may need to re-build an object in its original format" so the recipient can use it. Rebuilding is therefore both a transformation step and, in some designs, the final step before delivery.

ATT&CK techniques D3FEND relates to D3-CNR

Relationship type: inferred only. D3FEND lists no direct ATT&CK mapping for D3-CNR. Its site derives related techniques through shared digital artefacts and labels them "inferred, experimental" (D3FEND 1.6.0, checked November 2026). Because D3-CNR modifies the File artefact, the inferred list is long: more than a hundred technique names across persistence, privilege escalation, stealth, credential access, collection, execution, command and control, exfiltration, initial access, lateral movement and impact, most of them simply because the technique reads, writes or executes a file.

The table below is a selection, made by NHI Mgmt Group, of the inferred techniques where rebuilding a file in transit genuinely changes the outcome. Each ID was checked against ATT&CK v20. D3FEND's list also includes Impair Defenses entries that ATT&CK v20 has revoked; the v20 successors include T1685 Disable or Modify Tools, which content rebuild does not affect.

ATT&CK IDTechniqueWhat rebuilding changes (NHI Mgmt Group view)
T1566.001Spearphishing AttachmentThe delivered attachment is a regenerated copy without the active or malformed parts
T1566.003, T1534Spearphishing via Service, Internal SpearphishingSame effect where files from collaboration services or internal mail pass the rebuild point
T1204.002Malicious FileThe file the user opens no longer carries the payload the attacker relied on the user to run
T1137, T1137.001, T1137.003Office Application Startup, Office Template Macros, Outlook FormsMacro projects and form code are not carried into the rebuilt file when policy forbids them
T1564.007VBA StompingHidden or mismatched VBA streams are dropped with the macro project
T1027.001Binary PaddingData outside the format structure is not rewritten into the output
T1027, T1140Obfuscated Files or Information, Deobfuscate/Decode Files or InformationEncoded content hidden in unused objects or streams does not survive the rebuild
T1036.005, T1036.006Match Legitimate Resource Name or Location, Space after FilenameLimited: rebuilding changes content, not names; pair with file type verification
T1005, T1074.001, T1083, T1119Data from Local System, Local Data Staging, File and Directory Discovery, Automated CollectionLittle practical effect; listed by D3FEND only because these techniques act on files

Read the last two rows as a warning about inferred mappings: D3FEND relates them through the File artefact, but rebuilding inbound files does not stop an attacker already on a host from collecting or staging local data. For the defensive detail on those techniques, see MITRE ATT&CK T1005 Data from Local System and T1074 Data Staged. The initial access path is covered in MITRE ATT&CK T1566 Phishing and T1204 User Execution.

Where it is implemented

Implementation classWhere the rebuild happensPractical notes
Email security gateway or cloud email service with CDRAttachments in inbound mail, before deliveryDecide how users request the original and who approves release
Secure web gateway or remote browser isolation with file sanitisationFiles downloaded through the proxyLarge files add latency; see the Remote Browser Isolation Guide
CDR engine called by APICustomer and partner uploads inside applications and pipelinesThe OWASP File Upload Cheat Sheet advises running uploads "through CDR (Content Disarm & Reconstruct) if applicable type", naming PDF and DOCX; see the File Upload Security Guide
Image processing libraries in the applicationUploaded images re-encoded to a permitted format with metadata strippedOWASP cautions that "Rewriting does not guarantee that all malicious content is removed" and that the image library itself needs restricted formats, resource limits and sandboxing
File transfer and storage connectorsPartner transfers, shared drives, cloud storageSee the Managed File Transfer (MFT) Security Guide
Cross domain solution or import kioskContent moving into a higher-trust network, including removable media importsRebuild on the low side, verify on the high side, as the NCSC import pattern describes

Deployment steps

  1. Map entry points and file mix. List every way untrusted files arrive and sample a month of traffic per channel: file types, sizes, archive nesting depth and the share of encrypted or password-protected files. This sample becomes the test corpus.
  2. Write the content policy per channel. For each file type decide what may survive: macros, embedded objects, external links, form actions, hidden text, comments, metadata. D3FEND's Content Policy artefact is this decision, written down.
  3. Define outcomes for files that cannot be rebuilt. Encrypted archives, signed documents, malformed files and unsupported types need a fixed outcome: block, quarantine (Content Quarantine, D3-CQ, is the D3FEND technique), release on request, or deliver with a warning.
  4. Run in report-only mode first. Where the product allows, log what would be removed without changing delivery. Review the log with the business owners of affected workflows, such as finance workbooks with macros or signed contracts.
  5. Pilot with one channel and one group. Turn on rebuilding for inbound email to a pilot group, measure fidelity complaints and release requests for two to four weeks, then widen.
  6. Add verification after rebuild. Check that the output is well formed and contains no forbidden element. In high-assurance designs this is a separate component; in commercial deployments it is often a second scan of the rebuilt file.
  7. Plan rollback. Keep originals in a protected store for a defined period so a broken rebuild can be reversed by releasing the original after review, and keep a per-channel switch to fall back to scan-and-block if the engine fails.

How to verify it works

A rebuild engine that silently passes files through looks the same as one that rebuilds them. Testing needs harmless samples with known structure.

  • Known-structure test files: build a corpus of benign files that each contain one feature policy should remove: a document with a harmless macro, a PDF with a JavaScript action that only shows a message, a document with an external template reference, a file with data appended after its end marker, an image with location metadata. Send each through every channel and inspect the output structure.
  • Byte-level difference: the hash of every rebuilt file should differ from the original. Identical hashes on supported types mean the file was passed through, not rebuilt.
  • Fidelity checks: open the rebuilt files in the applications users rely on and confirm text, tables, formulas and images are intact. Poor fidelity drives users to personal email and file sharing, which bypasses the control.
  • Bypass checks: send the same samples inside an archive, inside a password-protected archive and as an embedded object inside another document, and confirm the nested content is handled or the policy outcome applies. The NCSC content-based attack protection principle asks for nested content to be expanded, transformed and verified the same way as the outer file.
  • Verification alerts: confirm a deliberately malformed file produces an alert rather than a silent drop.
MetricExample target (NHI Mgmt Group suggestion, not a standard)Why it matters
Test corpus files with the forbidden element removed, per channel100% on every monthly runProves the rebuild still runs after updates and policy changes
Share of supported files actually rebuilt (hash changed)Close to 100%Catches pass-through after errors or size limits
Files ending in the cannot-rebuild outcomeTracked by type and channelShows how much traffic escapes the control, for example encrypted archives
Original release requests per 1,000 rebuilt filesFalling after the pilotMeasures fidelity and policy fit
Verification failures raised as alertsEvery failure investigatedThe NCSC pattern treats a failure as a sign the transformation step is faulty or compromised

Limits, bypasses and failure patterns

  • The rebuild engine is an attack surface. It parses hostile input by design. The NCSC pattern says the transformation engine "could itself be vulnerable to attack" and places it on the untrusted side; patch the engine promptly and run it with least privilege and resource limits.
  • Encrypted content passes untouched. A password-protected archive cannot be rebuilt without the password, and attackers often put the password in the email body. Decide the outcome explicitly; the default should not be silent delivery.
  • Unsupported formats fall through. A product that rebuilds Office and PDF but not disk images, scripts, CAD files or less common archive formats leaves those paths open. Pair rebuild with file type allowlisting and D3-FFV File Format Verification.
  • Links are content, not structure. A rebuilt document can still carry a perfectly valid hyperlink to a credential phishing page unless the policy rewrites or removes links. That is a substitution decision, not a rebuild one.
  • Release workflows reopen the gap. If users can release originals without review, the control becomes advisory. Restrict release rights and log every release.
  • Coverage stops at the channels you instrument. Files that arrive by personal webmail, unmanaged cloud storage or USB do not pass the rebuild point. The Office Macro Blocking Guide covers the endpoint control that still applies.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5SI-3 Malicious Code ProtectionProtection at system entry points, of which rebuilding is one mechanism
NIST SP 800-53 Rev 5AC-4(8) Security and Privacy Policy Filters, AC-4(14) Security or Privacy Policy Filter ConstraintsContent filters enforced on information flows, including files moving between domains
NIST SP 800-53 Rev 5SC-18 Mobile CodeControls on macros and other active code in documents
NIST CSF 2.0PR.PS-01, DE.CM-09Configuration practices for the rebuild platform; monitoring of software and data for adverse events
MITRE D3FENDD3-CF, D3-CM, D3-CNRGrandparent, parent and technique
  • Content Substitution (D3-CNS): replaces a non-compliant element with a safe alternative instead of dropping it; see D3-CNS Content Substitution.
  • Content Excision (D3-CNE) and Content Format Conversion (D3-CFC): the other two Content Modification children, for removing parts or flattening to a simpler format.
  • Content Quarantine (D3-CQ) and Content Validation (D3-CV): Content Filtering siblings for files that fail policy or need checking before release.
  • Analysis techniques: D3-FCOA File Content Analysis and D3-DA Dynamic Analysis detect what rebuilding may miss. The wider model is in the MITRE D3FEND Guide.

Practitioner checklist

  • Inventory every inbound file channel and its real file mix before choosing where to rebuild.
  • Write a per-channel content policy covering macros, embedded objects, links, hidden content and metadata.
  • Set a fixed outcome for encrypted, signed, malformed and unsupported files.
  • Start in report-only mode, then pilot one channel and one group.
  • Verify rebuilt output separately and alert on every verification failure.
  • Run a monthly corpus of harmless known-structure files through every channel and check hashes changed.
  • Test nested and password-protected content, not only top-level files.
  • Restrict and log release of originals.
  • Patch the rebuild engine promptly and run it with least privilege and resource limits.

Standards and references

Related NHI Mgmt Group resources: Content Disarm and Reconstruction · File Upload Security Guide · Email Security Guide · Macro Malware Guide · MITRE D3FEND Guide

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 12 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org