Join our Newsletter — 33% off our NHI Course
Home› Guides› D3-CNS Content Substitution: Replacing Risky File Content and…
Guide Email & Communications Security

D3-CNS Content Substitution: Replacing Risky File Content and Verifying the Result

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 12 November 2026 11 min read
On this page

Deleting every risky element from a file is safe but often breaks the file, while leaving the element in place is usable but unsafe; content substitution is the middle path of swapping the element for something harmless. MITRE D3FEND names this countermeasure Content Substitution (D3-CNS) and defines it as "Modifies specific digital content information by replacing it with something else." It sits under the Isolate tactic as a child of Content Modification (D3-CM), alongside Content Excision, Content Format Conversion and Content Rebuild. This card explains what gets substituted in practice, which ATT&CK techniques D3FEND relates to it, where the technique is implemented, how to test that substitutes are safe and the file still works, and where substitution stops helping. It is for email, web and application security engineers who run or are designing a content disarm and reconstruction (CDR) pipeline; the rebuild step itself is covered in D3-CNR Content Rebuild.

Key takeaways

  • Replace, do not just remove. D3FEND's description is that when malicious or unnecessary elements are found, or an embedded portion does not comply with policy, "it may be replaced with alternatives to ensure safety."
  • It is a policy action inside CDR. D3FEND's only reference for D3-CNS is the same OPSWAT content disarm and reconstruction patent used for the whole Content Modification family; in products, substitution is usually one of several actions a CDR policy can take per element.
  • The substitute must be inert and honest. A placeholder that tells the user what was replaced keeps trust and cuts release requests; a silent swap leaves users confused about what changed.
  • The ATT&CK links are broad and inferred. D3FEND relates D3-CNS to techniques through the File artefact; the practical value is against malicious attachments, macros, embedded objects and links in delivered files.
  • Test the substitute, not only the removal. A rewritten link that resolves to an unchecked page, or a re-encoded image produced by a vulnerable library, moves the risk rather than removing it.

D3-CNS at a glance

AttributeValue
D3FEND IDD3-CNS (d3f:ContentSubstitution)
TacticIsolate
Parent techniqueContent Modification (D3-CM), under Content Filtering (D3-CF)
Sibling techniquesContent Excision (D3-CNE), Content Format Conversion (D3-CFC), Content Rebuild (D3-CNR)
Digital artefactsModifies 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 substitutionsActive content to a notice, hyperlinks to inspected links, images to re-encoded copies, metadata values to neutral values
Main limitationThe substitute inherits trust; if it is not itself safe or checked, the attack moves to the substitute

D3FEND version 1.6.0, checked November 2026. In the D3FEND ontology the artefact relations are declared on the parent D3-CM and inherited by D3-CNS; the D3FEND site lists the same relations for D3-CNS.

How it works

Content substitution acts on one element at a time. The CDR engine parses the file, identifies each element, compares it with the content policy, and for elements that fail the policy chooses a replacement rather than deleting them or rejecting the whole file. The OPSWAT patent that D3FEND cites frames the element-level decision around three questions: whether the element's behaviour is acceptable, whether it is visible to the user, and whether it is necessary. Substitution suits elements that are visible or necessary but whose behaviour is not acceptable.

ElementExample substituteWhy substitute rather than remove
Macro project or script in a documentA short visible notice that active content was removed, and where to request the originalUsers see why a button or automation no longer works and do not open a support ticket
Embedded object (for example an embedded executable or OLE package)A static image or icon of the object, or a text notePage layout survives, so the document still reads correctly
Hyperlink in a document or messageA rewritten link that routes through a checking service, or the plain text of the original URLThe reader keeps the reference without a direct click to an unchecked destination
ImageA re-encoded copy in a permitted format with metadata strippedThe picture stays; hidden data in the original encoding does not
Metadata values (author, path, comments, location)Neutral or empty valuesRemoves information leakage while keeping a valid file structure that requires the field
Form actions in PDFInert form fieldsThe form can still be read and printed

The OWASP File Upload Cheat Sheet recommends converting uploaded images into a permitted format and stripping unneeded metadata, and cautions that "Rewriting does not guarantee that all malicious content is removed." It also notes that the image library is processing untrusted input and should run with restricted formats, resource limits and sandboxing. The same caution applies to every substitution engine.

ATT&CK techniques D3FEND relates to D3-CNS

Relationship type: inferred only. D3FEND lists no direct ATT&CK mapping for D3-CNS. Its site derives related techniques through shared digital artefacts and labels them "inferred, experimental" (D3FEND 1.6.0, checked November 2026). Because D3-CNS modifies the File artefact, the list spans most ATT&CK tactics. The table is a selection, made by NHI Mgmt Group, of techniques where substituting content in delivered files genuinely changes the outcome; each ID was checked against ATT&CK v20. D3FEND's list also carries Impair Defenses entries that ATT&CK v20 has revoked; the v20 successors include T1685 Disable or Modify Tools, which substitution does not affect.

ATT&CK IDTechniqueWhat substitution changes (NHI Mgmt Group view)
T1566.001Spearphishing AttachmentActive parts of the attachment are replaced before delivery
T1566.002Spearphishing LinkLinks inside delivered documents can be replaced by checked or non-clickable versions
T1204.002Malicious FileThe element the user was meant to trigger is no longer there to run
T1137, T1137.001Office Application Startup, Office Template MacrosMacro code is replaced by a notice when policy forbids macros
T1564.007VBA StompingThe VBA project, including any mismatched streams, is replaced as a whole
T1027Obfuscated Files or InformationObfuscated content in a substituted element is not carried forward
T1036.005, T1036.006Match Legitimate Resource Name or Location, Space after FilenameLimited: substitution changes content, not file names; pair with file type checks
T1005, T1070.004, T1072, T1074.001, T1083, T1119Data from Local System, File Deletion, Software Deployment Tools, Local Data Staging, File and Directory Discovery, Automated CollectionLittle practical effect; related by D3FEND only because these techniques act on files

