Join our Newsletter — 33% off our NHI Course
Home› Guides› D3-PCSV Process Code Segment Verification: Catching Tampered Code…
Guide SOC & Detection Engineering

D3-PCSV Process Code Segment Verification: Catching Tampered Code in Running Processes

PDF for newsletter subscribers · free to read online

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

Once an exploit or injector has rewritten the executable code of a running process, every file on disk can still look clean, so the only place the change shows is in memory. MITRE D3FEND names the countermeasure Process Code Segment Verification (D3-PCSV) and defines it as "Comparing the "text" or "code" memory segments to a source of truth." It sits under the Detect tactic as a child of Process Analysis, beside siblings such as Process Spawn Analysis and Process Self-Modification Detection. This card explains how D3-PCSV works, which ATT&CK techniques D3FEND relates to it, where it is implemented, how to prove it works and where it can be bypassed. It is written for detection engineers, EDR owners and incident responders who already know the injection basics in the T1055 Process Injection Defensive Guide.

Key takeaways

  • It compares memory with a reference. D3-PCSV checks the loaded code segment of a process (the "text" section, including the import table) against a system of record such as the on-disk binary, a remote checksum or an embedded checksum.
  • D3FEND relates it to exploitation and injection. Through the Process Code Segment artefact, D3FEND links it to Process Hollowing (T1055.012), Credential API Hooking (T1056.004) and the exploitation techniques T1068, T1203, T1210, T1211 and T1212.
  • The verifier is part of the attack surface. D3FEND's own considerations note that local verification logic, periodic checks and a modifiable source of truth can all be defeated.
  • Relocation and legitimate patching cause false positives. Address randomisation, rebasing and security products that hook APIs all change code bytes, so the verifier must account for relocations and known hooks.
  • Detection should lead to eviction. D3FEND names Process Termination and Executable Denylisting as follow-on actions when a code segment is found altered.

D3-PCSV at a glance

AttributeValue
D3FEND IDD3-PCSV (d3f:ProcessCodeSegmentVerification)
TacticDetect
Parent techniqueProcess Analysis (D3-PA)
Digital artefactProcess Code Segment (D3FEND relation: verifies Process Code Segment)
Systems of record named by D3FENDOn-disk application binary files or checksums; remotely stored binary data or checksums; embedded binary data or checksums
When it runsAt application start-up or continuously during execution
Where the verifier livesA separate third-party process, logic embedded at compile time, or logic linked dynamically at runtime
Typical data sourcesEDR memory scanning, memory forensics, in-application anti-tamper guards, operating system tampering events
Main limitationPoint-in-time or locally hosted checks can be raced or disabled; legitimate code changes must be modelled

How it works

D3FEND describes a process code segment as the executable portion of a process's virtual address space that corresponds to the loaded image code segment. D3-PCSV compares that segment with an expected value. The design has three choices.

  • Timing: verify once when the application starts, or repeatedly while it runs. A start-up check catches a patched image on disk or a loader that was tampered with; only a continuous check catches code rewritten after start, which is where hollowing, hooking and exploit payloads act.
  • Placement of the verifier: D3FEND lists three options. An external process (an EDR sensor or a memory scanner) is harder for the target to tamper with. Logic embedded at compile time is the anti-tamper "guard" model described in the Arxan and Purdue patents D3FEND cites. Dynamically linked logic sits between the two.
  • Source of truth: the on-disk binary is convenient but is the same file an attacker may already have replaced. A remote checksum or a signed embedded value is harder to forge. D3FEND warns that verification based on a system of record that a malicious user can modify may fail.

When the comparison fails, D3FEND points to Eviction techniques: Process Termination (D3-PT) to end the process, and Executable Denylisting (D3-EDL) to stop the executable launching again. In practice most implementations raise an alert first, collect the altered memory region for analysis, and terminate only where a high-confidence rule is in place. Termination is covered in D3-PT Process Termination.

What a mismatch usually means

  • Hollowing or image replacement: the process name and path are legitimate but the mapped code is a different program. Sysmon records this pattern as Event ID 25, ProcessTampering, which Microsoft describes as generated "when process hiding techniques such as "hollow" or "herpaderp" are being detected."
  • Inline hooks: a few bytes at the start of an exported function are overwritten with a jump, the pattern behind Credential API Hooking (T1056.004).
  • Exploit payload residue: code pages altered during exploitation of the process itself, the pattern D3FEND links to the exploitation techniques.
  • Legitimate change: a security product's own hooks, a compatibility shim or a debugger breakpoint. These are the main source of noise.

