Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Vulnerability Scanning Basics

The whole lesson is free and interactive. Read it here, or press Start lab to run it for real in a live lab, with no account needed.

Container lab6 min read4 commands

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

What is inside a web server you did not build?

A vulnerability scanner lists every package inside a system and checks each version against known security flaws. Most of a server is other people's work, so a scan is how you find out what came with it. This lab scans an old web server with Trivy, with no internet at all.

By the end of this lesson

Note

I can scan a container image with Trivy and read what it found.

Key words

  • Vulnerability: a weakness an attacker could use.
  • CVE: the public name of one known vulnerability, such as CVE-2024-45492.
  • Scanner: a tool that lists packages and their known flaws.
  • Severity: how bad a flaw is, from low to critical.
  • Fixed version: the first version without the flaw.

Starter: what you already know

Note

Answer in your head. 1. What does a package manager install? 2. Why does a newer version of a program sometimes matter? 3. What is a container image built from? Answers: programs and libraries; it can fix a flaw; layers of files.

Before you start

Note

Press Start the lab on the bar at the top of this lesson and wait until it says it is running. The scanner is a service called scanner, the web server is web and the Python is tools. Scan only what you own or have written permission to test: here, your own copy. Each Run button below types its command into your lab's terminal, one after another in the same session. To watch them, or to type your own, press Open terminal on the bar.

1. Which database does the scanner have?

Trivy prints its version, 0.76.2, and when its vulnerability database was made: UpdatedAt 2026-11-21. The lab has no internet, so this database never changes, and every copy finds the same flaws. A real scan today would use a newer database and find more.

Command
docker exec scanner trivy --version

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

2. What is the web server running?

The web server says it is Alpine Linux 3.18.6. That release no longer gets security fixes from Alpine. The scanner holds a copy of the same image as web-1.25.3.tar.

Command
docker exec web cat /etc/alpine-release

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

3. The critical flaws in its image

Trivy reads the image's list of packages and checks each one. It finds 74 flaws in all, and the table shows the 3 critical ones: CVE-2024-45491 and CVE-2024-45492 in libexpat, and CVE-2024-56171 in libxml2. Each row gives the installed version and the fixed one.

Command
docker exec scanner trivy image --input /targets/web-1.25.3.tar --severity CRITICAL

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

4. A project's libraries

Your own code brings libraries too. The Java service's lock file pins Log4j 2.14.1, and Trivy finds 2 critical flaws in it: CVE-2021-44228, known as Log4Shell, and CVE-2021-45046. Both are in CISA's list of flaws attackers are known to use, which is why they come first.

Command
docker exec scanner trivy fs /targets/reports --severity CRITICAL

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Exit check

Tip

Answer without looking back. 1. What date is the scanner's database from? 2. Which Alpine release is the web server? 3. How many critical flaws are in its image? 4. Which library holds Log4Shell? Answers: 21 November 2026; 3.18.6; 3; Log4j, in the Java service.

For teachers

Tip

This lesson is a small example of a lesson worked in a lab: the steps and the Run buttons are the lesson, and the lab is each student's own copy. The lab is three small services with no internet, and nothing here marks itself: the student hands in a short triage of the new web image and the shop, which this lesson does not do for them. Key learning points: 1. A scanner reads a system's packages and checks each version. 2. A CVE names one flaw, with a severity and a fixed version. 3. Libraries in your own code are scanned from their lock file. Common mistake: thinking a clean scan means no flaws; a scanner sees only what it can identify and what has been published. Equipment: the lab and its terminal. Tip: ask students to guess how many flaws an old web server has before the Run. The module Vulnerability management goes further in six lessons. Copy it into your own module and change it, or build one from scratch with the Lab menu in the lesson builder.

Teaching a class? Set these lessons for your students with marking and a lab for every student.