<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: certifiedrehman</title>
    <description>The latest articles on DEV Community by certifiedrehman (@certifiedrehman).</description>
    <link>https://dev.to/certifiedrehman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F698173%2Fda3bd371-654e-490e-98f0-935a1148eb00.jpg</url>
      <title>DEV Community: certifiedrehman</title>
      <link>https://dev.to/certifiedrehman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/certifiedrehman"/>
    <language>en</language>
    <item>
      <title>Automating Zero-Day Discovery in Windows Kernel Drivers with LangChain DeepAgents</title>
      <dc:creator>certifiedrehman</dc:creator>
      <pubDate>Tue, 07 Apr 2026 05:31:20 +0000</pubDate>
      <link>https://dev.to/certifiedrehman/automating-zero-day-discovery-in-windows-kernel-drivers-with-langchain-deepagents-24d9</link>
      <guid>https://dev.to/certifiedrehman/automating-zero-day-discovery-in-windows-kernel-drivers-with-langchain-deepagents-24d9</guid>
      <description>&lt;p&gt;I had $100 in unused Google Cloud credits from my Google One Ultra plan and figured I'd put them toward something interesting. Over the long weekend I ended up building an automated pipeline that scans thousands of Windows kernel drivers for exploitable vulnerabilities, specifically looking for ones that can be used in BYOVD (Bring Your Own Vulnerable Driver) attacks. On its first real run on a massive driver pack, it successfully flagged a zero-day in an ASUS driver.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the pipeline works
&lt;/h2&gt;

&lt;p&gt;I don't reverse drivers manually anymore. I built a pipeline that scans thousands of drivers automatically and flags the ones that look exploitable. Here's what it does.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────────────┐
│                  DeepZero                        │
│                                                  │
│  Triage ──▶ Ghidra ──▶ Semgrep ──▶ Gemini 2.5   │
│  (.sys)     (headless)  (rules)    (Vertex AI)   │
│                                        │         │
│                                        ▼         │
│                                  VULNERABLE /    │
│                                  SAFE report     │
└──────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a vulnerable driver goes through this pipeline, its import table hits the risk heuristics, and the decompiled dispatch handler confirms the vulnerability with precise source mapping. Last step hands this off to Gemini 2.5 to generate a report, after which manual analysis/verification can take over.&lt;/p&gt;

&lt;h3&gt;
  
  
  LOLDrivers baseline
&lt;/h3&gt;

&lt;p&gt;I started with the &lt;a href="https://www.loldrivers.io/" rel="noopener noreferrer"&gt;LOLDrivers&lt;/a&gt; database, which has 509 known-vulnerable drivers and 1,822 hashes. I fed the whole JSON to Gemini and asked it what these drivers have in common. Turns out most of them import the same set of dangerous APIs: &lt;code&gt;MmMapIoSpace&lt;/code&gt;, &lt;code&gt;MmAllocateContiguousMemory&lt;/code&gt;, &lt;code&gt;IoAllocateMdl&lt;/code&gt;, &lt;code&gt;MmMapLockedPages&lt;/code&gt;, &lt;code&gt;__readmsr&lt;/code&gt;, &lt;code&gt;__writemsr&lt;/code&gt;, stuff like that. And they all create a device that usermode can talk to.&lt;/p&gt;

&lt;p&gt;So that became my filter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Triage
&lt;/h3&gt;

&lt;p&gt;I threw an entire massive driver pack (&lt;a href="https://sdi-tool.org/download/" rel="noopener noreferrer"&gt;SDI_RUS&lt;/a&gt;) containing around 12,000 &lt;code&gt;.sys&lt;/code&gt; files at the triage engine. It parses every PE header, looks at the import table, checks if it's a kernel driver, checks if it creates a device, and flags it if it matches the LOLDrivers pattern.&lt;/p&gt;

&lt;p&gt;Identical drivers hidden under different filenames in different driver folders get deduplicated by SHA256 hash so I don't pay to analyze the same driver twice. From the 12,000 starting pool, exactly 7,463 unique candidates came out flagged as having a reachable IOCTL surface. I then had the pipeline prioritize drivers that explicitly declare Windows 10/11 compatibility so the most modern candidates get analyzed first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ghidra
&lt;/h3&gt;

&lt;p&gt;All ~7,500 candidates get decompiled headless by &lt;a href="https://ghidra-sre.org/" rel="noopener noreferrer"&gt;Ghidra&lt;/a&gt;. This is the main computational bottleneck of the pipeline—it takes roughly 1 to 3 minutes to extract the dispatch logic per driver depending on complexity. Fortunately, doing this concurrently across a thread pool brings the time down significantly. Scanning the massive 7.5k candidate pack finishes overnight on my machine.&lt;/p&gt;

&lt;p&gt;I wrote a &lt;a href="https://www.jython.org/" rel="noopener noreferrer"&gt;Jython&lt;/a&gt; script that finds &lt;code&gt;DriverEntry&lt;/code&gt;, traces the dispatch table assignment to find the IOCTL handler, decompiles it, and follows internal functions a few levels deep. Output is clean C for every IOCTL the driver handles.&lt;/p&gt;

&lt;h3&gt;
  
  
  Semgrep
&lt;/h3&gt;