ATT&CK techniques D3FEND relates to D3-PCSV

Relationship type: inferred only. Every row below is inferred by D3FEND through the shared Process Code Segment artefact: D3-PCSV verifies Process Code Segment, and these ATT&CK techniques modify or may modify it (D3FEND 1.6.0, checked November 2026). Each ID was checked against ATT&CK v20.

ATT&CK IDTechniqueD3FEND relation (inferred via artefact)What verification can catch
T1055.012Process Hollowingmodifies Process Code SegmentA legitimate process whose mapped code no longer matches its image file
T1056.004Credential API Hookingmay-modify Process Code SegmentOverwritten prologue bytes in authentication or input functions
T1068Exploitation for Privilege Escalationmodifies Process Code SegmentCode pages altered during exploitation of a privileged process
T1203Exploitation for Client Executionmodifies Process Code SegmentCode changes in browsers, document readers and office applications after a malicious file is opened
T1210Exploitation of Remote Servicesmay-modify Process Code SegmentAltered code in a network service process after remote exploitation
T1211Exploitation for Stealthmay-modify Process Code SegmentCode changes in a security tool that was exploited to blind it
T1212Exploitation for Credential Accessmay-modify Process Code SegmentAltered code in an authentication service process

The D3FEND ontology also relates the same artefact to four ATT&CK for ICS techniques: Exploitation for Evasion (T0820), Exploitation of Remote Services (T0866), Hooking (T0874) and Exploitation for Privilege Escalation (T0890). Treat all rows as a placement guide, not a coverage claim: verification detects a technique only if it runs after the change, against the right process, with a trustworthy reference. Defensive detail for the exploitation rows is in T1068 Exploitation for Privilege Escalation, MITRE ATT&CK T1203 Exploitation for Client Execution and MITRE ATT&CK T1211 Exploitation for Stealth.

Where it is implemented

Implementation classWhat it providesVerifier placementFits when
EDR memory scanningSensor compares in-memory images with on-disk files, flags unbacked executable memory and hollowed processesExternal process with kernel supportYou run an EDR fleet and want continuous coverage
Operating system tampering eventsSysmon Event ID 25 ProcessTampering for hollowing and herpaderping; Event ID 8 CreateRemoteThread for the injection that often precedes itExternal driver and serviceYou collect Sysmon and want a no-licence signal in the SIEM
On-demand memory scannersOpen source tools such as HollowsHunter and PE-sieve (BSD-2-Clause) scan processes for replaced or injected PEs, shellcode, hooks and in-memory patches, and dump what they findExternal process, run on demandTriage of a suspect host during an investigation
Memory forensicsVolatility 3 malfind lists process memory ranges that potentially contain injected codeOffline, against a memory imagePost-incident analysis and validating what live tools missed
In-application anti-tamper guardsChecksums compiled into the application that verify its own code at run time, the model in D3FEND's Arxan and Purdue referencesEmbedded in the applicationYou ship software that runs on hosts you do not control

Prevention controls work on the same artefact and pair well with verification. Windows exploit protection's Arbitrary code guard prevents memory being marked executable after load, and Code integrity guard blocks mapping of binaries not signed by Microsoft; both offer an Audit only mode. These sit closer to D3FEND's Process Segment Execution Prevention than to D3-PCSV, but they reduce how much a verifier has to find. Endpoint sensor choices are covered in the EDR Guide.

Implementation steps

  1. Choose the processes that matter. Start with processes that hold credentials or run with high privilege (lsass.exe, authentication services, the EDR sensor itself), then internet-facing clients and services that D3FEND's exploitation rows describe.
  2. Confirm the verifier runs continuously. Check whether your EDR performs periodic or event-driven memory scans and on which processes. A start-up-only check misses hollowing and hooking.
  3. Collect the supporting events. If Sysmon is deployed, include Event IDs 8, 10 and 25 in the configuration, filtered as Microsoft advises for Event ID 10 to avoid volume from diagnostic tools. The Sysmon Guide covers configuration.
  4. Model legitimate change. List the products that hook or patch code in your estate: other security agents, application compatibility shims, DRM and performance profilers. Record their modules so alerts can be tagged rather than suppressed blindly.
  5. Pilot in alert-only mode. Run on one business unit for two to four weeks, review every mismatch and fix noise at its source. Keep termination off until false positives are understood.
  6. Enable eviction for high-confidence patterns. Hollowed system processes and unsigned code inside credential processes are good candidates for automatic termination. Roll back by returning the policy to alert-only, not by removing the sensor.

