---
name: Windows Security Boundaries
slug: windows-security-boundaries
category: Quality
description: Windows Security Boundaries maps Windows security boundary taxonomy and enumerates attack surfaces such as kernel/user, sandbox, COM/RPC, and hypervisor boundaries, used when planning privilege escalation and sandbox escape paths.
github: "https://github.com/SnailSploit/Claude-Red/tree/main/Skills/infrastructure/offensive-windows-boundaries"
language: Python
stars: 2929
forks: 479
install: "npx degit https://github.com/SnailSploit/Claude-Red/tree/main/Skills/infrastructure/offensive-windows-boundaries ~/.claude/skills/offensive-windows-boundaries"
installs_to: ~/.claude/skills/offensive-windows-boundaries
source_path: Skills/infrastructure/offensive-windows-boundaries/SKILL.md
collection_size: 25
category_size: 1354
collection_url: "https://dirskills.com/collections/SnailSploit/Claude-Red"
added: 2026-08-17T07:10:01.630Z
last_synced: 2026-08-17T07:10:01.630Z
canonical_url: "https://dirskills.com/skills/windows-security-boundaries"
---

# Windows Security Boundaries

Windows Security Boundaries maps Windows security boundary taxonomy and enumerates attack surfaces such as kernel/user, sandbox, COM/RPC, and hypervisor boundaries, used when planning privilege escalation and sandbox escape paths.

**Install:**

```bash
npx degit https://github.com/SnailSploit/Claude-Red/tree/main/Skills/infrastructure/offensive-windows-boundaries ~/.claude/skills/offensive-windows-boundaries
```

## README

# SKILL: Week 7: Defeating Windows Security Boundaries

## Metadata
- **Skill Name**: windows-boundaries
- **Folder**: offensive-windows-boundaries
- **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/7-windows-boundaries.md

## Description
Windows security boundary taxonomy and attack surface enumeration: kernel/user boundary, sandbox boundaries (LPAC, AppContainer), COM/RPC boundaries, hypervisor boundary, trust level transitions. Use when planning privilege escalation paths, sandbox escapes, or understanding Windows security architecture.

## Trigger Phrases
Use this skill when the conversation involves any of:
`Windows boundaries, security boundary, kernel user boundary, sandbox escape, AppContainer, LPAC, COM boundary, RPC boundary, hypervisor, Hyper-V, privilege escalation, trust level`

## Instructions for Claude

When this skill is active:
1. Load and apply the full methodology below as your operational checklist
2. Follow steps in order unless the user specifies otherwise
3. For each technique, consider applicability to the current target/context
4. Track which checklist items have been completed
5. Suggest next steps based on findings

---

## Full Methodology

# Week 7: Defeating Windows Security Boundaries

## Overview

_created by AnotherOne from @Pwn3rzs Telegram channel_.

Week 6 taught you how mitigations work defensively.
You'll learn to bypass the OS security _policies and features_ that prevent your code from running, your processes from accessing protected resources, and your actions from being logged.
This is distinct from Week 8, which teaches you how to bypass _exploit mitigations_ (DEP, ASLR, CFG) once your code is already running.

> **Week 7 vs Week 8 - The Key Distinction**:
>
> - **Week 7** answers: _"Can my code execute at all?"_ - bypass AMSI, WDAC, ASR, AppContainers, integrity levels, PPL, ETW telemetry
> - **Week 8** answers: _"Can my exploit succeed?"_ - bypass DEP, ASLR, stack cookies, CFG/XFG, heap safe-unlinking

**This Week's Focus**:

- Offensive reconnaissance and mitigation fingerprinting
- AMSI bypass and script-based attack techniques
- Protected Process Light (PPL) exploitation
- Sandbox, integrity level, and AppContainer bypass
- WDAC and Attack Surface Reduction (ASR) bypass
- ETW manipulation and telemetry blinding
- Kernel driver interaction fundamentals (preparation for Week 11)

**Prerequisites**:

- Completed Week 6: Understanding Modern Windows Mitigations
- Week 5: Basic exploitation techniques (stack overflow, ROP, heap)
- Familiarity with WinDbg, x64dbg, and IDA/Ghidra
- C/C++, Python, and assembly knowledge

### Week 7 Deliverables

By the end of this week, you should have completed:

