Suivre la documentation https://trivy.dev/v0.57/getting-started/installation/
Test sur une vielle image docker non mise à jour depuis des années
trivy image gz-autoinstall:latest
2025-06-24T12:14:31+02:00 INFO [vuln] Vulnerability scanning is enabled
2025-06-24T12:14:31+02:00 INFO [secret] Secret scanning is enabled
2025-06-24T12:14:31+02:00 INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2025-06-24T12:14:31+02:00 INFO [secret] Please see also https://aquasecurity.github.io/trivy/v0.57/docs/scanner/secret#recommendation for faster secret detection
2025-06-24T12:14:31+02:00 INFO Detected OS family="alpine" version="3.17.1"
2025-06-24T12:14:31+02:00 INFO [alpine] Detecting vulnerabilities... os_version="3.17" repository="3.17" pkg_num=16
2025-06-24T12:14:31+02:00 INFO Number of language-specific files num=20
2025-06-24T12:14:31+02:00 INFO [gobinary] Detecting vulnerabilities...
2025-06-24T12:14:31+02:00 INFO [node-pkg] Detecting vulnerabilities...
2025-06-24T12:14:31+02:00 WARN Using severities from other vendors for some vulnerabilities. Read https://aquasecurity.github.io/trivy/v0.57/docs/scanner/vulnerability#severity-selection for details.
2025-06-24T12:14:31+02:00 WARN This OS version is no longer supported by the distribution family="alpine" version="3.17.1"
2025-06-24T12:14:31+02:00 WARN The vulnerability detection may be insufficient because security updates are not provided
gz-autoinstall:latest (alpine 3.17.1)
=====================================
Total: 68 (UNKNOWN: 2, LOW: 4, MEDIUM: 44, HIGH: 18, CRITICAL: 0)
┌───────────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │
├───────────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
│ busybox │ CVE-2023-42363 │ MEDIUM │ fixed │ 1.35.0-r29 │ 1.35.0-r31 │ busybox: use-after-free in awk │
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-42363 │
│ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-42364 │ │ │ │ │ busybox: use-after-free │
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-42364 │
│ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-42365 │ │ │ │ │ busybox: use-after-free │
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-42365 │
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-42366 │ │ │ │ 1.35.0-r30 │ busybox: A heap-buffer-overflow │
...
...
usr/local/go/bin/go (gobinary)
==============================
Total: 40 (UNKNOWN: 0, LOW: 0, MEDIUM: 22, HIGH: 15, CRITICAL: 3)
┌─────────┬────────────────┬──────────┬────────┬───────────────────┬──────────────────────────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │
├─────────┼────────────────┼──────────┼────────┼───────────────────┼──────────────────────────────────┼──────────────────────────────────────────────────────────────┤
│ stdlib │ CVE-2023-24538 │ CRITICAL │ fixed │ v1.18.10 │ 1.19.8, 1.20.3 │ golang: html/template: backticks not treated as string │
│ │ │ │ │ │ │ delimiters │
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-24538 │
│ ├────────────────┤ │ │ ├──────────────────────────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-24540 │ │ │ │ 1.19.9, 1.20.4 │ golang: html/template: improper handling of JavaScript │
│ │ │ │ │ │ │ whitespace │
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-24540 │
│ ├────────────────┤ │ │ ├──────────────────────────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2024-24790 │ │ │ │ 1.21.11, 1.22.4 │ golang: net/netip: Unexpected behavior from Is methods for │
│ │ │ │ │ │ │ IPv4-mapped IPv6 addresses │
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2024-24790 │
...
...
Le scan détails les vulnerabilitées de chaque layer, une vision plus synthetique peut être générée via l'utilisation du plugin scan2html
trivy plugin install scan2html
trivy scan2html image --scanners vuln,secret gz-autoinstall:latest --scan2html-flags --output interactive_report.html
Cette commande génére un fichier html dynamique (react js ) à ouvrir avec votre navigateur
