Skip to Content
OpenVAPTAlpha
Pre-release. Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. Free for your own use, 100% at your own risk. This website collects no data. Read MoreRead Less
Pre-release. OpenVAPT has no Stable release yet. Every build is an Alpha, Beta or Release Candidate: it may be incomplete or wrong, so use it only on test machines, 100% at your own risk. See Release Channels
Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. These are AI systems, not people or registered engineers. Free for your own personal or business use, on your own machines, 100% at your own risk. Not for sale. Not for providing services. This website collects no data. Read the Acknowledgements
Pre-release. OpenVAPT has no Stable release yet. Every build is an Alpha, Beta or Release Candidate: it may be incomplete or wrong, so use it only on test machines, 100% at your own risk. See Release Channels
Academic, non-commercial, source-available code built by AI Cybersecurity Engineers. These are AI systems, not people or registered engineers. Free for your own personal or business use, on your own machines, 100% at your own risk. Not for sale. Not for providing services. This website collects no data. Read the Acknowledgements
MediumHOST-CVE-005Patch and Vulnerability ManagementServer

Container Image Layers With Known Vulnerabilities

Checks package lists inside local Docker image layers against the offline vulnerability snapshot.

Why It Matters
A patched host can still run containers built from old images, because host updates never reach them.
How It Detects
Reads the dpkg and apk package databases inside Docker overlay2 layers, refusing a final symbolic link, and matches High, Critical and known exploited advisories. It reads layers, not running containers, and rpm image layers are not covered. A later layer may hold a newer version, so each finding is labelled heuristic. It reports Incomplete when a layer cannot be read or its distribution cannot be told.
How to Fix
Rebuild each image from an updated base image, redeploy it and remove the old image.
How to Verify
Re-run this check after removing the old images and confirm the layer is no longer listed.
CVSS v3.1 Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
Control Category
Patch and Vulnerability Management: CIS Controls v8 7, 2; NIST CSF 2.0 ID.RA, PR.PS
Fix Effort
Medium
CIS Controls v8 Safeguard
7.3
NIST CSF 2.0 Subcategory
ID.RA-01, PR.PS-02
CWE
CWE-1104
OWASP Top 10
A06:2021
NIST SP 800-53 Rev. 5
SI-2, RA-5
References
OSV vulnerability database
NVD
CISA KEV
Learn the theory behind this check: P10 Vulnerability Management: CVE, OSV and Known Exploited Vulnerabilities.

Source Code

The complete file that defines this check. Run it with openvapt scan --only HOST-CVE-005, or read it offline with openvapt explain HOST-CVE-005.

