Please enable JavaScript to use CodeHS

$ git log --oneline // cybersecurity basics

Why Software Updates Matter Patches, bugs, and security

That "update available" message is not just about new emoji. Most updates close security holes that attackers already know about. Learn how a bug becomes a patch, why the clock starts ticking the moment a fix comes out, and how to update safely.

v4.2.1 → v4.2.2 ~12 min Middle / High school
@@ 01 bugs @@

Bugs and security holes

Every app, game, and operating system is made of code written by people. People make mistakes. A bug is a mistake in code that makes a program do something its makers did not plan. Big programs have millions of lines of code, so they always have some bugs hiding in them.

Most bugs are just annoying. A button does nothing, or a game crashes when you open the map. But some bugs are dangerous. A bug that lets someone do something they should not be allowed to do is called a vulnerability, or a security hole.

bug Annoying

Your music app skips the last song in a playlist. It is frustrating, but nobody can use it to hurt you.

vulnerability Dangerous

A chat app shows your private messages to anyone who changes one number in a web address. A stranger could read them.

Attackers hunt for vulnerabilities because each one is like an unlocked window into a device. Through it they might steal passwords, spy on messages, or install malware, which is software built to cause harm.

Key idea: every vulnerability is a bug, but not every bug is a vulnerability. Security updates focus on the bugs that attackers could use.


@@ 02 patches @@

What a patch is

A patch is a small piece of new code that fixes a bug. Think of a bandage on a cut, or a patch sewn over a hole in your jeans. When your phone says "update available," it is usually offering you a bundle of patches.

Programmers often show a patch as a diff, short for "difference." Red lines starting with - are removed. Green lines starting with + are added. Here is a toy example from a pretend photo-sharing app:

photos/permissions.py +2-1
  def can_view(user, post):      if post.is_public:          return True      return user.is_logged_in      # Only the owner may see a private post      return user.id == post.owner_id

Before the fix, any signed-in user could see anyone's private photos. After the fix, only the owner can.

Notice something about that diff. It fixes the bug, but it also points straight at it. Anyone who reads the patch now knows exactly where the hole was. Attackers know this too. When a big company releases a security update, attackers compare the old code to the new code to figure out what changed. This is called reverse engineering the patch.

The twist: a patch protects the people who install it, and it gives a clue to attackers about everyone who has not installed it yet.


@@ 03 the race @@

The patch race: from bug to fix to attack

Here is the life of a typical security bug, step by step.

  1. Someone finds the bugA security researcher, a programmer, or sometimes an attacker spots a hole in the code.
  2. It gets reportedA good-faith finder tells the software maker privately, so the bug is not shared publicly before a fix is ready. This is called responsible disclosure.
  3. A patch is releasedThe maker writes a fix, tests it, and sends it out as an update.
  4. Attackers study the patchThey figure out the bug from the fix and build tools to use it on devices that have not updated.
  5. Users install the updateEach device that updates is safe from that bug. Each one that does not stays open.

Security people use two names for where a bug sits in this story:

  • A zero-day is a hole attackers use before any fix exists. The maker has had zero days to patch it. These are rare and valuable. Learn more in What Is a Zero-Day Vulnerability?
  • An n-day is a hole that already has a fix. The "n" stands for however many days have passed since the patch came out. Most real attacks use n-days, because so many devices never get updated.
race_simulator.run
Line chart. The green line shows the share of devices that installed the patch. The dashed red line shows the share of attackers with a working attack. The red shaded area shows devices still open to attack. A marker shows the chosen day.
0%of devices have the patch
0%of attackers have a working attack
0%of devices are open to attack right now

Toy model with made-up numbers to show the shape of the race. Real timelines vary a lot.

Drag the slider and switch between the two modes. With automatic updates, most devices get the fix before attackers are ready. When people update by hand, a big chunk of devices stays open for weeks or months.

Real example: in May 2017 the WannaCry ransomware spread to over 200,000 computers in about 150 countries. Microsoft had released a patch for the hole it used two months earlier. The computers that got hit were the ones that had not installed it. Read the full story in WannaCry: The Day Ransomware Went Global.


@@ 04 versions @@

Reading version numbers like 4.2.1

Every release of a program gets a version number so people can tell which copy they have. Many projects follow a system called semantic versioning. The number has three parts, MAJOR.MINOR.PATCH, and each part tells you what kind of change happened.

  • MAJOR goes up for big changes that might break old things, like a full redesign.
  • MINOR goes up when new features are added in a way that does not break anything.
  • PATCH goes up for bug fixes, including many security fixes.