How to verify it works

  • Authorised emulation: in a lab or approved test window, run a process hollowing and an API hooking test from an adversary emulation framework your red team already uses, and confirm the alert, the process context and any memory dump reach the SOC.
  • Reference integrity check: confirm where the verifier gets its source of truth and that it is protected from local modification (signed, remote or read-only).
  • Coverage audit: list hosts where memory scanning is disabled by exclusion, policy or sensor health. EDR exclusions often remove exactly the processes that matter; see the EDR Tuning and Exclusions Management Guide.
  • Offline cross-check: after a real or simulated incident, run memory forensics on a captured image and compare with what live tooling reported.
MetricExample target (NHI Mgmt Group suggestion, not a standard)Why it matters
Endpoints with continuous memory verification enabledAbove 95% of managed Windows endpoints and serversGaps are where hollowing goes unseen
Emulation tests detected100% of quarterly hollowing and hooking testsProves the end-to-end path works
Mismatch alerts traced to a known legitimate hookerFalling month on monthShows legitimate change is modelled
Time from mismatch to analyst triageUnder 30 minutes for credential processesAltered code in those processes signals active intrusion
Exclusions covering high-value processesZero without documented approvalExclusions silently disable the control

Limits, bypasses and failure patterns

  • Local verifier tampering: D3FEND notes that verification run only locally can be defeated by altering the local verification logic. Protect the sensor against tampering, as described in Securing the EDR and XDR platform itself.
  • Race windows: a check that runs only on a schedule can be evaded if the alteration completes, and possibly reverts, between runs.
  • Copy-and-check evasion: D3FEND notes that verification which operates on a subset of the code segment can be evaded by performing the operation on a copy of the relevant bytes.
  • Code outside the image: a payload in newly allocated memory leaves the original code segment untouched. Unbacked executable memory needs its own analysis, which many tools perform alongside code segment checks.
  • Relocation noise: address randomisation and module rebasing change bytes legitimately. D3FEND's guidance is to feed the relocation data into the verifier rather than to ignore the module.
  • Self-modifying software: packers and some protection products rewrite their own code, which overlaps with D3-PSMD Process Self-Modification Detection.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5SI-7 Software, Firmware, and Information Integrity; SI-7(1) Integrity ChecksIntegrity verification of software, the control family for code segment checks
NIST SP 800-53 Rev 5SI-16 Memory ProtectionProtecting memory from unauthorised code execution, the prevention counterpart
NIST SP 800-53 Rev 5SI-3 Malicious Code Protection, SI-4 System MonitoringDetection and monitoring that consume the verification result
NIST CSF 2.0DE.CM-09, DE.AE-02Monitoring software and runtime environments; analysing adverse events
MITRE D3FENDD3-PA, D3-PCSVParent and technique

The mapping above is an NHI Mgmt Group view; D3FEND itself does not map D3-PCSV to NIST controls.

Practitioner checklist

  • List the high-value processes whose code must be verified continuously.
  • Confirm your EDR verifies code segments during execution, not only at start-up.
  • Collect Sysmon Event IDs 8, 10 and 25 where Sysmon is deployed.
  • Protect the verifier and its source of truth from local modification.
  • Record every product that legitimately hooks or patches code and tag its alerts.
  • Pilot in alert-only mode before enabling automatic termination.
  • Review exclusions that remove credential and security processes from memory scanning.
  • Test with authorised hollowing and hooking emulation every quarter.
  • Keep a memory forensics capability to cross-check live findings after incidents.

Standards and references

Related NHI Mgmt Group resources: MITRE D3FEND Guide · T1055 Process Injection Defensive Guide · EDR Evasion and Defence Guide · Sysmon Guide · D3-PSA Process Spawn Analysis

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.

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

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 the PDF box to continue.