Microsoft Patents AI That Rewrites Security Patches to Fit Customized Software Copies
A security fix exists for a known vulnerability, but your software is a custom fork and the patch simply won't install. Microsoft is filing a patent for an AI system that rewrites the fix so it fits your code.
What Microsoft's auto-patch rewriter actually does
When a security hole is discovered in a popular open-source library, developers release a patch to close it. The problem is that many companies run modified versions of that library, and the official patch often can't be applied directly because the code has drifted too far from the original.
Microsoft's patent describes a system that takes that official patch, looks at the parts that failed to install (called "rejected hunks"), and feeds everything into an AI model. The model studies an example of a previous, successful patch job, then writes a brand-new version of the fix tailored to your specific codebase.
The goal is to close the gap between "a fix exists" and "your system is actually protected", a gap that can leave software exposed for weeks or months while engineers manually adapt patches by hand.
How the model adapts an upstream fix to downstream code
The system operates in four main steps.
- Receive upstream materials: The system ingests the original library's source code and the official security patch written against it.
- Identify the downstream package: It finds the modified, organization-specific version of that library, the "downstream" code that a company actually runs.
- Build the AI prompt: This is the core of the invention. The system constructs a prompt for a generative model that includes two components: a training shot (a worked example pulled from a stored library of past, successful patch translations) and an inference shot (the current problem). The inference shot bundles the original source, the original patch, the rejected hunks, the specific lines of the patch that couldn't be applied automatically, and the downstream source code.
- Generate the downstream patch: The model reads all of this context and produces a new patch file written to match the downstream code.
The "rejected hunks" detail is the meaningful engineering choice here. Standard tools already attempt to apply patches automatically and report which sections fail. This system takes those failure reports as signal rather than a dead end, telling the model exactly where the adaptation work needs to happen.
What this means for software supply chain security
Unpatched forks of open-source libraries are one of the most consistent sources of real-world breaches. A fix can be publicly available for months while downstream users remain exposed simply because no one had the time to adapt it manually. This system, if it works reliably in practice, could compress that window from weeks to minutes.
Microsoft's run of AI-assisted security filings suggests the company is betting that AI can take over much of the drudge work in vulnerability management. For developers maintaining large software estates with dozens of custom library forks, a tool like this would change patching from a skilled, time-consuming task into something closer to a review job.
Microsoft's 376th filing in our Microsoft coverage since May joins earlier work like one predicting cyberattack targets and one giving files permanent nicknames.
Known security flaws in widely-used software routinely stay unfixed for months across the thousands of products built on top of them. The cost of that delay is measured in breaches, ransom payments, and compromised personal data.
One flaw in a foundational piece of software can ripple outward into hundreds of dependent products, each needing its own tailored repair. Compressing that exposure from months to days would be a meaningful win for anyone whose data sits inside those products.
The honest question is whether automatically generated fixes are trustworthy enough to deploy, because a patch that appears to close a vulnerability while leaving it open is more dangerous than no patch at all. That reliability question is the only thing that actually matters here.
There are more where this came from
We read every patent application Big Tech publishes and send you the ones worth knowing. Plain English, free, every week.
The drawings
8 drawing sheets from US 2026/0259990 A1 · click any drawing to enlarge
Want this weekly breakdown for a company we don't cover? Patentlyze Pro →