- [ ] **Recon Tool**: Built a mitigation fingerprinting tool
- [ ] **AMSI Bypass**: Implemented working AMSI bypass techniques
- [ ] **PPL Research**: Documented PPL bypass vectors
- [ ] **Sandbox Escape**: Bypassed AppContainer or integrity level restrictions
- [ ] **WDAC/ASR Bypass**: Demonstrated at least one WDAC and one ASR bypass
- [ ] **ETW Blinding**: Implemented ETW provider patching to suppress telemetry
- [ ] **Driver IOCTL Lab**: Loaded a test driver, sent an IOCTL, set a kernel breakpoint (Week 11 prep)

## Day 1: Offensive Reconnaissance & Mitigation Fingerprinting

- **Goal**: Master target enumeration - fingerprint system and process mitigations to identify attack vectors.
- **Activities**:
  - _Reading_:
    - [Windows Exploit Protection](https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/exploit-protection-reference) - Official mitigation documentation
    - [Process Mitigation Policies](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocessmitigationpolicy)
    - [Override Process Mitigations via Policy](https://learn.microsoft.com/en-us/windows/security/operating-system-security/device-management/override-mitigation-options-for-app-related-security-policies)
  - _Online Resources_:
    - [DEFCON 27 - Exploiting Windows Exploit Mitigation for ROP Exploits](https://www.youtube.com/watch?v=gIJOtP1AC3A)
    - [Sandbox Mitigations](https://troopers.de/media/filer_public/f6/07/f6076037-85e0-42b7-9a51-507986edafce/the_joy_of_sandbox_mitigations_export.pdf)
    - [Offensive Windows Internals](https://github.com/matthieu-hackwitharts/Win32_Offensive_Cheatsheet)
  - _Tool Setup_:
    - Process Hacker / System Informer
    - WinDbg Preview with mitigation inspection scripts
    - PE-bear / pestudio for binary analysis
  - _Exercise_:
    - Build comprehensive mitigation scanner
    - Enumerate all protected processes on target
    - Identify legacy/unprotected binaries for exploitation

### Deliverables

- [ ] Build a comprehensive mitigation scanner
- [ ] Fingerprint process-level protections remotely
- [ ] Identify unprotected/legacy binaries on target
- [ ] Map kernel mitigation status

### Target Mitigation Landscape

```text
┌─────────────────────────────────────────────────────────────────┐
│              Offensive Reconnaissance: What to Enumerate        │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  SYSTEM-LEVEL                    PROCESS-LEVEL                  │
│  ─────────────                   ─────────────                  │
│  ┌──────────────┐               ┌──────────────┐                │
│  │ VBS/HVCI     │               │ DEP/NX       │                │
│  │ WDAC/CI      │               │ ASLR         │                │
│  │ Secure Boot  │               │ CFG/XFG      │                │
│  │ Credential   │               │ CET/Shadow   │                │
│  │   Guard      │               │ ACG          │                │
│  │ KDP          │               │ CIG          │                │
│  │ KASLR        │               │ Child Process│                │
│  └──────────────┘               └──────────────┘                │
│         │                              │                        │
│         ▼                              ▼                        │
│  Determines:                    Determines:                     │
│  - Kernel exploit              - Shellcode execution            │
│    feasibility                 - Code injection                 │
│  - Driver loading              - ROP requirements               │
│  - Credential theft            - Process hollowing              │
│                                                                 │
│  ATTACK SURFACE MAPPING                                         │
│  ─────────────────────                                          │
│  ├── Unprotected legacy binaries (no ASLR/DEP)                  │
│  ├── Signed but vulnerable drivers (BYOVD)                      │
│  ├── Processes running without ACG/CFG                          │
│  └── Kernel version -> known vulnerabilities                    │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
```

### Mitigation Scanner

This scanner enumerates security boundaries on a Windows target. **Why this matters**: Before exploiting a target, you need to know which mitigations are active.

```c
// unified_recon.c
// Combines system, process, binary, and policy analysis
// Compile: cl src\unified_recon.c /Fe:bin\unified_recon.exe advapi32.lib

#include <windows.h>
#include <stdio.h>
#include <tlhelp32.h>

// PE DLL Characteristics flags
#define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA    0x0020
#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE       0x0040
#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT          0x0100
#define IMAGE_DLLCHARACTERISTICS_NO_SEH             0x0400
#define IMAGE_DLLCHARACTERISTICS_GUARD_CF           0x4000

void CheckSystemMitigations() {
    printf("\n=== SYSTEM-LEVEL MITIGATIONS ===\n\n");

    // Check VBS/HVCI via registry (more reliable than WMI)
    printf("[*] Checking VBS/HVCI status...\n");
    HKEY hKey;
    DWORD vbsEnabled = 0, hvciEnabled = 0;
    DWORD size = sizeof(DWORD);

    if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
        "SYSTEM\\CurrentControlSet\\Control\\DeviceGuard", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
        RegQueryValueExA(hKey, "EnableVirtualizationBasedSecurity", NULL, NULL, (LPBYTE)&vbsEnabled, &size);
        RegCloseKey(hKey);
    }

    if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
        "SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity",
        0, KEY_READ, &hKey) == ERROR_SUCCESS) {
        RegQueryValueExA(hKey, "Enabled", NULL, NULL, (LPBYTE)&hvciEnabled, &size);
        RegCloseKey(hKey);
    }

    printf("    VBS: %s\n", vbsEnabled ? "ENABLED" : "Disabled");
    printf("    HVCI: %s\n", hvciEnabled ? "ENABLED" : "Disabled");

    if (hvciEnabled) {
        printf("    [!] HVCI blocks unsigned kernel drivers\n");
        printf("    [*] Attack: Need signed vulnerable driver (BYOVD)\n");
    } else {
        printf("    [+] HVCI disabled - unsigned drivers can load\n");
    }

    // Check Secure Boot via firmware variable
    printf("\n[*] Checking Secure Boot...\n");
    DWORD secureBootEnabled = 0;
    size = sizeof(DWORD);
    if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
        "SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State",
        0, KEY_READ, &hKey) == ERROR_SUCCESS) {
        RegQueryValueExA(hKey, "UEFISecureBootEnabled", NULL, NULL, (LPBYTE)&secureBootEnabled, &size);
        RegCloseKey(hKey);
        printf("    Secure Boot: %s\n", secureBootEnabled ? "ENABLED" : "Disabled");
    } else {
        printf("    Secure Boot: Unable to determine (may not be UEFI)\n");
    }

    // Check KASLR status (kernel base randomization)
    printf("\n[*] Checking KASLR (kernel base varies per boot)...\n");
    printf("    Note: KASLR leaks restricted in Win 24H2+ without SeDebugPrivilege\n");
    printf("    KASLR is enabled by default on modern Windows\n");

    // Check Credential Guard
    printf("\n[*] Checking Credential Guard...\n");
    DWORD credGuard = 0;
    size = sizeof(DWORD);
    if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
        "SYSTEM\\CurrentControlSet\\Control\\Lsa", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
        RegQueryValueExA(hKey, "LsaCfgFlags", NULL, NULL, (LPBYTE)&credGuard, &size);
        RegCloseKey(hKey);

        if (credGuard & 1) {
            printf("    Credential Guard: ENABLED\n");
            printf("    [!] Mimikatz credential dumping will FAIL\n");
        } else {
            printf("    Credential Guard: Disabled\n");
            printf("    [+] Mimikatz can dump credentials\n");
        }
    }
}

void CheckProcessMitigations(DWORD pid, const char* procName) {
    HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
    if (!hProcess) return;

    printf("\n[%s (PID: %d)]\n", procName, pid);

    // DEP
    PROCESS_MITIGATION_DEP_POLICY depPolicy = {0};
    if (GetProcessMitigationPolicy(hProcess, ProcessDEPPolicy, &depPolicy, sizeof(depPolicy))) {
        printf("  DEP: %s%s\n",
            depPolicy.Enable ? "ON" : "OFF",
            depPolicy.Permanent ? " (Permanent)" : "");
    }

    // ASLR
    PROCESS_MITIGATION_ASLR_POLICY aslrPolicy = {0};
    if (GetProcessMitigationPolicy(hProcess, ProcessASLRPolicy, &aslrPolicy, sizeof(aslrPolicy))) {
        printf("  ASLR: BottomUp=%d HighEntropy=%d ForceRelocate=%d\n",
            aslrPolicy.EnableBottomUpRandomization,
            aslrPolicy.EnableHighEntropy,
            aslrPolicy.EnableForceRelocateImages);
    }

    // ACG (Dynamic Code)
    PROCESS_MITIGATION_DYNAMIC_CODE_POLICY acgPolicy = {0};
    if (GetProcessMitigationPolicy(hProcess, ProcessDynamicCodePolicy, &acgPolicy, sizeof(acgPolicy))) {
        printf("  ACG: %s\n", acgPolicy.ProhibitDynamicCode ? "ON (No dynamic code)" : "OFF");
    }

    // CFG
    PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY cfgPolicy = {0};
    if (GetProcessMitigationPolicy(hProcess, ProcessControlFlowGuardPolicy, &cfgPolicy, sizeof(cfgPolicy))) {
        printf("  CFG: %s StrictMode=%d\n",
            cfgPolicy.EnableControlFlowGuard ? "ON" : "OFF",
            cfgPolicy.StrictMode);
    }

    CloseHandle(hProcess);
}

void FindWeakProcesses() {
    printf("\n=== HUNTING WEAK PROCESSES ===\n");
    printf("[*] Looking for processes WITHOUT mitigations (exploitation targets)...\n\n");

    HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    PROCESSENTRY32 pe = { sizeof(pe) };

    if (Process32First(hSnapshot, &pe)) {
        do {
            HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pe.th32ProcessID);
            if (!hProc) continue;

            PROCESS_MITIGATION_DEP_POLICY dep = {0};
            PROCESS_MITIGATION_ASLR_POLICY aslr = {0};
            PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY cfg = {0};

            GetProcessMitigationPolicy(hProc, ProcessDEPPolicy, &dep, sizeof(dep));
            GetProcessMitigationPolicy(hProc, ProcessASLRPolicy, &aslr, sizeof(aslr));
            GetProcessMitigationPolicy(hProc, ProcessControlFlowGuardPolicy, &cfg, sizeof(cfg));

            // Flag if missing critical mitigations
            if (!dep.Enable || !aslr.EnableBottomUpRandomization || !cfg.EnableControlFlowGuard) {
                printf("[!] WEAK: %s (PID %d) - DEP:%d ASLR:%d CFG:%d\n",
                    pe.szExeFile, pe.th32ProcessID,
                    dep.Enable, aslr.EnableBottomUpRandomization, cfg.EnableControlFlowGuard);
            }

            CloseHandle(hProc);
        } while (Process32Next(hSnapshot, &pe));
    }
    CloseHandle(hSnapshot);
}

void EnumerateDrivers() {
    printf("\n=== DRIVER ENUMERATION (BYOVD Targets) ===\n");
    printf("[*] Enumerating loaded kernel drivers...\n\n");

    // Query drivers via registry
    HKEY hKey;
    if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
        "SYSTEM\\CurrentControlSet\\Services", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {

        DWORD index = 0;
        char subKeyName[256];
        DWORD subKeyLen;
        int driverCount = 0;

        printf("%-30s %-10s %s\n", "Driver Name", "Type", "Path");
        printf("%-30s %-10s %s\n", "===========", "====", "====");

        while (1) {
            subKeyLen = sizeof(subKeyName);
            if (RegEnumKeyExA(hKey, index++, subKeyName, &subKeyLen, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
                break;

            HKEY hSubKey;
            char fullPath[512];
            snprintf(fullPath, sizeof(fullPath), "SYSTEM\\CurrentControlSet\\Services\\%s", subKeyName);

            if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, fullPath, 0, KEY_READ, &hSubKey) == ERROR_SUCCESS) {
                DWORD type = 0;
                DWORD size = sizeof(DWORD);

                if (RegQueryValueExA(hSubKey, "Type", NULL, NULL, (LPBYTE)&type, &size) == ERROR_SUCCESS) {
                    // Type 1 = Kernel driver
                    if (type == 1) {
                        char imagePath[512] = {0};
                        size = sizeof(imagePath);
                        RegQueryValueExA(hSubKey, "ImagePath", NULL, NULL, (LPBYTE)imagePath, &size);

                        printf("%-30s %-10s %s\n", subKeyName, "Kernel", imagePath);
                        driverCount++;

                        if (driverCount >= 20) {  // Limit output
                            printf("\n[*] Showing first 20 drivers. Total may be higher.\n");
                            break;
                        }
                    }
                }
                RegCloseKey(hSubKey);
            }
        }
        RegCloseKey(hKey);
    }

    printf("\n[*] Check against vulnerable driver list:\n");
    printf("    https://www.loldrivers.io/\n");
    printf("    https://github.com/magicsword-io/LOLDrivers\n");
}

// XFG (eXtended Flow Guard) - finer-grained CFI than CFG

void CheckXFGStatus(HANDLE hProcess, const char* procName) {
    /*
    XFG (eXtended Flow Guard) Detection:
    =====================================
    XFG improves on CFG by using type-based hashes for indirect calls.

    Detection methods:
    1. Check PE header for XFG metadata
    2. Look for __guard_xfg_* symbols
    3. Check if process has XFG-aware imports

    Attack implications:
    - XFG makes CFG bypass harder
    - Need type-compatible function for exploit
    - Data-only attacks still work
    */

    PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY cfgPolicy = {0};
    if (GetProcessMitigationPolicy(hProcess, ProcessControlFlowGuardPolicy, &cfgPolicy, sizeof(cfgPolicy))) {
        printf("  XFG Analysis:\n");
        printf("    CFG Enabled: %s\n", cfgPolicy.EnableControlFlowGuard ? "YES" : "NO");
        printf("    Export Suppression: %s\n", cfgPolicy.EnableExportSuppression ? "YES" : "NO");
        printf("    Strict Mode: %s\n", cfgPolicy.StrictMode ? "YES" : "NO");

        if (cfgPolicy.EnableControlFlowGuard && cfgPolicy.StrictMode) {
            printf("    [!] Likely XFG-enabled (strict CFG + export suppression)\n");
            printf("    [*] Attack: Need type-compatible gadgets for bypass\n");
        }
    }
}

void CheckCETShadowStack(HANDLE hProcess, const char* procName) {
    /*
    CET Shadow Stack Detection:
    ===========================
    Hardware-enforced return address protection (Intel 11th gen+)

    Shadow stack keeps copy of return addresses in protected memory.
    ROP attacks fail because RET validates against shadow stack.

    Bypass vectors:
    1. JOP (Jump-Oriented Programming) - doesn't use RET
    2. COP (Call-Oriented Programming)
    3. Find code without CET (legacy binaries)
    4. Disable CET via kernel exploit
    */

    PROCESS_MITIGATION_USER_SHADOW_STACK_POLICY cetPolicy = {0};
    if (GetProcessMitigationPolicy(hProcess, ProcessUserShadowStackPolicy, &cetPolicy, sizeof(cetPolicy))) {
        printf("  CET Shadow Stack:\n");
        printf("    Enabled: %s\n", cetPolicy.EnableUserShadowStack ? "YES" : "NO");
        printf("    Strict Mode: %s\n", cetPolicy.EnableUserShadowStackStrictMode ? "YES" : "NO");
        printf("    Block Non-CET Binaries: %s\n", cetPolicy.BlockNonCetBinaries ? "YES" : "NO");
        printf("    IP Validation: %s\n", cetPolicy.SetContextIpValidation ? "YES" : "NO");

        if (cetPolicy.EnableUserShadowStack) {
            printf("    [!] ROP will FAIL - shadow stack validates returns\n");
            printf("    [*] Attack: Use JOP/COP or find non-CET modules\n");

            if (!cetPolicy.BlockNonCetBinaries) {
                printf("    [+] Non-CET binaries allowed - find legacy DLLs\n");
            }
        } else {
            printf("    [+] CET disabled - ROP attacks viable\n");
        }
    } else {
        printf("  CET Shadow Stack: Not supported or access denied\n");
    }
}

void CheckARM64PAC() {
    /*
    ARM64 Pointer Authentication (PAC):
    ====================================
    Signs pointers with cryptographic signature in unused bits.
    Available on ARM64 Windows 11 and ARM Linux/macOS.

    PAC keys:
    - APIA/APIB: Instruction pointers (return addresses)
    - APDA/APDB: Data pointers
    - APGA: Generic authentication

    Bypass vectors:
    1. PAC oracle to brute-force signature
    2. Pointer substitution attacks
    3. Find code path that doesn't validate
    4. Kernel exploit to leak/forge keys
    */

    printf("\n=== ARM64 PAC Detection ===\n");

    #ifdef _M_ARM64
    // Check if running on ARM64 Windows
    SYSTEM_INFO sysInfo;
    GetNativeSystemInfo(&sysInfo);

    if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) {
        printf("[*] Running on ARM64 architecture\n");

        // Check for PAC support via IsProcessorFeaturePresent
        // PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE (32) indicates ARMv8.3+
        if (IsProcessorFeaturePresent(32)) {
            printf("[!] ARMv8.3+ detected - PAC likely supported\n");
            printf("[*] Attack implications:\n");
            printf("    - Ret