&lt;p&gt;Custom rules using &lt;a href="https://semgrep.dev/" rel="noopener noreferrer"&gt;Semgrep&lt;/a&gt; scan the decompiled C for patterns that look like known vulnerabilities. Things like &lt;code&gt;MmMapIoSpace&lt;/code&gt; with user-controlled args, &lt;code&gt;memcpy&lt;/code&gt; with user-controlled length, &lt;code&gt;METHOD_NEITHER&lt;/code&gt; without &lt;code&gt;ProbeForRead&lt;/code&gt;, that kind of thing.&lt;/p&gt;

&lt;p&gt;Anything with zero hits gets dropped. This is the important step because everything up to here is free. Everything after this step costs money.&lt;/p&gt;

&lt;h3&gt;
  
  
  LLM analysis
&lt;/h3&gt;

&lt;p&gt;The survivors get sent to &lt;a href="https://deepmind.google/technologies/gemini/" rel="noopener noreferrer"&gt;Gemini 2.5 Pro&lt;/a&gt; on &lt;a href="https://cloud.google.com/vertex-ai" rel="noopener noreferrer"&gt;Vertex AI&lt;/a&gt;. &lt;strong&gt;DeepZero Pipeline Source Code&lt;/strong&gt; - Contains the Python-based triager, Ghidra extractor script, Semgrep rules, and the LangChain &lt;a href="https://github.com/langchain-ai/deepagents" rel="noopener noreferrer"&gt;DeepAgents&lt;/a&gt; reasoning loop.&lt;/p&gt;

&lt;p&gt;The agent has two tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;triage_drivers&lt;/code&gt; which runs the PE analysis and import scoring&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;batch_analyze_candidates&lt;/code&gt; which drives Ghidra + Semgrep&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each driver, the LLM gets the full decompiled dispatch handler plus semgrep findings. It traces data flow from the IOCTL input buffer to dangerous sinks and decides if it's actually exploitable or just a false positive. It outputs a report for each driver saying &lt;code&gt;[VULNERABLE]&lt;/code&gt; or &lt;code&gt;[SAFE]&lt;/code&gt; with evidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost
&lt;/h3&gt;

&lt;p&gt;Each driver analysis eats 50K-200K tokens depending on how big the dispatch handler is. That's about $2-3 per driver at Vertex AI pricing. I got 9 reports out of my first run and it cost around $20. &lt;strong&gt;(Disclaimer: This pricing reflects what the pipeline cost &lt;em&gt;before&lt;/em&gt; any optimizations were implemented. Real-world costs with current prompt formatting, context culling, and prompt caching are significantly lower and this earlier figure is no longer reflective of what it should cost today.)&lt;/strong&gt; The pre-LLM pipeline runs locally and costs nothing, so the whole game is making sure only real candidates reach the expensive step.&lt;/p&gt;

&lt;h3&gt;
  
  
  After the pipeline
&lt;/h3&gt;

&lt;p&gt;The pipeline gives you a report for each driver saying VULNERABLE or SAFE with evidence. That's not the end though. I still went through each VULNERABLE report manually to sanity check the data flow and make sure the LLM wasn't hallucinating a vulnerability that doesn't exist.&lt;/p&gt;

&lt;p&gt;For the valid zero-days flagged, the reports were extremely clean. The data flow from the IOCTL user-buffer into the dangerous sink was mathematically proven by the LLM tracing the Ghidra output. I attached WinDbg to a test VM to verify the vulnerability dynamically, then needed a working PoC.&lt;/p&gt;

&lt;p&gt;I handed the decompiled dispatch handler and the vulnerability report to &lt;a href="https://claude.ai/" rel="noopener noreferrer"&gt;Claude 3.7&lt;/a&gt; and had it write the proof of concept script. It generated the C code, I compiled it, loaded the driver on my Windows 11 testing image, ran it, and confirmed the exploit.&lt;/p&gt;

&lt;p&gt;The whole pipeline is written in &lt;a href="https://www.python.org/" rel="noopener noreferrer"&gt;Python&lt;/a&gt; and ties everything together with &lt;a href="https://github.com/erocarrera/pefile" rel="noopener noreferrer"&gt;pefile&lt;/a&gt; for PE parsing, Ghidra headless for decompilation, and semgrep for pattern matching.&lt;/p&gt;

&lt;p&gt;So the full workflow looks like: pipeline finds candidates (Vertex AI) -&amp;gt; I manually verify the reports -&amp;gt; Claude writes the bare-metal PoC -&amp;gt; I test it on real hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;The pipeline found a clean zero-day in an ASUS driver. Since it is currently undergoing responsible disclosure with ASUS PSIRT, I won't be naming the specific driver or dropping any IOCTL details or PoCs until a patch is issued.&lt;/p&gt;

&lt;p&gt;However, if you want to use this to hunt for vulnerabilities on your own hardware or databases, I've open-sourced the entire &lt;code&gt;DeepZero&lt;/code&gt; pipeline on GitHub.&lt;/p&gt;

&lt;p&gt;Check it out here: &lt;a href="https://github.com/416rehman/deepzero" rel="noopener noreferrer"&gt;https://github.com/416rehman/deepzero&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Timeline
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2026-04-06&lt;/td&gt;
&lt;td&gt;Vulnerability discovered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-04-06&lt;/td&gt;
&lt;td&gt;Anonymous PoC confirmed on Windows 11 24H2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-04-06&lt;/td&gt;
&lt;td&gt;Report submitted to ASUS PSIRT&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>ai</category>
      <category>cybersecurity</category>
      <category>automation</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
