<?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 Tyler Booth (dru1d) on Medium]]></title>
        <description><![CDATA[Stories by Tyler Booth (dru1d) on Medium]]></description>
        <link>https://medium.com/@dru1d?source=rss-7508d18b24c5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gRSH6u1rjySE2eKhcT4o8A@2x.jpeg</url>
            <title>Stories by Tyler Booth (dru1d) on Medium</title>
            <link>https://medium.com/@dru1d?source=rss-7508d18b24c5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:08:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dru1d/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[Windows Driver Exploit Development — irec.sys]]></title>
            <link>https://blog.dru1d.ninja/windows-driver-exploit-development-irec-sys-a5eb45093945?source=rss-7508d18b24c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5eb45093945</guid>
            <category><![CDATA[exploit-development]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[windows-kernel]]></category>
            <category><![CDATA[windows-internals]]></category>
            <dc:creator><![CDATA[Tyler Booth (dru1d)]]></dc:creator>
            <pubDate>Fri, 18 Aug 2023 17:33:25 GMT</pubDate>
            <atom:updated>2023-09-27T15:24:50.220Z</atom:updated>
            <content:encoded><![CDATA[<h3>Windows Driver Exploit Development — irec.sys [CVE-2023–41444]</h3><h3>Background</h3><p>As we advance in our careers as security professionals, we begin to observe trends in how we can refine our craft. Over time, it’s our hope that defensive capabilities become more advanced and robust. This evolution prompts some trailblazers to adopt innovative approaches, establishing a “meta” that others soon follow. My experience with Windows internals and kernel exploitation mirrors this trend.</p><p>I would like to quickly shout out on specific friend who helped me get to where I am today and who has been a major influence — Mike Alfaro (<a href="https://github.com/alfarom256">https://github.com/alfarom256</a>/<a href="https://twitter.com/_mmpte_software">https://twitter.com/_mmpte_software</a>). If you just search his handle in the <a href="https://www.loldrivers.io/">LOLDrivers</a> project you’ll find a few gems. One of these gems is the <a href="https://www.loldrivers.io/drivers/d74fdf19-b4b0-4ec2-9c29-4213b064138b/">irec.sys</a> driver — which coincidentally is tied to an incorrect project of his on GitHub, but I digress.</p><h3>Where did this driver come from?</h3><p>If you read the admittedly vague description from the <a href="https://www.loldrivers.io/drivers/d74fdf19-b4b0-4ec2-9c29-4213b064138b/">LOLDriver entry</a> it says the driver can be used for privilege escalation. I set out to figure out a bit more about the driver and my first stop was Google. This led me to a digital forensics tool from Binalyze —<a href="https://www.binalyze.com/irec"> IREC</a> (Incident Response Forensic Evidence Collector).</p><blockquote>“Our Proprietary Evidence Collection Engine, IREC, is the Foundation of all Our Products.”</blockquote><p>If this driver is truly an integral part of this product, we’re going to have a really powerful tool for Bring Your Own Vulnerable Driver attacks. While the driver is in the LOLDrivers project, it is not in the Microsoft driver blocklist (at the time of writing).</p><p>Let’s open the driver in Ghidra and take a look inside…</p><h3>What does this driver even do?</h3><p>When we first open the driver up for review in Ghidra, we need to identify the driver’s entry. This should be fairly straightforward if you have experience reversing drivers already; if not, you should check out this <a href="https://posts.specterops.io/methodology-for-static-reverse-engineering-of-windows-kernel-drivers-3115b2efed83">excellent post from Matt Hand</a> to get started.</p><p>There’s quite a bit of code to look at, but we can identify several key components necessary for communicating with the driver:</p><ul><li>We learn that the name of the device is \\.\IREC.</li></ul><pre>  RtlInitUnicodeString((PUNICODE_STRING)&amp;DAT_1400182a0,L&quot;\\Device\\IREC&quot;);<br>  RtlInitUnicodeString((PUNICODE_STRING)&amp;DAT_1400182b0,L&quot;\\DosDevices\\IREC&quot;);</pre><ul><li>We also identify the driver major functions. The function that’s most compelling to us has the function code 0xe as that&#39;s associated with IRP_MJ_DEVICE_CONTROL.</li></ul><pre>  DriverObject-&gt;MajorFunction[0xe] = FUN_1400029d0;<br>  DriverObject-&gt;MajorFunction[0] = FUN_140002980;<br>  DriverObject-&gt;MajorFunction[2] = FUN_140002980;</pre><p>Now that we’re looking over the disassembly of FUN_1400029d0 we can start putting together how the driver works in a bit more detail. One thing that I noticed while reviewing this function is that there are actually 22 different switch-cases that lead to multiple different code paths. There are debug strings here so it’s easy to determine what each of these cases do.</p><p>EDIT: Some of these functions you might find interesting include:</p><ul><li>Arbitrary file copy/creation (case 0).</li><li>Reading raw disk sectors (case 4).</li><li>Physical memory range enumeration (case 8).</li><li>Physical memory read (case 0xc).</li><li>Read process virtual memory (case 0x24).</li><li>Query virtual memory (case 0x28).</li></ul><p>For the purposes of this post, let’s review switch case 0x20:</p><pre>    case 0x20:<br>      local_178 = 0;<br>      local_22c = 0;<br>      local_128 = local_278;<br>      local_120 = local_278;<br>      if (uVar1 &lt; 4) {<br>        local_288 = 0xc0000023;<br>        iVar3 = FUN_140001000(0x20);<br>        if (iVar3 != 0) {<br>          DbgPrint(&quot;OPENPROCESS failed due to ResponseSize %d&quot;);<br>        }<br>      }<br>      else {<br>        local_22c = *(uint *)local_278;<br>        local_288 = FUN_1400084d0(local_22c,0x410,0,&amp;local_178);<br>        local_1fc = (uint)(-1 &lt; (int)local_288);<br>        if (local_1fc == 0) {<br>          iVar3 = FUN_140001000(0x20);<br>          if (iVar3 != 0) {<br>            DbgPrint(&quot;OPENPROCESS failed for pid %d&quot;);<br>          }<br>        }<br>        else {<br>          local_27c = 4;<br>          *(undefined4 *)local_120 = (undefined4)local_178;<br>          iVar3 = FUN_140001000(1);<br>          if (iVar3 != 0) {<br>            DbgPrint(&quot;OPENPROCESS succeeded for pid %d&quot;);<br>          }<br>        }<br>      }<br>      break;</pre><p>The debug statements specifically mention that this allows us to “OPENPROCESS”. This means we’ll need to dig further into FUN_1400084d0 to see how the driver actually performs the action.</p><pre>int FUN_1400084d0(uint param_1,ACCESS_MASK param_2,int param_3,PHANDLE param_4)<br><br>{<br>  NTSTATUS NVar1;<br>  int iVar2;<br>  _CLIENT_ID local_50;<br>  _OBJECT_ATTRIBUTES local_40;<br>  <br>  local_50.UniqueThread = (HANDLE)0x0;<br>  local_40.Length = 0x30;<br>  local_40.RootDirectory = (HANDLE)0x0;<br>  local_40.Attributes = 2;<br>  local_40.ObjectName = (PUNICODE_STRING)0x0;<br>  local_40.SecurityDescriptor = (PVOID)0x0;<br>  local_40.SecurityQualityOfService = (PVOID)0x0;<br>  if (param_3 != 0) {<br>    local_40.Attributes = 0x202;<br>  }<br>  local_50.UniqueProcess = (HANDLE)(ulonglong)param_1;<br>  NVar1 = ZwOpenProcess(param_4,param_2,&amp;local_40,&amp;local_50);<br>  if (NVar1 &lt; 0) {<br>    iVar2 = FUN_140001000(0x20);<br>    if (iVar2 != 0) {<br>      DbgPrint(&quot;Open process failed for %d&quot;,(ulonglong)param_1);<br>    }<br>  }<br>  return NVar1;<br>}</pre><p>We can see that the function accepts several parameters. Let’s tidy up the function by renaming and retyping variables as necessary. Given that we’re using the documented Windows API, it should be straightforward to understand what the function does.</p><pre><br>int OPENPROCESS(uint PID,ACCESS_MASK DesiredAccess,int flag,PHANDLE hProcess)<br><br>{<br>  NTSTATUS status;<br>  int iVar1;<br>  _CLIENT_ID clientId;<br>  _OBJECT_ATTRIBUTES objAttrs;<br>  <br>  clientId.UniqueThread = (HANDLE)0x0;<br>  objAttrs.Length = 0x30;<br>  objAttrs.RootDirectory = (HANDLE)0x0;<br>                    /* OBJ_INHERIT */<br>  objAttrs.Attributes = 2;<br>  objAttrs.ObjectName = (PUNICODE_STRING)0x0;<br>  objAttrs.SecurityDescriptor = (PVOID)0x0;<br>  objAttrs.SecurityQualityOfService = (PVOID)0x0;<br>  if (flag != 0) {<br>                    /* OBJ_INHERIT<br>                       OBJ_KERNEL_HANDLE */<br>    objAttrs.Attributes = 0x202;<br>  }<br>  clientId.UniqueProcess = (HANDLE)(ulonglong)PID;<br>  status = ZwOpenProcess(hProcess,DesiredAccess,&amp;objAttrs,&amp;clientId);<br>  if (status &lt; 0) {<br>    iVar1 = FUN_140001000(0x20);<br>    if (iVar1 != 0) {<br>      DbgPrint(&quot;Open process failed for %d&quot;,(ulonglong)PID);<br>    }<br>  }<br>  return status;<br>}<br></pre><p>We can observe that the function expects a DWORD (PID) as input and returns a handle to that process using the same buffer supplied by the user, which operates within the kernel. We don’t need to worry about the access mask or the extra flag as they’re hardcoded for us. It should be noted that the hardcoded access mask is 0x410 and this gives us PROCESS_QUERY_INFORMATION and PROCESS_VM_READ on the returned process handle. This enables a user to obtain handles to sensitive processes, such as LSASS, and execute a MiniDumpWriteDump from an unprivileged context, assuming that the driver has already been loaded.</p><h3>PoC or GTFO</h3><p>This can be accomplished with the following <a href="https://gist.github.com/dru1d-foofus/1af21179f253879f101c3a8d4f718bf0">PoC code</a> on GitHub.</p><figure><img alt="Successful LSASS.exe dump by abusing the IREC driver." src="https://cdn-images-1.medium.com/max/976/1*WYkPg7H6-8ArcQ1_nvn2xA.png" /><figcaption>LSASS Dump via irec.sys driver</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*qrK4MfDjiqlyi2-Fif-4pw.png" /><figcaption>Parsing of minidump</figcaption></figure><h3>Where do we go from here?</h3><p>There’s so much to be learned by reviewing known vulnerable driver samples. If you’re excited about this like I am, I would suggest grabbing some and tearing them apart.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5eb45093945" width="1" height="1" alt=""><hr><p><a href="https://blog.dru1d.ninja/windows-driver-exploit-development-irec-sys-a5eb45093945">Windows Driver Exploit Development — irec.sys</a> was originally published in <a href="https://blog.dru1d.ninja/">dru1d</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>