internal/checks/host/cve.go · Lines 1-240View on GitHub at This Commit
1package host
2
3import (
4 "context"
5 "fmt"
6 "sort"
7 "strings"
8 "time"
9
10 "github.com/openvapt/openvapt/internal/check"
11 "github.com/openvapt/openvapt/internal/checks/collect"
12 "github.com/openvapt/openvapt/internal/sys"
13 "github.com/openvapt/openvapt/internal/vulndb"
14)
15
16var cveRefs = []check.Ref{{Title: "OSV vulnerability database", URL: "https://osv.dev/"}, {Title: "NVD", URL: "https://nvd.nist.gov/"}, {Title: "CISA KEV", URL: "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"}}
17var cveStandards = check.Standards{CWE: []string{"CWE-1104"}, OWASP: []string{"A06:2021"}, NIST: []string{"SI-2", "RA-5"}}
18
19// repeatsKnownFlaw records the advisory's CVEs for the group and reports
20// whether every one of them was already seen.
21func repeatsKnownFlaw(group string, a vulndb.Advisory, seen map[string]bool) bool {
22 cves := vulndb.CVEs(a)
23 all := len(cves) > 0
24 for _, c := range cves {
25 key := group + "\x00" + c
26 if !seen[key] {
27 all = false
28 seen[key] = true
29 }
30 }
31 return all
32}
33
34// minorResults gives one line per source package, because a long-lived server
35// can match hundreds of lesser advisories and each one alone rarely needs action.
36func minorResults(items []collect.Installed, db vulndb.Snapshot, keep func(vulndb.Advisory) bool, label string) []check.Result {
37 type tally struct {
38 ids []string
39 version string
40 matcher string
41 }
42 byName := map[string]*tally{}
43 seen := map[string]bool{}
44 for _, p := range items {
45 group := p.Source
46 if group == "" {
47 group = p.Package
48 }
49 if p.Layer != "" {
50 group = "layer " + p.Layer + ": " + group
51 }
52 for _, nv := range p.Names() {
53 for _, m := range db.MatchStream(p.Ecosystem, nv[0], nv[1], p.Stream) {
54 a := m.Advisory
55 if !keep(a) {
56 continue
57 }
58 if key := group + "\x00id\x00" + a.ID; seen[key] {
59 continue
60 } else {
61 seen[key] = true
62 }
63 if repeatsKnownFlaw(group, a, seen) {
64 continue
65 }
66 t := byName[group]
67 if t == nil {
68 t = &tally{version: nv[1], matcher: p.Matcher(m.Matcher)}
69 byName[group] = t
70 }
71 t.ids = append(t.ids, a.ID)
72 }
73 }
74 }
75 names := make([]string, 0, len(byName))
76 for n := range byName {
77 names = append(names, n)
78 }
79 sort.Strings(names)
80 out := make([]check.Result, 0, len(names))
81 for _, n := range names {
82 t := byName[n]
83 sort.Strings(t.ids)
84 shown := t.ids
85 if len(shown) > 5 {
86 shown = shown[:5]
87 }
88 out = append(out, check.FailR(n, fmt.Sprintf("%s %s: %d %s advisories, including %s", n, t.version, len(t.ids), label, strings.Join(shown, ", ")), "matcher: "+t.matcher, db.Notice()))
89 }
90 return out
91}
92
93func init() {
94 for _, spec := range []struct {
95 id, title string
96 sev check.Severity
97 kev, age bool
98 cvss string
99 minor bool
100 }{
101 // Representative vectors: a vulnerable package usually needs a reachable
102 // code path (AC:H); a known exploited one is used in the wild (AC:L);
103 // an outdated snapshot only hides information.
104 {"HOST-CVE-001", "Installed OS Packages With Known Vulnerabilities", check.High, false, false, "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", false},
105 {"HOST-CVE-002", "Known Exploited Vulnerabilities Present", check.Critical, true, false, "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", false},
106 {"HOST-CVE-003", "Vulnerability Snapshot Outdated or Test Data", check.Low, false, true, "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N", false},
107 {"HOST-CVE-004", "Installed OS Packages With Medium or Low Advisories", check.Low, false, false, "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N", true},
108 } {
109 x := spec
110 check.Register(&check.Check{
111 ID: x.id,
112 Title: x.title,
113 Domain: check.DomainHost,
114 Severity: x.sev,
115 Category: check.CatPatch,
116 Effort: check.EffortMedium,
117 CVSS: x.cvss,
118 Summary: "Checks installed packages against an offline vulnerability snapshot. HOST-CVE-001 lists High and Critical advisories one by one, HOST-CVE-002 known exploited ones, and HOST-CVE-004 sums up Medium and Low advisories per package.",
119 Rationale: "Known vulnerable package versions can expose a server to documented attacks.",
120 Detection: "Reads installed package versions and matches OSV ecosystem ranges; each match names its matcher (exact version or range) and the snapshot date. When the binary carries only the test fixture snapshot (a source build without 'make vulndb'), the check reports Incomplete rather than Pass, because no advisory data was available.",
121 Fix: "Install the vendor security update. For a source build, run 'make vulndb' to embed a snapshot generated from OSV and CISA KEV, then rebuild.",
122 Verify: "Re-run OpenVAPT after patching and confirm the finding is absent.",
123 Refs: cveRefs,
124 Standards: cveStandards,
125 Run: func(ctx context.Context, s sys.System) []check.Result {
126 db, e := collect.VulnDB(ctx, s)
127 if e != nil {
128 return []check.Result{check.IncompleteR("vulnerability snapshot", "Snapshot could not be read")}
129 }
130 if db.Header.Fixture {
131 return []check.Result{check.IncompleteR("vulnerability snapshot", "No advisory data: the embedded snapshot is test fixture data", collect.FixtureNotice, db.Notice())}
132 }
133 if x.age {
134 if old, _ := db.Age(time.Now()); old {
135 return []check.Result{check.FailR("vulnerability snapshot", db.Notice())}
136 }
137 return []check.Result{check.PassR("vulnerability snapshot", db.Notice())}
138 }
139 items, ok := collect.HostInventory(ctx, s)
140 if !ok {
141 return []check.Result{check.IncompleteR("OS package inventory", "Installed packages could not be fully inventoried", db.Notice())}
142 }
143 if len(items) > 0 && !db.Covers(items[0].Ecosystem) {
144 return []check.Result{check.IncompleteR("OS package inventory", "The snapshot has no advisories for "+items[0].Ecosystem, db.Notice())}
145 }
146 if x.minor {
147 out := minorResults(items, db, func(a vulndb.Advisory) bool { return a.Severity == "medium" || a.Severity == "low" }, "Medium or Low")
148 if len(out) == 0 {
149 return []check.Result{check.PassR("OS package inventory", "No Medium or Low advisories match the embedded snapshot", db.Notice())}
150 }
151 return out
152 }
153 var out []check.Result
154 seen := map[string]bool{} // binaries of one source share one advisory
155 seenCVE := map[string]bool{} // and sources repeat one flaw under several ids
156 for _, p := range items {
157 group := p.Source
158 if group == "" {
159 group = p.Package
160 }
161 for _, nv := range p.Names() {
162 name, version := nv[0], nv[1]
163 for _, m := range db.MatchStream(p.Ecosystem, name, version, p.Stream) {
164 a := m.Advisory
165 if x.kev && !a.KEV {
166 continue
167 }
168 if !x.kev && a.Severity != "high" && a.Severity != "critical" {
169 continue
170 }
171 if key := group + "\x00" + a.ID; seen[key] {
172 continue
173 } else {
174 seen[key] = true
175 }
176 if repeatsKnownFlaw(group, a, seenCVE) {
177 continue
178 }
179 fixed := vulndb.FixedVersion(a, p.Ecosystem, name, version)
180 if fixed == "" {
181 fixed = "not specified"
182 }
183 out = append(out, check.FailR(name, fmt.Sprintf("%s %s: %s (%s), fixed in %s, severity %s", name, version, a.ID, strings.Join(a.Aliases, ", "), fixed, a.Severity), "matcher: "+p.Matcher(m.Matcher), "installed package: "+p.Package, db.Notice()))
184 }
185 }
186 }
187 if len(out) == 0 {
188 return []check.Result{check.PassR("OS package inventory", "No matching advisories in the embedded snapshot", db.Notice())}
189 }
190 return out
191 },
192 })
193 }
194}
195
196func init() {
197 check.Register(&check.Check{
198 ID: "HOST-CVE-005", Title: "Container Image Layers With Known Vulnerabilities", Domain: check.DomainHost,
199 Severity: check.Medium, Category: check.CatPatch, Effort: check.EffortMedium,
200 CVSS: "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L",
201 Summary: "Checks package lists inside local Docker image layers against the offline vulnerability snapshot.",
202 Rationale: "A patched host can still run containers built from old images, because host updates never reach them.",
203 Detection: "Reads the dpkg and apk package databases inside Docker overlay2 layers, refusing a final symbolic link, and matches High, Critical and known exploited advisories. It reads layers, not running containers, and rpm image layers are not covered. A later layer may hold a newer version, so each finding is labelled heuristic. It reports Incomplete when a layer cannot be read or its distribution cannot be told.",
204 Fix: "Rebuild each image from an updated base image, redeploy it and remove the old image.",
205 Verify: "Re-run this check after removing the old images and confirm the layer is no longer listed.",
206 Refs: cveRefs,
207 Standards: cveStandards,
208 Run: func(ctx context.Context, s sys.System) []check.Result {
209 db, e := collect.VulnDB(ctx, s)
210 if e != nil {
211 return []check.Result{check.IncompleteR("vulnerability snapshot", "Snapshot could not be read")}
212 }
213 if db.Header.Fixture {
214 return []check.Result{check.IncompleteR("vulnerability snapshot", "No advisory data: the embedded snapshot is test fixture data", collect.FixtureNotice, db.Notice())}
215 }
216 items, found, complete := collect.LayerInventory(ctx, s)
217 if !found {
218 return []check.Result{check.SkipR("image layers", "No Docker image layer with a package database was found")}
219 }
220 covered := items[:0]
221 for _, p := range items {
222 if db.Covers(p.Ecosystem) {
223 covered = append(covered, p)
224 } else {
225 complete = false
226 }
227 }
228 out := minorResults(covered, db, func(a vulndb.Advisory) bool {
229 return a.KEV || a.Severity == "high" || a.Severity == "critical"
230 }, "High, Critical or known exploited")
231 if !complete {
232 out = append(out, check.IncompleteR("image layers", "Some image layers could not be read, placed in a distribution or matched to snapshot data", db.Notice()))
233 }
234 if len(out) == 0 {
235 return []check.Result{check.PassR("image layers", "No matching advisories in the embedded snapshot", db.Notice())}
236 }
237 return out
238 },
239 })
240}

Also available as plain Markdown for notes, scripts and AI tools. Same facts, same source, no styling.

Cite This Page

If this page helped your work, please cite it. The version and web address are filled in; the access date is today's date in your browser. Every other style, and when credit is required, is on How to Cite OpenVAPT.

APA 7
OpenVAPT. (2026). HOST-CVE-005 Container Image Layers With Known Vulnerabilities (Version 0.2.0-alpha.1). OpenVAPT Check Catalogue. Retrieved November 4, 2026, from https://openvapt.com/checks/HOST-CVE-005.html

In text: (OpenVAPT, 2026). Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.

BibTeX
@misc{openvapt_host_cve_005,
  author       = {{OpenVAPT}},
  title        = {{HOST-CVE-005 Container Image Layers With Known Vulnerabilities}},
  year         = {2026},
  howpublished = {\url{https://openvapt.com/checks/HOST-CVE-005.html}},
  note         = {OpenVAPT Check Catalogue, version 0.2.0-alpha.1. Accessed 4 November 2026}
}

Accessed: the date shown is today's date from your own browser (the site's build date without JavaScript); change it to the day you read the page.

Citing OpenVAPT does not mean OpenVAPT endorses, approves or has reviewed your work.