Arbitrary Code Guard (ACG) is a Windows exploit protection mitigation that stops a process from creating new executable memory or making existing code pages writable. It blocks shellcode injection and some memory-corruption exploits. Applications that rely on just-in-time compilation can break, so administrators test it per application before enforcing it.
What Arbitrary Code Guard Does
Arbitrary Code Guard is a Windows exploit protection mitigation that narrows a process’s ability to create executable memory or flip existing code pages to writable. That makes it harder for injected shellcode and some memory-corruption payloads to turn control over the process into code execution.
It is best understood as a runtime hardening control, not a vulnerability fix. ACG changes what the process is allowed to do at execution time, so it can reduce exploitability even when the underlying software bug still exists.
Why ACG Matters for Exploit Resilience
ACG directly targets the memory states that many modern exploits depend on: writable code, executable data, or a transition between the two. By limiting those transitions, it raises the cost of shellcode injection, reflective loading and some post-corruption exploitation chains. It is especially valuable when paired with other mitigations that reduce the attacker’s ability to pivot after a memory safety flaw.
Because ACG works at the process boundary, its protection is only as strong as the application’s own compatibility with it. Software that generates code dynamically, including some JIT compilers and runtimes, may fail or degrade if the mitigation is enforced without testing. The practical trade-off is straightforward, stronger resistance to code injection versus possible breakage in apps that rely on runtime code generation.
That is why ACG is usually evaluated per workload rather than applied blindly across an estate. The right question is not whether the mitigation is useful, but whether the target application can operate under its memory policy.
Where ACG Fits in a Defensive Stack
ACG is one layer in a broader anti-exploitation posture. On its own, it does not prevent logic abuse, credential theft, or every form of memory corruption, but it can block a common exploitation step: turning a controlled write into executable code. In practice, defenders use it alongside DEP, ASLR, CFG, code signing expectations, and telemetry that can reveal blocked injection attempts or suspicious memory transitions.
For teams comparing exploit hardening options, Exploit Mitigations Guide provides the broader context for how ACG relates to ASLR, DEP, CFI and other platform protections. For a control-focused mapping, M1050 Exploit Protection shows how Windows exploit protections are used to raise attacker cost in practice.
Detection also matters after enforcement. If a process starts failing only when exploit protection is enabled, that may indicate legitimate JIT activity, but it can also expose hidden self-modifying behaviour, packers or suspicious code-loading patterns that deserve review.
How Security Teams Validate and Use ACG
ACG should be tested against the real application portfolio before rollout, especially for browsers, developer tools, line-of-business apps and runtime-heavy platforms. Administrators need to understand which processes should be protected, which ones require exceptions, and whether a failure is a compatibility issue or evidence of undesired code-generation behaviour.
When a process is protected successfully, the operational win is that memory corruption alone is less likely to become code execution. That does not remove the need for patching, secure coding or EDR visibility, but it gives defenders a valuable containment layer while those broader fixes are being delivered.
For teams that need to understand process tampering patterns beyond the mitigation itself, MITRE ATT&CK T1620 Reflective Code Loading and D3-PCSV Process Code Segment Verification help connect ACG to in-memory execution, integrity checking and related detection workflows.
Risk and Threat Considerations
ACG reduces the chance that an attacker can convert a memory corruption bug into executable payload delivery, but it can also create operational risk if it is enabled without compatibility testing. The main failure mode is not that the mitigation is ineffective, but that a legitimate application breaks, falls back to weaker behaviour, or is quietly exempted after a bad rollout.
Failure mechanism: Attackers try to move from a corruption primitive to injected or generated executable code, while defenders may discover that legitimate runtime code generation collides with the mitigation and forces exceptions.
Impact: If ACG is absent or poorly tuned, shellcode and related in-memory payloads may execute more easily after exploitation. If it is enforced indiscriminately, critical applications may fail, creating availability and support risk.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5, CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1055 — Process Injection | ACG raises the cost of code injection and related in-memory execution paths. |
| Recommendation — Map blocked in-memory execution patterns to T1055 and hunt for injection telemetry. | ||
| NIST SP 800-53 Rev 5 | SI-16 — Memory Protection | ACG is a memory-protection mitigation that constrains executable and writable code pages. |
| Recommendation — Apply SI-16 to restrict executable memory transitions and reduce exploitability. | ||
| CIS Controls v8 | CIS-10 — Malware Defenses | ACG supports anti-exploitation hardening that complements malware and injection defenses. |
| Recommendation — Use CIS-10 to harden endpoints with exploit protection and related blocking controls. | ||
| NIST CSF 2.0 | PR.PS-05 — Resilience Mechanisms | ACG contributes to protective resilience by limiting exploit execution paths in running processes. |
| Recommendation — Implement process hardening measures that limit exploit impact in production systems. | ||
Practitioner Guidance
Why practitioners should care: ACG is most useful when you want exploit resistance without waiting for every underlying bug to be removed. Treat it as a workload-specific hardening control, not a universal switch.
Common misunderstanding: Enabling ACG is not the same as fixing memory safety. It can block an execution stage, but it does not make unsafe code paths safe.
Practitioner takeaway: Validate ACG against each application’s runtime behaviour, then enforce it where the protection benefit clearly outweighs the compatibility cost.
Related resources from NHI Mgmt Group
- What should organisations do after a developer tool is shown to allow arbitrary code execution?
- How should security teams respond when a package installation step can execute arbitrary code before a dependency is ever imported?
- Why does arbitrary file writing through a custom map create remote code execution risk on Windows?
- Why does arbitrary configuration injection in Git increase the risk of local code execution?
Deepen Your Knowledge
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.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org