Yesterday I introduced the concept of an SBOM, a Software Bill Of Materials. An SBOM lists all the components that make up the software , or were used to build it.
I showed you how to use the docker sbom
command to generate such an SBOM for your container images. Today I want to show you how you can use this generated SBOM to check for vulnerabilities. The tool we want to use for this is Grype.
Install Grype on Windows
Out of the box, Grype is only built for Linux and MacOS. As I’m a Windows user, probably the easiest way to get Grype running on your system is through WSL(Windows Subsystem for Linux).
Open up a terminal to your installed Linux Distribution(I typically use Windows Terminal), or if you didn’t have a Linux distribution installed yet, install a distribution of your choice:
wsl --install -d Ubuntu
Downloading: Ubuntu
Installing: Ubuntu
Ubuntu has been installed.
Launching Ubuntu...
After the installation has completed, a new menu item is added that opens a terminal window to your installed distribution and an extra entry is added to Windows Terminal(if installed on your machine).
Now we can download and install Grype using the following command:
sudo curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /mnt/c/dev/bin/grype/
This is how the output looked like on my machine:
bawu@MININT-9ABLAQJ:~$ sudo curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /mnt/c/dev/bin/grype
[info] checking github for the current release tag
[info] fetching release script for tag='v0.35.0'
[info] checking github for the current release tag
[info] using release tag='v0.35.0' version='0.35.0' os='linux' arch='amd64'
[info] installed /mnt/c/dev/bin/grype
Check for vulnerabilities
Now that we have succesfully installed Grype, we can execute it using the following command:
grype sbom:<locationofyoursbomfile>
Here is an example where I had the sbom generated on my c: drive under c:\users\bawu
bawu@MININT-9ABLAQJ:~$ grype sbom:/mnt/c/users/bawu/sbom.json
✔ Vulnerability DB [updated]
✔ Scanned image [75 vulnerabilities]
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
busybox 1.33.1-r3 1.33.1-r5 apk CVE-2021-42375 Medium
busybox 1.33.1-r3 1.33.1-r7 apk CVE-2022-28391 Critical
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42380 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42381 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42382 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42383 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42384 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42378 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42386 High
busybox 1.33.1-r3 1.33.1-r4 apk CVE-2021-42374 Medium
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42379 High
busybox 1.33.1-r3 1.33.1-r6 apk CVE-2021-42385 High
expat 2.4.1-r0 2.4.3-r0 apk CVE-2022-22822 Critical
expat 2.4.1-r0 2.4.5-r0 apk CVE-2022-25314 High
expat 2.4.1-r0 2.4.3-r0 apk CVE-2022-22824 Critical
expat 2.4.1-r0 2.4.4-r0 apk CVE-2022-23990 Critical
expat 2.4.1-r0 2.4.3-r0 apk CVE-2022-22826 High
expat 2.4.1-r0 2.4.5-r0 apk CVE-2022-25313 Medium
expat 2.4.1-r0 2.4.3-r0 apk CVE-2022-22825 High
expat 2.4.1-r0 2.4.4-r0 apk CVE-2022-23852 Critical
expat 2.4.1-r0 2.4.3-r0 apk CVE-2022-22827 High
expat 2.4.1-r0 2.4.3-r0 apk CVE-2021-45960 High
expat 2.4.1-r0 2.4.3-r0 apk CVE-2021-46143 High
expat 2.4.1-r0 2.4.3-r0 apk CVE-2022-22823 Critical
expat 2.4.1-r0 2.4.5-r0 apk CVE-2022-25315 Critical
expat 2.4.1-r0 2.4.5-r0 apk CVE-2022-25235 Critical
expat 2.4.1-r0 2.4.5-r0 apk CVE-2022-25236 Critical
libcrypto1.1 1.1.1l-r0 1.1.1n-r0 apk CVE-2022-0778 High
libcrypto1.1 1.1.1l-r0 apk CVE-2021-4160 Medium
libretls 3.3.3p1-r2 3.3.3p1-r3 apk CVE-2022-0778 High
libssl1.1 1.1.1l-r0 apk CVE-2021-4160 Medium
libssl1.1 1.1.1l-r0 1.1.1n-r0 apk CVE-2022-0778 High
ssl_client 1.33.1-r3 1.33.1-r5 apk CVE-2021-42375 Medium
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42379 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42381 High
ssl_client 1.33.1-r3 1.33.1-r7 apk CVE-2022-28391 Critical
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42378 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42385 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42386 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42380 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42383 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42382 High
ssl_client 1.33.1-r3 1.33.1-r6 apk CVE-2021-42384 High
ssl_client 1.33.1-r3 1.33.1-r4 apk CVE-2021-42374 Medium
xz-libs 5.2.5-r0 5.2.5-r1 apk CVE-2022-1271 Unknown
zlib 1.2.11-r3 1.2.12-r0 apk CVE-2018-25032 High
Looks like we have some work to do…