For the defensive detail on the initial access path, see MITRE ATT&CK T1566 Phishing and T1204 User Execution. On-host techniques such as MITRE ATT&CK T1072 Software Deployment Tools need host and identity controls, not content substitution.

Where it is implemented

  • CDR engines and services: per-element policy actions (keep, remove, replace) for macros, embedded objects, links and metadata, applied by email gateways, web gateways, file transfer connectors and APIs. The Content Disarm and Reconstruction buyer's guide covers how to evaluate these.
  • Email security link rewriting: many email security services replace URLs in messages with links that route through a checking service at click time. This is substitution applied to message content rather than to attachments; see the Email Security Guide.
  • Application upload pipelines: image re-encoding and metadata replacement in the application, using an image or document library, as covered in the File Upload Security Guide.
  • Cross domain solutions: in an import gateway, a complex element may be substituted with a simpler, verifiable form before the protocol break, following the transformation and verification steps of the NCSC safe import pattern.

Deployment steps

  1. Choose the action per element type. For each file type and channel, record whether each element class is kept, removed (excision) or replaced (substitution). Substitution is usually right for visible elements users notice when missing.
  2. Design the substitutes. Write the notice text, choose the placeholder image, decide whether rewritten links are clickable, and confirm the substitute itself contains no active content.
  3. Keep a change record per file. Log which elements were substituted, so analysts and users can see what changed. The NCSC cross domain principles note that the end user must still be able to judge whether a transformation has changed the data.
  4. Run in report-only mode. Log the substitutions that would happen for two to four weeks and review them with the owners of affected workflows.
  5. Pilot and widen. Enable substitution for one channel and group, track release requests and complaints, then extend.
  6. Verify after substitution. Check that the output is well formed and that no forbidden element remains; raise an alert on every verification failure, as the NCSC import pattern advises.
  7. Roll back safely. Keep originals in a protected store for a defined period and allow reviewed release, so a bad substitution can be reversed without disabling the control.

How to verify it works

  • Known-structure corpus: send harmless test files through every channel, each containing one element that policy should replace: a document with a harmless macro, a document with an embedded object, a PDF with a form action, an image with location metadata, a document with a hyperlink. Confirm the substitute appears and the original element does not.
  • Substitute inspection: open the output and confirm the notice text is present, the placeholder renders, and rewritten links resolve through the checking service rather than directly.
  • Nested content: repeat with the same samples inside archives and embedded documents. The NCSC content-based attack protection principle asks for nested content to be expanded, transformed and verified like the outer file.
  • Fidelity: confirm layout and remaining content are unchanged apart from the substituted elements.
MetricExample target (NHI Mgmt Group suggestion, not a standard)Why it matters
Corpus elements replaced as policy requires, per channel100% on every monthly runProves substitution still runs after updates
Substitutes containing any active contentZeroThe substitute must be inert
Release requests per 1,000 processed filesFalling after the pilotShows the substitutes keep files usable
Files with a complete change record100%Lets users and analysts see what changed
Verification failures raised as alertsEvery failure investigatedA failure points to a faulty or compromised transformation step

Limits, bypasses and failure patterns

  • Substitutes that point somewhere unchecked: a rewritten link only helps if the checking service evaluates the destination at click time; a link replaced by another direct link changes nothing.
  • Silent substitution: users who find a broken document with no explanation forward the original through personal channels, which bypasses the control.
  • Vulnerable substitution libraries: image and document libraries parse hostile input. Patch them, restrict formats and run them sandboxed with resource limits, as OWASP advises for image rewriting.
  • Encrypted and unsupported content: elements inside password-protected archives or unsupported formats cannot be substituted; set an explicit outcome instead of silent delivery.
  • Substitution of the wrong layer: replacing the visible text of a link but not its target, or the thumbnail of an embedded object but not the object, leaves the risky element in place. Test the structure, not the appearance.
  • Treating substitution as detection: substitution removes risk silently and produces few alerts. Keep D3-FCOA File Content Analysis and sandboxing so you still learn who is being targeted.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5SI-3 Malicious Code ProtectionProtection at entry points, of which content substitution is one mechanism
NIST SP 800-53 Rev 5AC-4(8) Security and Privacy Policy FiltersPolicy filters on information flows that modify non-compliant content
NIST SP 800-53 Rev 5SC-18 Mobile CodeControls on macros and active code in documents
NIST CSF 2.0PR.PS-01Configuration practices for the substitution policy and platform
MITRE D3FENDD3-CF, D3-CM, D3-CNSGrandparent, parent and technique

Practitioner checklist

  • Decide keep, remove or replace for every element class, per channel.
  • Design substitutes that are inert and tell the user what was replaced.
  • Route rewritten links through click-time checking, or make them non-clickable.
  • Log a change record for every processed file.
  • Start in report-only mode, then pilot one channel and group.
  • Verify output after substitution and alert on every failure.
  • Test nested and encrypted content, and set an explicit outcome for what cannot be processed.
  • Patch and sandbox the libraries that perform substitution.

Standards and references

Related NHI Mgmt Group resources: D3-CNR Content Rebuild · Content Disarm and Reconstruction · Office Macro Blocking Guide · Email Security Guide · MITRE D3FEND Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

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.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.