Techniqueresearch
Patch-based exploit generation
Also called APEG.
The finding that a published patch reveals the flaw it fixes, so attacks on unpatched hosts can be derived automatically; the lesson is to deliver patches fast and all at once.
Patch-based exploit generation is the problem of taking a program and its patched version and deriving, automatically, an input that exploits the flaw that is present in and fixed in . Brumley, Poosankam, Song and Zheng (IEEE S&P 2008) proposed techniques for it and showed that they worked for 5 Microsoft programs, using patches delivered by Windows Update. They did not claim that the techniques work in every case. Their point was the principle that security must estimate the capabilities of attackers conservatively, so the problem must be treated as practical. The main implication is about patch distribution. A patch is a precise description of a flaw. When it reaches hosts over a long period, the attackers who receive it first can attack the large fraction of hosts that have not yet received it. This page describes the threat model, the conditions, the history and the lessons for patch distribution, with an abstract model in place of any real target. It gives no procedure, parameters or details of software.
In plain words
A patch fixes a hole in a program. To fix it, the patch adds a check or changes a step at exactly the place of the hole.
So the patch also shows where the hole is. Anyone who compares the old program with the new one can see what changed, and can look for an input that the new check would stop. On the old program that input still works.
The 2008 study showed that a computer can do much of this work by itself. That changes the race between the vendor and the attacker. If some users get the patch today and others next week, an attacker can use today's patch against next week's users.
The lesson is about delivery. Patches must reach everyone quickly and at about the same time, and users must install them soon.
When it applies
The class needs all of these conditions. Each defense removes one.
- The attacker gets the patch before the target installs it. Any patch that is public, or that reaches some hosts first, gives this. Fast and simultaneous delivery shrinks the gap, and automatic installation removes most of it.
- The patch shows the change. The difference between and points to the new check. Obfuscation of the patch makes the difference harder to find, though it only delays an analyst.
- The new check is a condition on the input. The fix rejects some inputs that the old version accepted, so an input that fails the new check is a candidate. Fixes that change a design rather than add a check are harder to use in this way.
- The old version still runs. The target has not installed and has no other mitigation. Vulnerability signatures at a filter, and defenses such as control-flow integrity, protect hosts during the gap.
The template
The block names the stages of the published method at the level of the paper's abstract, with the lesson for defenders at each stage. It is not a procedure.
APEG-STAGES(old program P, patched program P')- 1
stage 1: obtain P' while some targets still run P ▷ simultaneous release; encrypted delivery with the key released to all at once - 2
stage 2: locate the ⟨changed code⟩ of P' relative to P ▷ patch obfuscation delays this stage - 3
stage 3: state the ⟨new check⟩ as a condition c on the state ▷ fixes that restructure code give no single condition - 4
stage 4: find an input whose run on P reaches the point with c false ▷ fast automatic installation: few hosts still run P - 5
the gain of the attacker is the fraction of hosts that run P meanwhile ▷ filters and mitigations protect the hosts that are late
Walk-through. Line L1 is the threat model: the attacker is just one more receiver of the patch. Line L2 is a comparison of two versions, a problem close to binary code similarity and to text diff. Line L3 turns the change into a predicate, and line L4 is a search for an input that reaches a point and falsifies a predicate, the same kind of question as in symbolic execution with an SMT solver or in directed fuzzing. Line L5 is where the defense lives. The method does not create a new flaw; it only uses the time between the first and the last installation.
Example: an abstract model. Model a population of hosts with made-up quantities, none about a real system. A patch is released at time . Let be the fraction of hosts that have installed it by time , a nondecreasing function with . An attacker receives the patch at time and needs time to derive an input. Its gain is the fraction of hosts still unpatched at time , which is .
- Staggered rollout. If the vendor delivers the patch to the hosts at a uniform rate over a period and each host installs it at once, then for . For , the gain is . A rollout over a week against an attacker who needs a day leaves of the hosts exposed at the moment of attack.
- Encrypted delivery. The vendor sends an encrypted patch to all hosts over the period , and then publishes the key at time , when the attacker also learns the patch. If a host installs within time after the key, then with a uniform rate, and the gain is . When the gain is , whatever is. The cost of delivery is moved before the moment of disclosure.
- Faster delivery. If delivery spreads from host to host, as in a gossip protocol, then the fraction that has the patch grows like the infected fraction of an epidemic model, and the time to reach all hosts grows only with rounds. The model shows why peer-to-peer delivery was proposed for patches.
- Obfuscation. If obfuscation multiplies the time of stage 2 by a factor , then becomes at least , where is the time of stage 2 without it. In the staggered model the gain is then at most , which is small only if comes close to . Obfuscation buys time; it does not remove the gap.
Classic examples
- The 2008 study. For 5 Microsoft programs, the authors derived inputs for the fixed flaws from the patches of Windows Update, and concluded that patch distribution staggered over long periods leaves the late hosts open to the first receivers of the patch.
- Automatic exploit generation. The later work on automatic exploit generation by the same group searched for exploitable bugs without a patch as a guide, which shows that the patch is one source of guidance among several.
- Signatures in the gap. A patch and a sample input can be turned into a vulnerability signature, which filters inputs for the flaw at the network or in the program while hosts install the patch. The 2006 work on signatures and the 2008 work on patches came from the same group and address the two sides of this gap.
- Patch analysis in practice. Comparing versions of a program to find the security change is an established practice of analysts on both sides, which is why the time between release and installation matters for every patch, not only in the automatic case.
Variations
- Source patches. For open-source programs the change is visible in the source, and the window starts when the fix is committed, often before a release. Projects coordinate such fixes privately and release them together with the advisory.
- Silent fixes. A vendor can fix a flaw without saying so, inside a larger update. This hides the purpose of the change from casual readers but not from a comparison of versions.
- Hot patching. Fixing a running program in memory without a restart shortens the time to install and so the gap.
- Diversity. If different hosts run different but equivalent builds, a comparison of two versions on one host says less about another. This is the idea behind software diversity as a defense.
Pitfalls
These are mistakes defenders make about the class.
- Thinking that an undisclosed flaw is a secret. The patch discloses the flaw. Plan as if the details are public at the moment the first host receives the patch.
- Long staggered rollouts. A slow rollout reduces the risk of a bad patch but extends the window for the attacker. Weigh both, and keep the period short for security fixes.
- Relying on obfuscation alone. It multiplies the time of one stage. Against an automatic tool that time can still be short compared with the rollout.
- Late installation by users. Delivery is not installation. Automatic installation, and short deadlines for manual installation, are what make rise.
- Leaving late hosts without protection. Filters, signatures and mitigations can cover the hosts that cannot install at once. Deploy them at the same time as the patch.
Exercises
- In the staggered model with , find the gain of an attacker with . By what factor must the vendor shorten to halve the gain?
- In the encrypted model, show that the gain does not depend on . What is the gain when ? What does the vendor have to ensure about the key for the model to hold?
- Suppose that delivery from host to host doubles the fraction of hosts with the patch in each round, starting from one host, until all hosts have it. How many rounds are needed for ? Compare with a central server that serves hosts per round.
- Explain why a fix that adds a check on an input condition reveals more to a comparison of versions than a fix that replaces an unsafe interface by a safe one. Which of the two is a better design for patch distribution, and why?
References
- David Brumley, Pongsin Poosankam, Dawn Song and Jiang Zheng, Automatic patch-based exploit generation is possible: techniques and implications, IEEE Symposium on Security and Privacy 2008, pp. 143 to 157, the abstract: the problem statement, the results on 5 Microsoft programs from Windows Update patches, the principle of a conservative estimate of attackers, and the implication for staggered patch distribution
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag D41XYX Edit this page History Report an error Markdown