When one part goes up, the parts to its right reset to zero. Try it below.

version_decoder
4major
2minor
1patch

Major version 4, minor version 2, patch 1.

    Which is newer?

    Version numbers are not decimals. Compare each part on its own, left to right. Click the newer version in each pair.

    or
    or
    or

    Not every company follows these rules exactly. Phone and computer makers often use their own numbering, and some apps use dates. Still, a jump in the last number almost always means "fixes," and fixes are the updates you never want to skip.


    @@ 05 what needs updating @@

    Apps, operating systems, firmware, and end-of-life

    "Updating" is not one single thing. Your devices have several layers of software, and each layer gets its own updates.

    Appsgames, browsers, chat

    Updated through your device's app store or the app itself. Your web browser is the most important app to keep current, because it touches every website you visit.

    Operating systemthe OS

    The main software that runs the whole device, like the system on your phone or laptop. OS updates fix the deepest and most serious holes. Find them in Settings.

    Firmwarerouters, consoles, smart TVs

    Firmware is software built into hardware. Your Wi-Fi router runs firmware, and it guards every device in your home. Routers are easy to forget, so check that auto-update is on in the router's app or admin page.

    End-of-lifeno more patches

    Eventually a maker stops supporting an old device or program. That is called end-of-life, or EOL. After that, new holes are found but never fixed. An EOL device should be replaced, or at least kept off the internet.

    Turning on automatic updates means your device downloads and installs fixes by itself, often overnight. It is the single easiest security habit there is. See how it changes things for a pretend household:

    device_inventory Toggle each switch
      Exposure meter
      High
      saferexposed

        Toy scoring. The router and browser count extra because they face the internet all day.


        @@ 06 fake updates @@

        Spot a fake “update now” popup

        Scammers know people trust the word "update." So they make fake update messages that install malware, steal passwords, or push you to call a fake support line. The trick is simple: real updates come from places you go to on purpose. Fake ones come at you.

        Look at each message below and decide if it is a real update or a scam.

        real_or_fake 1 / 6

        How to update safely

        • Open Settings and look for "Software update" or "System update"
        • Update apps in your device's official app store
        • Turn on automatic updates once, then let them run
        • Restart when your device asks; many fixes finish on restart
        • Download an "update" from a popup on a website
        • Tap update links in texts, emails, or chat messages
        • Call a phone number shown in a warning popup

        Fake update messages are a kind of phishing, which means tricking someone with a message that pretends to come from someone trusted. If you want more practice, try Don't Fall for a Phishing Email.


        @@ 07 faq @@

        Frequently asked questions

        Why are software updates important?

        Software updates fix bugs, and many of those bugs are security holes that attackers can use to break into a device. Once a fix is released, attackers study it to learn where the hole was, so devices that skip the update become easy targets. Updating closes the hole.

        What happens if I never update my phone or computer?

        Your device keeps every security hole that has been found since your last update. Attackers keep lists of these known holes and the tools to use them, so an old device is much easier to break into. Apps may also stop working over time.

        Should I install updates right away or wait?

        For security updates, install them as soon as you reasonably can. The days right after a patch comes out are when attackers race to use the bug it fixed. Turning on automatic updates is the easiest way to stay ahead.

        How can I tell if an update popup is fake?

        Real updates come from your device's Settings app, its built-in app store, or the app itself. A popup on a random website, a text message, or an email that pushes you to download a file, call a phone number, or hurry is almost always a scam. When in doubt, close it and check for updates in Settings yourself.

        What is the difference between a zero-day and an n-day vulnerability?

        A zero-day is a security hole that attackers use before the software maker has released a fix, so defenders have had zero days to patch. An n-day is a hole that already has a fix, but attackers use it against devices that have not installed the update yet. Most real attacks use n-days.

        Do I need to update my Wi-Fi router?

        Yes. A router runs its own software, called firmware, and it guards every device on your home network. Many routers can update themselves automatically if you turn that setting on in the router's app or admin page. If a router no longer gets updates, it is time to replace it.


        @@ 08 quiz @@

        Quick quiz

        1. What makes a bug a vulnerability?

        2. Why are the days right after a patch comes out risky?

        3. An app goes from version 5.3.7 to 5.3.8. What most likely changed?

        4. A website popup says "Your phone is infected! Tap here to install the security update." What should you do?

        Keep learning about security

        You now know why that update button matters and how to use it safely. Dig deeper into the bugs, attacks, and people on both sides of the patch race.

        Part of the Cybersecurity Skills and Careers tutorial series.