bastion

Understanding Vulnerabilities and Exploits

Build this skill

Separate a vulnerability from an exploit, describe the window between disclosure and patching, and explain what makes a zero-day dangerous.

A weak spot is not yet a break-in

One Monday morning Neha Kulkarni finds an email from Rathi Softech, the company that makes Tulsi Health's MedLedger billing software. It says that version 4.2 has a security flaw in its report export, that version 4.3 fixes it, and that every customer should update "as soon as possible". Nothing has gone wrong at any store. Yet from the moment that email went out, a race began between Neha and anyone who wants to misuse the flaw.

To follow that race you need two words that beginners often mix up. A vulnerability is a weakness in software, settings or a process that could let someone do what they should not. An exploit is the method, often a small program, that actually uses that weakness to cause harm. Think of a window latch at home that does not quite catch: that is the vulnerability. A thief's trick of sliding a ruler under the frame to lift it is the exploit. The latch is a problem even if no thief ever comes, but harm needs both the weakness and someone with a way to use it.

Tulsi Health ? Recall notice Exploit: ruler trick Latch that won't catch software vulnerability Key under the mat security misconfiguration Crack nobody has seen zero-day vulnerability Recall notice ignored unpatched system

Four kinds of weakness on one building. Only the figure with the ruler is an exploit: the trick that turns one weakness into a break-in.

Where software weaknesses come from

A software vulnerability is a mistake in a program's code that has security consequences. Programs are written by people, and large programs contain thousands of small mistakes; most just cause a wrong number or a crash, but some let an outsider in. A common pattern is software that trusts its input too much. Suppose the Tulsi Health app showed an order to anyone who typed its order number into the address bar, without checking that the order belonged to the person asking. Changing 10452 to 10453 would show a stranger's prescriptions. Nothing is broken in the usual sense; the program simply forgot to ask "is this yours?".

Known vulnerabilities are catalogued publicly so that everyone can talk about the same one. Each gets an identifier called a CVE (Common Vulnerabilities and Exposures), such as CVE-2021-44228, and usually a severity score from 0 to 10. A score of 9 or 10 means an attacker can do serious damage easily, often from across the internet with no password. Neha reads these scores the way a doctor reads a fever chart: they say where to look first, not the whole story.

When the settings are the weakness

Sometimes the software has no bug at all and the problem is how it was set up. A security misconfiguration is a setting that leaves something more open than intended. It is a good lock on a door with the key left under the doormat. These are among the most common real weaknesses, because every system ships with dozens of settings and a busy person accepts the defaults.

Misconfiguration at Tulsi Health What it exposes The fix
Store Wi-Fi router still uses its factory password Anyone nearby can change the router's settings Set a unique admin password on day one
Invoice folder shared as "anyone with the link" A forwarded link opens supplier contracts to strangers Share with named staff accounts only
App's test mode left on in the live app Detailed error messages reveal how the app is built Turn test settings off before release
Guest Wi-Fi and billing laptops on one network A customer's infected phone can reach MedLedger Keep guest and staff networks separate

The race after a patch is released

When a vendor fixes a vulnerability, it releases a patch: an update that changes the faulty code. A system still running the old version is an unpatched system, and it stays vulnerable however good the fix is. The patch only protects the machines it is installed on.

The awkward truth is that a patch also teaches attackers. Once a fix is public, skilled people compare the old and new versions to see exactly what changed, and ready-made exploits for well-known flaws can appear within days. The time between an exploit becoming available and the patch being installed on your machines is the window of exposure. It is like a housing society that receives a notice that its gate lock model can be opened with a common trick: the notice is published for every society, so burglars read it too, and the society is at risk until the lock is changed.

Rathi Softechfixing quietlypatch 4.3 availableAttackersexploit circulatingKothrud laptopstill on 4.2patchedExposed25 days at risk0 d10 d20 d30 d40 d50 d60 dFlaw reported to vendorDisclosure and patchExploit appearsTulsi installs 4.3

The danger starts when an exploit exists and ends when the patch is installed. Patching on day 12 instead of day 38 would have closed the window before it opened.

With 14 stores, Tulsi Health does not patch every laptop on the same day; a store may be busy, a laptop may be switched off, or the update may fail. Suppose ready-made attack code appears three days after the patch is released. The 14 counter laptops were patched on days 1, 1, 2, 2, 4, 5, 5, 8, 10, 12, 15, 21, 28 and 42 (Kothrud and Baner first, Satpur last). Any laptop patched after day 3 was open to attack for the days in between, so Satpur, patched on day 42, sat exposed for 39 days. Predict before reading on: how many stores were exposed at all? The optional cell below adds up the exposure across all 14 laptops. You can press Run without knowing any Python, then change the exploit day, marked with a comment, to see what a slower attacker would have meant.

python · runs in your browser

Expected output:

text
Stores exposed: 10 of 14
Total laptop-days at risk: 120
Line What it does
exploit_day = 3 The day ready-made attack code appeared. This is the one value to change
patch_days = [...] The day each store's laptop got the patch, one number per store
exposed_stores = 0 and laptop_days = 0 Two running totals, both starting at zero
for day in patch_days: Repeats the indented lines once for each laptop
if day > exploit_day: > means "later than": only laptops patched after the attack code appeared are counted
laptop_days = laptop_days + (day - exploit_day) Adds the days that laptop sat open to the running total

Only 4 of the 14 laptops beat the exploit; the other 10 were exposed for a total of 120 laptop-days, and the three slowest (College Road, Panchavati and Satpur, patched on days 21, 28 and 42) account for 18 + 25 + 39 = 82 of them, more than two-thirds of the risk.

The lesson for Neha is that the average store is not the problem; the stragglers are. A rule such as "every critical patch on every laptop within three days, and a phone call to any store that misses it" removes most of the risk.

Zero-day: a flaw nobody has fixed

Everything so far assumed the vendor knew about the flaw first. Sometimes attackers find it before anyone else and use it quietly. A zero-day vulnerability is one that is being exploited before the vendor knows about it or has a fix, so defenders have had "zero days" to prepare. It is like a lock flaw that even the locksmith has not discovered: you cannot replace the lock, because no better lock exists yet.

Zero-days are dangerous for three reasons. No patch exists, so the usual cure is unavailable. Security tools that look for known attacks have nothing to recognise. And the attack may run for weeks before anyone notices, so the window of exposure starts long before disclosure. In December 2021, a flaw in Log4j, a logging library used inside countless Java programs and known as Log4Shell, was exploited within hours of becoming public, and organisations spent weeks finding every place it ran.

Known, patch availableVendor has a fixTools can recognise the attackRisk ends when you installSpeed of patching decides itZero-dayNo fix exists yetTools have nothing to matchAttacks run before anyone knowsOnly other layers can help

Against a known flaw the defence is fast patching. Against a zero-day it is everything else: limited access, monitoring, separate networks and backups.

Because a zero-day cannot be patched, the defence is to limit what any single flaw can reach. The billing laptops run MedLedger under an ordinary user account rather than an administrator account, the guest Wi-Fi cannot reach them, Neha watches for laptops contacting unknown internet addresses, and the nightly backup means a damaged laptop can be rebuilt. Sometimes the vendor also publishes a workaround, such as switching off the faulty feature, which narrows the window before a full patch is ready.

Try the race yourself below. Change how quickly attack code appears, how quickly Tulsi Health patches, and whether the flaw was a zero-day, and complete the mission.

These four words are easy to blur together, so sort some real situations into the right category. Each card describes something Neha might find at Tulsi Health or read in a security notice.

Follow your curiosity.

↑ ↓ to explore · Enter to open · Escape to close