|
1 | 1 | command: docker scout cves |
2 | 2 | short: Display CVEs identified in a software artifact |
3 | 3 | long: |- |
4 | | - The docker scout cves command analyzes a software artifact for vulnerabilities. |
| 4 | + The `docker scout cves` command analyzes a software artifact for vulnerabilities. |
5 | 5 |
|
6 | 6 | If no image is specified, the most recently built image is used. |
7 | 7 |
|
8 | 8 | The following artifact types are supported: |
9 | 9 |
|
10 | 10 | - Images |
11 | 11 | - OCI layout directories |
12 | | - - Tarball archives, as created by docker save |
| 12 | + - Tarball archives, as created by `docker save` |
13 | 13 | - Local directory or file |
14 | | - - SPDX file or in-toto attestation file with SPDX predicate |
15 | | -
|
16 | | - The tool analyzes the provided software artifact, and generates a vulnerability report. |
17 | 14 |
|
18 | 15 | By default, the tool expects an image reference, such as: |
19 | 16 |
|
20 | | - - redis |
21 | | - - curlimages/curl:7.87.0 |
22 | | - - mcr.microsoft.com/dotnet/runtime:7.0 |
| 17 | + - `redis` |
| 18 | + - `curlimages/curl:7.87.0` |
| 19 | + - `mcr.microsoft.com/dotnet/runtime:7.0` |
23 | 20 |
|
24 | 21 | If the artifact you want to analyze is an OCI directory, a tarball archive, a local file or directory, |
25 | 22 | or if you want to control from where the image will be resolved, you must prefix the reference with one of the following: |
26 | 23 |
|
27 | | - - image:// (default) use a local image, or fall back to a registry lookup |
28 | | - - local:// use an image from the local image store (don't do a registry lookup) |
29 | | - - registry:// use an image from a registry (don't use a local image) |
30 | | - - oci-dir:// use an OCI layout directory |
31 | | - - archive:// use a tarball archive, as created by docker save |
32 | | - - fs:// use a local directory or file |
33 | | - - sbom:// use an SBOM as SPDX file or in-toto attestation file with SPDX predicate or syft json SBOM file |
| 24 | + - `image://` (default) use a local image, or fall back to a registry lookup |
| 25 | + - `local://` use an image from the local image store (don't do a registry lookup) |
| 26 | + - `registry://` use an image from a registry (don't use a local image) |
| 27 | + - `oci-dir://` use an OCI layout directory |
| 28 | + - `archive://` use a tarball archive, as created by `docker save` |
| 29 | + - `fs://` use a local directory or file |
| 30 | + - `sbom://` SPDX file or in-toto attestation file with SPDX predicate or `syft` json SBOM file |
| 31 | + In case of `sbom://` prefix, if the file is not defined then it will try to read it from the standard input. |
34 | 32 | usage: docker scout cves [OPTIONS] [IMAGE|DIRECTORY|ARCHIVE] |
35 | 33 | pname: docker scout |
36 | 34 | plink: docker_scout.yaml |
@@ -59,6 +57,7 @@ options: |
59 | 57 | default_value: "false" |
60 | 58 | description: | |
61 | 59 | Display the EPSS scores and organize the package's CVEs according to their EPSS score |
| 60 | + details_url: '#epss' |
62 | 61 | deprecated: false |
63 | 62 | hidden: false |
64 | 63 | experimental: false |
@@ -399,7 +398,168 @@ inherited_options: |
399 | 398 | experimentalcli: false |
400 | 399 | kubernetes: false |
401 | 400 | swarm: false |
402 | | -examples: " Display vulnerabilities for the most recently built image\n $ docker scout cves\e[0m\n\n Display vulnerabilities grouped by package\n $ docker scout cves alpine\e[0m\n\n Display vulnerabilities from a docker save tarball\n $ docker save alpine > alpine.tar\e[0m\n $ docker scout cves archive://alpine.tar\e[0m\n\n Display vulnerabilities from an OCI directory\n $ skopeo copy --override-os linux docker://alpine oci:alpine\e[0m\n $ docker scout cves oci-dir://alpine\e[0m\n\n Display vulnerabilities from the current directory\n $ docker scout cves fs://.\e[0m\n\n Export vulnerabilities to a SARIF JSON file\n $ docker scout cves --format sarif --output alpine.sarif.json alpine\e[0m\n\n Markdown output, including HTML tags. To be used in Pull Request comments for instance.\n $ docker scout cves --format markdown alpine\e[0m\n\n List all Go packages of the image that are vulnerable\n $ docker scout cves --format only-packages --only-package-type golang --only-vuln-packages golang:1.18.0\e[0m\n\n List vulnerabilities from an SPDX file\n $ syft -o spdx-json alpine | docker scout cves sbom://\e[0m" |
| 401 | +examples: |- |
| 402 | + ### Display vulnerabilities grouped by package |
| 403 | +
|
| 404 | + ```console |
| 405 | + $ docker scout cves alpine |
| 406 | + Analyzing image alpine |
| 407 | + ✓ Image stored for indexing |
| 408 | + ✓ Indexed 18 packages |
| 409 | + ✓ No vulnerable package detected |
| 410 | + ``` |
| 411 | +
|
| 412 | + ### Display vulnerabilities from a `docker save` tarball |
| 413 | +
|
| 414 | + ```console |
| 415 | + $ docker save alpine > alpine.tar |
| 416 | +
|
| 417 | + $ docker scout cves archive://alpine.tar |
| 418 | + Analyzing archive alpine.tar |
| 419 | + ✓ Archive read |
| 420 | + ✓ SBOM of image already cached, 18 packages indexed |
| 421 | + ✓ No vulnerable package detected |
| 422 | + ``` |
| 423 | +
|
| 424 | + ### Display vulnerabilities from an OCI directory |
| 425 | +
|
| 426 | + ```console |
| 427 | + $ skopeo copy --override-os linux docker://alpine oci:alpine |
| 428 | +
|
| 429 | + $ docker scout cves oci-dir://alpine |
| 430 | + Analyzing OCI directory alpine |
| 431 | + ✓ OCI directory read |
| 432 | + ✓ Image stored for indexing |
| 433 | + ✓ Indexed 19 packages |
| 434 | + ✓ No vulnerable package detected |
| 435 | + ``` |
| 436 | +
|
| 437 | + ### Display vulnerabilities from the current directory |
| 438 | +
|
| 439 | + ```console |
| 440 | + $ docker scout cves fs://. |
| 441 | + ``` |
| 442 | +
|
| 443 | + ### Export vulnerabilities to a SARIF JSON file |
| 444 | +
|
| 445 | + ```console |
| 446 | + $ docker scout cves --format sarif --output alpine.sarif.json alpine |
| 447 | + Analyzing image alpine |
| 448 | + ✓ SBOM of image already cached, 18 packages indexed |
| 449 | + ✓ No vulnerable package detected |
| 450 | + ✓ Report written to alpine.sarif.json |
| 451 | + ``` |
| 452 | +
|
| 453 | + ### Display markdown output |
| 454 | +
|
| 455 | + The following example shows how to generate the vulnerability report as markdown. |
| 456 | +
|
| 457 | + ```console |
| 458 | + $ docker scout cves --format markdown alpine |
| 459 | + ✓ Pulled |
| 460 | + ✓ SBOM of image already cached, 19 packages indexed |
| 461 | + ✗ Detected 1 vulnerable package with 3 vulnerabilities |
| 462 | + <h2>:mag: Vulnerabilities of <code>alpine</code></h2> |
| 463 | +
|
| 464 | + <details open="true"><summary>:package: Image Reference</strong> <code>alpine</code></summary> |
| 465 | + <table> |
| 466 | + <tr><td>digest</td><td><code>sha256:e3bd82196e98898cae9fe7fbfd6e2436530485974dc4fb3b7ddb69134eda2407</code></td><tr><tr><td>vulnerabilities</td><td><img alt="critical: 0" src="https://img.shields.io/badge/critical-0-lightgrey"/> <img alt="high: 0" src="https://img.shields.io/badge/high-0-lightgrey"/> <img alt="medium: 2" src="https://img.shields.io/badge/medium-2-fbb552"/> <img alt="low: 0" src="https://img.shields.io/badge/low-0-lightgrey"/> <img alt="unspecified: 1" src="https://img.shields.io/badge/unspecified-1-lightgrey"/></td></tr> |
| 467 | + <tr><td>platform</td><td>linux/arm64</td></tr> |
| 468 | + <tr><td>size</td><td>3.3 MB</td></tr> |
| 469 | + <tr><td>packages</td><td>19</td></tr> |
| 470 | + </table> |
| 471 | + </details></table> |
| 472 | + </details> |
| 473 | + ... |
| 474 | + ``` |
| 475 | +
|
| 476 | + ### List all vulnerable packages of a certain type |
| 477 | +
|
| 478 | + The following example shows how to generate a list of packages, only including |
| 479 | + packages of the specified type, and only showing packages that are vulnerable. |
| 480 | +
|
| 481 | + ```console |
| 482 | + $ docker scout cves --format only-packages --only-package-type golang --only-vuln-packages golang:1.18.0 |
| 483 | + ✓ Pulled |
| 484 | + ✓ SBOM of image already cached, 296 packages indexed |
| 485 | + ✗ Detected 1 vulnerable package with 40 vulnerabilities |
| 486 | +
|
| 487 | + Name Version Type Vulnerabilities |
| 488 | + ─────────────────────────────────────────────────────────── |
| 489 | + stdlib 1.18 golang 2C 29H 8M 1L |
| 490 | + ``` |
| 491 | +
|
| 492 | + ### Display EPSS score (--epss) {#epss} |
| 493 | +
|
| 494 | + The `--epss` flag adds [Exploit Prediction Scoring System (EPSS)](https://www.first.org/epss/) |
| 495 | + scores to the `docker scout cves` output. EPSS scores are estimates of the likelihood (probability) |
| 496 | + that a software vulnerability will be exploited in the wild in the next 30 days. |
| 497 | + The higher the score, the greater the probability that a vulnerability will be exploited. |
| 498 | +
|
| 499 | + ```console {hl_lines="13,14"} |
| 500 | + $ docker scout cves --epss nginx |
| 501 | + ✓ Provenance obtained from attestation |
| 502 | + ✓ SBOM obtained from attestation, 232 packages indexed |
| 503 | + ✓ Pulled |
| 504 | + ✗ Detected 23 vulnerable packages with a total of 39 vulnerabilities |
| 505 | +
|
| 506 | + ... |
| 507 | +
|
| 508 | + ✗ HIGH CVE-2023-52425 |
| 509 | + https://scout.docker.com/v/CVE-2023-52425 |
| 510 | + Affected range : >=2.5.0-1 |
| 511 | + Fixed version : not fixed |
| 512 | + EPSS Score : 0.000510 |
| 513 | + EPSS Percentile : 0.173680 |
| 514 | + ``` |
| 515 | +
|
| 516 | + - `EPSS Score` is a floating point number between 0 and 1 representing the probability of exploitation in the wild in the next 30 days (following score publication). |
| 517 | + - `EPSS Percentile` is the percentile of the current score, the proportion of all scored vulnerabilities with the same or a lower EPSS score. |
| 518 | +
|
| 519 | + You can use the `--epss-score` and `--epss-percentile` flags to filter the output |
| 520 | + of `docker scout cves` based on these scores. For example, |
| 521 | + to only show vulnerabilities with an EPSS score higher than 0.5: |
| 522 | +
|
| 523 | + ```console |
| 524 | + $ docker scout cves --epss --epss-score 0.5 nginx |
| 525 | + ✓ SBOM of image already cached, 232 packages indexed |
| 526 | + ✓ EPSS scores for 2024-03-01 already cached |
| 527 | + ✗ Detected 1 vulnerable package with 1 vulnerability |
| 528 | +
|
| 529 | + ... |
| 530 | +
|
| 531 | + ✗ LOW CVE-2023-44487 |
| 532 | + https://scout.docker.com/v/CVE-2023-44487 |
| 533 | + Affected range : >=1.22.1-9 |
| 534 | + Fixed version : not fixed |
| 535 | + EPSS Score : 0.705850 |
| 536 | + EPSS Percentile : 0.979410 |
| 537 | + ``` |
| 538 | +
|
| 539 | + EPSS scores are updated on a daily basis. |
| 540 | + By default, the latest available score is displayed. |
| 541 | + You can use the `--epss-date` flag to manually specify a date |
| 542 | + in the format `yyyy-mm-dd` for fetching EPSS scores. |
| 543 | +
|
| 544 | + ```console |
| 545 | + $ docker scout cves --epss --epss-date 2024-01-02 nginx |
| 546 | + ``` |
| 547 | +
|
| 548 | + ### List vulnerabilities from an SPDX file |
| 549 | +
|
| 550 | + The following example shows how to generate a list of vulnerabilities from an SPDX file using `syft`. |
| 551 | +
|
| 552 | + ```console |
| 553 | + $ syft -o spdx-json alpine:3.16.1 | docker scout cves sbom:// |
| 554 | + ✔ Pulled image |
| 555 | + ✔ Loaded image alpine:3.16.1 |
| 556 | + ✔ Parsed image sha256:3d81c46cd8756ddb6db9ec36fa06a6fb71c287fb265232ba516739dc67a5f07d |
| 557 | + ✔ Cataloged contents 274a317d88b54f9e67799244a1250cad3fe7080f45249fa9167d1f871218d35f |
| 558 | + ├── ✔ Packages [14 packages] |
| 559 | + ├── ✔ File digests [75 files] |
| 560 | + ├── ✔ File metadata [75 locations] |
| 561 | + └── ✔ Executables [16 executables] |
| 562 | + ✗ Detected 2 vulnerable packages with a total of 11 vulnerabilities |
403 | 563 | deprecated: false |
404 | 564 | experimental: false |
405 | 565 | experimentalcli: false |
|
0 commit comments